raw_acpi/msct.rs
1use crate::SDTHeader;
2
3#[derive(Copy, Clone)]
4#[repr(C, packed)]
5/// ## Maximum Proximity Domain Information Structure
6///
7/// The Maximum Proximity Domain Information Structure is used to report system maximum characteristics.
8/// It is likely that these characteristics may be the same for many proximity domains, but they can vary from one proximity domain to another.
9/// This structure optimizes to cover the former case, while allowing the flexibility for the latter as well.
10/// These structures must be organized in ascending order of the proximity domain enumerations.
11/// All proximity domains within the Maximum Number of Proximity Domains reported in the MSCT must be covered by one of these structures.
12pub struct MaximumProximityDomainInformation {
13 pub revision: u8,
14 /// 22
15 pub length: u8,
16 /// The starting proximity domain for the proximity domain range that this structure is providing information.
17 pub proximity_domain_range_low: u32,
18 /// The ending proximity domain for the proximity domain range that this structure is providing information.
19 pub proximity_domain_range_high: u32,
20 /// The Maximum Processor Capacity of each of the Proximity Domains specified in the range.
21 ///
22 /// A value of 0 means that the proximity domains do not contain processors.
23 /// This field must be >= the number of processor entries for the domain in the SRAT.
24 pub max_processor_capacity: u32,
25 /// The Maximum Memory Capacity (size in bytes) of the Proximity Domains specified in the range.
26 ///
27 /// A value of 0 means that the proximity domains do not contain memory.
28 pub max_memory_capacity: u64,
29}
30
31#[derive(Copy, Clone)]
32#[repr(C, packed)]
33/// ## Maximum System Characteristics Table (MSCT)
34///
35/// This section describes the format of the Maximum System Characteristic Table (MSCT), which provides OSPM with information characteristics of a system’s maximum topology capabilities.
36/// If the system maximum topology is not known up front at boot time, then this table is not present.
37/// OSPM will use information provided by the MSCT only when the System Resource Affinity Table (SRAT) exists. The MSCT must contain all proximity and clock domains defined in the SRAT.
38pub struct MaximumSystemCharacteristicsTable {
39 /// - **Signature** - "MSCT"
40 pub header: SDTHeader,
41 /// Offset in bytes to the Proximity Domain Information Structure table entry.
42 pub offset_prox_dom_info: u32,
43 /// Indicates the maximum number of Proximity Domains ever possible in the system.
44 ///
45 /// The number reported in this field is (maximum domains - 1). For example if there are 0x10000 possible domains in the system, this field would report 0xFFFF.
46 pub max_number_of_proximity_domains: u32,
47 /// Indicates the maximum number of Clock Domains ever possible in the system.
48 ///
49 /// The number reported in this field is (maximum domains - 1).
50 pub max_number_of_clock_domains: u32,
51 /// Indicates the maximum Physical Address ever possible in the system.
52 ///
53 /// Note: this is the top of the reachable physical address.
54 pub max_physical_address: u64,
55}
56impl MaximumSystemCharacteristicsTable {
57 /// **JJ's Note: The specs say that this field is located somewhere depending on the offset field in the structure (not aligned with the structure at all), which is why I provided this.**
58 pub const fn proximity_domain_information(&self) -> &[MaximumProximityDomainInformation] {
59 // SAFETY: I sure hope the OEM doesn't frick things up...
60 unsafe {
61 core::slice::from_raw_parts(
62 (self as *const _ as *const u8).add(self.offset_prox_dom_info as usize)
63 as *const MaximumProximityDomainInformation,
64 (self.header.length as usize)
65 .checked_sub(self.offset_prox_dom_info as usize)
66 .expect("INCORRECT MATH: MSCT impl --- slice reference parsing (offset beyond table length)")
67 / core::mem::size_of::<MaximumProximityDomainInformation>(),
68 )
69 }
70 }
71}