diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2023-02-27 20:21:09 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-02-28 20:25:07 +0000 |
commit | a77bb32573f0c23e11a745050b15dab2300ae2b0 (patch) | |
tree | 2169b82ebe8c9a95ad16bb0acacda991cce3b554 /src/soc | |
parent | 6457ba17b29a1fbcfea88d73c37d2eb2f38dd216 (diff) |
soc/amd/common/block/apob/apob_cache: use enum cb_err
Use enum cb_err to return an error/success state instead of an int in
get_nv_rdev and get_nv_rdev_rw.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I73706a93bc1dbc8556e11885faf7f486c468bea9
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73317
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/amd/common/block/apob/apob_cache.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/soc/amd/common/block/apob/apob_cache.c b/src/soc/amd/common/block/apob/apob_cache.c index 5eab44be62..06dc5977c7 100644 --- a/src/soc/amd/common/block/apob/apob_cache.c +++ b/src/soc/amd/common/block/apob/apob_cache.c @@ -90,26 +90,26 @@ static void *get_apob_dram_address(void) return apob_src_ram; } -static int get_nv_rdev(struct region_device *r) +static enum cb_err get_nv_rdev(struct region_device *r) { if (fmap_locate_area_as_rdev(vboot_recovery_mode_enabled() ? RECOVERY_MRC_CACHE : DEFAULT_MRC_CACHE, r) < 0) { printk(BIOS_ERR, "No APOB NV region is found in flash\n"); - return -1; + return CB_ERR; } - return 0; + return CB_SUCCESS; } -static int get_nv_rdev_rw(struct region_device *r) +static enum cb_err get_nv_rdev_rw(struct region_device *r) { if (fmap_locate_area_as_rdev_rw(vboot_recovery_mode_enabled() ? RECOVERY_MRC_CACHE : DEFAULT_MRC_CACHE, r) < 0) { printk(BIOS_ERR, "No APOB NV region is found in flash\n"); - return -1; + return CB_ERR; } - return 0; + return CB_SUCCESS; } static struct apob_thread_context { @@ -146,7 +146,7 @@ void start_apob_cache_read(void) if (acpi_is_wakeup_s3()) return; - if (get_nv_rdev(&thread->apob_rdev) != 0) + if (get_nv_rdev(&thread->apob_rdev) != CB_SUCCESS) return; assert(ARRAY_SIZE(thread->buffer) == region_device_sz(&thread->apob_rdev)); @@ -210,7 +210,7 @@ static void soc_update_apob_cache(void *unused) if (apob_src_ram == NULL) return; - if (get_nv_rdev(&read_rdev) != 0) + if (get_nv_rdev(&read_rdev) != CB_SUCCESS) return; timestamp_add_now(TS_AMD_APOB_READ_START); @@ -251,7 +251,7 @@ static void soc_update_apob_cache(void *unused) apob_src_ram, apob_src_ram->size, region_device_offset(&read_rdev), region_device_sz(&read_rdev)); - if (get_nv_rdev_rw(&write_rdev) != 0) + if (get_nv_rdev_rw(&write_rdev) != CB_SUCCESS) return; timestamp_add_now(TS_AMD_APOB_ERASE_START); @@ -281,7 +281,7 @@ static void *get_apob_nv_address(void) { struct region_device rdev; - if (get_nv_rdev(&rdev) != 0) + if (get_nv_rdev(&rdev) != CB_SUCCESS) return NULL; return get_apob_from_nv_rdev(&rdev); |