[coreboot] New patch to review for coreboot: aa4e002 Fix to allow one vbios rom to match multiple PCI device IDs

Marc Jones (marcj303@gmail.com) gerrit at coreboot.org
Thu Jan 12 23:40:42 CET 2012


Marc Jones (marcj303 at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/534

-gerrit

commit aa4e002b797e11d2a6508153e9962faec0aa4e5c
Author: Martin L Roth <martin at se-eng.com>
Date:   Thu Jan 12 15:09:02 2012 -0700

    Fix to allow one vbios rom to match multiple PCI device IDs
    
    This change supplies an AND mask which is applied to the PCI device
    ID for VGA devices before comparison with the rom device ID.  The
    reason for the change is to support "generic" video bios roms which
    work with multiple different device IDs.
    
    Change-Id: Ic68af575fe73d6700b5575b55148feef529637ef
    Signed-off-by: Martin L Roth <martin at se-eng.com>
    Signed-off-by: Marc Jones <marcj303 at gmail.com>
---
 src/Kconfig           |   22 ++++++++++++++++++++++
 src/devices/pci_rom.c |   24 ++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index 525d452..37fe861 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -2,6 +2,8 @@
 ## This file is part of the coreboot project.
 ##
 ## Copyright (C) 2009-2010 coresystems GmbH
+## Copyright (C) 2012 Sage Electronic Engineering, LLC
+## (Written by Martin Roth <martin at se-eng.com> for Sage)
 ##
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -497,6 +499,26 @@ config VGA_BIOS_ID
 	  the "0x" prefix) and 3230 specifies the PCI device ID of the
 	  video card (also in hex, without "0x" prefix).
 
+config VGA_BIOS_ID_MASKda02d261343849f764ddc5a41ce4b40acdb7027e
+	hex "VGA device PCI device ID mask"
+	depends on VGA_BIOS
+	default 0xffff
+	help
+	  This is an AND mask that is applied to the PCI device ID that
+	  would associate your VGA BIOS to your video card when deciding
+	  to apply the rom to the PCI device.
+
+	  Example: 0xFFF0
+
+	  In the above example, the lower nibble of the device ID would not
+	  be included when comparing the ROM's programmed device ID with
+	  the device ID of the actual PCI device.  This allows a rom with
+	  a device ID of 3230 to match against any PCI devices with ids
+	  in the range of 3230 to 323F
+
+	  Note: The device ID portion of the VGA_BIOS_ID should have any
+	  masked bits set to zero as well.
+
 config INTEL_MBI
 	bool "Add an MBI image"
 	depends on NORTHBRIDGE_INTEL_I82830
diff --git a/src/devices/pci_rom.c b/src/devices/pci_rom.c
index 56712df..a5e1717 100644
--- a/src/devices/pci_rom.c
+++ b/src/devices/pci_rom.c
@@ -6,6 +6,8 @@
  * (Written by Yinghai Lu <yhlu at tyan.com> for Tyan)
  * Copyright (C) 2005 Ronald G. Minnich <rminnich at gmail.com>
  * Copyright (C) 2005-2007 Stefan Reinauer <stepan at openbios.org>
+ * Copyright (C) 2012 Sage Electronic Engineering, LLC
+ * (Written by Martin Roth <martin at se-eng.com> for Sage)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,6 +37,14 @@ struct rom_header *pci_rom_probe(struct device *dev)
 	struct pci_data *rom_data;
 
 	/* If it's in FLASH, then don't check device for ROM. */
+
+#if CONFIG_VGA_BIOS
+	if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
+		rom_header = cbfs_load_optionrom(dev->vendor,
+			(dev->device & CONFIG_VGA_BIOS_ID_MASK), NULL);
+	else
+#endif
+
 	rom_header = cbfs_load_optionrom(dev->vendor, dev->device, NULL);
 
 	if (rom_header) {
@@ -78,6 +88,20 @@ struct rom_header *pci_rom_probe(struct device *dev)
 
 	printk(BIOS_SPEW, "PCI ROM image, vendor ID %04x, device ID %04x,\n",
 	       rom_data->vendor, rom_data->device);
+
+#if CONFIG_VGA_BIOS
+	if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA) {
+		if (dev->vendor != rom_data->vendor
+		    || ((dev->device & CONFIG_VGA_BIOS_ID_MASK) !=
+			(rom_data->device & CONFIG_VGA_BIOS_ID_MASK))) {
+			printk(BIOS_ERR, "ID mismatch: vendor ID %04x, "
+			       "device ID %04x\n", rom_data->vendor,
+			       rom_data->device);
+			return NULL;
+		}
+	} else
+#endif
+
 	if (dev->vendor != rom_data->vendor
 	    || dev->device != rom_data->device) {
 		printk(BIOS_ERR, "ID mismatch: vendor ID %04x, "




More information about the coreboot mailing list