From 7ac5bdbae0d7b279323c89e707bc08b5abdbf237 Mon Sep 17 00:00:00 2001
From: 4lDO2 <4lDO2@protonmail.com>
Date: Wed, 10 Mar 2021 14:06:43 +0100
Subject: [PATCH] WIP: Implement userspace-driven shutdown.
---
src/acpi/dmar/mod.rs | 3 +-
src/acpi/hpet.rs | 3 +-
src/acpi/madt.rs | 3 +-
src/acpi/mod.rs | 41 ------
src/arch/x86_64/device/ioapic.rs | 3 -
src/arch/x86_64/stop.rs | 25 +++-
src/scheme/acpi.rs | 214 +++++++++++++++++++++++++------
src/scheme/mod.rs | 2 +-
src/sync/wait_condition.rs | 2 +-
9 files changed, 203 insertions(+), 93 deletions(-)
diff --git a/src/acpi/dmar/mod.rs b/src/acpi/dmar/mod.rs
index 8b107e2..caf8726 100644
--- a/src/acpi/dmar/mod.rs
+++ b/src/acpi/dmar/mod.rs
@@ -5,7 +5,7 @@ use self::drhd::Drhd;
use crate::memory::Frame;
use crate::paging::{ActivePageTable, PageFlags, PhysicalAddress};
-use super::{find_sdt, load_table, get_sdt_signature};
+use super::find_sdt;
pub mod drhd;
@@ -22,7 +22,6 @@ impl Dmar {
pub fn init(active_table: &mut ActivePageTable) {
let dmar_sdt = find_sdt("DMAR");
let dmar = if dmar_sdt.len() == 1 {
- load_table(get_sdt_signature(dmar_sdt[0]));
Dmar::new(dmar_sdt[0])
} else {
println!("Unable to find DMAR");
diff --git a/src/acpi/hpet.rs b/src/acpi/hpet.rs
index 269fa60..498a668 100644
--- a/src/acpi/hpet.rs
+++ b/src/acpi/hpet.rs
@@ -6,7 +6,7 @@ use crate::memory::Frame;
use crate::paging::{ActivePageTable, PhysicalAddress, Page, PageFlags, VirtualAddress};
use super::sdt::Sdt;
-use super::{ACPI_TABLE, find_sdt, load_table, get_sdt_signature};
+use super::{ACPI_TABLE, find_sdt};
#[repr(packed)]
#[derive(Clone, Copy, Debug, Default)]
@@ -38,7 +38,6 @@ impl Hpet {
pub fn init(active_table: &mut ActivePageTable) {
let hpet_sdt = find_sdt("HPET");
let hpet = if hpet_sdt.len() == 1 {
- load_table(get_sdt_signature(hpet_sdt[0]));
Hpet::new(hpet_sdt[0], active_table)
} else {
println!("Unable to find HPET");
diff --git a/src/acpi/madt.rs b/src/acpi/madt.rs
index 031598c..f6dabb6 100644
--- a/src/acpi/madt.rs
+++ b/src/acpi/madt.rs
@@ -4,7 +4,7 @@ use crate::memory::{allocate_frames, Frame};
use crate::paging::{ActivePageTable, Page, PageFlags, PhysicalAddress, VirtualAddress};
use super::sdt::Sdt;
-use super::{find_sdt, load_table, get_sdt_signature};
+use super::find_sdt;
use core::intrinsics::{atomic_load, atomic_store};
use core::sync::atomic::Ordering;
@@ -31,7 +31,6 @@ impl Madt {
pub fn init(active_table: &mut ActivePageTable) {
let madt_sdt = find_sdt("APIC");
let madt = if madt_sdt.len() == 1 {
- load_table(get_sdt_signature(madt_sdt[0]));
Madt::new(madt_sdt[0])
} else {
println!("Unable to find MADT");
diff --git a/src/acpi/mod.rs b/src/acpi/mod.rs
index 3d6adeb..348c35f 100644
--- a/src/acpi/mod.rs
+++ b/src/acpi/mod.rs
@@ -81,11 +81,6 @@ pub unsafe fn init(active_table: &mut ActivePageTable, already_supplied_rsdps: O
*sdt_ptrs = Some(BTreeMap::new());
}
- {
- let mut order = SDT_ORDER.write();
- *order = Some(vec!());
- }
-
// Search for RSDP
if let Some(rsdp) = RSDP::get_rsdp(active_table, already_supplied_rsdps) {
info!("RSDP: {:?}", rsdp);
@@ -149,7 +144,6 @@ pub unsafe fn init(active_table: &mut ActivePageTable, already_supplied_rsdps: O
pub type SdtSignature = (String, [u8; 6], [u8; 8]);
pub static SDT_POINTERS: RwLock