Skip to content
Snippets Groups Projects
Unverified Commit 387cd41e authored by Connor Wood's avatar Connor Wood
Browse files

Implemented ACPI table

parent 687f991a
No related branches found
No related tags found
1 merge request!36HPET Driver
use core::{mem, ptr};
use super::sdt::Sdt;
#[repr(packed)]
#[derive(Clone, Copy, Debug, Default)]
pub struct GenericAddressStructure {
address_space: u8,
bit_width: u8,
bit_offset: u8,
access_size: u8,
address: u64,
}
#[repr(packed)]
#[derive(Debug)]
pub struct Hpet {
pub header: Sdt,
pub hw_rev_id: u8,
pub comparator_descriptor: u8,
pub pci_vendor_id: u16,
pub base_address: GenericAddressStructure,
pub hpet_number: u8,
pub min_periodic_clk_tick: u16,
pub oem_attribute: u8
}
impl Hpet {
pub fn new(sdt: &'static Sdt) -> Option<Hpet> {
if &sdt.signature == b"HPET" && sdt.length as usize >= mem::size_of::<Hpet>() {
Some(unsafe { ptr::read((sdt as *const Sdt) as *const Hpet) })
} else {
None
}
}
}
...@@ -18,9 +18,11 @@ use self::madt::{Madt, MadtEntry}; ...@@ -18,9 +18,11 @@ use self::madt::{Madt, MadtEntry};
use self::rsdt::Rsdt; use self::rsdt::Rsdt;
use self::sdt::Sdt; use self::sdt::Sdt;
use self::xsdt::Xsdt; use self::xsdt::Xsdt;
use self::hpet::Hpet;
use self::aml::{is_aml_table, parse_aml_table, AmlNamespace, AmlError}; use self::aml::{is_aml_table, parse_aml_table, AmlNamespace, AmlError};
mod hpet;
mod dmar; mod dmar;
mod fadt; mod fadt;
mod madt; mod madt;
...@@ -195,6 +197,8 @@ fn parse_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) { ...@@ -195,6 +197,8 @@ fn parse_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) {
_ => () _ => ()
} }
} }
} else if let Some(hpet) = Hpet::new(sdt) {
println!(": {:#?}", hpet);
} else if is_aml_table(sdt) { } else if is_aml_table(sdt) {
ACPI_TABLE.lock().namespace = match parse_aml_table(sdt) { ACPI_TABLE.lock().namespace = match parse_aml_table(sdt) {
Ok(res) => { Ok(res) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment