On 15 August 2012 20:36, Peter Maydell <peter.mayd...@linaro.org> wrote: > I also think we should follow up Paul Brook's suggestion > that we don't need to have any kind of "default sd card" flag > at all. Floppy is weird because we don't properly separate out > the drive and the controller, right? Not sure about cdrom...
So I looked at the IF_SD users, which fall into two categories: (1) ssi-sd.c, pl181.c, milkymist-memcard.c These are all SD controller models, which in init do something along the lines of dinfo = drive_get_next(IF_SD); s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0); so they correctly handle there being no drive provided by the user (sd_init() treats NULL bdrv as like "no card present"). (2) omap1.c, omap2.c, pxa2xx.c These are board models, which do: dinfo = drive_get(IF_SD, 0, 0); if (!dinfo) { fprintf(stderr, "qemu: missing SecureDigital device\n"); exit(1); } s->mmc = pxa2xx_mmci_init(address_space, 0x41100000, dinfo->bdrv, qdev_get_gpio_in(s->pic, PXA2XX_PIC_MMC), qdev_get_gpio_in(s->dma, PXA2XX_RX_RQ_MMCI), qdev_get_gpio_in(s->dma, PXA2XX_TX_RQ_MMCI)); ie they do the drive_get themselves and pass the bdrv to the MMC/SD controller model, which assumes it's not NULL. So we should convert the case (2) systems to behave like (1) and then we can drop the creation of a "default" sd card. -- PMM