Always create an SD bdrv, so that PXA and OMAP boards can boot with
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 4 Dec 2007 00:10:34 +0000 (00:10 +0000)
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
Tue, 4 Dec 2007 00:10:34 +0000 (00:10 +0000)
no card inserted again.  Eventually SD, CDROM and floppy should all
be registered conditionally depending on machine.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3771 c046a42c-6fe2-441c-8c8c-71466251a162

hw/omap.c
vl.c

index c56cd24..af93870 100644 (file)
--- a/hw/omap.c
+++ b/hw/omap.c
@@ -4901,7 +4901,7 @@ struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size,
     struct omap_mpu_state_s *s = (struct omap_mpu_state_s *)
             qemu_mallocz(sizeof(struct omap_mpu_state_s));
     ram_addr_t imif_base, emiff_base;
-    int index;
+    int sdindex;
     
     if (!core)
         core = "ti925t";
@@ -4998,14 +4998,14 @@ struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size,
     omap_dpll_init(&s->dpll[1], 0xfffed000, omap_findclk(s, "dpll2"));
     omap_dpll_init(&s->dpll[2], 0xfffed100, omap_findclk(s, "dpll3"));
 
-    index = drive_get_index(IF_SD, 0, 0);
-    if (index == -1) {
+    sdindex = drive_get_index(IF_SD, 0, 0);
+    if (sdindex == -1) {
         fprintf(stderr, "qemu: missing SecureDigital device\n");
         exit(1);
     }
-    s->mmc = omap_mmc_init(0xfffb7800, drives_table[index].bdrv,
-                    s->irq[1][OMAP_INT_OQN],
-                    &s->drq[OMAP_DMA_MMC_TX], omap_findclk(s, "mmc_ck"));
+    s->mmc = omap_mmc_init(0xfffb7800, drives_table[sdindex].bdrv,
+                    s->irq[1][OMAP_INT_OQN], &s->drq[OMAP_DMA_MMC_TX],
+                    omap_findclk(s, "mmc_ck"));
 
     s->mpuio = omap_mpuio_init(0xfffb5000,
                     s->irq[1][OMAP_INT_KEYBOARD], s->irq[1][OMAP_INT_MPUIO],
diff --git a/vl.c b/vl.c
index 70f250e..6614bbd 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -4793,7 +4793,7 @@ void do_info_network(void)
 #define FD_ALIAS "index=%d,if=floppy"
 #define PFLASH_ALIAS "file=\"%s\",if=pflash"
 #define MTD_ALIAS "file=\"%s\",if=mtd"
-#define SD_ALIAS "file=\"%s\",if=sd"
+#define SD_ALIAS "index=0,if=sd"
 
 static int drive_add(const char *fmt, ...)
 {
@@ -8179,7 +8179,7 @@ int main(int argc, char **argv)
                drive_add(MTD_ALIAS, optarg);
                 break;
             case QEMU_OPTION_sd:
-                drive_add(SD_ALIAS, optarg);
+                drive_add("file=\"%s\"," SD_ALIAS, optarg);
                 break;
             case QEMU_OPTION_pflash:
                drive_add(PFLASH_ALIAS, optarg);
@@ -8756,11 +8756,16 @@ int main(int argc, char **argv)
     if (nb_drives_opt < MAX_DRIVES)
         drive_add(CDROM_ALIAS);
 
-    /* we always create at least on floppy */
+    /* we always create at least one floppy */
 
     if (nb_drives_opt < MAX_DRIVES)
         drive_add(FD_ALIAS, 0);
 
+    /* we always create one sd slot, even if no card is in it */
+
+    if (nb_drives_opt < MAX_DRIVES)
+        drive_add(SD_ALIAS);
+
     /* open the virtual block devices */
 
     for(i = 0; i < nb_drives_opt; i++)