diff options
author | Sridhar Siricilla <sridhar.siricilla@intel.com> | 2023-01-10 14:59:35 +0530 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2023-01-15 01:56:23 +0000 |
commit | ad6d3128f87c47369f015122ae3e9905de7a0df9 (patch) | |
tree | 1f1cb4c7ff4f30179cae118112a415232156ceba /src/soc/intel | |
parent | 2fed41d46275999061be637dcd26d7dd3a2737e6 (diff) |
soc/intel/common: Use enum cb_err values
The patch uses cb_err enum values as return values for below functions:
1. cse_hmrfpo_enable()
2. cse_boot_to_ro()
3. cse_prep_for_rw_update()
4. cse_sub_part_get_target_rdev()
5. cse_get_sub_part_fw_version()
6. cse_prep_for_component_update()
Signed-off-by: Sridhar Siricilla <sridhar.siricilla@intel.com>
Change-Id: I1bdb7d6b2051a69f1021673d464bfad63dd39431
Reviewed-on: https://review.coreboot.org/c/coreboot/+/71823
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Diffstat (limited to 'src/soc/intel')
-rw-r--r-- | src/soc/intel/common/block/cse/cse.c | 14 | ||||
-rw-r--r-- | src/soc/intel/common/block/cse/cse_lite.c | 48 | ||||
-rw-r--r-- | src/soc/intel/common/block/include/intelblocks/cse.h | 2 |
3 files changed, 32 insertions, 32 deletions
diff --git a/src/soc/intel/common/block/cse/cse.c b/src/soc/intel/common/block/cse/cse.c index 82f619a1fd..ad99e1fe6e 100644 --- a/src/soc/intel/common/block/cse/cse.c +++ b/src/soc/intel/common/block/cse/cse.c @@ -758,7 +758,7 @@ static bool cse_is_hmrfpo_enable_allowed(void) } /* Sends HMRFPO Enable command to CSE */ -int cse_hmrfpo_enable(void) +enum cb_err cse_hmrfpo_enable(void) { struct hmrfpo_enable_msg { struct mkhi_hdr hdr; @@ -791,31 +791,31 @@ int cse_hmrfpo_enable(void) if (cse_is_hfs1_com_secover_mei_msg()) { printk(BIOS_DEBUG, "HECI: CSE is already in security override mode, " "skip sending HMRFPO_ENABLE command to CSE\n"); - return 1; + return CB_SUCCESS; } printk(BIOS_DEBUG, "HECI: Send HMRFPO Enable Command\n"); if (!cse_is_hmrfpo_enable_allowed()) { printk(BIOS_ERR, "HECI: CSE does not meet required prerequisites\n"); - return 0; + return CB_ERR; } if (heci_send_receive(&msg, sizeof(struct hmrfpo_enable_msg), &resp, &resp_size, HECI_MKHI_ADDR)) - return 0; + return CB_ERR; if (resp.hdr.result) { printk(BIOS_ERR, "HECI: Resp Failed:%d\n", resp.hdr.result); - return 0; + return CB_ERR; } if (resp.status) { printk(BIOS_ERR, "HECI: HMRFPO_Enable Failed (resp status: %d)\n", resp.status); - return 0; + return CB_ERR; } - return 1; + return CB_SUCCESS; } /* diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c index 8a6ff8eee9..08a3d1fef5 100644 --- a/src/soc/intel/common/block/cse/cse_lite.c +++ b/src/soc/intel/common/block/cse/cse_lite.c @@ -477,10 +477,10 @@ static bool cse_is_rw_bp_status_valid(const struct cse_bp_info *cse_bp_info) return true; } -static bool cse_boot_to_ro(const struct cse_bp_info *cse_bp_info) +static enum cb_err cse_boot_to_ro(const struct cse_bp_info *cse_bp_info) { if (cse_get_current_bp(cse_bp_info) == RO) - return true; + return CB_SUCCESS; return cse_set_and_boot_from_next_bp(RO); } @@ -720,7 +720,7 @@ static enum csme_failure_reason cse_update_rw(const struct cse_bp_info *cse_bp_i return CSE_NO_ERROR; } -static bool cse_prep_for_rw_update(const struct cse_bp_info *cse_bp_info, +static enum cb_err cse_prep_for_rw_update(const struct cse_bp_info *cse_bp_info, enum cse_update_status status) { /* @@ -728,13 +728,13 @@ static bool cse_prep_for_rw_update(const struct cse_bp_info *cse_bp_info, * 1. Ensure CSE to boot from RO(BP1) * 2. Send HMRFPO_ENABLE command to CSE */ - if (!cse_boot_to_ro(cse_bp_info)) - return false; + if (cse_boot_to_ro(cse_bp_info) != CB_SUCCESS) + return CB_ERR; if ((status == CSE_UPDATE_DOWNGRADE) || (status == CSE_UPDATE_CORRUPTED)) { if (cse_data_clear_request(cse_bp_info) != CB_SUCCESS) { printk(BIOS_ERR, "cse_lite: CSE data clear failed!\n"); - return false; + return CB_SUCCESS; } } @@ -779,7 +779,7 @@ static enum csme_failure_reason cse_trigger_fw_update(const struct cse_bp_info * goto error_exit; } - if (!cse_prep_for_rw_update(cse_bp_info, status)) { + if (cse_prep_for_rw_update(cse_bp_info, status) != CB_SUCCESS) { rv = CSE_COMMUNICATION_ERROR; goto error_exit; } @@ -850,7 +850,7 @@ static bool cse_locate_area_as_rdev_rw(const struct cse_bp_info *cse_bp_info, return true; } -static bool cse_sub_part_get_target_rdev(const struct cse_bp_info *cse_bp_info, +static enum cb_err cse_sub_part_get_target_rdev(const struct cse_bp_info *cse_bp_info, struct region_device *target_rdev, size_t bp, enum bpdt_entry_type type) { struct bpdt_header bpdt_hdr; @@ -861,19 +861,19 @@ static bool cse_sub_part_get_target_rdev(const struct cse_bp_info *cse_bp_info, if (!cse_locate_area_as_rdev_rw(cse_bp_info, bp, &cse_rdev)) { printk(BIOS_ERR, "cse_lite: Failed to locate %s in the CSE Region\n", cse_regions[bp]); - return false; + return CB_ERR; } if ((rdev_readat(&cse_rdev, &bpdt_hdr, 0, BPDT_HEADER_SZ)) != BPDT_HEADER_SZ) { printk(BIOS_ERR, "cse_lite: Failed to read BPDT header from CSE region\n"); - return false; + return CB_ERR; } if ((rdev_readat(&cse_rdev, bpdt_entries, BPDT_HEADER_SZ, (bpdt_hdr.descriptor_count * BPDT_ENTRY_SZ))) != (bpdt_hdr.descriptor_count * BPDT_ENTRY_SZ)) { printk(BIOS_ERR, "cse_lite: Failed to read BPDT entries from CSE region\n"); - return false; + return CB_ERR; } /* walk through BPDT entries to identify sub-partition's payload offset and size */ @@ -885,17 +885,17 @@ static bool cse_sub_part_get_target_rdev(const struct cse_bp_info *cse_bp_info, if (rdev_chain(target_rdev, &cse_rdev, bpdt_entries[i].offset, bpdt_entries[i].size)) - return false; + return CB_ERR; else - return true; + return CB_SUCCESS; } } printk(BIOS_ERR, "cse_lite: Sub-partition %s is not found\n", cse_sub_part_str(type)); - return false; + return CB_ERR; } -static bool cse_get_sub_part_fw_version(enum bpdt_entry_type type, +static enum cb_err cse_get_sub_part_fw_version(enum bpdt_entry_type type, const struct region_device *rdev, struct fw_version *fw_ver) { @@ -906,14 +906,14 @@ static bool cse_get_sub_part_fw_version(enum bpdt_entry_type type, != SUBPART_ENTRY_SZ) { printk(BIOS_ERR, "cse_lite: Failed to read %s sub partition entry\n", cse_sub_part_str(type)); - return false; + return CB_ERR; } if ((rdev_readat(rdev, &man_hdr, subpart_entry.offset_bytes, SUBPART_MANIFEST_HDR_SZ)) != SUBPART_MANIFEST_HDR_SZ) { printk(BIOS_ERR, "cse_lite: Failed to read %s Sub part entry #0 manifest\n", cse_sub_part_str(type)); - return false; + return CB_ERR; } fw_ver->major = man_hdr.binary_version.major; @@ -921,7 +921,7 @@ static bool cse_get_sub_part_fw_version(enum bpdt_entry_type type, fw_ver->hotfix = man_hdr.binary_version.hotfix; fw_ver->build = man_hdr.binary_version.build; - return true; + return CB_SUCCESS; } static void cse_sub_part_get_source_fw_version(void *subpart_cbfs_rw, struct fw_version *fw_ver) @@ -939,15 +939,15 @@ static void cse_sub_part_get_source_fw_version(void *subpart_cbfs_rw, struct fw_ fw_ver->build = man_hdr->binary_version.build; } -static bool cse_prep_for_component_update(const struct cse_bp_info *cse_bp_info) +static enum cb_err cse_prep_for_component_update(const struct cse_bp_info *cse_bp_info) { /* * To set CSE's operation mode to HMRFPO mode: * 1. Ensure CSE to boot from RO(BP1) * 2. Send HMRFPO_ENABLE command to CSE */ - if (!cse_boot_to_ro(cse_bp_info)) - return false; + if (cse_boot_to_ro(cse_bp_info) != CB_SUCCESS) + return CB_ERR; return cse_hmrfpo_enable(); } @@ -1012,12 +1012,12 @@ static enum csme_failure_reason cse_sub_part_fw_component_update(enum bpdt_entry /* Trigger sub-partition update in CSE RO and CSE RW */ for (size_t bp = 0; bp < ARRAY_SIZE(cse_regions); bp++) { - if (!cse_sub_part_get_target_rdev(cse_bp_info, &target_rdev, bp, type)) { + if (cse_sub_part_get_target_rdev(cse_bp_info, &target_rdev, bp, type) != CB_SUCCESS) { rv = CSE_LITE_SKU_SUB_PART_ACCESS_ERR; goto error_exit; } - if (!cse_get_sub_part_fw_version(type, &target_rdev, &target_fw_ver)) { + if (cse_get_sub_part_fw_version(type, &target_rdev, &target_fw_ver) != CB_SUCCESS) { rv = CSE_LITE_SKU_SUB_PART_ACCESS_ERR; goto error_exit; } @@ -1036,7 +1036,7 @@ static enum csme_failure_reason cse_sub_part_fw_component_update(enum bpdt_entry printk(BIOS_INFO, "CSE %s %s Update initiated\n", GET_BP_STR(bp), cse_sub_part_str(type)); - if (!cse_prep_for_component_update(cse_bp_info)) { + if (cse_prep_for_component_update(cse_bp_info) != CB_SUCCESS) { rv = CSE_LITE_SKU_SUB_PART_ACCESS_ERR; goto error_exit; } diff --git a/src/soc/intel/common/block/include/intelblocks/cse.h b/src/soc/intel/common/block/include/intelblocks/cse.h index bccdc4ead4..356df0560d 100644 --- a/src/soc/intel/common/block/include/intelblocks/cse.h +++ b/src/soc/intel/common/block/include/intelblocks/cse.h @@ -405,7 +405,7 @@ int cse_request_global_reset(void); * Returns 0 on failure to send HECI command and to enable HMRFPO mode, and 1 on success. * */ -int cse_hmrfpo_enable(void); +enum cb_err cse_hmrfpo_enable(void); /* * Send HMRFPO_GET_STATUS command. |