172c194f7SMichael S. Tsirkin /* 272c194f7SMichael S. Tsirkin * This program is free software; you can redistribute it and/or modify 372c194f7SMichael S. Tsirkin * it under the terms of the GNU General Public License as published by 472c194f7SMichael S. Tsirkin * the Free Software Foundation; either version 2 of the License, or 572c194f7SMichael S. Tsirkin * (at your option) any later version. 672c194f7SMichael S. Tsirkin 772c194f7SMichael S. Tsirkin * This program is distributed in the hope that it will be useful, 872c194f7SMichael S. Tsirkin * but WITHOUT ANY WARRANTY; without even the implied warranty of 972c194f7SMichael S. Tsirkin * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1072c194f7SMichael S. Tsirkin * GNU General Public License for more details. 1172c194f7SMichael S. Tsirkin 1272c194f7SMichael S. Tsirkin * You should have received a copy of the GNU General Public License along 1372c194f7SMichael S. Tsirkin * with this program; if not, see <http://www.gnu.org/licenses/>. 1472c194f7SMichael S. Tsirkin */ 1572c194f7SMichael S. Tsirkin #ifndef QEMU_ACPI_DEFS_H 1672c194f7SMichael S. Tsirkin #define QEMU_ACPI_DEFS_H 1772c194f7SMichael S. Tsirkin 1872c194f7SMichael S. Tsirkin enum { 1972c194f7SMichael S. Tsirkin ACPI_FADT_F_WBINVD, 2072c194f7SMichael S. Tsirkin ACPI_FADT_F_WBINVD_FLUSH, 2172c194f7SMichael S. Tsirkin ACPI_FADT_F_PROC_C1, 2272c194f7SMichael S. Tsirkin ACPI_FADT_F_P_LVL2_UP, 2372c194f7SMichael S. Tsirkin ACPI_FADT_F_PWR_BUTTON, 2472c194f7SMichael S. Tsirkin ACPI_FADT_F_SLP_BUTTON, 2572c194f7SMichael S. Tsirkin ACPI_FADT_F_FIX_RTC, 2672c194f7SMichael S. Tsirkin ACPI_FADT_F_RTC_S4, 2772c194f7SMichael S. Tsirkin ACPI_FADT_F_TMR_VAL_EXT, 2872c194f7SMichael S. Tsirkin ACPI_FADT_F_DCK_CAP, 2972c194f7SMichael S. Tsirkin ACPI_FADT_F_RESET_REG_SUP, 3072c194f7SMichael S. Tsirkin ACPI_FADT_F_SEALED_CASE, 3172c194f7SMichael S. Tsirkin ACPI_FADT_F_HEADLESS, 3272c194f7SMichael S. Tsirkin ACPI_FADT_F_CPU_SW_SLP, 3372c194f7SMichael S. Tsirkin ACPI_FADT_F_PCI_EXP_WAK, 3472c194f7SMichael S. Tsirkin ACPI_FADT_F_USE_PLATFORM_CLOCK, 3572c194f7SMichael S. Tsirkin ACPI_FADT_F_S4_RTC_STS_VALID, 3672c194f7SMichael S. Tsirkin ACPI_FADT_F_REMOTE_POWER_ON_CAPABLE, 3772c194f7SMichael S. Tsirkin ACPI_FADT_F_FORCE_APIC_CLUSTER_MODEL, 3872c194f7SMichael S. Tsirkin ACPI_FADT_F_FORCE_APIC_PHYSICAL_DESTINATION_MODE, 3972c194f7SMichael S. Tsirkin ACPI_FADT_F_HW_REDUCED_ACPI, 4072c194f7SMichael S. Tsirkin ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE, 4172c194f7SMichael S. Tsirkin }; 4272c194f7SMichael S. Tsirkin 4372c194f7SMichael S. Tsirkin /* 4472c194f7SMichael S. Tsirkin * ACPI 2.0 Generic Address Space definition. 4572c194f7SMichael S. Tsirkin */ 4672c194f7SMichael S. Tsirkin struct Acpi20GenericAddress { 4772c194f7SMichael S. Tsirkin uint8_t address_space_id; 4872c194f7SMichael S. Tsirkin uint8_t register_bit_width; 4972c194f7SMichael S. Tsirkin uint8_t register_bit_offset; 5072c194f7SMichael S. Tsirkin uint8_t reserved; 5172c194f7SMichael S. Tsirkin uint64_t address; 5272c194f7SMichael S. Tsirkin } QEMU_PACKED; 5372c194f7SMichael S. Tsirkin typedef struct Acpi20GenericAddress Acpi20GenericAddress; 5472c194f7SMichael S. Tsirkin 5572c194f7SMichael S. Tsirkin struct AcpiRsdpDescriptor { /* Root System Descriptor Pointer */ 5672c194f7SMichael S. Tsirkin uint64_t signature; /* ACPI signature, contains "RSD PTR " */ 5772c194f7SMichael S. Tsirkin uint8_t checksum; /* To make sum of struct == 0 */ 5872c194f7SMichael S. Tsirkin uint8_t oem_id [6]; /* OEM identification */ 5972c194f7SMichael S. Tsirkin uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ 6072c194f7SMichael S. Tsirkin uint32_t rsdt_physical_address; /* 32-bit physical address of RSDT */ 6172c194f7SMichael S. Tsirkin uint32_t length; /* XSDT Length in bytes including hdr */ 6272c194f7SMichael S. Tsirkin uint64_t xsdt_physical_address; /* 64-bit physical address of XSDT */ 6372c194f7SMichael S. Tsirkin uint8_t extended_checksum; /* Checksum of entire table */ 6472c194f7SMichael S. Tsirkin uint8_t reserved [3]; /* Reserved field must be 0 */ 6572c194f7SMichael S. Tsirkin } QEMU_PACKED; 6672c194f7SMichael S. Tsirkin typedef struct AcpiRsdpDescriptor AcpiRsdpDescriptor; 6772c194f7SMichael S. Tsirkin 6872c194f7SMichael S. Tsirkin /* Table structure from Linux kernel (the ACPI tables are under the 6972c194f7SMichael S. Tsirkin BSD license) */ 7072c194f7SMichael S. Tsirkin 7172c194f7SMichael S. Tsirkin 7272c194f7SMichael S. Tsirkin #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ 7372c194f7SMichael S. Tsirkin uint32_t signature; /* ACPI signature (4 ASCII characters) */ \ 7472c194f7SMichael S. Tsirkin uint32_t length; /* Length of table, in bytes, including header */ \ 7572c194f7SMichael S. Tsirkin uint8_t revision; /* ACPI Specification minor version # */ \ 7672c194f7SMichael S. Tsirkin uint8_t checksum; /* To make sum of entire table == 0 */ \ 7772c194f7SMichael S. Tsirkin uint8_t oem_id [6]; /* OEM identification */ \ 7872c194f7SMichael S. Tsirkin uint8_t oem_table_id [8]; /* OEM table identification */ \ 7972c194f7SMichael S. Tsirkin uint32_t oem_revision; /* OEM revision number */ \ 8072c194f7SMichael S. Tsirkin uint8_t asl_compiler_id [4]; /* ASL compiler vendor ID */ \ 8172c194f7SMichael S. Tsirkin uint32_t asl_compiler_revision; /* ASL compiler revision number */ 8272c194f7SMichael S. Tsirkin 8372c194f7SMichael S. Tsirkin 8472c194f7SMichael S. Tsirkin struct AcpiTableHeader /* ACPI common table header */ 8572c194f7SMichael S. Tsirkin { 8672c194f7SMichael S. Tsirkin ACPI_TABLE_HEADER_DEF 8772c194f7SMichael S. Tsirkin } QEMU_PACKED; 8872c194f7SMichael S. Tsirkin typedef struct AcpiTableHeader AcpiTableHeader; 8972c194f7SMichael S. Tsirkin 9072c194f7SMichael S. Tsirkin /* 91*c2f7c0c3SShannon Zhao * ACPI Fixed ACPI Description Table (FADT) 9272c194f7SMichael S. Tsirkin */ 93*c2f7c0c3SShannon Zhao #define ACPI_FADT_COMMON_DEF /* FADT common definition */ \ 94*c2f7c0c3SShannon Zhao ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ 95*c2f7c0c3SShannon Zhao uint32_t firmware_ctrl; /* Physical address of FACS */ \ 96*c2f7c0c3SShannon Zhao uint32_t dsdt; /* Physical address of DSDT */ \ 97*c2f7c0c3SShannon Zhao uint8_t model; /* System Interrupt Model */ \ 98*c2f7c0c3SShannon Zhao uint8_t reserved1; /* Reserved */ \ 99*c2f7c0c3SShannon Zhao uint16_t sci_int; /* System vector of SCI interrupt */ \ 100*c2f7c0c3SShannon Zhao uint32_t smi_cmd; /* Port address of SMI command port */ \ 101*c2f7c0c3SShannon Zhao uint8_t acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ 102*c2f7c0c3SShannon Zhao uint8_t acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ 103*c2f7c0c3SShannon Zhao /* Value to write to SMI CMD to enter S4BIOS state */ \ 104*c2f7c0c3SShannon Zhao uint8_t S4bios_req; \ 105*c2f7c0c3SShannon Zhao uint8_t reserved2; /* Reserved - must be zero */ \ 106*c2f7c0c3SShannon Zhao /* Port address of Power Mgt 1a acpi_event Reg Blk */ \ 107*c2f7c0c3SShannon Zhao uint32_t pm1a_evt_blk; \ 108*c2f7c0c3SShannon Zhao /* Port address of Power Mgt 1b acpi_event Reg Blk */ \ 109*c2f7c0c3SShannon Zhao uint32_t pm1b_evt_blk; \ 110*c2f7c0c3SShannon Zhao uint32_t pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ 111*c2f7c0c3SShannon Zhao uint32_t pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ 112*c2f7c0c3SShannon Zhao uint32_t pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ 113*c2f7c0c3SShannon Zhao uint32_t pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ 114*c2f7c0c3SShannon Zhao /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ 115*c2f7c0c3SShannon Zhao uint32_t gpe0_blk; \ 116*c2f7c0c3SShannon Zhao /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ 117*c2f7c0c3SShannon Zhao uint32_t gpe1_blk; \ 118*c2f7c0c3SShannon Zhao uint8_t pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \ 119*c2f7c0c3SShannon Zhao uint8_t pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \ 120*c2f7c0c3SShannon Zhao uint8_t pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ 121*c2f7c0c3SShannon Zhao uint8_t pm_tmr_len; /* Byte Length of ports at pm_tm_blk */ \ 122*c2f7c0c3SShannon Zhao uint8_t gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ 123*c2f7c0c3SShannon Zhao uint8_t gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ 124*c2f7c0c3SShannon Zhao uint8_t gpe1_base; /* Offset in gpe model where gpe1 events start */ \ 125*c2f7c0c3SShannon Zhao uint8_t reserved3; /* Reserved */ \ 126*c2f7c0c3SShannon Zhao uint16_t plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ 127*c2f7c0c3SShannon Zhao uint16_t plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ 128*c2f7c0c3SShannon Zhao uint16_t flush_size; /* Size of area read to flush caches */ \ 129*c2f7c0c3SShannon Zhao uint16_t flush_stride; /* Stride used in flushing caches */ \ 130*c2f7c0c3SShannon Zhao uint8_t duty_offset; /* Bit location of duty cycle field in p_cnt reg */ \ 131*c2f7c0c3SShannon Zhao uint8_t duty_width; /* Bit width of duty cycle field in p_cnt reg */ \ 132*c2f7c0c3SShannon Zhao uint8_t day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ 133*c2f7c0c3SShannon Zhao uint8_t mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ 134*c2f7c0c3SShannon Zhao uint8_t century; /* Index to century in RTC CMOS RAM */ 135*c2f7c0c3SShannon Zhao 13672c194f7SMichael S. Tsirkin struct AcpiFadtDescriptorRev1 13772c194f7SMichael S. Tsirkin { 138*c2f7c0c3SShannon Zhao ACPI_FADT_COMMON_DEF 13972c194f7SMichael S. Tsirkin uint8_t reserved4; /* Reserved */ 14072c194f7SMichael S. Tsirkin uint8_t reserved4a; /* Reserved */ 14172c194f7SMichael S. Tsirkin uint8_t reserved4b; /* Reserved */ 14272c194f7SMichael S. Tsirkin uint32_t flags; 14372c194f7SMichael S. Tsirkin } QEMU_PACKED; 14472c194f7SMichael S. Tsirkin typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1; 14572c194f7SMichael S. Tsirkin 146*c2f7c0c3SShannon Zhao struct AcpiGenericAddress { 147*c2f7c0c3SShannon Zhao uint8_t space_id; /* Address space where struct or register exists */ 148*c2f7c0c3SShannon Zhao uint8_t bit_width; /* Size in bits of given register */ 149*c2f7c0c3SShannon Zhao uint8_t bit_offset; /* Bit offset within the register */ 150*c2f7c0c3SShannon Zhao uint8_t access_width; /* Minimum Access size (ACPI 3.0) */ 151*c2f7c0c3SShannon Zhao uint64_t address; /* 64-bit address of struct or register */ 152*c2f7c0c3SShannon Zhao } QEMU_PACKED; 153*c2f7c0c3SShannon Zhao 154*c2f7c0c3SShannon Zhao struct AcpiFadtDescriptorRev5_1 { 155*c2f7c0c3SShannon Zhao ACPI_FADT_COMMON_DEF 156*c2f7c0c3SShannon Zhao /* IA-PC Boot Architecture Flags (see below for individual flags) */ 157*c2f7c0c3SShannon Zhao uint16_t boot_flags; 158*c2f7c0c3SShannon Zhao uint8_t reserved; /* Reserved, must be zero */ 159*c2f7c0c3SShannon Zhao /* Miscellaneous flag bits (see below for individual flags) */ 160*c2f7c0c3SShannon Zhao uint32_t flags; 161*c2f7c0c3SShannon Zhao /* 64-bit address of the Reset register */ 162*c2f7c0c3SShannon Zhao struct AcpiGenericAddress reset_register; 163*c2f7c0c3SShannon Zhao /* Value to write to the reset_register port to reset the system */ 164*c2f7c0c3SShannon Zhao uint8_t reset_value; 165*c2f7c0c3SShannon Zhao /* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ 166*c2f7c0c3SShannon Zhao uint16_t arm_boot_flags; 167*c2f7c0c3SShannon Zhao uint8_t minor_revision; /* FADT Minor Revision (ACPI 5.1) */ 168*c2f7c0c3SShannon Zhao uint64_t Xfacs; /* 64-bit physical address of FACS */ 169*c2f7c0c3SShannon Zhao uint64_t Xdsdt; /* 64-bit physical address of DSDT */ 170*c2f7c0c3SShannon Zhao /* 64-bit Extended Power Mgt 1a Event Reg Blk address */ 171*c2f7c0c3SShannon Zhao struct AcpiGenericAddress xpm1a_event_block; 172*c2f7c0c3SShannon Zhao /* 64-bit Extended Power Mgt 1b Event Reg Blk address */ 173*c2f7c0c3SShannon Zhao struct AcpiGenericAddress xpm1b_event_block; 174*c2f7c0c3SShannon Zhao /* 64-bit Extended Power Mgt 1a Control Reg Blk address */ 175*c2f7c0c3SShannon Zhao struct AcpiGenericAddress xpm1a_control_block; 176*c2f7c0c3SShannon Zhao /* 64-bit Extended Power Mgt 1b Control Reg Blk address */ 177*c2f7c0c3SShannon Zhao struct AcpiGenericAddress xpm1b_control_block; 178*c2f7c0c3SShannon Zhao /* 64-bit Extended Power Mgt 2 Control Reg Blk address */ 179*c2f7c0c3SShannon Zhao struct AcpiGenericAddress xpm2_control_block; 180*c2f7c0c3SShannon Zhao /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ 181*c2f7c0c3SShannon Zhao struct AcpiGenericAddress xpm_timer_block; 182*c2f7c0c3SShannon Zhao /* 64-bit Extended General Purpose Event 0 Reg Blk address */ 183*c2f7c0c3SShannon Zhao struct AcpiGenericAddress xgpe0_block; 184*c2f7c0c3SShannon Zhao /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 185*c2f7c0c3SShannon Zhao struct AcpiGenericAddress xgpe1_block; 186*c2f7c0c3SShannon Zhao /* 64-bit Sleep Control register (ACPI 5.0) */ 187*c2f7c0c3SShannon Zhao struct AcpiGenericAddress sleep_control; 188*c2f7c0c3SShannon Zhao /* 64-bit Sleep Status register (ACPI 5.0) */ 189*c2f7c0c3SShannon Zhao struct AcpiGenericAddress sleep_status; 190*c2f7c0c3SShannon Zhao } QEMU_PACKED; 191*c2f7c0c3SShannon Zhao 192*c2f7c0c3SShannon Zhao typedef struct AcpiFadtDescriptorRev5_1 AcpiFadtDescriptorRev5_1; 193*c2f7c0c3SShannon Zhao 194*c2f7c0c3SShannon Zhao enum { 195*c2f7c0c3SShannon Zhao ACPI_FADT_ARM_USE_PSCI_G_0_2 = 0, 196*c2f7c0c3SShannon Zhao ACPI_FADT_ARM_PSCI_USE_HVC = 1, 197*c2f7c0c3SShannon Zhao }; 198*c2f7c0c3SShannon Zhao 19972c194f7SMichael S. Tsirkin /* 20072c194f7SMichael S. Tsirkin * ACPI 1.0 Root System Description Table (RSDT) 20172c194f7SMichael S. Tsirkin */ 20272c194f7SMichael S. Tsirkin struct AcpiRsdtDescriptorRev1 20372c194f7SMichael S. Tsirkin { 20472c194f7SMichael S. Tsirkin ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 20572c194f7SMichael S. Tsirkin uint32_t table_offset_entry[0]; /* Array of pointers to other */ 20672c194f7SMichael S. Tsirkin /* ACPI tables */ 20772c194f7SMichael S. Tsirkin } QEMU_PACKED; 20872c194f7SMichael S. Tsirkin typedef struct AcpiRsdtDescriptorRev1 AcpiRsdtDescriptorRev1; 20972c194f7SMichael S. Tsirkin 21072c194f7SMichael S. Tsirkin /* 21172c194f7SMichael S. Tsirkin * ACPI 1.0 Firmware ACPI Control Structure (FACS) 21272c194f7SMichael S. Tsirkin */ 21372c194f7SMichael S. Tsirkin struct AcpiFacsDescriptorRev1 21472c194f7SMichael S. Tsirkin { 21572c194f7SMichael S. Tsirkin uint32_t signature; /* ACPI Signature */ 21672c194f7SMichael S. Tsirkin uint32_t length; /* Length of structure, in bytes */ 21772c194f7SMichael S. Tsirkin uint32_t hardware_signature; /* Hardware configuration signature */ 21872c194f7SMichael S. Tsirkin uint32_t firmware_waking_vector; /* ACPI OS waking vector */ 21972c194f7SMichael S. Tsirkin uint32_t global_lock; /* Global Lock */ 22072c194f7SMichael S. Tsirkin uint32_t flags; 22172c194f7SMichael S. Tsirkin uint8_t resverved3 [40]; /* Reserved - must be zero */ 22272c194f7SMichael S. Tsirkin } QEMU_PACKED; 22372c194f7SMichael S. Tsirkin typedef struct AcpiFacsDescriptorRev1 AcpiFacsDescriptorRev1; 22472c194f7SMichael S. Tsirkin 22572c194f7SMichael S. Tsirkin /* 22672c194f7SMichael S. Tsirkin * Differentiated System Description Table (DSDT) 22772c194f7SMichael S. Tsirkin */ 22872c194f7SMichael S. Tsirkin 22972c194f7SMichael S. Tsirkin /* 23072c194f7SMichael S. Tsirkin * MADT values and structures 23172c194f7SMichael S. Tsirkin */ 23272c194f7SMichael S. Tsirkin 23372c194f7SMichael S. Tsirkin /* Values for MADT PCATCompat */ 23472c194f7SMichael S. Tsirkin 23572c194f7SMichael S. Tsirkin #define ACPI_DUAL_PIC 0 23672c194f7SMichael S. Tsirkin #define ACPI_MULTIPLE_APIC 1 23772c194f7SMichael S. Tsirkin 23872c194f7SMichael S. Tsirkin /* Master MADT */ 23972c194f7SMichael S. Tsirkin 24072c194f7SMichael S. Tsirkin struct AcpiMultipleApicTable 24172c194f7SMichael S. Tsirkin { 24272c194f7SMichael S. Tsirkin ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 24372c194f7SMichael S. Tsirkin uint32_t local_apic_address; /* Physical address of local APIC */ 24472c194f7SMichael S. Tsirkin uint32_t flags; 24572c194f7SMichael S. Tsirkin } QEMU_PACKED; 24672c194f7SMichael S. Tsirkin typedef struct AcpiMultipleApicTable AcpiMultipleApicTable; 24772c194f7SMichael S. Tsirkin 24872c194f7SMichael S. Tsirkin /* Values for Type in APIC sub-headers */ 24972c194f7SMichael S. Tsirkin 25072c194f7SMichael S. Tsirkin #define ACPI_APIC_PROCESSOR 0 25172c194f7SMichael S. Tsirkin #define ACPI_APIC_IO 1 25272c194f7SMichael S. Tsirkin #define ACPI_APIC_XRUPT_OVERRIDE 2 25372c194f7SMichael S. Tsirkin #define ACPI_APIC_NMI 3 25472c194f7SMichael S. Tsirkin #define ACPI_APIC_LOCAL_NMI 4 25572c194f7SMichael S. Tsirkin #define ACPI_APIC_ADDRESS_OVERRIDE 5 25672c194f7SMichael S. Tsirkin #define ACPI_APIC_IO_SAPIC 6 25772c194f7SMichael S. Tsirkin #define ACPI_APIC_LOCAL_SAPIC 7 25872c194f7SMichael S. Tsirkin #define ACPI_APIC_XRUPT_SOURCE 8 25972c194f7SMichael S. Tsirkin #define ACPI_APIC_RESERVED 9 /* 9 and greater are reserved */ 26072c194f7SMichael S. Tsirkin 26172c194f7SMichael S. Tsirkin /* 26272c194f7SMichael S. Tsirkin * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) 26372c194f7SMichael S. Tsirkin */ 26472c194f7SMichael S. Tsirkin #define ACPI_SUB_HEADER_DEF /* Common ACPI sub-structure header */\ 26572c194f7SMichael S. Tsirkin uint8_t type; \ 26672c194f7SMichael S. Tsirkin uint8_t length; 26772c194f7SMichael S. Tsirkin 26872c194f7SMichael S. Tsirkin /* Sub-structures for MADT */ 26972c194f7SMichael S. Tsirkin 27072c194f7SMichael S. Tsirkin struct AcpiMadtProcessorApic 27172c194f7SMichael S. Tsirkin { 27272c194f7SMichael S. Tsirkin ACPI_SUB_HEADER_DEF 27372c194f7SMichael S. Tsirkin uint8_t processor_id; /* ACPI processor id */ 27472c194f7SMichael S. Tsirkin uint8_t local_apic_id; /* Processor's local APIC id */ 27572c194f7SMichael S. Tsirkin uint32_t flags; 27672c194f7SMichael S. Tsirkin } QEMU_PACKED; 27772c194f7SMichael S. Tsirkin typedef struct AcpiMadtProcessorApic AcpiMadtProcessorApic; 27872c194f7SMichael S. Tsirkin 27972c194f7SMichael S. Tsirkin struct AcpiMadtIoApic 28072c194f7SMichael S. Tsirkin { 28172c194f7SMichael S. Tsirkin ACPI_SUB_HEADER_DEF 28272c194f7SMichael S. Tsirkin uint8_t io_apic_id; /* I/O APIC ID */ 28372c194f7SMichael S. Tsirkin uint8_t reserved; /* Reserved - must be zero */ 28472c194f7SMichael S. Tsirkin uint32_t address; /* APIC physical address */ 28572c194f7SMichael S. Tsirkin uint32_t interrupt; /* Global system interrupt where INTI 28672c194f7SMichael S. Tsirkin * lines start */ 28772c194f7SMichael S. Tsirkin } QEMU_PACKED; 28872c194f7SMichael S. Tsirkin typedef struct AcpiMadtIoApic AcpiMadtIoApic; 28972c194f7SMichael S. Tsirkin 29072c194f7SMichael S. Tsirkin struct AcpiMadtIntsrcovr { 29172c194f7SMichael S. Tsirkin ACPI_SUB_HEADER_DEF 29272c194f7SMichael S. Tsirkin uint8_t bus; 29372c194f7SMichael S. Tsirkin uint8_t source; 29472c194f7SMichael S. Tsirkin uint32_t gsi; 29572c194f7SMichael S. Tsirkin uint16_t flags; 29672c194f7SMichael S. Tsirkin } QEMU_PACKED; 29772c194f7SMichael S. Tsirkin typedef struct AcpiMadtIntsrcovr AcpiMadtIntsrcovr; 29872c194f7SMichael S. Tsirkin 29972c194f7SMichael S. Tsirkin struct AcpiMadtLocalNmi { 30072c194f7SMichael S. Tsirkin ACPI_SUB_HEADER_DEF 30172c194f7SMichael S. Tsirkin uint8_t processor_id; /* ACPI processor id */ 30272c194f7SMichael S. Tsirkin uint16_t flags; /* MPS INTI flags */ 30372c194f7SMichael S. Tsirkin uint8_t lint; /* Local APIC LINT# */ 30472c194f7SMichael S. Tsirkin } QEMU_PACKED; 30572c194f7SMichael S. Tsirkin typedef struct AcpiMadtLocalNmi AcpiMadtLocalNmi; 30672c194f7SMichael S. Tsirkin 30772c194f7SMichael S. Tsirkin /* 30872c194f7SMichael S. Tsirkin * HPET Description Table 30972c194f7SMichael S. Tsirkin */ 31072c194f7SMichael S. Tsirkin struct Acpi20Hpet { 31172c194f7SMichael S. Tsirkin ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 31272c194f7SMichael S. Tsirkin uint32_t timer_block_id; 31372c194f7SMichael S. Tsirkin Acpi20GenericAddress addr; 31472c194f7SMichael S. Tsirkin uint8_t hpet_number; 31572c194f7SMichael S. Tsirkin uint16_t min_tick; 31672c194f7SMichael S. Tsirkin uint8_t page_protect; 31772c194f7SMichael S. Tsirkin } QEMU_PACKED; 31872c194f7SMichael S. Tsirkin typedef struct Acpi20Hpet Acpi20Hpet; 31972c194f7SMichael S. Tsirkin 32072c194f7SMichael S. Tsirkin /* 32172c194f7SMichael S. Tsirkin * SRAT (NUMA topology description) table 32272c194f7SMichael S. Tsirkin */ 32372c194f7SMichael S. Tsirkin 32472c194f7SMichael S. Tsirkin struct AcpiSystemResourceAffinityTable 32572c194f7SMichael S. Tsirkin { 32672c194f7SMichael S. Tsirkin ACPI_TABLE_HEADER_DEF 32772c194f7SMichael S. Tsirkin uint32_t reserved1; 32872c194f7SMichael S. Tsirkin uint32_t reserved2[2]; 32972c194f7SMichael S. Tsirkin } QEMU_PACKED; 33072c194f7SMichael S. Tsirkin typedef struct AcpiSystemResourceAffinityTable AcpiSystemResourceAffinityTable; 33172c194f7SMichael S. Tsirkin 33272c194f7SMichael S. Tsirkin #define ACPI_SRAT_PROCESSOR 0 33372c194f7SMichael S. Tsirkin #define ACPI_SRAT_MEMORY 1 33472c194f7SMichael S. Tsirkin 33572c194f7SMichael S. Tsirkin struct AcpiSratProcessorAffinity 33672c194f7SMichael S. Tsirkin { 33772c194f7SMichael S. Tsirkin ACPI_SUB_HEADER_DEF 33872c194f7SMichael S. Tsirkin uint8_t proximity_lo; 33972c194f7SMichael S. Tsirkin uint8_t local_apic_id; 34072c194f7SMichael S. Tsirkin uint32_t flags; 34172c194f7SMichael S. Tsirkin uint8_t local_sapic_eid; 34272c194f7SMichael S. Tsirkin uint8_t proximity_hi[3]; 34372c194f7SMichael S. Tsirkin uint32_t reserved; 34472c194f7SMichael S. Tsirkin } QEMU_PACKED; 34572c194f7SMichael S. Tsirkin typedef struct AcpiSratProcessorAffinity AcpiSratProcessorAffinity; 34672c194f7SMichael S. Tsirkin 34772c194f7SMichael S. Tsirkin struct AcpiSratMemoryAffinity 34872c194f7SMichael S. Tsirkin { 34972c194f7SMichael S. Tsirkin ACPI_SUB_HEADER_DEF 35072c194f7SMichael S. Tsirkin uint8_t proximity[4]; 35172c194f7SMichael S. Tsirkin uint16_t reserved1; 35272c194f7SMichael S. Tsirkin uint64_t base_addr; 35372c194f7SMichael S. Tsirkin uint64_t range_length; 35472c194f7SMichael S. Tsirkin uint32_t reserved2; 35572c194f7SMichael S. Tsirkin uint32_t flags; 35672c194f7SMichael S. Tsirkin uint32_t reserved3[2]; 35772c194f7SMichael S. Tsirkin } QEMU_PACKED; 35872c194f7SMichael S. Tsirkin typedef struct AcpiSratMemoryAffinity AcpiSratMemoryAffinity; 35972c194f7SMichael S. Tsirkin 36072c194f7SMichael S. Tsirkin /* PCI fw r3.0 MCFG table. */ 36172c194f7SMichael S. Tsirkin /* Subtable */ 36272c194f7SMichael S. Tsirkin struct AcpiMcfgAllocation { 36372c194f7SMichael S. Tsirkin uint64_t address; /* Base address, processor-relative */ 36472c194f7SMichael S. Tsirkin uint16_t pci_segment; /* PCI segment group number */ 36572c194f7SMichael S. Tsirkin uint8_t start_bus_number; /* Starting PCI Bus number */ 36672c194f7SMichael S. Tsirkin uint8_t end_bus_number; /* Final PCI Bus number */ 36772c194f7SMichael S. Tsirkin uint32_t reserved; 36872c194f7SMichael S. Tsirkin } QEMU_PACKED; 36972c194f7SMichael S. Tsirkin typedef struct AcpiMcfgAllocation AcpiMcfgAllocation; 37072c194f7SMichael S. Tsirkin 37172c194f7SMichael S. Tsirkin struct AcpiTableMcfg { 37272c194f7SMichael S. Tsirkin ACPI_TABLE_HEADER_DEF; 37372c194f7SMichael S. Tsirkin uint8_t reserved[8]; 37472c194f7SMichael S. Tsirkin AcpiMcfgAllocation allocation[0]; 37572c194f7SMichael S. Tsirkin } QEMU_PACKED; 37672c194f7SMichael S. Tsirkin typedef struct AcpiTableMcfg AcpiTableMcfg; 37772c194f7SMichael S. Tsirkin 378711b20b4SStefan Berger /* 379711b20b4SStefan Berger * TCPA Description Table 380711b20b4SStefan Berger */ 381711b20b4SStefan Berger struct Acpi20Tcpa { 382711b20b4SStefan Berger ACPI_TABLE_HEADER_DEF /* ACPI common table header */ 383711b20b4SStefan Berger uint16_t platform_class; 384711b20b4SStefan Berger uint32_t log_area_minimum_length; 385711b20b4SStefan Berger uint64_t log_area_start_address; 386711b20b4SStefan Berger } QEMU_PACKED; 387711b20b4SStefan Berger typedef struct Acpi20Tcpa Acpi20Tcpa; 388711b20b4SStefan Berger 389d4eb9119SLe Tan /* DMAR - DMA Remapping table r2.2 */ 390d4eb9119SLe Tan struct AcpiTableDmar { 391d4eb9119SLe Tan ACPI_TABLE_HEADER_DEF 392d4eb9119SLe Tan uint8_t host_address_width; /* Maximum DMA physical addressability */ 393d4eb9119SLe Tan uint8_t flags; 394d4eb9119SLe Tan uint8_t reserved[10]; 395d4eb9119SLe Tan } QEMU_PACKED; 396d4eb9119SLe Tan typedef struct AcpiTableDmar AcpiTableDmar; 397d4eb9119SLe Tan 398d4eb9119SLe Tan /* Masks for Flags field above */ 399d4eb9119SLe Tan #define ACPI_DMAR_INTR_REMAP 1 400d4eb9119SLe Tan #define ACPI_DMAR_X2APIC_OPT_OUT (1 << 1) 401d4eb9119SLe Tan 402d4eb9119SLe Tan /* Values for sub-structure type for DMAR */ 403d4eb9119SLe Tan enum { 404d4eb9119SLe Tan ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, /* DRHD */ 405d4eb9119SLe Tan ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, /* RMRR */ 406d4eb9119SLe Tan ACPI_DMAR_TYPE_ATSR = 2, /* ATSR */ 407d4eb9119SLe Tan ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, /* RHSR */ 408d4eb9119SLe Tan ACPI_DMAR_TYPE_ANDD = 4, /* ANDD */ 409d4eb9119SLe Tan ACPI_DMAR_TYPE_RESERVED = 5 /* Reserved for furture use */ 410d4eb9119SLe Tan }; 411d4eb9119SLe Tan 412d4eb9119SLe Tan /* 413d4eb9119SLe Tan * Sub-structures for DMAR 414d4eb9119SLe Tan */ 415d4eb9119SLe Tan /* Type 0: Hardware Unit Definition */ 416d4eb9119SLe Tan struct AcpiDmarHardwareUnit { 417d4eb9119SLe Tan uint16_t type; 418d4eb9119SLe Tan uint16_t length; 419d4eb9119SLe Tan uint8_t flags; 420d4eb9119SLe Tan uint8_t reserved; 421d4eb9119SLe Tan uint16_t pci_segment; /* The PCI Segment associated with this unit */ 422d4eb9119SLe Tan uint64_t address; /* Base address of remapping hardware register-set */ 423d4eb9119SLe Tan } QEMU_PACKED; 424d4eb9119SLe Tan typedef struct AcpiDmarHardwareUnit AcpiDmarHardwareUnit; 425d4eb9119SLe Tan 426d4eb9119SLe Tan /* Masks for Flags field above */ 427d4eb9119SLe Tan #define ACPI_DMAR_INCLUDE_PCI_ALL 1 428d4eb9119SLe Tan 42972c194f7SMichael S. Tsirkin #endif 430