board_inspector: extract Compatible IDs of devices
In addition to the mandatory _HID (Hardware ID), the ACPI spec also defines an optional _CID (Compatible ID) object for device identification. This patch enhances the ACPI extractor by parsing the _CID objects of devices as well. Tracked-On: #6320 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
879c6c11ca
commit
94d517b514
|
@ -142,11 +142,32 @@ def fetch_device_info(devices_node, interpreter, namepath):
|
||||||
else:
|
else:
|
||||||
hid = "<unknown>"
|
hid = "<unknown>"
|
||||||
|
|
||||||
|
# Compatible ID
|
||||||
|
cids = []
|
||||||
|
if interpreter.context.has_symbol(f"{namepath}._CID"):
|
||||||
|
cid_object = interpreter.interpret_method_call(f"{namepath}._CID")
|
||||||
|
if isinstance(cid_object, (datatypes.String, datatypes.Integer)):
|
||||||
|
cid_data = [cid_object]
|
||||||
|
elif isinstance(cid_object, datatypes.Package):
|
||||||
|
cid_data = cid_object.elements
|
||||||
|
|
||||||
|
for cid_datum in cid_data:
|
||||||
|
if isinstance(cid_datum, datatypes.Integer):
|
||||||
|
eisa_id = parse_eisa_id(cid_datum.get())
|
||||||
|
if eisa_id:
|
||||||
|
cids.append(eisa_id)
|
||||||
|
else:
|
||||||
|
cids.append(hex(cid_datum.get()))
|
||||||
|
elif isinstance(cid_datum, datatypes.String):
|
||||||
|
cids.append(cid_datum.get())
|
||||||
|
|
||||||
# Create the XML element for the device and create its ancestors if necessary
|
# Create the XML element for the device and create its ancestors if necessary
|
||||||
element = get_device_element(devices_node, namepath, hid)
|
element = get_device_element(devices_node, namepath, hid)
|
||||||
if hid in buses.keys():
|
if hid in buses.keys():
|
||||||
element.tag = "bus"
|
element.tag = "bus"
|
||||||
element.set("type", buses[hid])
|
element.set("type", buses[hid])
|
||||||
|
for cid in cids:
|
||||||
|
add_child(element, "compatible_id", cid)
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
if interpreter.context.has_symbol(f"{namepath}._STR"):
|
if interpreter.context.has_symbol(f"{namepath}._STR"):
|
||||||
|
|
|
@ -23,7 +23,7 @@ def getkey(child):
|
||||||
return 0xFFFFFFFF
|
return 0xFFFFFFFF
|
||||||
|
|
||||||
tags = ["vendor", "identifier", "subsystem_vendor", "subsystem_identifier", "class",
|
tags = ["vendor", "identifier", "subsystem_vendor", "subsystem_identifier", "class",
|
||||||
"acpi_object", "status",
|
"acpi_object", "compatible_id", "status",
|
||||||
"resource", "capability", "interrupt_pin_routing", "bus", "device"]
|
"resource", "capability", "interrupt_pin_routing", "bus", "device"]
|
||||||
|
|
||||||
if child.tag == "resource":
|
if child.tag == "resource":
|
||||||
|
|
Loading…
Reference in New Issue