Skip to main content

raw_acpi/
rsdt.rs

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