drivers/intel/fsp2_0/hand_off_block: use cb_err in fsp_find_range_hob

Use enum cb_err as return value of fsp_find_range_hob instead of using
the raw -1 and 0 values. Also update the call sites accordingly.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Id6c9f69a886f53868f1ef543c8fa04be95381f53
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74082
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-by: Pratikkumar V Prajapati <pratikkumar.v.prajapati@intel.com>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
This commit is contained in:
Felix Held 2023-03-29 15:58:36 +02:00
parent 883a4c2b22
commit 1aa094a9af
3 changed files with 8 additions and 8 deletions

View File

@ -210,29 +210,29 @@ void fsp_print_guid(int level, const void *base)
id[8], id[9], id[10], id[11], id[12], id[13], id[14], id[15]); id[8], id[9], id[10], id[11], id[12], id[13], id[14], id[15]);
} }
int fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16]) enum cb_err fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16])
{ {
const struct hob_header *hob_iterator; const struct hob_header *hob_iterator;
const struct hob_resource *fsp_mem; const struct hob_resource *fsp_mem;
if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS)
return -1; return CB_ERR;
range_entry_init(re, 0, 0, 0); range_entry_init(re, 0, 0, 0);
if (fsp_hob_iterator_get_next_guid_resource(&hob_iterator, guid, &fsp_mem) != CB_SUCCESS) { if (fsp_hob_iterator_get_next_guid_resource(&hob_iterator, guid, &fsp_mem) != CB_SUCCESS) {
fsp_print_guid(BIOS_SPEW, guid); fsp_print_guid(BIOS_SPEW, guid);
printk(BIOS_SPEW, " not found!\n"); printk(BIOS_SPEW, " not found!\n");
return -1; return CB_ERR;
} }
range_entry_init(re, fsp_mem->addr, fsp_mem->addr + fsp_mem->length, 0); range_entry_init(re, fsp_mem->addr, fsp_mem->addr + fsp_mem->length, 0);
return 0; return CB_SUCCESS;
} }
void fsp_find_reserved_memory(struct range_entry *re) void fsp_find_reserved_memory(struct range_entry *re)
{ {
if (fsp_find_range_hob(re, fsp_reserved_memory_guid)) if (fsp_find_range_hob(re, fsp_reserved_memory_guid) != CB_SUCCESS)
die("9.1: FSP_RESERVED_MEMORY_RESOURCE_HOB missing!\n"); die("9.1: FSP_RESERVED_MEMORY_RESOURCE_HOB missing!\n");
} }
@ -372,7 +372,7 @@ const void *fsp_find_nv_storage_data(size_t *size)
void fsp_find_bootloader_tolum(struct range_entry *re) void fsp_find_bootloader_tolum(struct range_entry *re)
{ {
if (fsp_find_range_hob(re, fsp_bootloader_tolum_guid)) if (fsp_find_range_hob(re, fsp_bootloader_tolum_guid) != CB_SUCCESS)
die("9.3: FSP_BOOTLOADER_TOLUM_HOB missing!\n"); die("9.3: FSP_BOOTLOADER_TOLUM_HOB missing!\n");
} }

View File

@ -129,7 +129,7 @@ const void *fsp_get_hob_list(void);
void *fsp_get_hob_list_ptr(void); void *fsp_get_hob_list_ptr(void);
const void *fsp_find_extension_hob_by_guid(const uint8_t *guid, size_t *size); const void *fsp_find_extension_hob_by_guid(const uint8_t *guid, size_t *size);
const void *fsp_find_nv_storage_data(size_t *size); const void *fsp_find_nv_storage_data(size_t *size);
int fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16]); enum cb_err fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16]);
void fsp_display_fvi_version_hob(void); void fsp_display_fvi_version_hob(void);
void fsp_find_reserved_memory(struct range_entry *re); void fsp_find_reserved_memory(struct range_entry *re);
const struct hob_resource *fsp_hob_header_to_resource( const struct hob_resource *fsp_hob_header_to_resource(

View File

@ -46,7 +46,7 @@ void smm_region(uintptr_t *start, size_t *size)
struct range_entry tseg; struct range_entry tseg;
if (fsp_find_range_hob(&tseg, AMD_FSP_TSEG_HOB_GUID.b) < 0) { if (fsp_find_range_hob(&tseg, AMD_FSP_TSEG_HOB_GUID.b) != CB_SUCCESS) {
printk(BIOS_ERR, "unable to find TSEG HOB\n"); printk(BIOS_ERR, "unable to find TSEG HOB\n");
return; return;
} }