intel_crashlog/errata.rs
1// Copyright (C) 2025 Intel Corporation
2// SPDX-License-Identifier: MIT
3
4//! Collection of erratas present in the Intel(R) Crash Log technology
5//!
6//! The `erratas` collected in this module are reflecting the errors or corrections that had to be
7//! implemented in some products regarding the structure of the Crash Log record layout.
8
9use crate::header::{Version, record_types};
10
11/// Collection of Intel Crash Log erratas
12pub struct Errata {
13 /// Type0 server legacy header
14 ///
15 /// Some Intel(R) products in the server segment are using legacy Crash Log record headers with
16 /// Type0, which has a different layout compared with the currently defined Type0 Header.
17 ///
18 pub type0_legacy_server: bool,
19
20 /// Type0 server legacy header box record
21 ///
22 /// Some Intel(R) products in the server segment that are using the legacy Crash Log record
23 /// header with Type0 are using the PCORE record type with the same functionality as a BOX
24 /// record.
25 pub type0_legacy_server_box: bool,
26
27 /// Core record using record size in bytes
28 ///
29 /// The Crash Log headers have their sizes in DWORDs, but for some products that are using
30 /// ECORE and PCORE Crash Log records, their sizes are written in bytes.
31 pub core_record_size_bytes: bool,
32}
33
34const GNR_SP_PRODUCT_ID: u32 = 0x2f;
35const SRF_SP_PRODUCT_ID: u32 = 0x82;
36const CWF_SP_PRODUCT_ID: u32 = 0x8e;
37pub(crate) const SERVER_LEGACY_PRODUCT_IDS: [u32; 3] =
38 [GNR_SP_PRODUCT_ID, SRF_SP_PRODUCT_ID, CWF_SP_PRODUCT_ID];
39
40impl Errata {
41 pub fn from_version(version: &Version) -> Self {
42 let type0_legacy_server =
43 version.header_type == 0 && SERVER_LEGACY_PRODUCT_IDS.contains(&version.product_id);
44 let type0_legacy_server_box =
45 type0_legacy_server && version.record_type == record_types::PCORE;
46
47 let core_record_size_bytes = !type0_legacy_server
48 && ((version.record_type == record_types::ECORE && version.product_id < 0x96)
49 || (version.record_type == record_types::PCORE && version.product_id < 0x71));
50
51 Errata {
52 type0_legacy_server,
53 type0_legacy_server_box,
54 core_record_size_bytes,
55 }
56 }
57}