mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 21:47:22 +00:00
board_inspector: resume a device if it is not in D0
It is seen that the BAR in the PCI configuration space of a device can be cleared when the device is put to D3. This patch resumes a device not in D0 before parsing its configuration space in order to collect accurate information. This patch is added in v2 of the series. Tracked-On: #6287 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
d6e47bcea5
commit
6be3f93173
@ -66,6 +66,16 @@ def parse_device(bus_node, device_path):
|
|||||||
device_node = add_child(bus_node, "device", None, address=adr)
|
device_node = add_child(bus_node, "device", None, address=adr)
|
||||||
|
|
||||||
cfg = parse_config_space(device_path)
|
cfg = parse_config_space(device_path)
|
||||||
|
for cap in cfg.caps:
|
||||||
|
# If the device is not in D0, power it on and reparse its configuration space.
|
||||||
|
if cap.name == "Power Management" and cap.power_state != 0:
|
||||||
|
logging.info(f"Try resuming {device_path}")
|
||||||
|
try:
|
||||||
|
with open(os.path.join(device_path, "power", "control"), "w") as f:
|
||||||
|
f.write("on")
|
||||||
|
cfg = parse_config_space(device_path)
|
||||||
|
except Exception as e:
|
||||||
|
logging.info(f"Resuming {device_path} failed: {str(e)}")
|
||||||
|
|
||||||
# Device identifiers
|
# Device identifiers
|
||||||
vendor_id = "0x{:04x}".format(cfg.header.vendor_id)
|
vendor_id = "0x{:04x}".format(cfg.header.vendor_id)
|
||||||
|
@ -67,8 +67,8 @@ class PowerManagement(cdata.Struct, Capability):
|
|||||||
('data_select', ctypes.c_uint16, 4),
|
('data_select', ctypes.c_uint16, 4),
|
||||||
('data_scale', ctypes.c_uint16, 2),
|
('data_scale', ctypes.c_uint16, 2),
|
||||||
('pme_status', ctypes.c_uint16, 1),
|
('pme_status', ctypes.c_uint16, 1),
|
||||||
('reserved3', ctypes.c_uint16, 6),
|
('reserved3', ctypes.c_uint8, 6),
|
||||||
('undefined', ctypes.c_uint16, 2),
|
('undefined', ctypes.c_uint8, 2),
|
||||||
('data', ctypes.c_uint8),
|
('data', ctypes.c_uint8),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user