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

WIP : MCFG #73

This commit is contained in:
Adrien Bourmault 2020-02-09 20:55:13 +01:00
parent 25b913d140
commit 824420aa9a
2 changed files with 49 additions and 5 deletions

View File

@ -110,10 +110,11 @@ enum {
SDT_SRAT,
SDT_SSDT,
SDT_XSDT,
SDT_HEPT
SDT_HEPT,
SDT_MCFG
};
#define N_SDT_TYPES 23
#define N_SDT_TYPES 24
//----------------------------------------------------------------------------//
// FADT related

View File

@ -57,7 +57,8 @@ static char *SDTChar[N_SDT_TYPES] = {
"SRAT",
"SSDT",
"XSDT",
"HPET"
"HPET",
"MCFG"
};
// ACPI Tables Directory
@ -184,6 +185,31 @@ static inline void IoInitRXSDT(void)
}
}
//
// Returns the address of the MCFG
//
static inline SDTHeader_t *IoFindMCFG()
{
char *mcfg = NULL;
for (uint i = 0; i < memoryMap.length; i++) {
if (memoryMap.entry[i].type == RESERVED_ZONE) {
for (mcfg = (char *)memoryMap.entry[i].addr;
(ulong)mcfg < (ulong)(memoryMap.entry[i].addr +
memoryMap.entry[i].length);
mcfg++) {
if (!strncmp(mcfg, "MCFG", 3)) {
return (SDTHeader_t *)mcfg;
}
}
}
}
return NULL;
}
//
// Explore all ACPI Tables
//
@ -257,6 +283,25 @@ static inline void IoSearchAcpiTables(void)
SDTDirectory[SDT_DSDT] = dsdt;
}
}
// Finding MCFG
SDTHeader_t *mcfg = IoFindMCFG();
if (mcfg) {
//DebugLog("MCFG found at %p\n");
checksum = 0; //DoChecksum(mcfg, (size_t)mcfg->length, 0, 0);
if (!checksum) {
if (!strncmp(mcfg->signature, SDTChar[SDT_MCFG], 3)) {
DebugLog("ACPI System Table %s (OEM %s) length %lu [%p]\n",
SDTChar[SDT_MCFG],
mcfg->OEMID,
mcfg->length,
mcfg
);
SDTDirectory[SDT_MCFG] = mcfg;
}
}
}
}
// -------------------------------------------------------------------------- //
@ -268,9 +313,7 @@ void IoInitAcpi(void)
{
// MAP ACPI PAGES
// Search the zone where the start address is
for (uint i = 0; i < memoryMap.length; i++) {
// if the address is in an available zone, we can return the length
if (memoryMap.entry[i].type != AVAILABLE_ZONE) {
// Map each page that is in the busy zone