Skip to main content

raw_acpi/
xsdt.rs

1use crate::SDTHeader;
2
3#[derive(Copy, Clone)]
4#[repr(C, packed)]
5/// ## Extended System Description Table structure.
6pub struct ExtendedSystemDescriptionTable {
7    /// - **Signature** - "XSDT"
8    /// - **Revision** - 1
9    /// - **OEM Table ID** - For the XSDT, the table ID is the manufacture model ID. This field must match the OEM Table ID in the FADT structure.
10    pub header: SDTHeader,
11    /// An array of 64-bit physical addresses that point to other System Description Tables.
12    /// OSPM assumes at least the System Description Table is addressable, and then can further address the table based upon its Length field.
13    pub entry: [u64; 0],
14}
15impl ExtendedSystemDescriptionTable {
16    pub const fn entry(&self) -> &[u64] {
17        // SAFETY: I sure hope the OEM doesn't frick things up...
18        unsafe {
19            core::slice::from_raw_parts(
20                (self as *const _ as *const u8).add(crate::SDT_HEADER_SIZE) as *const u64,
21                (self.header.length as usize - crate::SDT_HEADER_SIZE) / 8,
22            )
23        }
24    }
25}