X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/2236410f4582ab45ae8c384dd6eeeef5d10aab15..d15268ba6eadf89a38087995ff407f50418485fb:/lunaix-os/hal/acpi/acpi.c diff --git a/lunaix-os/hal/acpi/acpi.c b/lunaix-os/hal/acpi/acpi.c index 5732ec8..b4faf63 100644 --- a/lunaix-os/hal/acpi/acpi.c +++ b/lunaix-os/hal/acpi/acpi.c @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include @@ -68,7 +68,7 @@ acpi_locate_rsdp() } static int -acpi_init(struct device_def* devdef) +__gather_acpi_table() { acpi_rsdp_t* rsdp = acpi_locate_rsdp(); @@ -85,15 +85,14 @@ acpi_init(struct device_def* devdef) 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); @@ -106,8 +105,4 @@ acpi_init(struct device_def* devdef) 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