raw_acpi/cpep.rs
1use crate::SDTHeader;
2
3#[derive(Copy, Clone)]
4#[repr(C, packed)]
5/// ## Corrected Platform Error Polling Processor Structure
6pub struct CorrectedPlatformErrorPollingProcessor {
7 /// 0 - Corrected Platform Error Polling Processor structure for APIC/SAPIC based processors
8 pub r#type: u8,
9 /// 8
10 pub length: u8,
11 /// Processor ID of destination.
12 pub processor_id: u8,
13 /// Processor EID of destination.
14 pub processor_eid: u8,
15 /// Platform-suggested polling interval (in milliseconds).
16 pub polling_interval: u32,
17}
18
19#[derive(Copy, Clone)]
20#[repr(C, packed)]
21/// ## Corrected Platform Error Polling Table (CPEP)
22///
23/// Platforms may contain the ability to detect and correct certain operational errors while maintaining platform function.
24/// These errors may be logged by the platform for the purpose of retrieval. Depending on the underlying hardware support, the means for retrieving corrected platform error information varies.
25/// If the platform hardware supports interrupt-based signaling of corrected platform errors, the MADT Platform Interrupt Source Structure describes the Corrected Platform Error Interrupt (CPEI).
26/// Alternatively, OSPM may poll processors for corrected platform error information.
27/// Error log information retrieved from a processor may contain information for all processors within an error reporting group.
28/// As such, it may not be necessary for OSPM to poll all processors in the system to retrieve complete error information.
29/// This optional table provides information that allows OSPM to poll only the processors necessary for a complete report of the platform’s corrected platform error information.
30pub struct CorrectedPlatformErrorPolling {
31 /// - **Signature** - "CPEP"
32 pub header: SDTHeader,
33 reserved: u64,
34 /// A list of Corrected Platform Error Polling Processor structures for the platform.
35 pub cpep_processor_structures: [CorrectedPlatformErrorPollingProcessor; 0],
36}
37impl CorrectedPlatformErrorPolling {
38 pub const fn cpep_processor_structures(&self) -> &[CorrectedPlatformErrorPollingProcessor] {
39 // SAFETY: I sure hope the OEM doesn't frick things up...
40 unsafe {
41 core::slice::from_raw_parts(
42 (self as *const _ as *const u8).add(crate::SDT_HEADER_SIZE + 8)
43 as *const CorrectedPlatformErrorPollingProcessor,
44 (self.header.length as usize - (crate::SDT_HEADER_SIZE + 8)) / core::mem::size_of::<CorrectedPlatformErrorPollingProcessor>(),
45 )
46 }
47 }
48}