1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

some cleanup

This commit is contained in:
Adrien Bourmault 2020-02-08 12:19:40 +01:00
parent 97f1c5f25d
commit 4ee95db32e

View File

@ -28,9 +28,6 @@
#include <mm/paging.h> #include <mm/paging.h>
#include <mm/map.h> #include <mm/map.h>
SDTHeader *AcpiSDT = NULL;
SDTHeader *AcpiFADT = NULL;
char IoACPIVersion = 1; char IoACPIVersion = 1;
int tableCount = 1; int tableCount = 1;
@ -94,15 +91,7 @@ static inline RSDPDescriptor *IoFindRSDP()
(ulong)rsdp < (ulong)0x0009FFFF; // EBDA end (ulong)rsdp < (ulong)0x0009FFFF; // EBDA end
rsdp++) { rsdp++) {
if (rsdp[0] == 'R' && if (!strncmp(rsdp, "RSD PTR", 6)) {
rsdp[1] == 'S' &&
rsdp[2] == 'D' &&
rsdp[3] == ' ' &&
rsdp[4] == 'P' &&
rsdp[5] == 'T' &&
rsdp[6] == 'R' &&
rsdp[7] == ' '
) {
return (RSDPDescriptor *)rsdp; return (RSDPDescriptor *)rsdp;
} }
} }
@ -112,15 +101,7 @@ static inline RSDPDescriptor *IoFindRSDP()
(ulong)rsdp < (ulong)0x000FFFFF; // BDA end (ulong)rsdp < (ulong)0x000FFFFF; // BDA end
rsdp++) { rsdp++) {
if (rsdp[0] == 'R' && if (!strncmp(rsdp, "RSD PTR", 6)) {
rsdp[1] == 'S' &&
rsdp[2] == 'D' &&
rsdp[3] == ' ' &&
rsdp[4] == 'P' &&
rsdp[5] == 'T' &&
rsdp[6] == 'R' &&
rsdp[7] == ' '
) {
return (RSDPDescriptor *)rsdp; return (RSDPDescriptor *)rsdp;
} }
} }
@ -156,10 +137,10 @@ static inline void IoInitRSDP(void)
rsdp->legacy.OEMID rsdp->legacy.OEMID
); );
AcpiSDT = (void *)(ulong)rsdp->legacy.rsdtAddress; SDTDirectory[SDT_RSDT] = (void *)(ulong)rsdp->legacy.rsdtAddress;
if (rsdp->legacy.revision) { if (rsdp->legacy.revision) {
AcpiSDT = (void *)rsdp->xsdtAddress; SDTDirectory[SDT_XSDT] = (void *)rsdp->xsdtAddress;
IoACPIVersion = 2; IoACPIVersion = 2;
} }
} }
@ -171,7 +152,11 @@ static inline void IoInitRXSDT(void)
{ {
char checksum = 1; char checksum = 1;
SDTHeader *rxsdt = AcpiSDT; SDTHeader *rxsdt = SDTDirectory[SDT_RSDT];
if (IoACPIVersion == 2) {
rxsdt = SDTDirectory[SDT_XSDT];
}
/* // Checksum calculation */ /* // Checksum calculation */
checksum = DoChecksum(rxsdt, (size_t)rxsdt->length, checksum = DoChecksum(rxsdt, (size_t)rxsdt->length,
@ -204,7 +189,7 @@ static inline void IoInitRXSDT(void)
// //
static inline void IoSearchAcpiTables(void) static inline void IoSearchAcpiTables(void)
{ {
SDTHeader *xrsdt = AcpiSDT; SDTHeader *xrsdt = SDTDirectory[SDT_RSDT];
SDTHeader *table = NULL; SDTHeader *table = NULL;
uint *curInt = NULL; uint *curInt = NULL;
ulong *curLong = NULL; ulong *curLong = NULL;
@ -214,6 +199,7 @@ static inline void IoSearchAcpiTables(void)
if (IoACPIVersion == 1) { if (IoACPIVersion == 1) {
entries = (xrsdt->length - sizeof(xrsdt)) / 4; entries = (xrsdt->length - sizeof(xrsdt)) / 4;
} else { } else {
xrsdt = SDTDirectory[SDT_XSDT];
entries = (xrsdt->length - sizeof(xrsdt)) / 8; entries = (xrsdt->length - sizeof(xrsdt)) / 8;
} }