#include <hal/acpi/acpi.h>
-#include <lunaix/device.h>
+#include <lunaix/owloysius.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/spike.h>
#include <lunaix/syslog.h>
}
static int
-acpi_init(struct device_def* devdef)
+__gather_acpi_table()
{
acpi_rsdp_t* rsdp = acpi_locate_rsdp();
size_t entry_n = (rsdt->header.length - sizeof(acpi_sdthdr_t)) >> 2;
for (size_t i = 0; i < entry_n; i++) {
- acpi_sdthdr_t* sdthdr =
- (acpi_sdthdr_t*)((acpi_apic_t**)&(rsdt->entry))[i];
+ acpi_sdthdr_t* sdthdr = __acpi_sdthdr(rsdt->entry[i]);
switch (sdthdr->signature) {
case ACPI_MADT_SIG:
- madt_parse((acpi_madt_t*)sdthdr, ctx);
+ madt_parse(__acpi_madt(sdthdr), ctx);
break;
case ACPI_FADT_SIG:
// FADT just a plain structure, no need to parse.
- ctx->fadt = *(acpi_fadt_t*)sdthdr;
+ ctx->fadt = *__acpi_fadt(sdthdr);
break;
case ACPI_MCFG_SIG:
mcfg_parse(sdthdr, ctx);
return 0;
}
-struct device_def acpi_sysdev = { .name = "ACPI Proxy",
- .class =
- DEVCLASS(DEVIF_FMW, DEVFN_CFG, DEV_ACPI),
- .init = acpi_init };
-EXPORT_DEVICE(acpi, &acpi_sysdev, load_sysconf);
\ No newline at end of file
+owloysius_fetch_init(__gather_acpi_table, on_sysconf);
\ No newline at end of file