fix/kernel: Fixed MADT tables to use
acpi_madt_entry_t header;
This commit is contained in:
parent
09de945b15
commit
1f70ada525
3 changed files with 20 additions and 16 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <flanterm/backends/fb.h>
|
||||
#endif // FLANTERM_SUPPORT
|
||||
#include <sys/acpi.h>
|
||||
#include <sys/acpi/madt.h>
|
||||
|
||||
__attribute__((used, section(".limine_requests"))) static volatile LIMINE_BASE_REVISION(3);
|
||||
__attribute__((used, section(".limine_requests"))) static volatile struct limine_memmap_request memmap_request = {
|
||||
|
@ -37,6 +38,9 @@ __attribute__((used, section(".limine_requests"))) volatile struct limine_frameb
|
|||
__attribute__((used, section(".limine_requests"))) static volatile struct limine_rsdp_request rsdp_request = {
|
||||
.revision = 0,
|
||||
.id = LIMINE_RSDP_REQUEST};
|
||||
__attribute__((used, section(".limine_requests"))) static volatile struct limine_mp_request mp_request = {
|
||||
.revision = 0,
|
||||
.id = LIMINE_MP_REQUEST};
|
||||
__attribute__((used, section(".limine_requests_start"))) static volatile LIMINE_REQUESTS_START_MARKER;
|
||||
__attribute__((used, section(".limine_requests_end"))) static volatile LIMINE_REQUESTS_END_MARKER;
|
||||
|
||||
|
@ -171,7 +175,7 @@ void emk_entry(void)
|
|||
acpi_init();
|
||||
log_early("Initialized ACPI");
|
||||
|
||||
void *madt = acpi_find_table("APIC");
|
||||
acpi_madt_t *madt = (acpi_madt_t *)acpi_find_table("APIC");
|
||||
if (!madt)
|
||||
{
|
||||
kpanic(NULL, "Failed to find MADT table");
|
||||
|
@ -179,5 +183,12 @@ void emk_entry(void)
|
|||
|
||||
log_early("Found MADT at %p", madt);
|
||||
|
||||
if (!mp_request.response)
|
||||
{
|
||||
kpanic(NULL, "Failed to get MP request");
|
||||
}
|
||||
|
||||
log_early("%d available cores", mp_request.response->cpu_count);
|
||||
|
||||
hlt();
|
||||
}
|
|
@ -30,8 +30,7 @@ typedef struct acpi_madt_entry
|
|||
/* Entry Type 0: Processor Local APIC */
|
||||
typedef struct acpi_madt_lapic
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
acpi_madt_entry_t header;
|
||||
uint8_t acpi_proc_id; /* ACPI Processor ID */
|
||||
uint8_t apic_id; /* APIC ID */
|
||||
uint32_t flags; /* Bit 0: Processor Enabled, Bit 1: Online Capable */
|
||||
|
@ -40,8 +39,7 @@ typedef struct acpi_madt_lapic
|
|||
/* Entry Type 1: I/O APIC */
|
||||
typedef struct acpi_madt_ioapic
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
acpi_madt_entry_t header;
|
||||
uint8_t ioapic_id; /* I/O APIC's ID */
|
||||
uint8_t reserved; /* Reserved (0) */
|
||||
uint32_t ioapic_addr; /* I/O APIC Address */
|
||||
|
@ -51,8 +49,7 @@ typedef struct acpi_madt_ioapic
|
|||
/* Entry Type 2: I/O APIC Interrupt Source Override */
|
||||
typedef struct acpi_madt_ioapic_src_ovr
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
acpi_madt_entry_t header;
|
||||
uint8_t bus_source; /* Bus Source */
|
||||
uint8_t irq_source; /* IRQ Source */
|
||||
uint32_t gsi; /* Global System Interrupt */
|
||||
|
@ -62,8 +59,7 @@ typedef struct acpi_madt_ioapic_src_ovr
|
|||
/* Entry Type 3: I/O APIC Non-Maskable Interrupt Source */
|
||||
typedef struct acpi_madt_ioapic_nmi_src
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
acpi_madt_entry_t header;
|
||||
uint8_t nmi_source; /* NMI Source */
|
||||
uint8_t reserved; /* Reserved */
|
||||
uint16_t flags; /* Flags */
|
||||
|
@ -73,8 +69,7 @@ typedef struct acpi_madt_ioapic_nmi_src
|
|||
/* Entry Type 4: Local APIC Non-Maskable Interrupt */
|
||||
typedef struct acpi_madt_lapic_nmi
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
acpi_madt_entry_t header;
|
||||
uint8_t acpi_proc_id; /* ACPI Processor ID (0xFF for all processors) */
|
||||
uint16_t flags; /* Flags */
|
||||
uint8_t lint; /* LINT# (0 or 1) */
|
||||
|
@ -83,8 +78,7 @@ typedef struct acpi_madt_lapic_nmi
|
|||
/* Entry Type 5: Local APIC Address Override */
|
||||
typedef struct acpi_madt_lapic_addr_ovr
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
acpi_madt_entry_t header;
|
||||
uint16_t reserved; /* Reserved */
|
||||
uint64_t lapic_addr; /* 64-bit Physical Address of Local APIC */
|
||||
} __attribute__((packed)) acpi_madt_lapic_addr_ovr_t;
|
||||
|
@ -92,8 +86,7 @@ typedef struct acpi_madt_lapic_addr_ovr
|
|||
/* Entry Type 9: Processor Local x2APIC */
|
||||
typedef struct acpi_madt_lx2apic
|
||||
{
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
acpi_madt_entry_t header;
|
||||
uint16_t reserved;
|
||||
uint32_t x2apic_id; /* Processor's Local x2APIC ID */
|
||||
uint32_t flags; /* Flags (same as Local APIC) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue