2020-07-21 16:19:52 +08:00
|
|
|
# Copyright (C) 2020 Intel Corporation. All rights reserved.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
#
|
|
|
|
|
|
|
|
import common
|
|
|
|
import board_cfg_lib
|
2020-08-24 08:45:16 +08:00
|
|
|
import scenario_cfg_lib
|
2020-07-21 16:19:52 +08:00
|
|
|
|
|
|
|
BOARD_INFO_DEFINE="""#ifndef BOARD_INFO_H
|
|
|
|
#define BOARD_INFO_H
|
|
|
|
"""
|
|
|
|
|
|
|
|
BOARD_INFO_ENDIF="""
|
|
|
|
#endif /* BOARD_INFO_H */"""
|
|
|
|
|
|
|
|
def gen_known_caps_pci_head(config):
|
|
|
|
|
|
|
|
bdf_list_len = 0
|
|
|
|
known_caps_pci_devs = board_cfg_lib.get_known_caps_pci_devs()
|
|
|
|
for dev,bdf_list in known_caps_pci_devs.items():
|
2020-08-30 14:46:56 +08:00
|
|
|
if dev == "VMSIX":
|
2020-07-21 16:19:52 +08:00
|
|
|
bdf_list_len = len(bdf_list)
|
|
|
|
print("#define MAX_VMSIX_ON_MSI_PDEVS_NUM\t{}U".format(bdf_list_len), file=config)
|
|
|
|
|
|
|
|
|
|
|
|
def find_hi_mmio_window(config):
|
|
|
|
|
|
|
|
i_cnt = 0
|
|
|
|
mmio_min = 0
|
|
|
|
mmio_max = 0
|
|
|
|
is_hi_mmio = False
|
|
|
|
|
|
|
|
iomem_lines = board_cfg_lib.get_info(common.BOARD_INFO_FILE, "<IOMEM_INFO>", "</IOMEM_INFO>")
|
|
|
|
|
|
|
|
for line in iomem_lines:
|
|
|
|
if "PCI Bus" not in line:
|
|
|
|
continue
|
|
|
|
|
|
|
|
line_start_addr = int(line.split('-')[0], 16)
|
|
|
|
line_end_addr = int(line.split('-')[1].split()[0], 16)
|
|
|
|
if line_start_addr < common.SIZE_4G and line_end_addr < common.SIZE_4G:
|
|
|
|
continue
|
|
|
|
elif line_start_addr < common.SIZE_4G and line_end_addr >= common.SIZE_4G:
|
|
|
|
i_cnt += 1
|
|
|
|
is_hi_mmio = True
|
|
|
|
mmio_min = common.SIZE_4G
|
|
|
|
mmio_max = line_end_addr
|
|
|
|
continue
|
|
|
|
|
|
|
|
is_hi_mmio = True
|
|
|
|
if i_cnt == 0:
|
|
|
|
mmio_min = line_start_addr
|
|
|
|
mmio_max = line_end_addr
|
|
|
|
|
|
|
|
if mmio_max < line_end_addr:
|
|
|
|
mmio_max = line_end_addr
|
|
|
|
i_cnt += 1
|
|
|
|
|
|
|
|
print("", file=config)
|
|
|
|
if is_hi_mmio:
|
|
|
|
print("#define HI_MMIO_START\t\t\t0x%xUL" % common.round_down(mmio_min, common.SIZE_G), file=config)
|
|
|
|
print("#define HI_MMIO_END\t\t\t0x%xUL" % common.round_up(mmio_max, common.SIZE_G), file=config)
|
|
|
|
else:
|
|
|
|
print("#define HI_MMIO_START\t\t\t~0UL", file=config)
|
|
|
|
print("#define HI_MMIO_END\t\t\t0UL", file=config)
|
|
|
|
print("#define HI_MMIO_SIZE\t\t\t{}UL".format(hex(board_cfg_lib.HI_MMIO_OFFSET)), file=config)
|
|
|
|
|
|
|
|
|
|
|
|
def generate_file(config):
|
|
|
|
# get cpu processor list
|
|
|
|
cpu_list = board_cfg_lib.get_processor_info()
|
|
|
|
max_cpu_num = len(cpu_list)
|
|
|
|
|
|
|
|
# start to generate board_info.h
|
|
|
|
print("{0}".format(board_cfg_lib.HEADER_LICENSE), file=config)
|
|
|
|
print(BOARD_INFO_DEFINE, file=config)
|
|
|
|
|
|
|
|
# define CONFIG_MAX_PCPCU_NUM
|
|
|
|
print("#define MAX_PCPU_NUM\t\t\t{}U".format(max_cpu_num), file=config)
|
|
|
|
|
|
|
|
# define MAX_VMSIX_ON_MSI_PDEVS_NUM
|
|
|
|
gen_known_caps_pci_head(config)
|
|
|
|
|
|
|
|
# define MAX_HIDDEN_PDEVS_NUM
|
|
|
|
if board_cfg_lib.BOARD_NAME in list(board_cfg_lib.KNOWN_HIDDEN_PDEVS_BOARD_DB):
|
|
|
|
print("#define MAX_HIDDEN_PDEVS_NUM\t\t{}U".format(len(board_cfg_lib.KNOWN_HIDDEN_PDEVS_BOARD_DB[board_cfg_lib.BOARD_NAME])), file=config)
|
|
|
|
else:
|
|
|
|
print("#define MAX_HIDDEN_PDEVS_NUM\t\t0U", file=config)
|
|
|
|
|
|
|
|
# generate HI_MMIO_START/HI_MMIO_END
|
|
|
|
find_hi_mmio_window(config)
|
|
|
|
|
2020-08-24 08:45:16 +08:00
|
|
|
if (common.VM_TYPES.get(0) is not None and
|
|
|
|
scenario_cfg_lib.VM_DB[common.VM_TYPES[0]]['load_type'] == "PRE_LAUNCHED_VM"
|
|
|
|
and board_cfg_lib.is_p2sb_passthru_possible()):
|
|
|
|
print("", file=config)
|
|
|
|
print("#define P2SB_BAR_ADDR\t\t\t0x{:X}UL".format(board_cfg_lib.find_p2sb_bar_addr()), file=config)
|
|
|
|
|
acrn-config: expose GPIO chassis interrupt to safety VM as INTx
This patch is to expose GPIO chassis interrupts as INTx to safety VM for
EHL. User can configure this per-VM attribute in scenario xml using the
following format:
<pt_intx desc="pt intx mapping.">
(phys_gsi0, virt_gsi0), (phys_gsi1, virt_gsi1), (phys_gsiN, virt_gsiN)
</pt_intx>
The physical and virtual interrupt gsi in each pair are separated by a
comma and enclosed in parentheses. If an integer begins with 0x or 0X,
it is hexadecimal, otherwise, it is assumed to be decimal. Example:
<pt_intx desc="pt intx mapping.">
(1, 0), (0x3, 1), (0x4, 2), (5, 6), (89, 0x12)
</pt_intx>
Tracked-On: #5241
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-08-24 09:09:30 +08:00
|
|
|
if board_cfg_lib.is_matched_board(("ehl-crb-b")):
|
|
|
|
print("", file=config)
|
|
|
|
print("#define BASE_GPIO_PORT_ID\t\t0x69U", file=config)
|
|
|
|
print("#define MAX_GPIO_COMMUNITIES\t0x6U", file=config)
|
|
|
|
|
2020-07-21 16:19:52 +08:00
|
|
|
print(BOARD_INFO_ENDIF, file=config)
|