[SeaBIOS] [patch v2 - reformatted] sdcard: skip detection of PCI sdhci controllers if etc/sdcard used

Matt DeVillier matt.devillier at gmail.com
Thu Mar 17 02:37:35 CET 2016


Some BayTrail ChromeOS devices have the eMMC controller hidden (thus 
requiring the use of etc/sdcard), while others do not, making it 
problematic to have a single payload which serves all devices 
properly.   Therefore, if the CBFS contains etc/sdcard entries, skip 
detection of any visible PCI sdhci controllers in order to avoid 
duplicate entries in the boot menu.

patch implementation suggested by Kevin O'Connor :)

Signed-off-by: Matt DeVillier <matt.devillier at gmail.com>
---
  src/hw/sdcard.c | 17 +++++++++++------
  1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c
index 7e0875f..38d05c4 100644
--- a/src/hw/sdcard.c
+++ b/src/hw/sdcard.c
@@ -550,18 +550,23 @@ sdcard_setup(void)
         return;

     struct romfile_s *file = NULL;
+    int num_romfiles = 0;
     for (;;) {
         file = romfile_findprefix("etc/sdcard", file);
         if (!file)
             break;
         run_thread(sdcard_romfile_setup, file);
+        num_romfiles++;
     }

-    struct pci_device *pci;
-    foreachpci(pci) {
-        if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2)
-            // Not an SDHCI controller following SDHCI spec
-            continue;
-        run_thread(sdcard_pci_setup, pci);
+    //only scan for PCI controllers if etc/sdcard not used
+    if (num_romfiles == 0) {
+        struct pci_device *pci;
+        foreachpci(pci) {
+            if (pci->class != PCI_CLASS_SYSTEM_SDHCI || pci->prog_if >= 2)
+                // Not an SDHCI controller following SDHCI spec
+                continue;
+            run_thread(sdcard_pci_setup, pci);
+        }
     }
}
-- 
2.5.0




More information about the SeaBIOS mailing list