WIP: Improve acpid logging.
This commit is contained in:
+10
-6
@@ -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<Option<HashMap<String, AmlValue>>>,
|
||||
namespace: RwLock<Option<BTreeMap<String, AmlValue>>>,
|
||||
|
||||
// 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<Sdt> {
|
||||
self.find_single_sdt_pos(signature).map(|pos| self.tables[pos].clone())
|
||||
}
|
||||
pub fn namespace(&self) -> RwLockReadGuard<'_, Option<HashMap<String, AmlValue>>> {
|
||||
pub fn namespace(&self) -> RwLockReadGuard<'_, Option<BTreeMap<String, AmlValue>>> {
|
||||
self.namespace.read()
|
||||
}
|
||||
pub fn namespace_mut(&self) -> RwLockWriteGuard<'_, Option<HashMap<String, AmlValue>>> {
|
||||
pub fn namespace_mut(&self) -> RwLockWriteGuard<'_, Option<BTreeMap<String, AmlValue>>> {
|
||||
self.namespace.write()
|
||||
}
|
||||
pub fn fadt(&self) -> Option<&Fadt> {
|
||||
|
||||
@@ -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<HashMap<String, AmlValue>>> {
|
||||
pub fn prelock<'ctx>(&mut self, ctx: &'ctx AcpiContext) -> RwLockWriteGuard<'ctx, Option<BTreeMap<String, AmlValue>>> {
|
||||
ctx.namespace_mut()
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user