[coreboot-gerrit] Change in coreboot[master]: drivers/intel/gma: Add validation method
Patrick Rudolph (Code Review)
gerrit at coreboot.org
Sat Apr 15 12:55:25 CEST 2017
Patrick Rudolph has uploaded a new change for review. ( https://review.coreboot.org/19313 )
Change subject: drivers/intel/gma: Add validation method
......................................................................
drivers/intel/gma: Add validation method
Add a method to find a valid VBT inside of a memmory-mapped
Intel VBIOS. Return zero if a valid VBT is found.
Change-Id: Iefecfbd253379f73ceb806f01436734d61b3473a
Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
M src/drivers/intel/gma/i915.h
M src/drivers/intel/gma/vbt.c
2 files changed, 37 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/19313/1
diff --git a/src/drivers/intel/gma/i915.h b/src/drivers/intel/gma/i915.h
index 728bf7e..1b3c479 100644
--- a/src/drivers/intel/gma/i915.h
+++ b/src/drivers/intel/gma/i915.h
@@ -313,6 +313,9 @@
/* locate .vbt file */
enum cb_err locate_vbt(struct region_device *rdev);
+/* find a valid VBT in an VBIOS mapped at given address */
+int locate_vbt_vbios(void *address);
+
/* interface to libgfxinit (gma.adb) */
void gma_gfxinit(u64 mmio_base, u64 linear_fb, u32 phys_fb, int *success);
diff --git a/src/drivers/intel/gma/vbt.c b/src/drivers/intel/gma/vbt.c
index f7ccefd..086741e 100644
--- a/src/drivers/intel/gma/vbt.c
+++ b/src/drivers/intel/gma/vbt.c
@@ -21,7 +21,9 @@
#include <device/device.h>
#include <string.h>
#include <device/pci.h>
+#include <device/pci_ids.h>
#include <drivers/intel/gma/opregion.h>
+#include <cbfs.h>
#include "i915.h"
#include "intel_bios.h"
@@ -127,3 +129,35 @@
return CB_SUCCESS;
}
+
+/* find a valid VBT in an VBIOS mapped at given address */
+int locate_vbt_vbios(void *vbios)
+{
+ optionrom_header_t *oprom = (optionrom_header_t *)vbios;
+ optionrom_pcir_t *pcir = (optionrom_pcir_t *)(vbios +
+ oprom->pcir_offset);
+
+ if (!((oprom->signature == OPROM_SIGNATURE) &&
+ (pcir->vendor == PCI_VENDOR_ID_INTEL) &&
+ (pcir->classcode[0] == 0x00) &&
+ (pcir->classcode[1] == 0x00) &&
+ (pcir->classcode[2] == 0x03))) {
+ printk(BIOS_DEBUG, "No valid VBIOS found at %p\n", vbios);
+ return 1;
+ }
+
+ if (!oprom->vbt_offset) {
+ printk(BIOS_DEBUG, "No VBT offset set at %p\n", vbios);
+ return 1;
+ }
+ optionrom_vbt_t *vbt = (optionrom_vbt_t *)(vbios +
+ oprom->vbt_offset);
+
+ if (read32(vbt->hdr_signature) != VBT_SIGNATURE) {
+ printk(BIOS_ERR, "VBT not found at %p offset %u\n",
+ vbios, oprom->vbt_offset);
+ return 1;
+ }
+
+ return 0;
+}
--
To view, visit https://review.coreboot.org/19313
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefecfbd253379f73ceb806f01436734d61b3473a
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Patrick Rudolph <siro at das-labor.org>
More information about the coreboot-gerrit
mailing list