From: Rob Barnes <robbar...@google.com>
Date: Wed, 22 Jan 2020 14:09:21 -0700

Some devices have the same vendor and device ID but need different
Option ROM files. Change the look-up to include the revision, then
fallback to looking up without the revision.

BUG=b:148125384
TEST=Manual, boot trembyle and confirm SeaBIOS console is displayed.

Change-Id: I4c969b08727077fcb5ca1198e61cc6711c675019
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/seabios/+/2015963
Reviewed-by: Raul E Rangel <rran...@chromium.org>
Tested-by: Rob Barnes <robbar...@google.com>
Commit-Queue: Rob Barnes <robbar...@google.com>
Auto-Submit: Rob Barnes <robbar...@google.com>
---
 src/optionroms.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/optionroms.c b/src/optionroms.c
index e906ab9..c3aa9b0 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -329,10 +329,17 @@ init_pcirom(struct pci_device *pci, int isvga, u64 *sources)
     dprintf(4, "Attempting to init PCI bdf %pP (vd %04x:%04x)\n"
             , pci, pci->vendor, pci->device);

-    char fname[17];
-    snprintf(fname, sizeof(fname), "pci%04x,%04x.rom"
-             , pci->vendor, pci->device);
+    char fname[20];
+    // Try to find rom file with revision included
+    snprintf(fname, sizeof(fname), "pci%04x,%04x,%02x.rom"
+             , pci->vendor, pci->device, pci->revision);
     struct romfile_s *file = romfile_find(fname);
+    if (!file) {
+        // Fallback to finding rom file without revision
+        snprintf(fname, sizeof(fname), "pci%04x,%04x.rom"
+             , pci->vendor, pci->device);
+        file = romfile_find(fname);
+    }
     struct rom_header *rom = NULL;
     if (file)
         rom = deploy_romfile(file);
--
2.25.1
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org

Reply via email to