diff --git a/kaleid/kernel/io/acpi.c b/kaleid/kernel/io/acpi.c index cb5c74a..424eda0 100644 --- a/kaleid/kernel/io/acpi.c +++ b/kaleid/kernel/io/acpi.c @@ -175,29 +175,41 @@ static inline void IoInitRXSDT(void) static inline void IoSearchAcpiTables(void) { SDTHeader *xrsdt = AcpiSDT; - SDTHeader *cur = NULL; SDTHeader *table = NULL; + uint *curInt = NULL; + ulong *curLong = NULL; register char checksum; int entries; - if (IoACPIVersion == 1) + if (IoACPIVersion == 1) { entries = (xrsdt->length - sizeof(xrsdt)) / 4; - else + } else { entries = (xrsdt->length - sizeof(xrsdt)) / 8; + } KernLog("\tACPI detected %d entries\n", entries); + curInt = &(xrsdt->sdtTablePtr); + curLong = &(xrsdt->sdtTablePtr); + for (int i = 0; i < entries; i++) { - cur = (SDTHeader *)((ulong)(xrsdt->sdtTablePtr)); - table = &cur[i]; + if (IoACPIVersion == 1) + table = (SDTHeader *)curInt[i]; + else + table = (SDTHeader *)curLong[i]; - // Checksum calculation - //checksum = DoChecksum(table, (size_t)table->length, 0, 0); - - //KernLog("Checksum : %d\n", (int)checksum); - - KernLog("\tACPI System Table id %s [%p]\n", table->signature, table); + //KernLog("\tACPI RSDT[%d] %p\n", i, table); + if (MmIsBusyZone(table)) { + checksum = DoChecksum(table, (size_t)table->length, 0, 0); + if (!checksum) { + KernLog("\tACPI System Table %s (OEM %s) length %d [%p]\n", + table->signature, + table->OEMID, + table->length, + table); + } + } } }