acrn-config: generate msix emulation information
generate msix emulation information from known exist PCI devices for board config. Tracked-On: #4831 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Reviewed-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
bdaa2a58df
commit
219bec5146
|
@ -260,6 +260,41 @@ def gen_pci_hide(config):
|
|||
print("const union pci_bdf plat_hidden_pdevs[MAX_HIDDEN_PDEVS_NUM];", file=config)
|
||||
|
||||
|
||||
def gen_known_caps_pci_devs(config):
|
||||
"""Generate information for known capabilities of pci devices"""
|
||||
|
||||
vpid_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<PCI_VID_PID>", "</PCI_VID_PID>")
|
||||
for dev,known_dev in board_cfg_lib.KNOWN_CAPS_PCI_DEVS_DB.items():
|
||||
if dev not in board_cfg_lib.KNOWN_CAPS_PCI_DEVS:
|
||||
board_cfg_lib.KNOWN_CAPS_PCI_DEVS[dev] = []
|
||||
for k_dev in known_dev:
|
||||
for vpid_line in vpid_lines:
|
||||
if k_dev in vpid_line:
|
||||
bdf = vpid_line.split()[0]
|
||||
board_cfg_lib.KNOWN_CAPS_PCI_DEVS[dev].append(bdf)
|
||||
break
|
||||
|
||||
for dev,bdf_list in board_cfg_lib.KNOWN_CAPS_PCI_DEVS.items():
|
||||
if dev == "TSN":
|
||||
print("", file=config)
|
||||
bdf_list_len = len(bdf_list)
|
||||
if bdf_list_len == 0:
|
||||
print("const struct vmsix_on_msi_info vmsix_on_msi_devs[MAX_VMSIX_ON_MSI_PDEVS_NUM];", file=config)
|
||||
break
|
||||
for i in range(bdf_list_len):
|
||||
b = bdf_list[i].split(":")[0]
|
||||
d = bdf_list[i].split(":")[1].split(".")[0]
|
||||
f = bdf_list[i].split(".")[1]
|
||||
print("#define VMSIX_ON_MSI_DEV{}\t.bdf.bits = {{.b = 0x{}U, .d = 0x{}U, .f =0x{}U}},".format(i, b, d, f), file=config)
|
||||
|
||||
for i in range(bdf_list_len):
|
||||
if i == 0:
|
||||
print("const struct vmsix_on_msi_info vmsix_on_msi_devs[MAX_VMSIX_ON_MSI_PDEVS_NUM] = {", file=config)
|
||||
print("\t{{VMSIX_ON_MSI_DEV{}}},".format(i), file=config)
|
||||
if i == (bdf_list_len - 1):
|
||||
print("};", file=config)
|
||||
|
||||
|
||||
def generate_file(config):
|
||||
"""
|
||||
Start to generate board.c
|
||||
|
@ -286,4 +321,7 @@ def generate_file(config):
|
|||
# gen hide pci info for platform
|
||||
gen_pci_hide(config)
|
||||
|
||||
# gen known caps of pci dev info for platform
|
||||
gen_known_caps_pci_devs(config)
|
||||
|
||||
return err_dic
|
||||
|
|
|
@ -181,6 +181,14 @@ def find_hi_mmio_window(config):
|
|||
print("#define HI_MMIO_START\t\t~0UL", file=config)
|
||||
print("#define HI_MMIO_END\t\t0UL", file=config)
|
||||
|
||||
def gen_known_caps_pci_head(config):
|
||||
|
||||
for dev,bdf_list in board_cfg_lib.KNOWN_CAPS_PCI_DEVS.items():
|
||||
if dev == "TSN":
|
||||
bdf_list_len = len(bdf_list)
|
||||
print("#define MAX_VMSIX_ON_MSI_PDEVS_NUM\t{}U".format(bdf_list_len), file=config)
|
||||
|
||||
|
||||
def generate_file(config):
|
||||
"""
|
||||
Start to generate board.c
|
||||
|
@ -237,6 +245,7 @@ def generate_file(config):
|
|||
common_clos_max = 0
|
||||
|
||||
print("#define MAX_PLATFORM_CLOS_NUM\t{}U".format(common_clos_max), file=config)
|
||||
gen_known_caps_pci_head(config)
|
||||
|
||||
|
||||
# define rootfs with macro
|
||||
|
|
|
@ -30,6 +30,13 @@ KNOWN_HIDDEN_PDEVS_BOARD_DB = {
|
|||
'apl-up2':['00:0d:0'],
|
||||
}
|
||||
|
||||
TSN_DEVS = ["8086:4b30", "8086:4b31", "8086:4b32", "8086:4ba0", "8086:4ba1", "8086:4ba2",
|
||||
"8086:4bb0", "8086:4bb1", "8086:4bb2", "8086:a0ac", "8086:43ac", "8086:43a2"]
|
||||
KNOWN_CAPS_PCI_DEVS_DB = {
|
||||
"TSN":TSN_DEVS,
|
||||
}
|
||||
KNOWN_CAPS_PCI_DEVS = {}
|
||||
|
||||
def get_info(board_info, msg_s, msg_e):
|
||||
"""
|
||||
Get information which specify by argument
|
||||
|
|
Loading…
Reference in New Issue