[SeaBIOS] [PATCH 1/5] sdcard: Check if card is present before sending commands to card
Kevin O'Connor
kevin at koconnor.net
Fri Jul 31 00:36:19 CEST 2015
Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
src/hw/sdcard.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/hw/sdcard.c b/src/hw/sdcard.c
index d2c3288..7523ab8 100644
--- a/src/hw/sdcard.c
+++ b/src/hw/sdcard.c
@@ -73,8 +73,9 @@ struct sdhci_s {
#define SI_READ_READY (1<<5)
// SDHCI present_state flags
-#define SP_CMD_INHIBIT (1<<0)
-#define SP_DAT_INHIBIT (1<<1)
+#define SP_CMD_INHIBIT (1<<0)
+#define SP_DAT_INHIBIT (1<<1)
+#define SP_CARD_INSERTED (1<<16)
// SDHCI transfer_mode flags
#define ST_BLOCKCOUNT (1<<1)
@@ -269,6 +270,10 @@ sdcard_controller_setup(void *data)
if (!runningOnQEMU())
// XXX - this init logic will probably only work on qemu!
return;
+ u32 present_state = readl(®s->present_state);
+ if (!(present_state & SP_CARD_INSERTED))
+ // No card present
+ return;
writew(®s->irq_signal, 0);
writew(®s->irq_enable, 0xffff);
writew(®s->error_signal, 0);
--
1.9.3
More information about the SeaBIOS
mailing list