commonlib/bsd: Remove cb_err_t

cb_err_t was meant to be used in place of `enum cb_err` in all
situations, but the choice to use a typedef here seems to be
controversial. We should not be arbitrarily using two different
identifiers for the same thing across the codebase, so since there are
no use cases for serializing enum cb_err at the moment (which would be
the primary reason to typedef a fixed-width integer instead), remove
cb_err_t again for now.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: Iaec36210d129db26d51f0a105d3de070c03b686b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62600
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Julius Werner
2022-03-04 17:49:56 -08:00
parent 270b0b60ac
commit 69cc557cfb
22 changed files with 119 additions and 121 deletions

View File

@ -34,15 +34,15 @@ static void switch_to_postram_cache(int unused)
}
ROMSTAGE_CBMEM_INIT_HOOK(switch_to_postram_cache);
cb_err_t _cbfs_boot_lookup(const char *name, bool force_ro,
union cbfs_mdata *mdata, struct region_device *rdev)
enum cb_err _cbfs_boot_lookup(const char *name, bool force_ro,
union cbfs_mdata *mdata, struct region_device *rdev)
{
const struct cbfs_boot_device *cbd = cbfs_get_boot_device(force_ro);
if (!cbd)
return CB_ERR;
size_t data_offset;
cb_err_t err = CB_CBFS_CACHE_FULL;
enum cb_err err = CB_CBFS_CACHE_FULL;
if (!CONFIG(NO_CBFS_MCACHE) && !ENV_SMM && cbd->mcache_size)
err = cbfs_mcache_lookup(cbd->mcache, cbd->mcache_size,
name, mdata, &data_offset);
@ -520,11 +520,11 @@ void *_cbfs_cbmem_allocator(void *arg, size_t size, const union cbfs_mdata *unus
return cbmem_add((uintptr_t)arg, size);
}
cb_err_t cbfs_prog_stage_load(struct prog *pstage)
enum cb_err cbfs_prog_stage_load(struct prog *pstage)
{
union cbfs_mdata mdata;
struct region_device rdev;
cb_err_t err;
enum cb_err err;
prog_locate_hook(pstage);
@ -612,8 +612,8 @@ void cbfs_boot_device_find_mcache(struct cbfs_boot_device *cbd, uint32_t id)
}
}
cb_err_t cbfs_init_boot_device(const struct cbfs_boot_device *cbd,
struct vb2_hash *mdata_hash)
enum cb_err cbfs_init_boot_device(const struct cbfs_boot_device *cbd,
struct vb2_hash *mdata_hash)
{
/* If we have an mcache, mcache_build() will also check mdata hash. */
if (!CONFIG(NO_CBFS_MCACHE) && !ENV_SMM && cbd->mcache_size > 0)
@ -625,7 +625,7 @@ cb_err_t cbfs_init_boot_device(const struct cbfs_boot_device *cbd,
/* Verification only: use cbfs_walk() without a walker() function to just run through
the CBFS once, will return NOT_FOUND by default. */
cb_err_t err = cbfs_walk(&cbd->rdev, NULL, NULL, mdata_hash, 0);
enum cb_err err = cbfs_walk(&cbd->rdev, NULL, NULL, mdata_hash, 0);
if (err == CB_CBFS_NOT_FOUND)
err = CB_SUCCESS;
return err;
@ -660,7 +660,7 @@ const struct cbfs_boot_device *cbfs_get_boot_device(bool force_ro)
die("Cannot locate primary CBFS");
if (ENV_INITIAL_STAGE) {
cb_err_t err = cbfs_init_boot_device(&ro, metadata_hash_get());
enum cb_err err = cbfs_init_boot_device(&ro, metadata_hash_get());
if (err == CB_CBFS_HASH_MISMATCH)
die("RO CBFS metadata hash verification failure");
else if (CONFIG(TOCTOU_SAFETY) && err == CB_CBFS_CACHE_FULL)