about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2020-06-24 03:35:40 +0200
committerYour Name <you@example.com>2020-06-24 03:35:40 +0200
commit331ac69fd1bb2f9803759f91c713907e535378b0 (patch)
treebfcda166fa8ef40980612d92f254b456ef83ed94
parentBase: added outw, outl, inw and inl to the system interface (diff)
downloadpOS-331ac69fd1bb2f9803759f91c713907e535378b0.tar.gz
pOS-331ac69fd1bb2f9803759f91c713907e535378b0.tar.bz2
pOS-331ac69fd1bb2f9803759f91c713907e535378b0.zip
Power: added temp ACPI interface
Qemu specific shutdown
-rw-r--r--src/pOS/arch/x86/kernel/acpi.cpp18
-rw-r--r--src/pOS/include/kernel/acpi.h14
-rw-r--r--src/pOS/include/kernel/kernel.h1
3 files changed, 33 insertions, 0 deletions
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 <kernel/acpi.h>
+
+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 <assert.h>
+#include <kernel/system.h>
+
+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 <kernel/time.h>
 #include <kernel/debug.h>
 #include <kernel/drivers.h>
+#include <kernel/acpi.h>
 #include <kernel/interrupts/gdt.h>
 #include <kernel/interrupts/idt.h>
 #include <kernel/interrupts/isrs.h>