mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-18 09:23:44 +00:00
config-tools: refine bin_gen.py arguments and tpm2_acpi_gen
Refine the arguments of bin_gen.py. The --board and --scenario take the path to the XMLs as the argument. The allocation.xml is needed for bin_gen.py to generate tpm2 acpi table. Refine the condition of tpm2_acpi_gen. The tpm2 device "MSFT0101" can be present in device id or compatible_id(CID). Check both attributes and child node of tpm2 device. Tracked-On: #6320 Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
This commit is contained in:
parent
7439ac1a92
commit
dce3142cfc
@ -398,7 +398,7 @@ pre_build: $(HV_CONFIG_H) $(HV_CONFIG_TIMESTAMP)
|
|||||||
$(MAKE) -C $(PRE_BUILD_DIR) BOARD=$(BOARD) SCENARIO=$(SCENARIO) TARGET_DIR=$(HV_CONFIG_DIR)
|
$(MAKE) -C $(PRE_BUILD_DIR) BOARD=$(BOARD) SCENARIO=$(SCENARIO) TARGET_DIR=$(HV_CONFIG_DIR)
|
||||||
@$(HV_OBJDIR)/hv_prebuild_check.out
|
@$(HV_OBJDIR)/hv_prebuild_check.out
|
||||||
@echo "generate the binary of ACPI tables for pre-launched VMs ..."
|
@echo "generate the binary of ACPI tables for pre-launched VMs ..."
|
||||||
python3 ../misc/config_tools/acpi_gen/bin_gen.py --board $(BOARD) --scenario $(SCENARIO) --asl $(HV_CONFIG_DIR) --out $(HV_OBJDIR)/acpi
|
python3 ../misc/config_tools/acpi_gen/bin_gen.py --board $(HV_OBJDIR)/.board.xml --scenario $(HV_OBJDIR)/.scenario.xml --asl $(HV_CONFIG_DIR) --out $(HV_OBJDIR)
|
||||||
|
|
||||||
.PHONY: header
|
.PHONY: header
|
||||||
header: $(VERSION) $(HV_CONFIG_H) $(HV_CONFIG_TIMESTAMP)
|
header: $(VERSION) $(HV_CONFIG_H) $(HV_CONFIG_TIMESTAMP)
|
||||||
|
@ -65,7 +65,7 @@ def asl_to_aml(dest_vm_acpi_path, dest_vm_acpi_bin_path):
|
|||||||
def tpm2_acpi_gen(acpi_bin, board_etree, scenario_etree, allocation_etree):
|
def tpm2_acpi_gen(acpi_bin, board_etree, scenario_etree, allocation_etree):
|
||||||
tpm2_enabled = common.get_node("//vm[@id = '0']/mmio_resources/TPM2/text()", scenario_etree)
|
tpm2_enabled = common.get_node("//vm[@id = '0']/mmio_resources/TPM2/text()", scenario_etree)
|
||||||
if tpm2_enabled is not None and tpm2_enabled == 'y':
|
if tpm2_enabled is not None and tpm2_enabled == 'y':
|
||||||
tpm2_node = common.get_node("//device[@id = 'MSFT0101']", board_etree)
|
tpm2_node = common.get_node("//device[@id = 'MSFT0101' or compatible_id = 'MSFT0101']", board_etree)
|
||||||
if tpm2_node is not None:
|
if tpm2_node is not None:
|
||||||
_data_len = 0x4c if common.get_node("//capability[@id = 'log_area']", board_etree) is not None else 0x40
|
_data_len = 0x4c if common.get_node("//capability[@id = 'log_area']", board_etree) is not None else 0x40
|
||||||
_data = bytearray(_data_len)
|
_data = bytearray(_data_len)
|
||||||
@ -212,22 +212,22 @@ def check_iasl():
|
|||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
|
||||||
board_type = args.board
|
board_etree = lxml.etree.parse(args.board)
|
||||||
scenario_name = args.scenario
|
scenario_etree = lxml.etree.parse(args.scenario)
|
||||||
board_path = os.path.join(VM_CONFIGS_PATH, 'data', board_type, board_type + '.xml')
|
|
||||||
board_etree = lxml.etree.parse(board_path)
|
scenario_name = common.get_node("//@scenario", scenario_etree)
|
||||||
scenario_path = os.path.join(VM_CONFIGS_PATH, 'data', board_type, scenario_name + '.xml')
|
|
||||||
scenario_etree = lxml.etree.parse(scenario_path)
|
|
||||||
allocation_path = os.path.join(common.SOURCE_ROOT_DIR, 'build', 'hypervisor', 'configs' ,'allocation.xml')
|
|
||||||
allocation_etree = lxml.etree.parse(allocation_path)
|
|
||||||
if args.asl is None:
|
if args.asl is None:
|
||||||
DEST_ACPI_PATH = os.path.join(VM_CONFIGS_PATH, 'scenarios', scenario_name)
|
DEST_ACPI_PATH = os.path.join(VM_CONFIGS_PATH, 'scenarios', scenario_name)
|
||||||
else:
|
else:
|
||||||
DEST_ACPI_PATH = os.path.join(common.SOURCE_ROOT_DIR, args.asl, 'scenarios', scenario_name)
|
DEST_ACPI_PATH = os.path.join(common.SOURCE_ROOT_DIR, args.asl, 'scenarios', scenario_name)
|
||||||
if args.out is None:
|
if args.out is None:
|
||||||
DEST_ACPI_BIN_PATH = os.path.join(common.SOURCE_ROOT_DIR, 'build', 'hypervisor', 'acpi')
|
hypervisor_out = os.path.join(common.SOURCE_ROOT_DIR, 'build', 'hypervisor')
|
||||||
else:
|
else:
|
||||||
DEST_ACPI_BIN_PATH = args.out
|
hypervisor_out = args.out
|
||||||
|
DEST_ACPI_BIN_PATH = os.path.join(hypervisor_out, 'acpi')
|
||||||
|
|
||||||
|
allocation_etree = lxml.etree.parse(os.path.join(hypervisor_out, 'configs', 'allocation.xml'))
|
||||||
|
|
||||||
if os.path.isdir(DEST_ACPI_BIN_PATH):
|
if os.path.isdir(DEST_ACPI_BIN_PATH):
|
||||||
shutil.rmtree(DEST_ACPI_BIN_PATH)
|
shutil.rmtree(DEST_ACPI_BIN_PATH)
|
||||||
@ -251,13 +251,13 @@ def main(args):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(usage="python3 bin_gen.py --board [board] --scenario [scenario]"
|
parser = argparse.ArgumentParser(usage="python3 bin_gen.py --board [board] --scenario [scenario]"
|
||||||
"[ --out [output dir of acpi ASL code]]",
|
"[ --out [output dir of acpi ASL code]]",
|
||||||
description="the tool to generate ACPI binary for Pre-launched VMs.")
|
description="the tool to generate ACPI binary for Pre-launched VMs")
|
||||||
parser.add_argument("--board", required=True, help="the board type.")
|
parser.add_argument("--board", required=True, help="the XML file summarizing characteristics of the target board")
|
||||||
parser.add_argument("--scenario", required=True, help="the scenario name.")
|
parser.add_argument("--scenario", required=True, help="the XML file specifying the scenario to be set up")
|
||||||
parser.add_argument("--asl", default=None, help="the input folder to store the ACPI ASL code. ")
|
parser.add_argument("--asl", default=None, help="the input folder to store the ACPI ASL code. ")
|
||||||
parser.add_argument("--out", default=None, help="the output folder to store the ACPI binary code. "
|
parser.add_argument("--out", default=None, help="the output folder to store the ACPI binary code. "
|
||||||
"If not specified, the path for the binary code is"
|
"If not specified, the path for the binary code is"
|
||||||
"build/acpi/")
|
"build/hypervisor/acpi/")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
rc = main(args)
|
rc = main(args)
|
||||||
|
Loading…
Reference in New Issue
Block a user