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

ACPI RSDT detected !

This commit is contained in:
Adrien Bourmault 2020-02-03 11:58:34 +01:00
parent 02e7b7ea77
commit 9f52833adb
5 changed files with 75 additions and 4 deletions

View File

@ -31,7 +31,25 @@
//----------------------------------------------------------------------------//
//
// ACPI 2.0 Legacy descriptor
//
struct RSDPDescriptor {
char signature[8];
uchar checksum;
char OEMID[6];
uchar revision;
uint rsdtAddress;
uint length;
ulong xsdtAddress;
uchar extendedChecksum;
uchar reserved[3];
} __attribute__ ((packed));
//----------------------------------------------------------------------------//
void IoTestAcpi(void);
RSDPDescriptor *IoFindRSDP(void);
//----------------------------------------------------------------------------//

View File

@ -56,6 +56,8 @@ typedef struct IdtPtr_t IdtPtr_t;
typedef struct ISRList_t ISRList_t;
typedef struct ISRFrame_t ISRFrame_t;
typedef struct RSDPDescriptor RSDPDescriptor;
typedef struct MemoryMap_t MemoryMap_t;
typedef struct MapEntry_t MapEntry_t;
typedef struct GdtEntry_t GdtEntry_t;

View File

@ -64,6 +64,9 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
// Sanity checks
BtDoSanityChecks(mbMagic);
// ACPI
IoTestAcpi();
// Memory
MmInitMemoryMap();
MmInitGdt();
@ -83,9 +86,6 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
KeGetCpuInfos();
IoEnableKeyb();
// ACPI
IoTestAcpi();
// Scheduler
PsInitSched();

View File

@ -24,6 +24,7 @@
#include <init/boot.h>
#include <io/vga.h>
#include <io/acpi.h>
void IoTestAcpi(void)
{
@ -34,6 +35,57 @@ void IoTestAcpi(void)
if (BtFirmwareInfo.apmValid)
KernLog("\tApm Table is valid at %p\n", BtFirmwareInfo.apmTable);
RSDPDescriptor *rsdp = IoFindRSDP();
if (!rsdp)
return;
KernLog("\tFound ACPI RSDP (%s) version %d at %p\n",
rsdp->OEMID, (uint)rsdp->revision, rsdp
);
return;
}
RSDPDescriptor *IoFindRSDP()
{
char *rsdp = NULL;
// Search in EBDA
for (rsdp = (char *)0x00080000; // EBDA address
(ulong)rsdp < (ulong)0x0009FFFF; // EBDA end
rsdp++) {
if (rsdp[0] == 'R' &&
rsdp[1] == 'S' &&
rsdp[2] == 'D' &&
rsdp[3] == ' ' &&
rsdp[4] == 'P' &&
rsdp[5] == 'T' &&
rsdp[6] == 'R' &&
rsdp[7] == ' '
) {
return (RSDPDescriptor *)rsdp;
}
}
// Search in BDA
for (rsdp = (char *)0x000E0000; // BDA address
(ulong)rsdp < (ulong)0x000FFFFF; // BDA end
rsdp++) {
if (rsdp[0] == 'R' &&
rsdp[1] == 'S' &&
rsdp[2] == 'D' &&
rsdp[3] == ' ' &&
rsdp[4] == 'P' &&
rsdp[5] == 'T' &&
rsdp[6] == 'R' &&
rsdp[7] == ' '
) {
return (RSDPDescriptor *)rsdp;
}
}
return NULL;
}

View File

@ -143,7 +143,6 @@ error_t CmdDumpMem(int argc, char **argv, char *cmdline)
x += step;
}
KernLog("\n\n");
return EOK;
}