[coreboot-gerrit] Patch set updated for coreboot: drivers/intel/fsp2_0: Add utility to get extension handoff-blocks

Alexandru Gagniuc (mr.nuke.me@gmail.com) gerrit at coreboot.org
Mon Jan 25 06:41:39 CET 2016


Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13382

-gerrit

commit 26488ce610d957412306cd496e4a19f23dae3023
Author: Alexandru Gagniuc <alexandrux.gagniuc at intel.com>
Date:   Tue Dec 15 12:55:56 2015 -0800

    drivers/intel/fsp2_0: Add utility to get extension handoff-blocks
    
    Some handoff blocks(HOB) contain useful information (e.g. framebuffer).
    Since every extension HOB has a uuid, the utility uses this to
    uniquely identify a HOB.
    
    Change-Id: Ic1f35cb14be37a213749bfdca301d88b6025e310
    Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc at intel.com>
---
 src/drivers/intel/fsp2_0/hand_off_block.c   | 36 +++++++++++++++++++++++++++++
 src/drivers/intel/fsp2_0/include/fsp/util.h |  1 +
 2 files changed, 37 insertions(+)

diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c
index 8529b58..7e47525 100644
--- a/src/drivers/intel/fsp2_0/hand_off_block.c
+++ b/src/drivers/intel/fsp2_0/hand_off_block.c
@@ -123,6 +123,19 @@ static const void *hob_header_to_struct(const struct hob_header *hob)
 	return hob_walker.hob_descr;
 }
 
+static const void *hob_header_to_extension_hob(const struct hob_header *hob)
+{
+	union {
+		const struct hob_header *hob_hdr;
+		const void *hob_descr;
+		uintptr_t addr;
+	} hob_walker;
+
+	hob_walker.hob_hdr = hob;
+	hob_walker.addr += HOB_HEADER_LEN + 16; /* header and 16-byte UUID */
+	return hob_walker.hob_descr;
+}
+
 static const
 struct hob_resource *hob_header_to_resource(const struct hob_header *hob)
 {
@@ -228,3 +241,26 @@ void fsp_print_memory_resource_hobs(const void *hob_list)
 			print_resource_descriptor(hob);
 	}
 }
+
+const void *fsp_find_extension_hob_by_uuid(const uint8_t *uuid, size_t *size)
+{
+	const uint8_t *hob_uuid;
+	const struct hob_header *hob = fsp_get_hob_list();
+
+	if (!hob)
+		return NULL;
+
+	for ( ; hob->type != HOB_TYPE_END_OF_HOB_LIST; hob = next_hob(hob)) {
+
+		if (hob->type != HOB_TYPE_GUID_EXTENSION)
+			continue;
+
+		hob_uuid = hob_header_to_struct(hob);
+		if (uuid_compare(hob_uuid, uuid)) {
+			*size = hob->length - (HOB_HEADER_LEN + 16);
+			return hob_header_to_extension_hob(hob);
+		}
+	}
+
+	return NULL;
+}
diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h
index 0e3f412..4c47987 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/util.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/util.h
@@ -22,6 +22,7 @@
  */
 void fsp_save_hob_list(void *hob_list_ptr);
 const void *fsp_get_hob_list(void);
+const void *fsp_find_extension_hob_by_uuid(const uint8_t *uuid, size_t *size);
 /*
  * Hand-off-block utilities which do not depend on CBMEM, but need to be passed
  * the HOB list explicitly.



More information about the coreboot-gerrit mailing list