Commit 9d413d1d4902a22059fa0ac6e6b621fe43cf9403

Authored by balrog
1 parent 6a5bd307

Always create an SD bdrv, so that PXA and OMAP boards can boot with

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
Showing 2 changed files with 14 additions and 9 deletions
hw/omap.c
@@ -4901,7 +4901,7 @@ struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size, @@ -4901,7 +4901,7 @@ struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size,
4901 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) 4901 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *)
4902 qemu_mallocz(sizeof(struct omap_mpu_state_s)); 4902 qemu_mallocz(sizeof(struct omap_mpu_state_s));
4903 ram_addr_t imif_base, emiff_base; 4903 ram_addr_t imif_base, emiff_base;
4904 - int index; 4904 + int sdindex;
4905 4905
4906 if (!core) 4906 if (!core)
4907 core = "ti925t"; 4907 core = "ti925t";
@@ -4998,14 +4998,14 @@ struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size, @@ -4998,14 +4998,14 @@ struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size,
4998 omap_dpll_init(&s->dpll[1], 0xfffed000, omap_findclk(s, "dpll2")); 4998 omap_dpll_init(&s->dpll[1], 0xfffed000, omap_findclk(s, "dpll2"));
4999 omap_dpll_init(&s->dpll[2], 0xfffed100, omap_findclk(s, "dpll3")); 4999 omap_dpll_init(&s->dpll[2], 0xfffed100, omap_findclk(s, "dpll3"));
5000 5000
5001 - index = drive_get_index(IF_SD, 0, 0);  
5002 - if (index == -1) { 5001 + sdindex = drive_get_index(IF_SD, 0, 0);
  5002 + if (sdindex == -1) {
5003 fprintf(stderr, "qemu: missing SecureDigital device\n"); 5003 fprintf(stderr, "qemu: missing SecureDigital device\n");
5004 exit(1); 5004 exit(1);
5005 } 5005 }
5006 - s->mmc = omap_mmc_init(0xfffb7800, drives_table[index].bdrv,  
5007 - s->irq[1][OMAP_INT_OQN],  
5008 - &s->drq[OMAP_DMA_MMC_TX], omap_findclk(s, "mmc_ck")); 5006 + s->mmc = omap_mmc_init(0xfffb7800, drives_table[sdindex].bdrv,
  5007 + s->irq[1][OMAP_INT_OQN], &s->drq[OMAP_DMA_MMC_TX],
  5008 + omap_findclk(s, "mmc_ck"));
5009 5009
5010 s->mpuio = omap_mpuio_init(0xfffb5000, 5010 s->mpuio = omap_mpuio_init(0xfffb5000,
5011 s->irq[1][OMAP_INT_KEYBOARD], s->irq[1][OMAP_INT_MPUIO], 5011 s->irq[1][OMAP_INT_KEYBOARD], s->irq[1][OMAP_INT_MPUIO],
@@ -4793,7 +4793,7 @@ void do_info_network(void) @@ -4793,7 +4793,7 @@ void do_info_network(void)
4793 #define FD_ALIAS "index=%d,if=floppy" 4793 #define FD_ALIAS "index=%d,if=floppy"
4794 #define PFLASH_ALIAS "file=\"%s\",if=pflash" 4794 #define PFLASH_ALIAS "file=\"%s\",if=pflash"
4795 #define MTD_ALIAS "file=\"%s\",if=mtd" 4795 #define MTD_ALIAS "file=\"%s\",if=mtd"
4796 -#define SD_ALIAS "file=\"%s\",if=sd" 4796 +#define SD_ALIAS "index=0,if=sd"
4797 4797
4798 static int drive_add(const char *fmt, ...) 4798 static int drive_add(const char *fmt, ...)
4799 { 4799 {
@@ -8179,7 +8179,7 @@ int main(int argc, char **argv) @@ -8179,7 +8179,7 @@ int main(int argc, char **argv)
8179 drive_add(MTD_ALIAS, optarg); 8179 drive_add(MTD_ALIAS, optarg);
8180 break; 8180 break;
8181 case QEMU_OPTION_sd: 8181 case QEMU_OPTION_sd:
8182 - drive_add(SD_ALIAS, optarg); 8182 + drive_add("file=\"%s\"," SD_ALIAS, optarg);
8183 break; 8183 break;
8184 case QEMU_OPTION_pflash: 8184 case QEMU_OPTION_pflash:
8185 drive_add(PFLASH_ALIAS, optarg); 8185 drive_add(PFLASH_ALIAS, optarg);
@@ -8756,11 +8756,16 @@ int main(int argc, char **argv) @@ -8756,11 +8756,16 @@ int main(int argc, char **argv)
8756 if (nb_drives_opt < MAX_DRIVES) 8756 if (nb_drives_opt < MAX_DRIVES)
8757 drive_add(CDROM_ALIAS); 8757 drive_add(CDROM_ALIAS);
8758 8758
8759 - /* we always create at least on floppy */ 8759 + /* we always create at least one floppy */
8760 8760
8761 if (nb_drives_opt < MAX_DRIVES) 8761 if (nb_drives_opt < MAX_DRIVES)
8762 drive_add(FD_ALIAS, 0); 8762 drive_add(FD_ALIAS, 0);
8763 8763
  8764 + /* we always create one sd slot, even if no card is in it */
  8765 +
  8766 + if (nb_drives_opt < MAX_DRIVES)
  8767 + drive_add(SD_ALIAS);
  8768 +
8764 /* open the virtual block devices */ 8769 /* open the virtual block devices */
8765 8770
8766 for(i = 0; i < nb_drives_opt; i++) 8771 for(i = 0; i < nb_drives_opt; i++)