raw_acpi/ssdt.rs
1use crate::SDTHeader;
2
3#[derive(Copy, Clone)]
4#[repr(C, packed)]
5/// ## Secondary System Description Table
6///
7/// Secondary System Description Tables (SSDT) are a continuation of the DSDT.
8/// The SSDT is comprised of a system description table header followed by data in Definition Block format. There can be multiple SSDTs present.
9/// After OSPM loads the DSDT to create the ACPI Namespace, each secondary system description table listed in the RSDT/XSDT with a unique OEM Table ID is loaded in the order presented in the RSDT/XSDT.
10///
11/// Additional tables can only add data; they cannot overwrite data from previous tables.
12///
13/// This allows the OEM to provide the base support in one table and add smaller system options in other tables.
14/// For example, the OEM might put dynamic object definitions into a secondary table such that the firmware can construct the dynamic information at boot without needing to edit the static DSDT.
15/// A SSDT can only rely on the DSDT being loaded prior to it.
16pub struct SecondarySystemDescriptionTable {
17 /// - **Signature** - "SSDT"
18 pub header: SDTHeader,
19 /// The bytes of AML code.
20 pub def_block: [u8; 0],
21}
22impl SecondarySystemDescriptionTable {
23 pub const fn def_block(&self) -> &[u8] {
24 // SAFETY: I sure hope the OEM doesn't frick things up...
25 unsafe {
26 core::slice::from_raw_parts(
27 (self as *const _ as *const u8).add(crate::SDT_HEADER_SIZE),
28 self.header.length as usize - crate::SDT_HEADER_SIZE,
29 )
30 }
31 }
32}