mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-18 17:33:43 +00:00
acrn-config: refine DRHD structure initialization
1. Initialize DRHDn_DEVSCOPEn_TYPE/DRHDn_DEVSCOPEn_ID for each devscope; 2. Remove DRHDn_IOAPIC_ID macro; 2. Refine the value format from base 10 to 16. Tracked-On: #3854 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
8fcfea1386
commit
4658259be7
@ -156,7 +156,8 @@ class DmarDevList:
|
|||||||
self.dev_scope_cnt_list = []
|
self.dev_scope_cnt_list = []
|
||||||
self.dev_bus_list = []
|
self.dev_bus_list = []
|
||||||
self.dev_path_list = []
|
self.dev_path_list = []
|
||||||
self.dev_ioapic = {}
|
self.dev_scope_id_list = []
|
||||||
|
self.dev_scope_type_list = []
|
||||||
|
|
||||||
def style_check_1(self):
|
def style_check_1(self):
|
||||||
"""Style check if have public method"""
|
"""Style check if have public method"""
|
||||||
@ -253,6 +254,10 @@ def walk_dev_scope(dmar_tbl, dmar_dev_list, dmar_hw_list, drhd_cnt):
|
|||||||
ACPI_DEV_SCOPE_TYPE['ACPI_DMAR_SCOPE_TYPE_RESERVED']:
|
ACPI_DEV_SCOPE_TYPE['ACPI_DMAR_SCOPE_TYPE_RESERVED']:
|
||||||
dmar_tbl.dev_scope_cnt += 1
|
dmar_tbl.dev_scope_cnt += 1
|
||||||
|
|
||||||
|
# get type and id from device scope
|
||||||
|
dmar_dev_list.dev_scope_type_list.append(dmar_tbl.dmar_dev_scope.entry_type)
|
||||||
|
dmar_dev_list.dev_scope_id_list.append(dmar_tbl.dmar_dev_scope.enumeration_id)
|
||||||
|
|
||||||
# path offset is in end of device spcope
|
# path offset is in end of device spcope
|
||||||
dmar_tbl.path_offset = dmar_tbl.dev_scope_offset + ctypes.sizeof(DmarDevScope)
|
dmar_tbl.path_offset = dmar_tbl.dev_scope_offset + ctypes.sizeof(DmarDevScope)
|
||||||
# walk the pci bus with path deep, and find the {Device,Function}
|
# walk the pci bus with path deep, and find the {Device,Function}
|
||||||
@ -263,11 +268,6 @@ def walk_dev_scope(dmar_tbl, dmar_dev_list, dmar_hw_list, drhd_cnt):
|
|||||||
dmar_dev_list.dev_bus_list.append(dmar_tbl.dmar_dev_scope.bus)
|
dmar_dev_list.dev_bus_list.append(dmar_tbl.dmar_dev_scope.bus)
|
||||||
dmar_dev_list.dev_path_list.append(tmp_pdf.path)
|
dmar_dev_list.dev_path_list.append(tmp_pdf.path)
|
||||||
|
|
||||||
# if the scope entry type is ioapic, should address enumeration id
|
|
||||||
if dmar_tbl.dmar_dev_scope.entry_type ==\
|
|
||||||
ACPI_DEV_SCOPE_TYPE['ACPI_DMAR_SCOPE_TYPE_IOAPIC']:
|
|
||||||
dmar_dev_list.dev_ioapic[drhd_cnt] = dmar_tbl.dmar_dev_scope.enumeration_id
|
|
||||||
|
|
||||||
dmar_tbl.dev_scope_offset += dmar_tbl.dmar_dev_scope.scope_length
|
dmar_tbl.dev_scope_offset += dmar_tbl.dmar_dev_scope.scope_length
|
||||||
|
|
||||||
return (dmar_tbl, dmar_dev_list, dmar_hw_list)
|
return (dmar_tbl, dmar_dev_list, dmar_hw_list)
|
||||||
@ -334,21 +334,32 @@ def write_dmar_data(sysnode, config):
|
|||||||
dmar_tbl, dmar_hw_list, dmar_dev_list, sysnode)
|
dmar_tbl, dmar_hw_list, dmar_dev_list, sysnode)
|
||||||
|
|
||||||
print("\t#define DRHD_COUNT {0}U".format(drhd_cnt), file=config)
|
print("\t#define DRHD_COUNT {0}U".format(drhd_cnt), file=config)
|
||||||
|
print("", file=config)
|
||||||
prev_dev_scope_num = 0
|
prev_dev_scope_num = 0
|
||||||
for drhd_hw_i in range(drhd_cnt):
|
for drhd_hw_i in range(drhd_cnt):
|
||||||
dev_scope_num = dmar_dev_list.dev_scope_cnt_list[drhd_hw_i]
|
dev_scope_num = dmar_dev_list.dev_scope_cnt_list[drhd_hw_i]
|
||||||
print("\t#define DRHD"+str(drhd_hw_i)+"_DEV_CNT {0}U".format(
|
print("\t#define DRHD"+str(drhd_hw_i)+"_DEV_CNT {0}U".format(
|
||||||
dmar_dev_list.dev_scope_cnt_list[drhd_hw_i]), file=config)
|
hex(dmar_dev_list.dev_scope_cnt_list[drhd_hw_i])), file=config)
|
||||||
print("\t#define DRHD"+str(drhd_hw_i)+"_SEGMENT {0}U".format(
|
print("\t#define DRHD"+str(drhd_hw_i)+"_SEGMENT {0}U".format(
|
||||||
dmar_hw_list.hw_segment_list[drhd_hw_i]), file=config)
|
hex(dmar_hw_list.hw_segment_list[drhd_hw_i])), file=config)
|
||||||
print("\t#define DRHD"+str(drhd_hw_i)+"_FLAGS {0}U".format(
|
print("\t#define DRHD"+str(drhd_hw_i)+"_FLAGS {0}U".format(
|
||||||
dmar_hw_list.hw_flags_list[drhd_hw_i]), file=config)
|
hex(dmar_hw_list.hw_flags_list[drhd_hw_i])), file=config)
|
||||||
print("\t#define DRHD"+str(drhd_hw_i)+"_REG_BASE 0x{:0>2X}UL".format(
|
print("\t#define DRHD"+str(drhd_hw_i)+"_REG_BASE 0x{:0>2X}UL".format(
|
||||||
dmar_hw_list.hw_address_list[drhd_hw_i]), file=config)
|
dmar_hw_list.hw_address_list[drhd_hw_i]), file=config)
|
||||||
if drhd_hw_i in dmar_hw_list.hw_ignore.keys():
|
if drhd_hw_i in dmar_hw_list.hw_ignore.keys():
|
||||||
print("\t#define DRHD"+str(drhd_hw_i)+"_IGNORE {0}".format(
|
print("\t#define DRHD"+str(drhd_hw_i)+"_IGNORE {0}".format(
|
||||||
dmar_hw_list.hw_ignore[drhd_hw_i]), file=config)
|
dmar_hw_list.hw_ignore[drhd_hw_i]), file=config)
|
||||||
for dev_scope_i in range(dev_scope_num):
|
for dev_scope_i in range(dev_scope_num):
|
||||||
|
print("\t#define DRHD"+str(drhd_hw_i)+"_DEVSCOPE"+str(dev_scope_i),
|
||||||
|
file=config, end="")
|
||||||
|
print("_TYPE {0}U".format(
|
||||||
|
hex(dmar_dev_list.dev_scope_type_list[prev_dev_scope_num + dev_scope_i])),
|
||||||
|
file=config)
|
||||||
|
print("\t#define DRHD"+str(drhd_hw_i)+"_DEVSCOPE"+str(dev_scope_i),
|
||||||
|
file=config, end="")
|
||||||
|
print("_ID {0}U".format(
|
||||||
|
hex(dmar_dev_list.dev_scope_id_list[prev_dev_scope_num + dev_scope_i])),
|
||||||
|
file=config)
|
||||||
print("\t#define DRHD"+str(drhd_hw_i)+"_DEVSCOPE"+str(dev_scope_i),
|
print("\t#define DRHD"+str(drhd_hw_i)+"_DEVSCOPE"+str(dev_scope_i),
|
||||||
file=config, end="")
|
file=config, end="")
|
||||||
print("_BUS {0}U".format(hex(
|
print("_BUS {0}U".format(hex(
|
||||||
@ -359,7 +370,6 @@ def write_dmar_data(sysnode, config):
|
|||||||
print("_PATH {0}U".format(hex(
|
print("_PATH {0}U".format(hex(
|
||||||
dmar_dev_list.dev_path_list[prev_dev_scope_num + dev_scope_i])),
|
dmar_dev_list.dev_path_list[prev_dev_scope_num + dev_scope_i])),
|
||||||
file=config)
|
file=config)
|
||||||
if drhd_hw_i in dmar_dev_list.dev_ioapic.keys():
|
|
||||||
print("\t#define DRHD"+str(drhd_hw_i)+"_IOAPIC_ID {0}U".format(
|
print("", file=config)
|
||||||
dmar_dev_list.dev_ioapic[drhd_hw_i]), file=config)
|
prev_dev_scope_num += dev_scope_num
|
||||||
prev_dev_scope_num = dev_scope_num
|
|
||||||
|
Loading…
Reference in New Issue
Block a user