Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 2 | #include <bootstate.h> |
| 3 | #include <console/console.h> |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 4 | #include <boot_device.h> |
| 5 | #include <cbfs.h> |
| 6 | #include <commonlib/cbfs.h> |
| 7 | #include <commonlib/region.h> |
| 8 | #include <fmap.h> |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 9 | #include <intelblocks/cse.h> |
| 10 | #include <security/vboot/vboot_common.h> |
Sridhar Siricilla | 87e36c4 | 2020-05-03 19:08:18 +0530 | [diff] [blame] | 11 | #include <security/vboot/misc.h> |
| 12 | #include <vb2_api.h> |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 13 | #include <soc/intel/common/reset.h> |
| 14 | |
| 15 | /* CSE RW version size reserved in the CSE CBFS RW binary */ |
| 16 | #define CSE_RW_VERSION_SZ 16 |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 17 | |
| 18 | /* Converts bp index to boot partition string */ |
| 19 | #define GET_BP_STR(bp_index) (bp_index ? "RW" : "RO") |
| 20 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 21 | /* CSE RW boot partition signature */ |
| 22 | #define CSE_RW_SIGNATURE 0x000055aa |
| 23 | |
| 24 | /* CSE RW boot partition signature size */ |
| 25 | #define CSE_RW_SIGN_SIZE sizeof(uint32_t) |
| 26 | |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 27 | /* |
Sridhar Siricilla | 99dbca3 | 2020-05-12 21:05:04 +0530 | [diff] [blame] | 28 | * CSE Firmware supports 3 boot partitions. For CSE Lite SKU, only 2 boot partitions are |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 29 | * used and 3rd boot partition is set to BP_STATUS_PARTITION_NOT_PRESENT. |
Sridhar Siricilla | 99dbca3 | 2020-05-12 21:05:04 +0530 | [diff] [blame] | 30 | * CSE Lite SKU Image Layout: |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 31 | * ------------- ------------------- --------------------- |
| 32 | * |CSE REGION | => | RO | RW | DATA | => | BP1 | BP2 | DATA | |
| 33 | * ------------- ------------------- --------------------- |
| 34 | */ |
| 35 | #define CSE_MAX_BOOT_PARTITIONS 3 |
| 36 | |
Sridhar Siricilla | 99dbca3 | 2020-05-12 21:05:04 +0530 | [diff] [blame] | 37 | /* CSE Lite SKU's valid bootable partition identifiers */ |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 38 | enum boot_partition_id { |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 39 | /* RO(BP1) contains recovery/minimal boot firmware */ |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 40 | RO = 0, |
| 41 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 42 | /* RW(BP2) contains fully functional CSE firmware */ |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 43 | RW = 1 |
| 44 | }; |
| 45 | |
Sridhar Siricilla | 87e36c4 | 2020-05-03 19:08:18 +0530 | [diff] [blame] | 46 | /* CSE recovery sub-error codes */ |
| 47 | enum csme_failure_reason { |
| 48 | /* Unspecified error */ |
| 49 | CSE_LITE_SKU_UNSPECIFIED = 1, |
| 50 | |
| 51 | /* CSE fails to boot from RW */ |
| 52 | CSE_LITE_SKU_RW_JUMP_ERROR = 2, |
| 53 | |
| 54 | /* CSE RW boot partition access error */ |
| 55 | CSE_LITE_SKU_RW_ACCESS_ERROR = 3, |
| 56 | |
| 57 | /* Fails to set next boot partition as RW */ |
| 58 | CSE_LITE_SKU_RW_SWITCH_ERROR = 4, |
| 59 | |
| 60 | /* CSE firmware update failure */ |
| 61 | CSE_LITE_SKU_FW_UPDATE_ERROR = 5, |
| 62 | |
| 63 | /* Fails to communicate with CSE */ |
| 64 | CSE_LITE_SKU_COMMUNICATION_ERROR = 6, |
| 65 | |
| 66 | /* Fails to wipe CSE runtime data */ |
| 67 | CSE_LITE_SKU_DATA_WIPE_ERROR = 7 |
| 68 | }; |
| 69 | |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 70 | /* |
| 71 | * Boot partition status. |
| 72 | * The status is returned in response to MKHI_BUP_COMMON_GET_BOOT_PARTITION_INFO cmd. |
| 73 | */ |
| 74 | enum bp_status { |
| 75 | /* This value is returned when a partition has no errors */ |
| 76 | BP_STATUS_SUCCESS = 0, |
| 77 | |
| 78 | /* |
| 79 | * This value is returned when a partition should be present based on layout, but it is |
| 80 | * not valid. |
| 81 | */ |
| 82 | BP_STATUS_GENERAL_FAILURE = 1, |
| 83 | |
| 84 | /* This value is returned when a partition is not present per initial image layout */ |
| 85 | BP_STATUS_PARTITION_NOT_PRESENT = 2, |
| 86 | |
Sridhar Siricilla | 2f6d555 | 2020-04-19 23:39:02 +0530 | [diff] [blame] | 87 | /* |
| 88 | * This value is returned when unexpected issues are detected in CSE Data area |
| 89 | * and CSE TCB-SVN downgrade scenario. |
| 90 | */ |
| 91 | BP_STATUS_DATA_FAILURE = 3, |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | /* |
| 95 | * Boot Partition Info Flags |
| 96 | * The flags are returned in response to MKHI_BUP_COMMON_GET_BOOT_PARTITION_INFO cmd. |
| 97 | */ |
| 98 | enum bp_info_flags { |
| 99 | |
| 100 | /* Redundancy Enabled: It indicates CSE supports RO(BP1) and RW(BP2) regions */ |
| 101 | BP_INFO_REDUNDANCY_EN = 1 << 0, |
| 102 | |
| 103 | /* It indicates RO(BP1) supports Minimal Recovery Mode */ |
| 104 | BP_INFO_MIN_RECOV_MODE_EN = 1 << 1, |
| 105 | |
| 106 | /* |
| 107 | * Read-only Config Enabled: It indicates HW protection to CSE RO region is enabled. |
| 108 | * The option is relevant only if the BP_INFO_MIN_RECOV_MODE_EN flag is enabled. |
| 109 | */ |
| 110 | BP_INFO_READ_ONLY_CFG = 1 << 2, |
| 111 | }; |
| 112 | |
| 113 | /* Boot Partition FW Version */ |
| 114 | struct fw_version { |
| 115 | uint16_t major; |
| 116 | uint16_t minor; |
| 117 | uint16_t hotfix; |
| 118 | uint16_t build; |
| 119 | } __packed; |
| 120 | |
| 121 | /* CSE boot partition entry info */ |
| 122 | struct cse_bp_entry { |
| 123 | /* Boot partition version */ |
| 124 | struct fw_version fw_ver; |
| 125 | |
| 126 | /* Boot partition status */ |
| 127 | uint32_t status; |
| 128 | |
| 129 | /* Starting offset of the partition within CSE region */ |
| 130 | uint32_t start_offset; |
| 131 | |
| 132 | /* Ending offset of the partition within CSE region */ |
| 133 | uint32_t end_offset; |
| 134 | uint8_t reserved[12]; |
| 135 | } __packed; |
| 136 | |
| 137 | /* CSE boot partition info */ |
| 138 | struct cse_bp_info { |
| 139 | /* Number of boot partitions */ |
| 140 | uint8_t total_number_of_bp; |
| 141 | |
| 142 | /* Current boot partition */ |
| 143 | uint8_t current_bp; |
| 144 | |
| 145 | /* Next boot partition */ |
| 146 | uint8_t next_bp; |
| 147 | |
| 148 | /* Boot Partition Info Flags */ |
| 149 | uint8_t flags; |
| 150 | |
| 151 | /* Boot Partition Entry Info */ |
| 152 | struct cse_bp_entry bp_entries[CSE_MAX_BOOT_PARTITIONS]; |
| 153 | } __packed; |
| 154 | |
| 155 | struct get_bp_info_rsp { |
| 156 | struct mkhi_hdr hdr; |
| 157 | struct cse_bp_info bp_info; |
| 158 | } __packed; |
| 159 | |
Sridhar Siricilla | 33aa115 | 2020-06-26 14:29:40 +0530 | [diff] [blame] | 160 | static void cse_log_status_registers(void) |
| 161 | { |
| 162 | printk(BIOS_DEBUG, "cse_lite: CSE status registers: HFSTS1: 0x%x, HFSTS2: 0x%x " |
| 163 | "HFSTS3: 0x%x\n", me_read_config32(PCI_ME_HFSTS1), |
| 164 | me_read_config32(PCI_ME_HFSTS2), me_read_config32(PCI_ME_HFSTS3)); |
| 165 | } |
| 166 | |
Sridhar Siricilla | 87e36c4 | 2020-05-03 19:08:18 +0530 | [diff] [blame] | 167 | static void cse_trigger_recovery(uint8_t rec_sub_code) |
| 168 | { |
Sridhar Siricilla | 33aa115 | 2020-06-26 14:29:40 +0530 | [diff] [blame] | 169 | /* Log CSE Firmware Status Registers to help debugging */ |
| 170 | cse_log_status_registers(); |
Sridhar Siricilla | 87e36c4 | 2020-05-03 19:08:18 +0530 | [diff] [blame] | 171 | if (CONFIG(VBOOT)) { |
Subrata Banik | 754de4d | 2020-09-15 15:16:42 +0530 | [diff] [blame] | 172 | struct vb2_context *ctx = vboot_get_context(); |
| 173 | if (ctx == NULL) |
| 174 | goto failure; |
Sridhar Siricilla | 87e36c4 | 2020-05-03 19:08:18 +0530 | [diff] [blame] | 175 | vb2api_fail(ctx, VB2_RECOVERY_INTEL_CSE_LITE_SKU, rec_sub_code); |
| 176 | vboot_save_data(ctx); |
| 177 | vboot_reboot(); |
| 178 | } |
Subrata Banik | 754de4d | 2020-09-15 15:16:42 +0530 | [diff] [blame] | 179 | failure: |
Sridhar Siricilla | 87e36c4 | 2020-05-03 19:08:18 +0530 | [diff] [blame] | 180 | die("cse_lite: Failed to trigger recovery mode(recovery subcode:%d)\n", rec_sub_code); |
| 181 | } |
| 182 | |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 183 | static uint8_t cse_get_current_bp(const struct cse_bp_info *cse_bp_info) |
| 184 | { |
| 185 | return cse_bp_info->current_bp; |
| 186 | } |
| 187 | |
| 188 | static const struct cse_bp_entry *cse_get_bp_entry(enum boot_partition_id bp, |
| 189 | const struct cse_bp_info *cse_bp_info) |
| 190 | { |
| 191 | return &cse_bp_info->bp_entries[bp]; |
| 192 | } |
| 193 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 194 | static void cse_get_bp_entry_range(const struct cse_bp_info *cse_bp_info, |
| 195 | enum boot_partition_id bp, uint32_t *start_offset, uint32_t *end_offset) |
| 196 | { |
| 197 | const struct cse_bp_entry *cse_bp; |
| 198 | |
| 199 | cse_bp = cse_get_bp_entry(bp, cse_bp_info); |
| 200 | |
| 201 | if (start_offset) |
| 202 | *start_offset = cse_bp->start_offset; |
| 203 | |
| 204 | if (end_offset) |
| 205 | *end_offset = cse_bp->end_offset; |
| 206 | |
| 207 | } |
| 208 | |
| 209 | static const struct fw_version *cse_get_bp_entry_version(enum boot_partition_id bp, |
| 210 | const struct cse_bp_info *bp_info) |
| 211 | { |
| 212 | const struct cse_bp_entry *cse_bp; |
| 213 | |
| 214 | cse_bp = cse_get_bp_entry(bp, bp_info); |
| 215 | return &cse_bp->fw_ver; |
| 216 | } |
| 217 | |
| 218 | static const struct fw_version *cse_get_rw_version(const struct cse_bp_info *cse_bp_info) |
| 219 | { |
| 220 | return cse_get_bp_entry_version(RW, cse_bp_info); |
| 221 | } |
| 222 | |
| 223 | static bool cse_is_rw_bp_status_valid(const struct cse_bp_info *cse_bp_info) |
| 224 | { |
| 225 | const struct cse_bp_entry *rw_bp; |
| 226 | |
| 227 | rw_bp = cse_get_bp_entry(RW, cse_bp_info); |
| 228 | |
| 229 | if (rw_bp->status == BP_STATUS_PARTITION_NOT_PRESENT || |
| 230 | rw_bp->status == BP_STATUS_GENERAL_FAILURE) { |
| 231 | printk(BIOS_ERR, "cse_lite: RW BP (status:%u) is not valid\n", rw_bp->status); |
| 232 | return false; |
| 233 | } |
| 234 | return true; |
| 235 | } |
| 236 | |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 237 | static void cse_print_boot_partition_info(const struct cse_bp_info *cse_bp_info) |
| 238 | { |
| 239 | const struct cse_bp_entry *cse_bp; |
| 240 | |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 241 | printk(BIOS_DEBUG, "cse_lite: Number of partitions = %d\n", |
| 242 | cse_bp_info->total_number_of_bp); |
| 243 | printk(BIOS_DEBUG, "cse_lite: Current partition = %s\n", |
| 244 | GET_BP_STR(cse_bp_info->current_bp)); |
| 245 | printk(BIOS_DEBUG, "cse_lite: Next partition = %s\n", GET_BP_STR(cse_bp_info->next_bp)); |
| 246 | printk(BIOS_DEBUG, "cse_lite: Flags = 0x%x\n", cse_bp_info->flags); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 247 | |
| 248 | /* Log version info of RO & RW partitions */ |
| 249 | cse_bp = cse_get_bp_entry(RO, cse_bp_info); |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 250 | printk(BIOS_DEBUG, "cse_lite: %s version = %d.%d.%d.%d (Status=0x%x, Start=0x%x, End=0x%x)\n", |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 251 | GET_BP_STR(RO), cse_bp->fw_ver.major, cse_bp->fw_ver.minor, |
| 252 | cse_bp->fw_ver.hotfix, cse_bp->fw_ver.build, |
| 253 | cse_bp->status, cse_bp->start_offset, |
| 254 | cse_bp->end_offset); |
| 255 | |
| 256 | cse_bp = cse_get_bp_entry(RW, cse_bp_info); |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 257 | printk(BIOS_DEBUG, "cse_lite: %s version = %d.%d.%d.%d (Status=0x%x, Start=0x%x, End=0x%x)\n", |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 258 | GET_BP_STR(RW), cse_bp->fw_ver.major, cse_bp->fw_ver.minor, |
| 259 | cse_bp->fw_ver.hotfix, cse_bp->fw_ver.build, |
| 260 | cse_bp->status, cse_bp->start_offset, |
| 261 | cse_bp->end_offset); |
| 262 | } |
| 263 | |
| 264 | /* |
| 265 | * Checks prerequisites for MKHI_BUP_COMMON_GET_BOOT_PARTITION_INFO and |
| 266 | * MKHI_BUP_COMMON_SET_BOOT_PARTITION_INFO HECI commands. |
| 267 | * It allows execution of the Boot Partition commands in below scenarios: |
| 268 | * - When CSE boots from RW partition (COM: Normal and CWS: Normal) |
| 269 | * - When CSE boots from RO partition (COM: Soft Temp Disable and CWS: Normal) |
| 270 | * - After HMRFPO_ENABLE command is issued to CSE (COM: SECOVER_MEI_MSG and CWS: Normal) |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 271 | * The prerequisite check should be handled in cse_get_bp_info() and |
| 272 | * cse_set_next_boot_partition() since the CSE's current operation mode is changed between these |
| 273 | * cmd handler calls. |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 274 | */ |
| 275 | static bool cse_is_bp_cmd_info_possible(void) |
| 276 | { |
| 277 | if (cse_is_hfs1_cws_normal()) { |
| 278 | if (cse_is_hfs1_com_normal()) |
| 279 | return true; |
| 280 | if (cse_is_hfs1_com_secover_mei_msg()) |
| 281 | return true; |
| 282 | if (cse_is_hfs1_com_soft_temp_disable()) |
| 283 | return true; |
| 284 | } |
| 285 | return false; |
| 286 | } |
| 287 | |
| 288 | static bool cse_get_bp_info(struct get_bp_info_rsp *bp_info_rsp) |
| 289 | { |
| 290 | struct get_bp_info_req { |
| 291 | struct mkhi_hdr hdr; |
| 292 | uint8_t reserved[4]; |
| 293 | } __packed; |
| 294 | |
| 295 | struct get_bp_info_req info_req = { |
| 296 | .hdr.group_id = MKHI_GROUP_ID_BUP_COMMON, |
| 297 | .hdr.command = MKHI_BUP_COMMON_GET_BOOT_PARTITION_INFO, |
| 298 | .reserved = {0}, |
| 299 | }; |
| 300 | |
| 301 | if (!cse_is_bp_cmd_info_possible()) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 302 | printk(BIOS_ERR, "cse_lite: CSE does not meet prerequisites\n"); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 303 | return false; |
| 304 | } |
| 305 | |
| 306 | size_t resp_size = sizeof(struct get_bp_info_rsp); |
| 307 | |
| 308 | if (!heci_send_receive(&info_req, sizeof(info_req), bp_info_rsp, &resp_size)) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 309 | printk(BIOS_ERR, "cse_lite: Could not get partition info\n"); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 310 | return false; |
| 311 | } |
| 312 | |
| 313 | if (bp_info_rsp->hdr.result) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 314 | printk(BIOS_ERR, "cse_lite: Get partition info resp failed: %d\n", |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 315 | bp_info_rsp->hdr.result); |
| 316 | return false; |
| 317 | } |
| 318 | |
| 319 | cse_print_boot_partition_info(&bp_info_rsp->bp_info); |
| 320 | |
| 321 | return true; |
| 322 | } |
| 323 | /* |
| 324 | * It sends HECI command to notify CSE about its next boot partition. When coreboot wants |
| 325 | * CSE to boot from certain partition (BP1 <RO> or BP2 <RW>), then this command can be used. |
| 326 | * The CSE's valid bootable partitions are BP1(RO) and BP2(RW). |
| 327 | * This function must be used before EOP. |
| 328 | * Returns false on failure and true on success. |
| 329 | */ |
| 330 | static bool cse_set_next_boot_partition(enum boot_partition_id bp) |
| 331 | { |
| 332 | struct set_boot_partition_info_req { |
| 333 | struct mkhi_hdr hdr; |
| 334 | uint8_t next_bp; |
| 335 | uint8_t reserved[3]; |
| 336 | } __packed; |
| 337 | |
| 338 | struct set_boot_partition_info_req switch_req = { |
| 339 | .hdr.group_id = MKHI_GROUP_ID_BUP_COMMON, |
| 340 | .hdr.command = MKHI_BUP_COMMON_SET_BOOT_PARTITION_INFO, |
| 341 | .next_bp = bp, |
| 342 | .reserved = {0}, |
| 343 | }; |
| 344 | |
| 345 | if (bp != RO && bp != RW) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 346 | printk(BIOS_ERR, "cse_lite: Incorrect partition id(%d) is provided", bp); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 347 | return false; |
| 348 | } |
| 349 | |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 350 | printk(BIOS_INFO, "cse_lite: Set Boot Partition Info Command (%s)\n", GET_BP_STR(bp)); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 351 | |
| 352 | if (!cse_is_bp_cmd_info_possible()) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 353 | printk(BIOS_ERR, "cse_lite: CSE does not meet prerequisites\n"); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 354 | return false; |
| 355 | } |
| 356 | |
| 357 | struct mkhi_hdr switch_resp; |
| 358 | size_t sw_resp_sz = sizeof(struct mkhi_hdr); |
| 359 | |
| 360 | if (!heci_send_receive(&switch_req, sizeof(switch_req), &switch_resp, &sw_resp_sz)) |
| 361 | return false; |
| 362 | |
| 363 | if (switch_resp.result) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 364 | printk(BIOS_ERR, "cse_lite: Set Boot Partition Info Response Failed: %d\n", |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 365 | switch_resp.result); |
| 366 | return false; |
| 367 | } |
| 368 | |
| 369 | return true; |
| 370 | } |
| 371 | |
Karthikeyan Ramasubramanian | f9cc637 | 2020-08-04 16:38:58 -0600 | [diff] [blame] | 372 | __weak void cse_board_reset(void) |
| 373 | { |
| 374 | /* Default weak implementation, does nothing. */ |
| 375 | } |
| 376 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 377 | /* Set the CSE's next boot partition and issues system reset */ |
| 378 | static bool cse_set_and_boot_from_next_bp(enum boot_partition_id bp) |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 379 | { |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 380 | if (!cse_set_next_boot_partition(bp)) |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 381 | return false; |
| 382 | |
Karthikeyan Ramasubramanian | f9cc637 | 2020-08-04 16:38:58 -0600 | [diff] [blame] | 383 | /* Allow the board to perform a reset for CSE RO<->RW jump */ |
| 384 | cse_board_reset(); |
| 385 | |
| 386 | /* If board does not perform the reset, then perform global_reset */ |
Furquan Shaikh | b13bd1e | 2020-09-21 22:44:27 +0000 | [diff] [blame^] | 387 | do_global_reset(); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 388 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 389 | die("cse_lite: Failed to reset the system\n"); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 390 | |
| 391 | /* Control never reaches here */ |
| 392 | return false; |
| 393 | } |
| 394 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 395 | static bool cse_boot_to_rw(const struct cse_bp_info *cse_bp_info) |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 396 | { |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 397 | if (cse_get_current_bp(cse_bp_info) == RW) |
| 398 | return true; |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 399 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 400 | return cse_set_and_boot_from_next_bp(RW); |
| 401 | } |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 402 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 403 | static bool cse_boot_to_ro(const struct cse_bp_info *cse_bp_info) |
| 404 | { |
| 405 | if (cse_get_current_bp(cse_bp_info) == RO) |
| 406 | return true; |
| 407 | |
| 408 | return cse_set_and_boot_from_next_bp(RO); |
| 409 | } |
| 410 | |
| 411 | static bool cse_get_rw_rdev(struct region_device *rdev) |
| 412 | { |
| 413 | if (fmap_locate_area_as_rdev_rw(CONFIG_SOC_INTEL_CSE_FMAP_NAME, rdev) < 0) { |
| 414 | printk(BIOS_ERR, "cse_lite: Failed to locate %s in FMAP\n", |
| 415 | CONFIG_SOC_INTEL_CSE_FMAP_NAME); |
| 416 | return false; |
| 417 | } |
| 418 | |
| 419 | return true; |
| 420 | } |
| 421 | |
| 422 | static bool cse_get_cbfs_rdev(struct region_device *source_rdev) |
| 423 | { |
| 424 | struct cbfsf file_desc; |
| 425 | |
| 426 | if (cbfs_boot_locate(&file_desc, CONFIG_SOC_INTEL_CSE_RW_CBFS_NAME, NULL) < 0) |
| 427 | return false; |
| 428 | |
| 429 | cbfs_file_data(source_rdev, &file_desc); |
| 430 | return true; |
| 431 | } |
| 432 | |
| 433 | static bool cse_is_rw_bp_sign_valid(const struct region_device *target_rdev) |
| 434 | { |
| 435 | uint32_t cse_bp_sign; |
| 436 | |
| 437 | if (rdev_readat(target_rdev, &cse_bp_sign, 0, CSE_RW_SIGN_SIZE) != CSE_RW_SIGN_SIZE) { |
| 438 | printk(BIOS_ERR, "cse_lite: Failed to read RW boot partition signature\n"); |
| 439 | return false; |
| 440 | } |
| 441 | |
| 442 | return cse_bp_sign == CSE_RW_SIGNATURE; |
| 443 | } |
| 444 | |
| 445 | static bool cse_get_target_rdev(const struct cse_bp_info *cse_bp_info, |
| 446 | struct region_device *target_rdev) |
| 447 | { |
| 448 | struct region_device cse_region_rdev; |
| 449 | size_t size; |
| 450 | uint32_t start_offset; |
| 451 | uint32_t end_offset; |
| 452 | |
| 453 | if (!cse_get_rw_rdev(&cse_region_rdev)) |
| 454 | return false; |
| 455 | |
| 456 | cse_get_bp_entry_range(cse_bp_info, RW, &start_offset, &end_offset); |
| 457 | size = end_offset + 1 - start_offset; |
| 458 | |
| 459 | if (rdev_chain(target_rdev, &cse_region_rdev, start_offset, size)) |
| 460 | return false; |
| 461 | |
| 462 | printk(BIOS_DEBUG, "cse_lite: CSE RW partition: offset = 0x%x, size = 0x%x\n", |
| 463 | (uint32_t)start_offset, (uint32_t) size); |
| 464 | |
| 465 | return true; |
| 466 | } |
| 467 | |
Sridhar Siricilla | 2f6d555 | 2020-04-19 23:39:02 +0530 | [diff] [blame] | 468 | static bool cse_data_clear_request(const struct cse_bp_info *cse_bp_info) |
| 469 | { |
| 470 | struct data_clr_request { |
| 471 | struct mkhi_hdr hdr; |
| 472 | uint8_t reserved[4]; |
| 473 | } __packed; |
| 474 | |
| 475 | struct data_clr_request data_clr_rq = { |
| 476 | .hdr.group_id = MKHI_GROUP_ID_BUP_COMMON, |
| 477 | .hdr.command = MKHI_BUP_COMMON_DATA_CLEAR, |
| 478 | .reserved = {0}, |
| 479 | }; |
| 480 | |
| 481 | if (!cse_is_hfs1_cws_normal() || !cse_is_hfs1_com_soft_temp_disable() || |
| 482 | cse_get_current_bp(cse_bp_info) != RO) { |
| 483 | printk(BIOS_ERR, "cse_lite: CSE doesn't meet DATA CLEAR cmd prerequisites\n"); |
| 484 | return false; |
| 485 | } |
| 486 | |
| 487 | printk(BIOS_DEBUG, "cse_lite: Sending DATA CLEAR HECI command\n"); |
| 488 | |
| 489 | struct mkhi_hdr data_clr_rsp; |
| 490 | size_t data_clr_rsp_sz = sizeof(data_clr_rsp); |
| 491 | |
| 492 | if (!heci_send_receive(&data_clr_rq, sizeof(data_clr_rq), &data_clr_rsp, |
| 493 | &data_clr_rsp_sz)) { |
| 494 | return false; |
| 495 | } |
| 496 | |
| 497 | if (data_clr_rsp.result) { |
| 498 | printk(BIOS_ERR, "cse_lite: CSE DATA CLEAR command response failed: %d\n", |
| 499 | data_clr_rsp.result); |
| 500 | return false; |
| 501 | } |
| 502 | |
| 503 | return true; |
| 504 | } |
| 505 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 506 | static bool cse_get_cbfs_rw_version(const struct region_device *source_rdev, |
| 507 | void *cse_cbfs_rw_ver) |
| 508 | { |
| 509 | |
| 510 | if (rdev_readat(source_rdev, (void *) cse_cbfs_rw_ver, 0, sizeof(struct fw_version)) |
| 511 | != sizeof(struct fw_version)) { |
| 512 | printk(BIOS_ERR, "cse_lite: Failed to read CSE CBFW RW version\n"); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 513 | return false; |
| 514 | } |
| 515 | return true; |
| 516 | } |
| 517 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 518 | /* |
| 519 | * Compare versions of CSE CBFS RW and CSE RW partition |
| 520 | * If ver_cmp_status = 0, no update is required |
| 521 | * If ver_cmp_status < 0, coreboot downgrades CSE RW region |
| 522 | * If ver_cmp_status > 0, coreboot upgrades CSE RW region |
| 523 | */ |
| 524 | static int cse_check_version_mismatch(const struct cse_bp_info *cse_bp_info, |
| 525 | const struct region_device *source_rdev) |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 526 | { |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 527 | struct fw_version cse_cbfs_rw_ver; |
| 528 | const struct fw_version *cse_rw_ver; |
| 529 | |
| 530 | if (!cse_get_cbfs_rw_version(source_rdev, &cse_cbfs_rw_ver)) |
| 531 | return false; |
| 532 | |
| 533 | printk(BIOS_DEBUG, "cse_lite: CSE CBFS RW version : %d.%d.%d.%d\n", |
| 534 | cse_cbfs_rw_ver.major, |
| 535 | cse_cbfs_rw_ver.minor, |
| 536 | cse_cbfs_rw_ver.hotfix, |
| 537 | cse_cbfs_rw_ver.build); |
| 538 | |
| 539 | cse_rw_ver = cse_get_rw_version(cse_bp_info); |
| 540 | |
| 541 | if (cse_cbfs_rw_ver.major != cse_rw_ver->major) |
| 542 | return cse_cbfs_rw_ver.major - cse_rw_ver->major; |
| 543 | else if (cse_cbfs_rw_ver.minor != cse_rw_ver->minor) |
| 544 | return cse_cbfs_rw_ver.minor - cse_rw_ver->minor; |
| 545 | else if (cse_cbfs_rw_ver.hotfix != cse_rw_ver->hotfix) |
| 546 | return cse_cbfs_rw_ver.hotfix - cse_rw_ver->hotfix; |
| 547 | else |
| 548 | return cse_cbfs_rw_ver.build - cse_rw_ver->build; |
| 549 | } |
| 550 | |
Sridhar Siricilla | 2f6d555 | 2020-04-19 23:39:02 +0530 | [diff] [blame] | 551 | /* Check if CSE RW data partition is valid or not */ |
| 552 | static bool cse_is_rw_dp_valid(const struct cse_bp_info *cse_bp_info) |
| 553 | { |
| 554 | const struct cse_bp_entry *rw_bp; |
| 555 | |
| 556 | rw_bp = cse_get_bp_entry(RW, cse_bp_info); |
| 557 | return rw_bp->status != BP_STATUS_DATA_FAILURE; |
| 558 | } |
| 559 | |
| 560 | /* |
| 561 | * It returns true if RW partition doesn't indicate BP_STATUS_DATA_FAILURE |
| 562 | * otherwise false if any operation fails. |
| 563 | */ |
| 564 | static bool cse_fix_data_failure_err(const struct cse_bp_info *cse_bp_info) |
| 565 | { |
| 566 | /* |
| 567 | * If RW partition status indicates BP_STATUS_DATA_FAILURE, |
| 568 | * - Send DATA CLEAR HECI command to CSE |
| 569 | * - Send SET BOOT PARTITION INFO(RW) command to set CSE's next partition |
| 570 | * - Issue GLOBAL RESET HECI command. |
| 571 | */ |
| 572 | if (cse_is_rw_dp_valid(cse_bp_info)) |
| 573 | return true; |
| 574 | |
| 575 | if (!cse_data_clear_request(cse_bp_info)) |
| 576 | return false; |
| 577 | |
| 578 | return cse_boot_to_rw(cse_bp_info); |
| 579 | } |
| 580 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 581 | static bool cse_erase_rw_region(const struct region_device *target_rdev) |
| 582 | { |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 583 | if (rdev_eraseat(target_rdev, 0, region_device_sz(target_rdev)) < 0) { |
| 584 | printk(BIOS_ERR, "cse_lite: CSE RW partition could not be erased\n"); |
| 585 | return false; |
| 586 | } |
| 587 | return true; |
| 588 | } |
| 589 | |
| 590 | static bool cse_copy_rw(const struct region_device *target_rdev, const void *buf, size_t offset, |
| 591 | size_t size) |
| 592 | { |
| 593 | if (rdev_writeat(target_rdev, buf, offset, size) < 0) { |
| 594 | printk(BIOS_ERR, "cse_lite: Failed to update CSE firmware\n"); |
| 595 | return false; |
| 596 | } |
| 597 | |
| 598 | return true; |
| 599 | } |
| 600 | |
| 601 | static bool cse_is_rw_version_latest(const struct cse_bp_info *cse_bp_info, |
| 602 | const struct region_device *source_rdev) |
| 603 | { |
| 604 | return !cse_check_version_mismatch(cse_bp_info, source_rdev); |
| 605 | } |
| 606 | |
Sridhar Siricilla | 2f6d555 | 2020-04-19 23:39:02 +0530 | [diff] [blame] | 607 | static bool cse_is_downgrade_instance(const struct cse_bp_info *cse_bp_info, |
| 608 | const struct region_device *source_rdev) |
| 609 | { |
| 610 | return cse_check_version_mismatch(cse_bp_info, source_rdev) < 0; |
| 611 | } |
| 612 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 613 | static bool cse_is_update_required(const struct cse_bp_info *cse_bp_info, |
| 614 | const struct region_device *source_rdev, struct region_device *target_rdev) |
| 615 | { |
| 616 | return (!cse_is_rw_bp_sign_valid(target_rdev) || |
| 617 | !cse_is_rw_version_latest(cse_bp_info, source_rdev)); |
| 618 | } |
| 619 | |
| 620 | static bool cse_write_rw_region(const struct region_device *target_rdev, |
| 621 | const struct region_device *source_rdev) |
| 622 | { |
| 623 | void *cse_cbfs_rw = rdev_mmap(source_rdev, CSE_RW_VERSION_SZ, |
| 624 | region_device_sz(source_rdev) - CSE_RW_VERSION_SZ); |
| 625 | |
| 626 | /* Points to CSE CBFS RW image after boot partition signature */ |
| 627 | uint8_t *cse_cbfs_rw_wo_sign = (uint8_t *)cse_cbfs_rw + CSE_RW_SIGN_SIZE; |
| 628 | |
| 629 | /* Size of CSE CBFS RW image without boot partition signature */ |
| 630 | uint32_t cse_cbfs_rw_wo_sign_sz = region_device_sz(source_rdev) - |
| 631 | (CSE_RW_VERSION_SZ + CSE_RW_SIGN_SIZE); |
| 632 | |
| 633 | /* Update except CSE RW signature */ |
| 634 | if (!cse_copy_rw(target_rdev, cse_cbfs_rw_wo_sign, CSE_RW_SIGN_SIZE, |
| 635 | cse_cbfs_rw_wo_sign_sz)) |
| 636 | goto exit_rw_update; |
| 637 | |
| 638 | /* Update CSE RW signature to indicate update is complete */ |
| 639 | if (!cse_copy_rw(target_rdev, (void *)cse_cbfs_rw, 0, CSE_RW_SIGN_SIZE)) |
| 640 | goto exit_rw_update; |
| 641 | |
| 642 | rdev_munmap(source_rdev, cse_cbfs_rw_wo_sign); |
| 643 | return true; |
| 644 | |
| 645 | exit_rw_update: |
| 646 | rdev_munmap(source_rdev, cse_cbfs_rw_wo_sign); |
| 647 | return false; |
| 648 | } |
| 649 | |
| 650 | static bool cse_update_rw(const struct cse_bp_info *cse_bp_info, |
| 651 | const struct region_device *source_rdev, struct region_device *target_rdev) |
| 652 | { |
| 653 | if (!cse_erase_rw_region(target_rdev)) |
| 654 | return false; |
| 655 | |
| 656 | if (!cse_write_rw_region(target_rdev, source_rdev)) |
| 657 | return false; |
| 658 | |
| 659 | printk(BIOS_INFO, "cse_lite: CSE RW Update Successful\n"); |
| 660 | return true; |
| 661 | } |
| 662 | |
Sridhar Siricilla | 2f6d555 | 2020-04-19 23:39:02 +0530 | [diff] [blame] | 663 | static bool cse_prep_for_rw_update(const struct cse_bp_info *cse_bp_info, |
| 664 | const struct region_device *source_rdev) |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 665 | { |
| 666 | /* |
| 667 | * To set CSE's operation mode to HMRFPO mode: |
| 668 | * 1. Ensure CSE to boot from RO(BP1) |
| 669 | * 2. Send HMRFPO_ENABLE command to CSE |
| 670 | */ |
| 671 | if (!cse_boot_to_ro(cse_bp_info)) |
| 672 | return false; |
| 673 | |
Sridhar Siricilla | 2f6d555 | 2020-04-19 23:39:02 +0530 | [diff] [blame] | 674 | if (cse_is_downgrade_instance(cse_bp_info, source_rdev) && |
| 675 | !cse_data_clear_request(cse_bp_info)) { |
| 676 | printk(BIOS_ERR, "cse_lite: CSE FW downgrade is aborted\n"); |
| 677 | return false; |
| 678 | } |
| 679 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 680 | return cse_hmrfpo_enable(); |
| 681 | } |
| 682 | |
| 683 | static uint8_t cse_trigger_fw_update(const struct cse_bp_info *cse_bp_info, |
| 684 | const struct region_device *source_rdev, struct region_device *target_rdev) |
| 685 | { |
Sridhar Siricilla | 2f6d555 | 2020-04-19 23:39:02 +0530 | [diff] [blame] | 686 | if (!cse_prep_for_rw_update(cse_bp_info, source_rdev)) |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 687 | return CSE_LITE_SKU_COMMUNICATION_ERROR; |
| 688 | |
| 689 | if (!cse_update_rw(cse_bp_info, source_rdev, target_rdev)) |
| 690 | return CSE_LITE_SKU_FW_UPDATE_ERROR; |
| 691 | |
| 692 | return 0; |
| 693 | } |
| 694 | |
| 695 | static uint8_t cse_fw_update(const struct cse_bp_info *cse_bp_info, |
| 696 | const struct region_device *source_rdev) |
| 697 | { |
| 698 | struct region_device target_rdev; |
| 699 | |
| 700 | if (!cse_get_target_rdev(cse_bp_info, &target_rdev)) { |
| 701 | printk(BIOS_ERR, "cse_lite: Failed to get CSE RW Partition\n"); |
| 702 | return CSE_LITE_SKU_RW_ACCESS_ERROR; |
| 703 | } |
| 704 | |
| 705 | if (cse_is_update_required(cse_bp_info, source_rdev, &target_rdev)) { |
| 706 | printk(BIOS_DEBUG, "cse_lite: CSE RW update is initiated\n"); |
| 707 | return cse_trigger_fw_update(cse_bp_info, source_rdev, &target_rdev); |
| 708 | } |
| 709 | |
| 710 | if (!cse_is_rw_bp_status_valid(cse_bp_info)) |
| 711 | return CSE_LITE_SKU_RW_JUMP_ERROR; |
| 712 | |
| 713 | return 0; |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 714 | } |
| 715 | |
| 716 | void cse_fw_sync(void *unused) |
| 717 | { |
| 718 | static struct get_bp_info_rsp cse_bp_info; |
| 719 | |
| 720 | if (vboot_recovery_mode_enabled()) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 721 | printk(BIOS_DEBUG, "cse_lite: Skip switching to RW in the recovery path\n"); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 722 | return; |
| 723 | } |
| 724 | |
Sridhar Siricilla | 99dbca3 | 2020-05-12 21:05:04 +0530 | [diff] [blame] | 725 | /* If CSE SKU type is not Lite, skip enabling CSE Lite SKU */ |
| 726 | if (!cse_is_hfs3_fw_sku_lite()) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 727 | printk(BIOS_ERR, "cse_lite: Not a CSE Lite SKU\n"); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 728 | return; |
| 729 | } |
| 730 | |
| 731 | if (!cse_get_bp_info(&cse_bp_info)) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 732 | printk(BIOS_ERR, "cse_lite: Failed to get CSE boot partition info\n"); |
Sridhar Siricilla | 87e36c4 | 2020-05-03 19:08:18 +0530 | [diff] [blame] | 733 | cse_trigger_recovery(CSE_LITE_SKU_COMMUNICATION_ERROR); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 734 | } |
| 735 | |
Sridhar Siricilla | 2f6d555 | 2020-04-19 23:39:02 +0530 | [diff] [blame] | 736 | if (!cse_fix_data_failure_err(&cse_bp_info.bp_info)) |
| 737 | cse_trigger_recovery(CSE_LITE_SKU_DATA_WIPE_ERROR); |
| 738 | |
Rizwan Qureshi | ec32109 | 2019-09-06 20:28:43 +0530 | [diff] [blame] | 739 | /* If RW blob is present in CBFS, then trigger CSE firmware update */ |
| 740 | uint8_t rv; |
| 741 | struct region_device source_rdev; |
| 742 | if (cse_get_cbfs_rdev(&source_rdev)) { |
| 743 | rv = cse_fw_update(&cse_bp_info.bp_info, &source_rdev); |
| 744 | if (rv) |
| 745 | cse_trigger_recovery(rv); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | if (!cse_boot_to_rw(&cse_bp_info.bp_info)) { |
Sridhar Siricilla | 9f71b17 | 2020-06-01 14:50:52 +0530 | [diff] [blame] | 749 | printk(BIOS_ERR, "cse_lite: Failed to switch to RW\n"); |
Sridhar Siricilla | 87e36c4 | 2020-05-03 19:08:18 +0530 | [diff] [blame] | 750 | cse_trigger_recovery(CSE_LITE_SKU_RW_SWITCH_ERROR); |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 751 | } |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 752 | } |
| 753 | |
Karthikeyan Ramasubramanian | cc05e31 | 2020-09-18 01:34:27 -0600 | [diff] [blame] | 754 | #if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_JASPERLAKE) |
Caveh Jalali | 9bc0411 | 2020-07-23 17:09:22 -0700 | [diff] [blame] | 755 | /* |
| 756 | * This needs to happen after the MRC cache write to avoid a 2nd |
| 757 | * memory training sequence. |
| 758 | */ |
| 759 | BOOT_STATE_INIT_ENTRY(BS_DEV_RESOURCES, BS_ON_ENTRY, cse_fw_sync, NULL); |
Jamie Ryu | bd8e761 | 2020-06-24 18:29:06 -0700 | [diff] [blame] | 760 | #else |
Sridhar Siricilla | f87ff33 | 2019-09-12 17:18:20 +0530 | [diff] [blame] | 761 | BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_ENTRY, cse_fw_sync, NULL); |
Jamie Ryu | bd8e761 | 2020-06-24 18:29:06 -0700 | [diff] [blame] | 762 | #endif |