acrn-config: always generate P2SB_BAR_ADDR related boilerplate code in vm_configurations.c

so that vm_configurations.h/vm_configurations.c are consistent for different boards

The boilerplate code is protected by #ifdef P2SB_BAR_ADDR/#endif, so it will
not hurt if we always produce related code.

Define new macros P2SB_BAR_ADDR_GPA and P2SB_BAR_SIZE to make the code more flexible.

Tracked-On: #5229
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
This commit is contained in:
dongshen 2020-09-09 13:05:45 -07:00 committed by wenlingz
parent 14a3abcce0
commit 0f0d0c0d18
2 changed files with 9 additions and 6 deletions

View File

@ -96,7 +96,12 @@ def generate_file(config):
and board_cfg_lib.is_p2sb_passthru_possible()): and board_cfg_lib.is_p2sb_passthru_possible()):
print("", file=config) print("", file=config)
print("#define P2SB_VGPIO_DM_ENABLED", file=config) print("#define P2SB_VGPIO_DM_ENABLED", file=config)
print("#define P2SB_BAR_ADDR\t\t\t0x{:X}UL".format(board_cfg_lib.find_p2sb_bar_addr()), 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")): if board_cfg_lib.is_matched_board(("ehl-crb-b")):
print("", file=config) print("", file=config)

View File

@ -337,15 +337,13 @@ def gen_pre_launch_vm(vm_type, vm_i, scenario_items, config):
print("\t\t},", file=config) print("\t\t},", file=config)
print("#endif", file=config) print("#endif", file=config)
if (vm_i == 0 and vm_info.mmio_resource_info.p2sb.get(vm_i) is not None if vm_i == 0:
and vm_info.mmio_resource_info.p2sb[vm_i]):
print("#ifdef P2SB_BAR_ADDR", file=config) print("#ifdef P2SB_BAR_ADDR", file=config)
print("\t\t.pt_p2sb_bar = true,", file=config) print("\t\t.pt_p2sb_bar = true,", file=config)
print("\t\t.mmiodevs[0] = {", file=config) print("\t\t.mmiodevs[0] = {", file=config)
gpa = common.hpa2gpa(0, board_cfg_lib.find_p2sb_bar_addr(), 0x1000000) print("\t\t\t.base_gpa = P2SB_BAR_ADDR_GPA,", file=config)
print("\t\t\t.base_gpa = 0x{:X}UL,".format(gpa), file=config)
print("\t\t\t.base_hpa = P2SB_BAR_ADDR,", file=config) print("\t\t\t.base_hpa = P2SB_BAR_ADDR,", file=config)
print("\t\t\t.size = 0x1000000UL,", file=config) print("\t\t\t.size = P2SB_BAR_SIZE,", file=config)
print("\t\t},", file=config) print("\t\t},", file=config)
print("#endif", file=config) print("#endif", file=config)