diff --git a/acpid/src/acpi.rs b/acpid/src/acpi.rs index 7e24025997..5b1c24c52b 100644 --- a/acpid/src/acpi.rs +++ b/acpid/src/acpi.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeMap, HashMap}; +use std::collections::BTreeMap; use std::convert::{TryFrom, TryInto}; use std::ops::Deref; use std::sync::{Arc, atomic::{self, AtomicUsize}}; @@ -217,7 +217,7 @@ pub struct AcpiContext { // TODO: Remove Option. This is not kernel code, and not static, but we still need to replace // every match where namespace{,_mut}() are used. - namespace: RwLock>>, + namespace: RwLock>>, // TODO: The kernel ACPI code seemed to use load_table quite ubiquitously, however ACPI 5.1 // states that DDBHandles can only be obtained when loading XSDT-pointed tables. So, we'll @@ -234,7 +234,7 @@ impl AcpiContext { .try_into() .expect("expected ACPI addresses to be compatible with the current word size"); - log::info!("TABLE AT {:#>08X}", physaddr); + log::debug!("TABLE AT {:#>08X}", physaddr); Sdt::load_from_physical(physaddr) .expect("failed to load physical SDT") @@ -244,7 +244,7 @@ impl AcpiContext { tables, dsdt: None, fadt: None, - namespace: RwLock::new(Some(HashMap::new())), + namespace: RwLock::new(Some(BTreeMap::new())), next_ctx: RwLock::new(0), sdt_order: RwLock::new(Vec::new()), @@ -258,6 +258,10 @@ impl AcpiContext { crate::aml::init_namespace(&this); + for (path, _) in this.namespace.get_mut().as_mut().unwrap().iter() { + log::trace!("ACPI NS: {}", path); + } + this } @@ -282,10 +286,10 @@ impl AcpiContext { pub fn take_single_sdt(&mut self, signature: [u8; 4]) -> Option { self.find_single_sdt_pos(signature).map(|pos| self.tables[pos].clone()) } - pub fn namespace(&self) -> RwLockReadGuard<'_, Option>> { + pub fn namespace(&self) -> RwLockReadGuard<'_, Option>> { self.namespace.read() } - pub fn namespace_mut(&self) -> RwLockWriteGuard<'_, Option>> { + pub fn namespace_mut(&self) -> RwLockWriteGuard<'_, Option>> { self.namespace.write() } pub fn fadt(&self) -> Option<&Fadt> { diff --git a/acpid/src/aml/parser.rs b/acpid/src/aml/parser.rs index 704aee5d8c..3902453ebe 100644 --- a/acpid/src/aml/parser.rs +++ b/acpid/src/aml/parser.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use std::collections::BTreeMap; use parking_lot::RwLockWriteGuard; @@ -292,7 +292,7 @@ impl<'a> AmlExecutionContext<'a> { } } - pub fn prelock<'ctx>(&mut self, ctx: &'ctx AcpiContext) -> RwLockWriteGuard<'ctx, Option>> { + pub fn prelock<'ctx>(&mut self, ctx: &'ctx AcpiContext) -> RwLockWriteGuard<'ctx, Option>> { ctx.namespace_mut() } diff --git a/acpid/src/main.rs b/acpid/src/main.rs index bc1e10afc5..f353f081a1 100644 --- a/acpid/src/main.rs +++ b/acpid/src/main.rs @@ -40,7 +40,7 @@ fn setup_logging() -> Option<&'static RedoxLogger> { let mut logger = RedoxLogger::new() .with_output( OutputBuilder::stderr() - .with_filter(log::LevelFilter::Trace) // limit global output to important info + .with_filter(log::LevelFilter::Info) // limit global output to important info .with_ansi_escape_codes() .flush_on_newline(true) .build() @@ -48,7 +48,7 @@ fn setup_logging() -> Option<&'static RedoxLogger> { #[cfg(target_os = "redox")] match File::open("debug:") { - Ok(d) => logger = logger.with_output(OutputBuilder::with_endpoint(d).flush_on_newline(true).with_filter(log::LevelFilter::Info).build()), + Ok(d) => logger = logger.with_output(OutputBuilder::with_endpoint(d).flush_on_newline(true).with_ansi_escape_codes().with_filter(log::LevelFilter::Info).build()), Err(error) => eprintln!("Failed to open `debug:` scheme: {}", error), } @@ -58,6 +58,7 @@ fn setup_logging() -> Option<&'static RedoxLogger> { // TODO: Add a configuration file for this b.with_filter(log::LevelFilter::Trace) .flush_on_newline(true) + .with_ansi_escape_codes() .build() ), Err(error) => eprintln!("Failed to create xhci.log: {}", error),