apic: Added madt entry struct types
This also moves madt parsing to apic.c
This commit is contained in:
parent
6627486995
commit
57ed3eefe6
6 changed files with 130 additions and 41 deletions
26
init/acpi.c
26
init/acpi.c
|
|
@ -1,4 +1,6 @@
|
|||
#include <kernel/acpi.h>
|
||||
#include <dev/apic.h>
|
||||
|
||||
#include <limine/limine.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -10,13 +12,6 @@ struct limine_rsdp_request rsdp_req = { .id = LIMINE_RSDP_REQUEST,
|
|||
static struct rsdp *rsdp = NULL;
|
||||
struct madt *__madt = NULL;
|
||||
|
||||
static const char *madt_entry_types[] = {
|
||||
"LAPIC", "IOAPIC", "IOAPIC_IRQ_SRC_OVRD",
|
||||
"IOAPIC_NMI_SRC", "LAPIC_NMI", "LAPIC_ADDR_OVRD",
|
||||
"INVALID", "INVALID", "INVALID",
|
||||
"CPU_LOCAL_X2-APIC"
|
||||
};
|
||||
|
||||
void rsdt_print(struct rsdt *rsdt)
|
||||
{
|
||||
int num_sdt = (rsdt->h.length - sizeof(rsdt->h)) / 4;
|
||||
|
|
@ -37,23 +32,6 @@ void rsdt_print(struct rsdt *rsdt)
|
|||
}
|
||||
}
|
||||
|
||||
int madt_parse_next_entry(int offset)
|
||||
{
|
||||
if ((unsigned)offset >= (__madt->h.length - 1))
|
||||
return 0;
|
||||
|
||||
static int n = 0; /* Entry number */
|
||||
|
||||
uint8_t *madt = (uint8_t *)__madt;
|
||||
int type = madt[offset];
|
||||
int len = madt[offset + 1];
|
||||
|
||||
printf("MADT Entry %d: %s\n", n, madt_entry_types[type]);
|
||||
|
||||
n++;
|
||||
return offset + len;
|
||||
}
|
||||
|
||||
void acpi_init()
|
||||
{
|
||||
rsdp = (struct rsdp *)rsdp_req.response->address;
|
||||
|
|
|
|||
Loading…
Reference in a new issue