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) p2sb = common.get_leaf_tag_map_bool(common.SCENARIO_INFO_FILE, "mmio_resources", "p2sb") 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() and p2sb.get(0, False)): print("", file=config) print("#define P2SB_VGPIO_DM_ENABLED", file=config) hpa = board_cfg_lib.find_p2sb_bar_addr() print("#define P2SB_BAR_ADDR\t\t\t0x{:X}UL".format(hpa), file=config) gpa = common.hpa2gpa(0, hpa, 0x1000000) print("#define P2SB_BAR_ADDR_GPA\t\t0x{:X}UL".format(gpa), file=config) print("#define P2SB_BAR_SIZE\t\t\t0x1000000UL", file=config) if board_cfg_lib.is_matched_board(("ehl-crb-b")): print("", file=config) print("#define P2SB_BASE_GPIO_PORT_ID\t\t0x69U", file=config) print("#define P2SB_MAX_GPIO_COMMUNITIES\t0x6U", file=config) print(BOARD_INFO_ENDIF, file=config)
def check_p2sb(enable_p2sb): for vm_i,p2sb in enable_p2sb.items(): if vm_i != 0: key = "vm:id={},p2sb".format(vm_i) ERR_LIST[key] = "Can only specify p2sb passthru for VM0" return if p2sb and not VM_DB[common.LOAD_ORDER[0]]['load_type'] == "PRE_LAUNCHED_VM": ERR_LIST["vm:id=0,p2sb"] = "p2sb passthru can only be enabled for Pre-launched VM" return if p2sb and not board_cfg_lib.is_p2sb_passthru_possible(): ERR_LIST["vm:id=0,p2sb"] = "p2sb passthru is not allowed for this board" return if p2sb and board_cfg_lib.is_tpm_passthru(): ERR_LIST["vm:id=0,p2sb"] = "Cannot enable p2sb and tpm passthru at the same time" return