Debian Codegraph @

src/soc/intel/common/block/include/intelblocks/cse_lite.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #ifndef SOC_INTEL_COMMON_CSE_LITE_H
4 #define SOC_INTEL_COMMON_CSE_LITE_H
5
6 #include <sys/types.h>
7
8 /* Converts bp index to boot partition string */
9 #define GET_BP_STR(bp_index) (bp_index ? "RW" : "RO")
10
11 /* CSE RW boot partition signature */
12 #define CSE_RW_SIGNATURE 0x000055aa
13
14 /* CSE RW boot partition signature size */
15 #define CSE_RW_SIGN_SIZE sizeof(uint32_t)
16
17 /*
18 * CSE Firmware supports 3 boot partitions. For CSE Lite SKU, only 2 boot partitions are
19 * used and 3rd boot partition is set to BP_STATUS_PARTITION_NOT_PRESENT.
20 * CSE Lite SKU Image Layout:
21 * +------------+ +----+------+----+ +-----+------+-----+
22 * | CSE REGION | => | RO | DATA | RW | => | BP1 | DATA | BP2 |
23 * +------------+ +----+------+----+ +-----+------+-----+
24 */
25 #define CSE_MAX_BOOT_PARTITIONS 3
26
27 /* CSE Lite SKU's valid bootable partition identifiers */
28 enum boot_partition_id {
29 /* RO(BP1) contains recovery/minimal boot firmware */
30 RO = 0,
31
32 /* RW(BP2) contains fully functional CSE firmware */
33 RW = 1
34 };
35
36 /*
37 * Boot partition status.
38 * The status is returned in response to MKHI_BUP_COMMON_GET_BOOT_PARTITION_INFO cmd.
39 */
40 enum bp_status {
41 /* This value is returned when a partition has no errors */
42 BP_STATUS_SUCCESS = 0,
43
44 /*
45 * This value is returned when a partition should be present based on layout, but it is
46 * not valid.
47 */
48 BP_STATUS_GENERAL_FAILURE = 1,
49
50 /* This value is returned when a partition is not present per initial image layout */
51 BP_STATUS_PARTITION_NOT_PRESENT = 2,
52
53 /*
54 * This value is returned when unexpected issues are detected in CSE Data area
55 * and CSE TCB-SVN downgrade scenario.
56 */
57 BP_STATUS_DATA_FAILURE = 3,
58 };
59
60 /*
61 * Boot Partition Info Flags
62 * The flags are returned in response to MKHI_BUP_COMMON_GET_BOOT_PARTITION_INFO cmd.
63 */
64 enum bp_info_flags {
65 /* Redundancy Enabled: It indicates CSE supports RO(BP1) and RW(BP2) regions */
66 BP_INFO_REDUNDANCY_EN = 1 << 0,
67
68 /* It indicates RO(BP1) supports Minimal Recovery Mode */
69 BP_INFO_MIN_RECOV_MODE_EN = 1 << 1,
70
71 /*
72 * Read-only Config Enabled: It indicates HW protection to CSE RO region is enabled.
73 * The option is relevant only if the BP_INFO_MIN_RECOV_MODE_EN flag is enabled.
74 */
75 BP_INFO_READ_ONLY_CFG = 1 << 2,
76 };
77
78 /* CSE boot partition entry info */
79 struct cse_bp_entry {
80 /* Boot partition version */
81 struct fw_version fw_ver;
82
83 /* Boot partition status */
84 uint32_t status;
85
86 /* Starting offset of the partition within CSE region */
87 uint32_t start_offset;
88
89 /* Ending offset of the partition within CSE region */
90 uint32_t end_offset;
91 uint8_t reserved[12];
92 } __packed;
93
94 /* CSE boot partition info */
95 struct cse_bp_info {
96 /* Number of boot partitions */
97 uint8_t total_number_of_bp;
98
99 /* Current boot partition */
100 uint8_t current_bp;
101
102 /* Next boot partition */
103 uint8_t next_bp;
104
105 /* Boot Partition Info Flags */
106 uint8_t flags;
107
108 /* Boot Partition Entry Info */
109 struct cse_bp_entry bp_entries[CSE_MAX_BOOT_PARTITIONS];
110 } __packed;
111
112 struct get_bp_info_rsp {
113 struct mkhi_hdr hdr;
114 struct cse_bp_info bp_info;
115 } __packed;
116
117 #endif // SOC_INTEL_COMMON_CSE_LITE_H