From 43d62e167e5f61799e1d0f79bcd107b6705aef11 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Sun, 2 Feb 2020 13:33:57 +0100 Subject: [PATCH] Acpi --- Makefile | 3 ++- boot/loader/mem/structures.inc | 2 +- include/io/acpi.h | 38 +++++++++++++++++++++++++++++++++ kaleid/kernel/init/info.c | 2 +- kaleid/kernel/init/init.c | 4 ++++ kaleid/kernel/io/acpi.c | 39 ++++++++++++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 include/io/acpi.h create mode 100644 kaleid/kernel/io/acpi.c diff --git a/Makefile b/Makefile index bb5f2a7..8d307c9 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,8 @@ KernSources = kernel/ke/cpuid.c kernel/mm/paging.c \ kernel/sh/shell.c kernel/sh/shcmds.c \ kernel/sh/musage.c kernel/io/ata.c \ kernel/sh/argv.c kernel/ke/pit.c \ - kernel/sh/testcmds.c kernel/mm/palloc.c + kernel/sh/testcmds.c kernel/mm/palloc.c \ + kernel/io/acpi.c KernObj=$(patsubst %.c,$(KOBJDIR)/%.o,$(KernSources)) KernDep=$(patsubst %.c,$(KOBJDIR)/%.d,$(KernSources)) diff --git a/boot/loader/mem/structures.inc b/boot/loader/mem/structures.inc index e52bba6..de8013d 100644 --- a/boot/loader/mem/structures.inc +++ b/boot/loader/mem/structures.inc @@ -31,7 +31,7 @@ global newStackEnd global GDT64 [section .text] -KERNEL_STACK equ 16 * 1024 * 1024 ; 16MB of stack +KERNEL_STACK equ 1 * 1024 * 1024 ; 1MB of stack newKernelEnd dq 0x0 newStackEnd dq 0x0 diff --git a/include/io/acpi.h b/include/io/acpi.h new file mode 100644 index 0000000..9b2d087 --- /dev/null +++ b/include/io/acpi.h @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Desc: ACPI, Hardware detection related // +// // +// // +// Copyright © 2018-2019 The OS/K Team // +// // +// This file is part of OS/K. // +// // +// OS/K is free software: you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation, either version 3 of the License, or // +// any later version. // +// // +// OS/K is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY//without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with OS/K. If not, see . // +//----------------------------------------------------------------------------// + +#ifndef _KERNEL_H +#include +#endif + +#ifndef _IO_ACPI_H +#define _IO_ACPI_H + +//----------------------------------------------------------------------------// + +void IoTestAcpi(void); + +//----------------------------------------------------------------------------// + +#endif diff --git a/kaleid/kernel/init/info.c b/kaleid/kernel/init/info.c index 1d2da60..9bf6830 100644 --- a/kaleid/kernel/init/info.c +++ b/kaleid/kernel/init/info.c @@ -25,7 +25,7 @@ #include // -// BootInfo_t initialization. It is necessary because grub will potentially be +// BootInfo_t initialization. It is necessary because grub will potentially be // wiped since it is below 1MB.... And we must reorganize all that stuff. // void BtInitBootInfo(multiboot_info_t *mbi, void *codeSeg) diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index a739f7a..09e3cbc 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -81,6 +82,9 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg) KeGetCpuInfos(); IoEnableKeyb(); + // ACPI + IoTestAcpi(); + // Command line (kernel mode) ShStartShell(); diff --git a/kaleid/kernel/io/acpi.c b/kaleid/kernel/io/acpi.c new file mode 100644 index 0000000..b5fdd6a --- /dev/null +++ b/kaleid/kernel/io/acpi.c @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Desc: ACPI, Hardware detection related functions // +// // +// // +// Copyright © 2018-2019 The OS/K Team // +// // +// This file is part of OS/K. // +// // +// OS/K is free software: you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation, either version 3 of the License, or // +// any later version. // +// // +// OS/K is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY//without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with OS/K. If not, see . // +//----------------------------------------------------------------------------// + +#include +#include + +void IoTestAcpi(void) +{ + + if (BtFirmwareInfo.romValid) + KernLog("\tRom Table is valid at %p\n", BtFirmwareInfo.romTable); + + if (BtFirmwareInfo.apmValid) + KernLog("\tApm Table is valid at %p\n", BtFirmwareInfo.apmTable); + + + return; +}