diff --git a/misc/acrn-config/acpi_gen/acpi_const.py b/misc/acrn-config/acpi_gen/acpi_const.py index fd51c8f4f..4bd80edcf 100644 --- a/misc/acrn-config/acpi_gen/acpi_const.py +++ b/misc/acrn-config/acpi_gen/acpi_const.py @@ -21,10 +21,10 @@ ACPI_BASE = 0x7ff00000 ACPI_RSDP_ADDR_OFFSET = 0x0 # (36 bytes fixed) ACPI_XSDT_ADDR_OFFSET = 0x80 # (36 bytes + 8*7 table addrs) -ACPI_FADT_ADDR_OFFSET = 0x100 # (244 bytes) -ACPI_DSDT_ADDR_OFFSET = 0x200 # (variable) -ACPI_MCFG_ADDR_OFFSET = 0x400 # (60 bytes) -ACPI_MADT_ADDR_OFFSET = 0x440 # (depends on #CPUs) +ACPI_FADT_ADDR_OFFSET = 0x100 # (268 bytes) +ACPI_DSDT_ADDR_OFFSET = 0x240 # (variable) +ACPI_MCFG_ADDR_OFFSET = 0x440 # (60 bytes) +ACPI_MADT_ADDR_OFFSET = 0x480 # (depends on #CPUs) ACPI_PTCT_ADDR_OFFSET = 0xF00 ACPI_TPM2_ADDR_OFFSET = 0x1100 # (52 bytes) @@ -38,10 +38,6 @@ ACPI_DSDT_ADDR = (ACPI_BASE + ACPI_DSDT_ADDR_OFFSET) ACPI_PTCT_ADDR = (ACPI_BASE + ACPI_PTCT_ADDR_OFFSET) ACPI_FACS_ADDR = 0x0 -PM1A_EVN_LEN = 0x4 -PM1A_CNT_LEN = 0x2 -FADT_FLAGS = 0x00001125 - VIRT_PCI_MMCFG_BASE = 0xE0000000 ACPI_MADT_TYPE_IOAPIC = 1 diff --git a/misc/acrn-config/acpi_gen/asl_gen.py b/misc/acrn-config/acpi_gen/asl_gen.py index 4ad665ef5..313835c27 100644 --- a/misc/acrn-config/acpi_gen/asl_gen.py +++ b/misc/acrn-config/acpi_gen/asl_gen.py @@ -9,6 +9,7 @@ import os, re, argparse, shutil import xml.etree.ElementTree as ElementTree from acpi_const import * import board_cfg_lib +import collections def calculate_checksum8(): ''' @@ -84,24 +85,6 @@ def gen_fadt(dest_vm_acpi_path, board_root): fadt_asl = 'facp.asl' p_facs_addr = r'FACS Address : ([0-9a-fA-F]{8})' p_dsdt_addr = r'DSDT Address : ([0-9a-fA-F]{8})$' - p_pm1a_event_block_addr = r'PM1A Event Block Address : (\d+)' - p_pm1a_control_block_addr = r'PM1A Control Block Address : (\d+)' - p_pm1_event_length = r'PM1 Event Block Length : (\d+)' - p_pm1_control_length = r'PM1 Control Block Length : (\d+)' - p_flasg = r' Flags (decoded below) : (\d+)' - - PM1A_EVT_ADDRESS = 0x0 - PM1A_CNT_ADDRESS = 0x0 - e_pm_info = board_root.find('PM_INFO') - for line in e_pm_info.text.split('\n'): - s = re.search(r'#define PM1A_EVT_ADDRESS (0x\d+)UL', line) - if s is not None and len(s.groups()) > 0: - PM1A_EVT_ADDRESS = int(s.groups()[0], 16) - continue - s = re.search(r'#define PM1A_CNT_ADDRESS (0x\d+)UL', line) - if s is not None and len(s.groups()) > 0: - PM1A_CNT_ADDRESS = int(s.groups()[0], 16) - continue with open(os.path.join(dest_vm_acpi_path, fadt_asl), 'w') as dest: lines = [] @@ -111,16 +94,6 @@ def gen_fadt(dest_vm_acpi_path, board_root): lines.append(re.sub(p_facs_addr, 'FACS Address : {0:08X}'.format(ACPI_FACS_ADDR), line)) elif re.search(p_dsdt_addr, line): lines.append(re.sub(p_dsdt_addr, 'DSDT Address : {0:08X}'.format(ACPI_DSDT_ADDR), line)) - elif re.search(p_pm1a_event_block_addr, line): - lines.append(re.sub(p_pm1a_event_block_addr, 'PM1A Event Block Address : {0:08X}'.format(PM1A_EVT_ADDRESS), line)) - elif re.search(p_pm1a_control_block_addr, line): - lines.append(re.sub(p_pm1a_control_block_addr, 'PM1A Control Block Address : {0:08X}'.format(PM1A_CNT_ADDRESS), line)) - elif re.search(p_pm1_event_length, line): - lines.append(re.sub(p_pm1_event_length, 'PM1 Event Block Length : {0:02X}'.format(PM1A_EVN_LEN), line)) - elif re.search(p_pm1_control_length, line): - lines.append(re.sub(p_pm1_control_length, 'PM1 Control Block Length : {0:02X}'.format(PM1A_CNT_LEN), line)) - elif re.search(p_flasg, line): - lines.append(re.sub(p_flasg, 'Flags (decoded below) : {0:08X}'.format(FADT_FLAGS), line)) else: lines.append(line) dest.writelines(lines) @@ -438,8 +411,8 @@ def main(args): if config.startswith('VM') and os.path.isdir(os.path.join(DEST_ACPI_PATH, config)): shutil.rmtree(os.path.join(DEST_ACPI_PATH, config)) - dict_passthru_devices = {} - dict_vcpu_list = {} + dict_passthru_devices = collections.OrderedDict() + dict_vcpu_list = collections.OrderedDict() for vm in scenario_root.findall('vm'): vm_id = vm.attrib['id'] vm_type_node = vm.find('vm_type') diff --git a/misc/vm_configs/acpi/template/dsdt.asl b/misc/vm_configs/acpi/template/dsdt.asl index af968e71a..f72e7567e 100644 --- a/misc/vm_configs/acpi/template/dsdt.asl +++ b/misc/vm_configs/acpi/template/dsdt.asl @@ -16,6 +16,10 @@ */ DefinitionBlock ("", "DSDT", 3, "ACRN ", "ACRNDSDT", 0x00000001) { - + Name (_S5, Package () + { + 0x05, + Zero, + }) } diff --git a/misc/vm_configs/acpi/template/facp.asl b/misc/vm_configs/acpi/template/facp.asl index 0331c4666..45e151845 100644 --- a/misc/vm_configs/acpi/template/facp.asl +++ b/misc/vm_configs/acpi/template/facp.asl @@ -9,9 +9,9 @@ */ [0004] Signature : "FACP" [Fixed ACPI Description Table (FADT)] -[0004] Table Length : 000000F4 -[0001] Revision : 03 -[0001] Checksum : 28 +[0004] Table Length : 0000010C +[0001] Revision : 05 +[0001] Checksum : 00 [0006] Oem ID : "ACRN " [0008] Oem Table ID : "ACRNFADT" [0004] Oem Revision : 00000001 @@ -28,16 +28,16 @@ [0001] ACPI Disable Value : 00 [0001] S4BIOS Command : 00 [0001] P-State Control : 00 -[0004] PM1A Event Block Address : 00001800 +[0004] PM1A Event Block Address : 00000000 [0004] PM1B Event Block Address : 00000000 -[0004] PM1A Control Block Address : 00001804 +[0004] PM1A Control Block Address : 00000000 [0004] PM1B Control Block Address : 00000000 [0004] PM2 Control Block Address : 00000000 [0004] PM Timer Block Address : 00000000 [0004] GPE0 Block Address : 00000000 [0004] GPE1 Block Address : 00000000 -[0001] PM1 Event Block Length : 04 -[0001] PM1 Control Block Length : 02 +[0001] PM1 Event Block Length : 00 +[0001] PM1 Control Block Length : 00 [0001] PM2 Control Block Length : 00 [0001] PM Timer Block Length : 00 [0001] GPE0 Block Length : 00 @@ -82,7 +82,7 @@ Remote Power-on capable (V4) : 0 Use APIC Cluster Model (V4) : 0 Use APIC Physical Destination Mode (V4) : 0 - Hardware Reduced (V5) : 0 + Hardware Reduced (V5) : 1 Low Power S0 Idle (V5) : 0 [0012] Reset Register : [Generic Address Structure] @@ -155,3 +155,16 @@ Use APIC Physical Destination Mode (V4) : 0 [0001] Bit Offset : 00 [0001] Encoded Access Width : 00 [Undefined/Legacy] [0008] Address : 0000000000000000 +[0012] Sleep Control Register : [Generic Address Structure] +[0001] Space ID : 01 [SystemIO] +[0001] Bit Width : 08 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 01 [Byte Access:8] +[0008] Address : 0000000000000400 + +[0012] Sleep Status Register : [Generic Address Structure] +[0001] Space ID : 01 [SystemIO] +[0001] Bit Width : 08 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 01 [Byte Access:8] +[0008] Address : 0000000000000401