mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Finish detecting ACPI tables and registerng these tables
This commit is contained in:
parent
3e8555315b
commit
3df905601b
@ -72,10 +72,45 @@ struct SDTHeader {
|
||||
uint sdtTablePtr;
|
||||
};
|
||||
|
||||
//
|
||||
// ACPI table types id
|
||||
//
|
||||
enum {
|
||||
SDT_MADT,
|
||||
SDT_BERT,
|
||||
SDT_CPEP,
|
||||
SDT_DSDT,
|
||||
SDT_ECDT,
|
||||
SDT_EINJ,
|
||||
SDT_ERST,
|
||||
SDT_FADT,
|
||||
SDT_FACS,
|
||||
SDT_HEST,
|
||||
SDT_MSCT,
|
||||
SDT_MPST,
|
||||
SDT_OEMx,
|
||||
SDT_PMTT,
|
||||
SDT_PSDT,
|
||||
SDT_RASF,
|
||||
SDT_RSDT,
|
||||
SDT_SBST,
|
||||
SDT_SLIT,
|
||||
SDT_SRAT,
|
||||
SDT_SSDT,
|
||||
SDT_XSDT,
|
||||
SDT_HEPT
|
||||
};
|
||||
|
||||
#define N_SDT_TYPES 23
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
void IoInitAcpi(void);
|
||||
|
||||
SDTHeader *IoGetAcpiTable(ulong id);
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#endif
|
||||
|
@ -36,6 +36,36 @@ int tableCount = 1;
|
||||
|
||||
extern MemoryMap_t memoryMap;
|
||||
|
||||
// ACPI reverse strings
|
||||
static char *SDTChar[N_SDT_TYPES] = {
|
||||
"APIC",
|
||||
"BERT",
|
||||
"CPEP",
|
||||
"DSDT",
|
||||
"ECDT",
|
||||
"EINJ",
|
||||
"ERST",
|
||||
"FACP",
|
||||
"FACS",
|
||||
"HEST",
|
||||
"MSCT",
|
||||
"MPST",
|
||||
"OEMx",
|
||||
"PMTT",
|
||||
"PSDT",
|
||||
"RASF",
|
||||
"RSDT",
|
||||
"SBST",
|
||||
"SLIT",
|
||||
"SRAT",
|
||||
"SSDT",
|
||||
"XSDT",
|
||||
"HPET"
|
||||
};
|
||||
|
||||
// ACPI Tables Directory
|
||||
static SDTHeader *SDTDirectory[N_SDT_TYPES] = {0};
|
||||
|
||||
//
|
||||
// Returns the checksum of the given structure
|
||||
//
|
||||
@ -189,25 +219,31 @@ static inline void IoSearchAcpiTables(void)
|
||||
|
||||
DebugLog("ACPI detected %d entries\n", entries);
|
||||
|
||||
curInt = &(xrsdt->sdtTablePtr);
|
||||
curLong = &(xrsdt->sdtTablePtr);
|
||||
curInt = (uint*)&(xrsdt->sdtTablePtr);
|
||||
curLong = (ulong*)&(xrsdt->sdtTablePtr);
|
||||
|
||||
for (int i = 0; i < entries; i++) {
|
||||
|
||||
if (IoACPIVersion == 1)
|
||||
table = (SDTHeader *)curInt[i];
|
||||
table = (SDTHeader *)(ulong)curInt[i];
|
||||
else
|
||||
table = (SDTHeader *)curLong[i];
|
||||
table = (SDTHeader *)(ulong)curLong[i];
|
||||
|
||||
//KernLog("\tACPI RSDT[%d] %p\n", i, table);
|
||||
if (MmIsBusyZone(table)) {
|
||||
checksum = DoChecksum(table, (size_t)table->length, 0, 0);
|
||||
if (!checksum) {
|
||||
DebugLog("ACPI System Table %s (OEM %s) length %d [%p]\n",
|
||||
table->signature,
|
||||
table->OEMID,
|
||||
table->length,
|
||||
table);
|
||||
for (ulong i=0; i < N_SDT_TYPES; i++) {
|
||||
if (!strncmp(table->signature, SDTChar[i], 3)) {
|
||||
DebugLog("ACPI System Table %s (OEM %s) length %d [%p]\n",
|
||||
SDTChar[i],
|
||||
table->OEMID,
|
||||
table->length,
|
||||
table
|
||||
);
|
||||
SDTDirectory[i] = table;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -252,3 +288,14 @@ void IoInitAcpi(void)
|
||||
|
||||
IoSearchAcpiTables();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Returns the addr of the submitted SDT
|
||||
//
|
||||
// Arg must be a member of the enum in acpi.h
|
||||
//
|
||||
SDTHeader *IoGetAcpiTable(ulong id)
|
||||
{
|
||||
return SDTDirectory[id];
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ void MmInitGdt(void)
|
||||
tssDesc.veryHighBase = ((ulong)&tss >> 32) & 0xFFFFFFFF;
|
||||
tssDesc.lowLimit = sizeof(tss);
|
||||
|
||||
tss.ist1 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR RESCUE STACK
|
||||
tss.ist2 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR STACK
|
||||
tss.ist3 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR STACK
|
||||
tss.ist1 = (ulong)memalign(4*MB, 4*KB) + 4*MB; // ISR RESCUE STACK
|
||||
tss.ist2 = (ulong)memalign(4*MB, 4*KB) + 4*MB; // ISR STACK
|
||||
tss.ist3 = (ulong)memalign(4*MB, 4*KB) + 4*MB; // ISR STACK
|
||||
tss.iomap_base = sizeof(tss);
|
||||
|
||||
DebugLog("ISR Stacks initialized : Rescue %p, Normal %p, %p\n",
|
||||
|
Loading…
Reference in New Issue
Block a user