From 331ac69fd1bb2f9803759f91c713907e535378b0 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 24 Jun 2020 03:35:40 +0200 Subject: Power: added temp ACPI interface Qemu specific shutdown --- src/pOS/arch/x86/kernel/acpi.cpp | 18 ++++++++++++++++++ src/pOS/include/kernel/acpi.h | 14 ++++++++++++++ src/pOS/include/kernel/kernel.h | 1 + 3 files changed, 33 insertions(+) create mode 100644 src/pOS/arch/x86/kernel/acpi.cpp create mode 100644 src/pOS/include/kernel/acpi.h diff --git a/src/pOS/arch/x86/kernel/acpi.cpp b/src/pOS/arch/x86/kernel/acpi.cpp new file mode 100644 index 0000000..7a8d3cd --- /dev/null +++ b/src/pOS/arch/x86/kernel/acpi.cpp @@ -0,0 +1,18 @@ +#include + +void ACPI::shutdown(void) +{ + System::outw(0x604, 0x2000); /* QEMU temp implementation */ + ASSERT(false); +} + +void ACPI::reboot(void) +{ + /* 8042 reset */ + int8_t good = 0x02; + while (good & 0x02) + good = System::inb(0x64); + System::outb(0x64, 0xFE); + + ASSERT(false); +} diff --git a/src/pOS/include/kernel/acpi.h b/src/pOS/include/kernel/acpi.h new file mode 100644 index 0000000..18cf4fa --- /dev/null +++ b/src/pOS/include/kernel/acpi.h @@ -0,0 +1,14 @@ +#ifndef _ACPI_H_ +#define _ACPI_H_ + +#include +#include + +class ACPI +{ +public: + static void shutdown(void); + static void reboot(void); +}; + +#endif diff --git a/src/pOS/include/kernel/kernel.h b/src/pOS/include/kernel/kernel.h index 7362374..622ef88 100644 --- a/src/pOS/include/kernel/kernel.h +++ b/src/pOS/include/kernel/kernel.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include -- cgit 1.4.1