// SPDX-License-Identifier: MPL-2.0 #ifndef SH_LIB_ACPI_MADT_H #define SH_LIB_ACPI_MADT_H #include "std/stdlib.h" // MADT header structure typedef struct { char signature[4]; sh_uint32 length; sh_uint8 revision; sh_uint8 checksum; char oem_id[6]; char oem_table_id[8]; sh_uint32 oem_revision; sh_uint32 creator_id; sh_uint32 creator_revision; } sh_acpi_madt_TABLE_HEADER; // MADT structure typedef struct { sh_acpi_madt_TABLE_HEADER header; sh_uint32 local_apic_address; sh_uint32 flags; } sh_acpi_madt_MADT; // MADT entry header structure typedef struct { sh_uint8 type; sh_uint8 length; } sh_acpi_madt_ENTRY_HEADER; // Local APIC structure typedef struct { sh_acpi_madt_ENTRY_HEADER header; sh_uint8 acpi_processor_id; sh_uint8 apic_id; sh_uint32 flags; } sh_acpi_madt_LAPIC; // IO APIC structure typedef struct { sh_acpi_madt_ENTRY_HEADER header; sh_uint8 ioapic_id; sh_uint8 reserved; sh_uint32 ioapic_address; sh_uint32 global_system_interrupt_base; } sh_acpi_madt_IOAPIC; // Interrupt source override structure typedef struct { sh_acpi_madt_ENTRY_HEADER header; sh_uint8 bus; sh_uint8 source; sh_uint32 gsi; sh_uint16 flags; } sh_acpi_madt_ISO; // Parse MADT table SH_STATUS sh_acpi_madt_parse(sh_uint64 madt_ptr); #endif