Fix FindTable method to work properly with RSDT instead of XSDT
This commit is contained in:
parent
f7f8c1068a
commit
5b132e3197
@ -12,18 +12,18 @@ ACPI::SDTHeader* ACPI::GetRSDTOrXSDT()
|
|||||||
|
|
||||||
void* ACPI::FindTable(ACPI::SDTHeader* rootSDT, const char* signature)
|
void* ACPI::FindTable(ACPI::SDTHeader* rootSDT, const char* signature)
|
||||||
{
|
{
|
||||||
bool isXSDT = strncmp(rootSDT->Signature, "XSDT", 4);
|
bool isXSDT = (strncmp(rootSDT->Signature, "XSDT", 4) == 0);
|
||||||
int entries = (rootSDT->Length - sizeof(SDTHeader)) / isXSDT ? 8 : 4;
|
int entries = (rootSDT->Length - sizeof(SDTHeader)) / (isXSDT ? 8 : 4);
|
||||||
|
|
||||||
printf("%d entries in root SDT\n", entries);
|
|
||||||
|
|
||||||
for (int i = 0; i < entries; i++)
|
for (int i = 0; i < entries; i++)
|
||||||
{
|
{
|
||||||
printf("Trying this entry\n");
|
|
||||||
SDTHeader* h;
|
SDTHeader* h;
|
||||||
if (isXSDT) h = (SDTHeader*)((XSDT*)rootSDT)->PointerToOtherSDT[i];
|
if (isXSDT) h = (SDTHeader*)((XSDT*)rootSDT)->PointerToOtherSDT[i];
|
||||||
else
|
else
|
||||||
h = (SDTHeader*)(uint64_t)((RSDT*)rootSDT)->PointerToOtherSDT[i];
|
{
|
||||||
|
uint32_t entry = ((RSDT*)rootSDT)->PointerToOtherSDT[i];
|
||||||
|
h = (SDTHeader*)(uint64_t)entry;
|
||||||
|
}
|
||||||
if (strncmp(h->Signature, signature, 4) == 0) return (void*)h;
|
if (strncmp(h->Signature, signature, 4) == 0) return (void*)h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user