board_inspector: add _CID to vACPI device objects

ACPI device drivers use both _HID and _CID to identify devices they
match. This patch copies _CID objects to vACPI devices so that guest
drivers can recognize the passthrough devices properly.

Tracked-On: #6288
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2021-08-19 08:37:13 +08:00 committed by wenlingz
parent ca32ae7e3d
commit ebee11ae11
1 changed files with 9 additions and 7 deletions

View File

@ -439,6 +439,12 @@ def fetch_device_info(devices_node, interpreter, namepath, args):
hid = "<unknown>"
add_object_to_device(interpreter, namepath, "_HID", result)
# Create the XML element for the device and create its ancestors if necessary
element = get_device_element(devices_node, namepath, hid)
if hid in buses.keys():
element.tag = "bus"
element.set("type", buses[hid])
# Compatible ID
cids = []
if interpreter.context.has_symbol(f"{namepath}._CID"):
@ -458,13 +464,9 @@ def fetch_device_info(devices_node, interpreter, namepath, args):
elif isinstance(cid_datum, datatypes.String):
cids.append(cid_datum.get())
# Create the XML element for the device and create its ancestors if necessary
element = get_device_element(devices_node, namepath, hid)
if hid in buses.keys():
element.tag = "bus"
element.set("type", buses[hid])
for cid in cids:
add_child(element, "compatible_id", cid)
for cid in cids:
add_child(element, "compatible_id", cid)
add_object_to_device(interpreter, namepath, "_CID", cid_object)
# Unique ID
uid = ""