From e2949b7c9c2d75589449547387c35dd1f3b11403 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Sat, 12 Nov 2022 01:52:52 +0100 Subject: drv/intel/fsp2_0/hand_off_block: rework fsp_find_extension_hob_by_guid Use the new fsp_hob_iterator_get_next_guid_extension function in fsp_find_extension_hob_by_guid instead of iterating through the HOB list in this function. TEST=AMD_FSP_DMI_HOB is still found and the same type 17 DMI info is printed on the console. Signed-off-by: Felix Held Change-Id: I4d4ce14c8a5494763de3f65ed049f98a768c40a5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/69478 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/drivers/intel/fsp2_0/hand_off_block.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/drivers/intel/fsp2_0') diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c index 2738c78988..2ded336994 100644 --- a/src/drivers/intel/fsp2_0/hand_off_block.c +++ b/src/drivers/intel/fsp2_0/hand_off_block.c @@ -233,22 +233,14 @@ void fsp_find_reserved_memory(struct range_entry *re) const void *fsp_find_extension_hob_by_guid(const uint8_t *guid, size_t *size) { - const uint8_t *hob_guid; - const struct hob_header *hob = fsp_get_hob_list(); + const struct hob_header *hob_iterator; + const void *hob_guid; - if (!hob) + if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) return NULL; - for (; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = fsp_next_hob(hob)) { - if (hob->type != HOB_TYPE_GUID_EXTENSION) - continue; - - hob_guid = hob_header_to_struct(hob); - if (fsp_guid_compare(hob_guid, guid)) { - *size = hob->length - (HOB_HEADER_LEN + 16); - return hob_header_to_extension_hob(hob); - } - } + if (fsp_hob_iterator_get_next_guid_extension(&hob_iterator, guid, &hob_guid, size) == CB_SUCCESS) + return hob_guid; return NULL; } -- cgit v1.2.3