From 2516947fd95c771295abbb53f5a856535d96dcff Mon Sep 17 00:00:00 2001 From: Felix Held Date: Sat, 12 Nov 2022 01:42:39 +0100 Subject: drivers/intel/fsp2_0/hand_off_block: use iterator in fsp_find_range_hob Drop the find_resource_hob_by_guid implementation and use the new fsp_hob_iterator_init and fsp_hob_iterator_get_next_guid_resource functions in fsp_find_range_hob. TEST=Mandolin still finds the TSEG range HOB and uses the correct TSEG location. Signed-off-by: Felix Held Change-Id: I00786cbeea203fba195ddc953c3242be544a7d70 Reviewed-on: https://review.coreboot.org/c/coreboot/+/69477 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/drivers/intel/fsp2_0/hand_off_block.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c index 13fbb06eef..2738c78988 100644 --- a/src/drivers/intel/fsp2_0/hand_off_block.c +++ b/src/drivers/intel/fsp2_0/hand_off_block.c @@ -190,23 +190,6 @@ enum cb_err fsp_hob_iterator_get_next_guid_extension(const struct hob_header **h return CB_ERR; } -static const -struct hob_resource *find_resource_hob_by_guid(const struct hob_header *hob, - const uint8_t guid[16]) -{ - const struct hob_resource *res; - - for (; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = fsp_next_hob(hob)) { - if (hob->type != HOB_TYPE_RESOURCE_DESCRIPTOR) - continue; - - res = fsp_hob_header_to_resource(hob); - if (fsp_guid_compare(res->owner_guid, guid)) - return res; - } - return NULL; -} - void fsp_print_guid(const void *base) { uint32_t big; @@ -224,17 +207,15 @@ void fsp_print_guid(const void *base) int fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16]) { + const struct hob_header *hob_iterator; const struct hob_resource *fsp_mem; - const void *hob_list = fsp_get_hob_list(); - if (!hob_list) + if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) return -1; range_entry_init(re, 0, 0, 0); - fsp_mem = find_resource_hob_by_guid(hob_list, guid); - - if (!fsp_mem) { + if (fsp_hob_iterator_get_next_guid_resource(&hob_iterator, guid, &fsp_mem) != CB_SUCCESS) { fsp_print_guid(guid); printk(BIOS_SPEW, " not found!\n"); return -1; -- cgit v1.2.3