summaryrefslogtreecommitdiff
path: root/src/soc/intel/common
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2021-04-13 15:28:12 -0700
committerJulius Werner <jwerner@chromium.org>2021-11-30 00:27:37 +0000
commit18881f993c96591b73bdffc0a7974b9441579c6e (patch)
tree62bef6e45d4b69a4bab169c1eeec5cf639dd709e /src/soc/intel/common
parent05714ccab70a8a36382351e22ce3d31d86a47bef (diff)
intel: cse_lite: Use cbfs_unverified_area API
This patch replaces the use of the deprecated cbfs_locate_file_in_region() API with the new cbfs_unverified_area_map(). Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: If4855280d6d06cf1aa646fded916fd830b287b30 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59679 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r--src/soc/intel/common/block/cse/cse_lite.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c
index 281d381736..bb644443e2 100644
--- a/src/soc/intel/common/block/cse/cse_lite.c
+++ b/src/soc/intel/common/block/cse/cse_lite.c
@@ -2,7 +2,6 @@
#include <console/console.h>
#include <cbfs.h>
-#include <commonlib/cbfs.h>
#include <commonlib/region.h>
#include <fmap.h>
#include <intelblocks/cse.h>
@@ -476,26 +475,6 @@ static const char *cse_get_source_rdev_fmap(void)
return CONFIG_SOC_INTEL_CSE_RW_B_FMAP_NAME;
}
-static bool cse_get_source_rdev(struct region_device *rdev)
-{
- const char *reg_name;
- uint32_t cbfs_type = CBFS_TYPE_RAW;
- struct cbfsf fh;
-
- reg_name = cse_get_source_rdev_fmap();
-
- if (reg_name == NULL)
- return false;
-
- if (cbfs_locate_file_in_region(&fh, reg_name, CONFIG_SOC_INTEL_CSE_RW_CBFS_NAME,
- &cbfs_type) < 0)
- return false;
-
- cbfs_file_data(rdev, &fh);
-
- return true;
-}
-
/*
* Compare versions of CSE CBFS RW and CSE RW partition
* If ver_cmp_status = 0, no update is required
@@ -686,15 +665,16 @@ static enum csme_failure_reason cse_trigger_fw_update(const struct cse_bp_info *
enum cse_update_status status,
struct region_device *target_rdev)
{
- struct region_device source_rdev;
enum csme_failure_reason rv;
uint8_t *cbfs_rw_hash;
+ size_t size;
- if (!cse_get_source_rdev(&source_rdev))
+ const char *area_name = cse_get_source_rdev_fmap();
+ if (!area_name)
return CSE_LITE_SKU_RW_BLOB_NOT_FOUND;
- void *cse_cbfs_rw = rdev_mmap_full(&source_rdev);
-
+ void *cse_cbfs_rw = cbfs_unverified_area_map(area_name,
+ CONFIG_SOC_INTEL_CSE_RW_CBFS_NAME, &size);
if (!cse_cbfs_rw) {
printk(BIOS_ERR, "cse_lite: CSE CBFS RW blob could not be mapped\n");
return CSE_LITE_SKU_RW_BLOB_NOT_FOUND;
@@ -708,8 +688,7 @@ static enum csme_failure_reason cse_trigger_fw_update(const struct cse_bp_info *
goto error_exit;
}
- if (!cse_verify_cbfs_rw_sha256(cbfs_rw_hash, cse_cbfs_rw,
- region_device_sz(&source_rdev))) {
+ if (!cse_verify_cbfs_rw_sha256(cbfs_rw_hash, cse_cbfs_rw, size)) {
rv = CSE_LITE_SKU_RW_BLOB_SHA256_MISMATCH;
goto error_exit;
}
@@ -719,12 +698,11 @@ static enum csme_failure_reason cse_trigger_fw_update(const struct cse_bp_info *
goto error_exit;
}
- rv = cse_update_rw(cse_bp_info, cse_cbfs_rw, region_device_sz(&source_rdev),
- target_rdev);
+ rv = cse_update_rw(cse_bp_info, cse_cbfs_rw, size, target_rdev);
error_exit:
cbfs_unmap(cbfs_rw_hash);
- rdev_munmap(&source_rdev, cse_cbfs_rw);
+ cbfs_unmap(cse_cbfs_rw);
return rv;
}