1 // SPDX-License-Identifier: Intel
3 * Copyright (C) 2013, Intel Corporation
10 * Returns the next instance of a HOB type from the starting HOB.
12 * @type: HOB type to search
13 * @hob_list: A pointer to the HOB list
15 * Return: A HOB object with matching type; Otherwise NULL.
17 const struct hob_header *hob_get_next_hob(uint type, const void *hob_list)
19 const struct hob_header *hdr;
23 /* Parse the HOB list until end of list or matching type is found */
24 while (!end_of_hob(hdr)) {
25 if (hdr->type == type)
28 hdr = get_next_hob(hdr);
35 * Returns the next instance of the matched GUID HOB from the starting HOB.
37 * @guid: GUID to search
38 * @hob_list: A pointer to the HOB list
40 * Return: A HOB object with matching GUID; Otherwise NULL.
42 const struct hob_header *hob_get_next_guid_hob(const efi_guid_t *guid,
45 const struct hob_header *hdr;
46 struct hob_guid *guid_hob;
49 while ((hdr = hob_get_next_hob(HOB_TYPE_GUID_EXT, hdr))) {
50 guid_hob = (struct hob_guid *)hdr;
51 if (!guidcmp(guid, &guid_hob->name))
53 hdr = get_next_hob(hdr);
60 * This function retrieves a GUID HOB data buffer and size.
62 * @hob_list: A HOB list pointer.
63 * @len: A pointer to the GUID HOB data buffer length.
64 * If the GUID HOB is located, the length will be updated.
65 * @guid A pointer to HOB GUID.
67 * Return: NULL: Failed to find the GUID HOB.
68 * Return: others: GUID HOB data buffer pointer.
70 void *hob_get_guid_hob_data(const void *hob_list, u32 *len,
71 const efi_guid_t *guid)
73 const struct hob_header *guid_hob;
75 guid_hob = hob_get_next_guid_hob(guid, hob_list);
80 *len = get_guid_hob_data_size(guid_hob);
82 return get_guid_hob_data(guid_hob);