* Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved.
* Copyright 2007, Michael Lotz, mmlr@mlotz.ch. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_x86_ARCH_ACPI_H
#define _KERNEL_ARCH_x86_ARCH_ACPI_H
#define ACPI_RSDP_SIGNATURE "RSD PTR "
#define ACPI_RSDT_SIGNATURE "RSDT"
#define ACPI_XSDT_SIGNATURE "XSDT"
#define ACPI_MADT_SIGNATURE "APIC"
#define ACPI_LOCAL_APIC_ENABLED 0x01
typedef struct acpi_rsdp_legacy {
char signature[8];
uint8 checksum;
char oem_id[6];
uint8 revision;
uint32 rsdt_address;
} _PACKED acpi_rsdp_legacy;
typedef struct acpi_rsdp_extended {
char signature[8];
uint8 checksum;
char oem_id[6];
uint8 revision;
uint32 rsdt_address;
uint32 xsdt_length;
uint64 xsdt_address;
uint8 extended_checksum;
uint8 reserved[3];
} _PACKED acpi_rsdp_extended;
typedef acpi_rsdp_extended acpi_rsdp;
typedef struct acpi_descriptor_header {
char signature[4];
uint32 length;
uint8 revision;
uint8 checksum;
char oem_id[6];
char oem_table_id[8];
uint32 oem_revision;
char creator_id[4];
uint32 creator_revision;
} _PACKED acpi_descriptor_header;
typedef struct acpi_madt {
acpi_descriptor_header header;
uint32 local_apic_address;
uint32 flags;
} _PACKED acpi_madt;
enum {
ACPI_MADT_LOCAL_APIC = 0,
ACPI_MADT_IO_APIC = 1,
ACPI_MADT_INTERRUPT_SOURCE_OVERRIDE = 2,
ACPI_MADT_NMI_SOURCE = 3,
ACPI_MADT_LOCAL_APIC_NMI = 4,
ACPI_MADT_LOCAL_APIC_ADDRESS_OVERRIDE = 5,
ACPI_MADT_IO_SAPIC = 6,
ACPI_MADT_LOCAL_SAPIC = 7,
ACPI_MADT_PLATFORM_INTERRUPT_SOURCE = 8,
ACPI_MADT_PROCESSOR_LOCAL_X2_APIC_NMI = 9,
ACPI_MADT_LOCAL_X2_APIC_NMI = 0XA
};
typedef struct acpi_apic {
uint8 type;
uint8 length;
} _PACKED acpi_apic;
typedef struct acpi_local_apic {
uint8 type;
uint8 length;
uint8 acpi_processor_id;
uint8 apic_id;
uint32 flags;
} _PACKED acpi_local_apic;
typedef struct acpi_io_apic {
uint8 type;
uint8 length;
uint8 io_apic_id;
uint8 reserved;
uint32 io_apic_address;
uint32 interrupt_base;
} _PACKED acpi_io_apic;
typedef struct acpi_int_source_override {
uint8 type;
uint8 length;
uint8 bus;
uint8 source;
uint32 interrupt;
bus-relative source int will signal */
uint16 flags;
ACPI Spec 4.0a or similar */
} _PACKED acpi_int_source_override;
typedef struct acpi_nmi_source {
uint8 type;
uint8 length;
uint16 flags;
ACPI Spec 4.0a or similar */
uint32 interrupt;
non-maskable interrupt will trigger */
} _PACKED acpi_nmi_source;
typedef struct acpi_local_apic_nmi {
uint8 type;
uint8 length;
uint8 acpi_processor_id;
ID in acpi_local_apic. 0xFF means
it applies to all processors */
uint16 flags;
ACPI Spec 4.0a or similar */
uint8 local_interrupt;
NMI is connected */
} _PACKED acpi_local_apic_nmi;
typedef struct acpi_local_apic_address_override {
uint8 type;
uint8 length;
uint16 reserved;
uint64 local_apic_address;
5-28 in ACPI Spec 4.0a for more */
} _PACKED acpi_local_apic_address_override;
typedef struct acpi_io_sapic {
uint8 type;
exists instead of I/O APIC if both exists
for a APIC ID.*/
uint8 length;
uint8 io_apic_id;
uint8 reserved;
uint32 interrupt_base;
uint64 sapic_address;
SAPIC. Each SAPIC resides at a unique
address */
} _PACKED acpi_io_sapic;
typedef struct acpi_local_sapic {
uint8 type;
uint8 length;
uint8 acpi_processor_id;
uint8 local_sapic_id;
uint8 local_sapic_eid;
uint8 reserved1;
uint8 reserved2;
uint8 reserved3;
uint32 flags;
ACPI Spec 4.0a */
uint32 processor_uid_nr;
number */
char processor_uid_str[];
string. Null-terminated */
} _PACKED acpi_local_sapic;
typedef struct acpi_platform_interrupt_source {
uint8 type;
uint8 length;
uint16 flags;
ACPI Spec 4.0a or similar */
uint8 interrupt_type;
Error Interrupt */
uint8 processor_id;
uint8 processor_eid;
uint8 io_sapic_vector;
vector field of the I/O SAPIC redirection
entry for entries with PMI type. */
uint32 interrupt;
platform interrupt will trigger */
uint32 platform_int_flags;
Table 5-32 of ACPI Spec 4.0a for desc */
} _PACKED acpi_platform_interrupt_source;
typedef struct acpi_local_x2_apic {
uint8 type;
uint8 length;
uint16 reserved;
uint32 x2apic_id;
uint32 flags;
uint32 processor_uid_nr;
number */
} _PACKED acpi_local_x2_apic;
typedef struct acpi_local_x2_apic_nmi {
uint8 type;
uint8 length;
uint16 flags;
ACPI Spec 4.0a or similar */
uint32 acpi_processor_uid;
device object. 0xFFFFFFFF means
it applies to all processors */
uint8 local_interrupt;
which NMI is connected */
uint8 reserved1;
uint8 reserved2;
uint8 reserved3;
} _PACKED acpi_local_x2_apic_nmi;
#endif