This series attempts to QOMify sd.c (the actual SD card model), including a proper QOM bus between the controller and the card.
This series removes the experimental x-drive property on sdhci-pci; the syntax for using that device changes: instead of using the x-drive property: -device sdhci-pci,x-drive=mydrive -drive id=mydrive,[...] we create a specific sd device (which is autoplugged into the sdhci-pci device's "sd-bus" bus if you don't manually connect them): -device sdhci-pci -drive id=mydrive,[...] -device sd,drive=mydrive The basic structure of the patch series is: * QOMify sd.c itself * Add the QOM bus APIs * Convert sdhci to use the QOM bus APIs * QOMify pxa2xx_mmci * Convert pxa2xx_mmci to use the QOM bus APIs Points worthy of review: * is the code in "sdhci_sysbus: Create SD card device in users" for xlnx-ep108.c to connect the SD cards up to the two controllers inside the SoC doing this in the right way? * I chose not to try to make the SD card type a subclass of SSI, because the interface we have at the moment didn't really seem to line up with what SSI has * generally do I have the QOM style right? Some notes on compatibility/bisection: * the old-style non-QOMified controllers (which get their drive via blk_by_legacy_dinfo() continue to work through the whole series * the only QOMified controller which doesn't do that is sdhci-pci, which uses the experimental x-drive property to take a drive. This support and property is removed in patch 1; support for the new syntax is added in patch 5. (Since we're breaking the old syntax anyway I chose to not try to introduce the new syntax in the same commit as breaking the old one; I think it makes the patches easier to review.) I don't have any Xilinx test images, so I haven't been able to test the changes to those boards (beyond confirming that the board doesn't crash on startup and that 'info qtree' seems to show SD cards connected to the right things). I have tested sdhci-pci and the pxa2xx. Peter Maydell (10): hw/sd/sdhci.c: Remove x-drive property hw/sd/sd.c: QOMify hw/sd/sd.c: Convert sd_reset() function into Device reset method hw/sd: Add QOM bus which SD cards plug in to hw/sd/sdhci.c: Update to use SDBus APIs sdhci_sysbus: Create SD card device in users, not the device itself hw/sd/pxa2xx_mmci: convert to SysBusDevice object hw/sd/pxa2xx_mmci: Update to use new SDBus APIs hw/sd/pxa2xx_mmci: Convert to VMStateDescription hw/sd/pxa2xx_mmci: Add reset function hw/arm/xilinx_zynq.c | 17 ++- hw/arm/xlnx-ep108.c | 19 ++++ hw/sd/Makefile.objs | 2 +- hw/sd/core.c | 146 ++++++++++++++++++++++++ hw/sd/pxa2xx_mmci.c | 304 ++++++++++++++++++++++++++++++++------------------ hw/sd/sd.c | 149 ++++++++++++++++++++----- hw/sd/sdhci.c | 83 ++++++++------ include/hw/sd/sd.h | 63 +++++++++++ include/hw/sd/sdhci.h | 3 +- 9 files changed, 610 insertions(+), 176 deletions(-) create mode 100644 hw/sd/core.c -- 1.9.1