impl Debug for AmlValue.

This commit is contained in:
4lDO2
2020-04-18 18:21:04 +02:00
parent 5490de9fd2
commit 290098b5a4
3 changed files with 18 additions and 16 deletions

View File

@@ -31,7 +31,7 @@ version = "0.29.0"
default-features = false
[features]
default = ["serial_debug"]
default = ["serial_debug", "acpi"]
acpi = []
doc = []
graphical_debug = []

View File

@@ -14,7 +14,7 @@ use super::AmlError;
use crate::acpi::{SdtSignature, get_signature_from_index, get_index_from_signature};
#[derive(Clone)]
#[derive(Clone, Debug)]
pub enum FieldSelector {
Region(String),
Bank {
@@ -28,7 +28,7 @@ pub enum FieldSelector {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub enum ObjectReference {
ArgObj(u8),
LocalObj(u8),
@@ -36,7 +36,7 @@ pub enum ObjectReference {
Index(Box<AmlValue>, Box<AmlValue>)
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Method {
pub arg_count: u8,
pub serialized: bool,
@@ -44,14 +44,14 @@ pub struct Method {
pub term_list: Vec<u8>
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct BufferField {
pub source_buf: Box<AmlValue>,
pub index: Box<AmlValue>,
pub length: Box<AmlValue>
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct FieldUnit {
pub selector: FieldSelector,
pub connection: Box<AmlValue>,
@@ -60,19 +60,19 @@ pub struct FieldUnit {
pub length: usize
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Device {
pub obj_list: Vec<String>,
pub notify_methods: BTreeMap<u8, Vec<fn()>>
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct ThermalZone {
pub obj_list: Vec<String>,
pub notify_methods: BTreeMap<u8, Vec<fn()>>
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Processor {
pub proc_id: u8,
pub p_blk: Option<u32>,
@@ -80,7 +80,7 @@ pub struct Processor {
pub notify_methods: BTreeMap<u8, Vec<fn()>>
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct OperationRegion {
pub region: RegionSpace,
pub offset: Box<AmlValue>,
@@ -89,13 +89,14 @@ pub struct OperationRegion {
pub accessed_by: Option<u64>
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct PowerResource {
pub system_level: u8,
pub resource_order: u16,
pub obj_list: Vec<String>
}
#[derive(Debug)]
pub struct Accessor {
pub read: fn(usize) -> u64,
pub write: fn(usize, u64)
@@ -110,7 +111,7 @@ impl Clone for Accessor {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub enum AmlValue {
None,
Uninitialized,
@@ -136,10 +137,6 @@ pub enum AmlValue {
ThermalZone(ThermalZone)
}
impl Debug for AmlValue {
fn fmt(&self, _f: &mut Formatter) -> Result<(), Error> { Ok(()) }
}
impl AmlValue {
pub fn get_type_string(&self) -> String {
match *self {

View File

@@ -306,6 +306,11 @@ pub unsafe fn init(active_table: &mut ActivePageTable) {
_ => (),
}
}
let namespace_guard = crate::acpi::ACPI_TABLE.namespace.read();
for (k, v) in namespace_guard.as_ref().unwrap().iter() {
println!("{} = {:?}", k, v);
}
}
println!("I/O APICs: {:?}, overrides: {:?}", ioapics(), src_overrides());