[coreboot-gerrit] Change in coreboot[master]: nb/intel/common: add ability to load OpRegion VBT from CBFS

Matt DeVillier (Code Review) gerrit at coreboot.org
Fri Jun 23 20:19:00 CEST 2017


Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/20317


Change subject: nb/intel/common: add ability to load OpRegion VBT from CBFS
......................................................................

nb/intel/common: add ability to load OpRegion VBT from CBFS

Currently, OpRegion VBT data is read from VBIOS data in
memory, but in cases of NGI or payload-initialized display,
a VBIOS may not be present. Add the option to load the VBT
data directly from CBFS, as is done on newer platforms.

Change-Id: I7c76ed8362f89179d639629f8059857192c8d8d2
Signed-off-by: Matt DeVillier <matt.devillier at gmail.com>
---
M src/northbridge/intel/common/gma_opregion.c
1 file changed, 39 insertions(+), 2 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/17/20317/1

diff --git a/src/northbridge/intel/common/gma_opregion.c b/src/northbridge/intel/common/gma_opregion.c
index 7d4c3f1..f6fba57 100644
--- a/src/northbridge/intel/common/gma_opregion.c
+++ b/src/northbridge/intel/common/gma_opregion.c
@@ -15,6 +15,7 @@
 
 #include <types.h>
 #include <string.h>
+#include <cbfs.h>
 #include <console/console.h>
 #include <arch/acpi.h>
 #include <device/pci.h>
@@ -49,7 +50,7 @@
 	return NULL;
 }
 
-static enum cb_err init_opregion_vbt(igd_opregion_t *opregion)
+static enum cb_err init_opregion_vbt_vbios(igd_opregion_t *opregion)
 {
 	void *vbios;
 	vbios = get_intel_vbios();
@@ -71,6 +72,38 @@
 	memcpy(opregion->header.vbios_version, vbt->coreblock_biosbuild, 4);
 	memcpy(opregion->vbt.gvd1, vbt, vbt->hdr_vbt_size < 7168 ?
 						vbt->hdr_vbt_size : 7168);
+
+	return CB_SUCCESS;
+}
+
+/* Reading VBT table from flash */
+static enum cb_err init_opregion_vbt_cbfs(igd_opregion_t *opregion)
+{
+	size_t vbt_size;
+	union {
+		const optionrom_vbt_t *data;
+		uint32_t *signature;
+	} vbt;
+
+	/* Locate the vbt file in cbfs */
+	vbt.data = cbfs_boot_map_with_leak("vbt.bin", CBFS_TYPE_RAW, &vbt_size);
+	if (!vbt.data) {
+		printk(BIOS_ERR, "vbt.bin not found in CBFS!\n");
+		return CB_ERR;
+	}
+	printk(BIOS_DEBUG, "VBT found at %p\n", vbt.data);
+
+	/* Validate the vbt file */
+	if (*vbt.signature != VBT_SIGNATURE) {
+		printk(BIOS_ERR, "Invalid signature in VBT data file (vbt.bin)!\n");
+		return CB_ERR;
+	}
+
+	memcpy(opregion->header.vbios_version, vbt.data->coreblock_biosbuild,
+		ARRAY_SIZE(vbt.data->coreblock_biosbuild));
+	memcpy(opregion->vbt.gvd1, vbt.data, vbt.data->hdr_vbt_size <
+		sizeof(opregion->vbt.gvd1) ? vbt.data->hdr_vbt_size :
+		sizeof(opregion->vbt.gvd1));
 
 	return CB_SUCCESS;
 }
@@ -115,7 +148,11 @@
 	opregion->mailbox3.bclm[9] = IGD_WORD_FIELD_VALID + 0x5ae5;
 	opregion->mailbox3.bclm[10] = IGD_WORD_FIELD_VALID + 0x64ff;
 
-	ret = init_opregion_vbt(opregion);
+	if (IS_ENABLED(CONFIG_ADD_VBT_DATA_FILE))
+		ret = init_opregion_vbt_cbfs(opregion);
+	else
+		ret = init_opregion_vbt_vbios(opregion);
+
 	if (ret != CB_SUCCESS)
 		return ret;
 

-- 
To view, visit https://review.coreboot.org/20317
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c76ed8362f89179d639629f8059857192c8d8d2
Gerrit-Change-Number: 20317
Gerrit-PatchSet: 1
Gerrit-Owner: Matt DeVillier <matt.devillier at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170623/4d1697a9/attachment.html>


More information about the coreboot-gerrit mailing list