From 8237711a423af9c9ccb634b5ea83af8c1e262d1b Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Tue, 4 Feb 2020 00:41:41 +0100 Subject: [PATCH] Misc cleanup --- boot/grub/grub.cfg | 3 ++ kaleid/kernel/io/acpi.c | 75 +++++++++++++++++++++-------------------- 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/boot/grub/grub.cfg b/boot/grub/grub.cfg index 97bc428..b893821 100755 --- a/boot/grub/grub.cfg +++ b/boot/grub/grub.cfg @@ -26,6 +26,9 @@ set timeout=0 set default=0 #Set the default menu entry +insmod vbe +insmod vga + menuentry "OS/K (pre-pre-alpha 0.0.1)" { multiboot /boot/kaleid # The multiboot command replaces the kernel command boot diff --git a/kaleid/kernel/io/acpi.c b/kaleid/kernel/io/acpi.c index e4e7b64..3cf93b9 100644 --- a/kaleid/kernel/io/acpi.c +++ b/kaleid/kernel/io/acpi.c @@ -31,6 +31,7 @@ SDTHeader *AcpiSDT = NULL; SDTHeader *AcpiFADT = NULL; char IoACPIVersion = 1; +int tableCount = 1; // // Returns the checksum of the given structure @@ -94,6 +95,42 @@ static inline RSDPDescriptor *IoFindRSDP() return NULL; } +// +// RSDP Exploration +// +static inline void IoInitRSDP(void) +{ + char checksum = 1; + + RSDPDescriptor *rsdp = IoFindRSDP(); + if (!rsdp) + KeStartPanic("ACPI RSDP not found in memory"); + + // Checksum calculation + checksum = DoChecksum(rsdp, (size_t)sizeof(RSDPDescriptor), + (size_t)sizeof(struct RSDPLegacy), + !rsdp->legacy.revision + ); + + if (checksum) + KeStartPanic("Invalid RSDP checksum : %d vs 0", checksum); + + if (rsdp->legacy.revision == 1 || rsdp->legacy.revision >= 3) + KeStartPanic("Invalid ACPI Revision : %d", rsdp->legacy.revision); + + KernLog("\tACPI Revision %d (OEM %s)\n", + (uint)rsdp->legacy.revision, + rsdp->legacy.OEMID + ); + + AcpiSDT = (void *)(ulong)rsdp->legacy.rsdtAddress; + + if (rsdp->legacy.revision) { + AcpiSDT = (void *)rsdp->xsdtAddress; + IoACPIVersion = 2; + } +} + // // R/XSDT Exploration // @@ -136,42 +173,6 @@ static inline void IoInitRXSDT(void) } } -// -// RSDP Exploration -// -static inline void IoInitRSDP(void) -{ - char checksum = 1; - - RSDPDescriptor *rsdp = IoFindRSDP(); - if (!rsdp) - KeStartPanic("ACPI RSDP not found in memory"); - - // Checksum calculation - checksum = DoChecksum(rsdp, (size_t)sizeof(RSDPDescriptor), - (size_t)sizeof(struct RSDPLegacy), - !rsdp->legacy.revision - ); - - if (checksum) - KeStartPanic("Invalid RSDP checksum : %d vs 0", checksum); - - if (rsdp->legacy.revision == 1 || rsdp->legacy.revision >= 3) - KeStartPanic("Invalid ACPI Revision : %d", rsdp->legacy.revision); - - KernLog("\tACPI Revision %d (OEM %s)\n", - (uint)rsdp->legacy.revision, - rsdp->legacy.OEMID - ); - - AcpiSDT = (void *)(ulong)rsdp->legacy.rsdtAddress; - - if (rsdp->legacy.revision) { - AcpiSDT = (void *)rsdp->xsdtAddress; - IoACPIVersion = 2; - } -} - // // Explore all ACPI Tables // @@ -181,6 +182,8 @@ static inline void IoSearchAcpiTables(void) } +// -------------------------------------------------------------------------- // + // // Initialise the ACPI by finding tables //