[SeaBIOS] [PATCH] sdcard: abort controller setup if capabilities invalid

Matt DeVillier matt.devillier at gmail.com
Thu Mar 17 02:53:09 CET 2016


If the version and low/high capabilities flags of a sdcard controller are
invalid (0xFFFF), assume the controller address is invalid, and exit setup
before attempting to reset the controller, which would introduce an 
unnecessary
delay, since the reset would ultimately fail after timing out.

This eliminates the delay in displaying the boot menu message on Baytrail
ChromeOS devices, where multiple /etc/sdcard entries are present in a 
single
payload to cover the range of eMMC controller addresses used.

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

diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c
index 38d05c4..e6090b8 100644
--- a/src/hw/sdcard.c
+++ b/src/hw/sdcard.c
@@ -486,9 +486,13 @@ sdcard_controller_setup(struct sdhci_s *regs, int prio)
     if (!(present_state & SP_CARD_INSERTED))
         // No card present
         return;
-    dprintf(3, "sdhci@%p ver=%x cap=%x %x\n", regs
-            , readw(&regs->controller_version)
-            , readl(&regs->cap_lo), readl(&regs->cap_hi));
+    u16 ver = readw(&regs->controller_version);
+    u32 cap_lo = readl(&regs->cap_lo);
+    u32 cap_hi = readl(&regs->cap_hi);
+    dprintf(3, "sdhci@%p ver=%x cap=%x %x\n", regs, ver, cap_lo, cap_hi);
+    if (ver == 0xffff && cap_lo == 0xffffffff && cap_hi == 0xffffffff)
+        //invalid controller address
+        return;
     sdcard_reset(regs, SRF_ALL);
     writew(&regs->irq_signal, 0);
     writew(&regs->irq_enable, 0x01ff);
-- 
2.5.0




More information about the SeaBIOS mailing list