aboutsummaryrefslogtreecommitdiff
path: root/hw/arm
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-10-07 13:59:18 +0200
committerKevin Wolf <kwolf@redhat.com>2014-10-20 14:02:25 +0200
commit4be746345f13e99e468c60acbd3a355e8183e3ce (patch)
tree16509218f940129beb113cf3b1be158c3501ec1d /hw/arm
parent2a30307f709e6a395d23cf94837e9aae15f8e8fa (diff)
downloadqemu-4be746345f13e99e468c60acbd3a355e8183e3ce.zip
qemu-4be746345f13e99e468c60acbd3a355e8183e3ce.tar.gz
qemu-4be746345f13e99e468c60acbd3a355e8183e3ce.tar.bz2
hw: Convert from BlockDriverState to BlockBackend, mostly
Device models should access their block backends only through the block-backend.h API. Convert them, and drop direct includes of inappropriate headers. Just four uses of BlockDriverState are left: * The Xen paravirtual block device backend (xen_disk.c) opens images itself when set up via xenbus, bypassing blockdev.c. I figure it should go through qmp_blockdev_add() instead. * Device model "usb-storage" prompts for keys. No other device model does, and this one probably shouldn't do it, either. * ide_issue_trim_cb() uses bdrv_aio_discard() instead of blk_aio_discard() because it fishes its backend out of a BlockAIOCB, which has only the BlockDriverState. * PC87312State has an unused BlockDriverState[] member. The next two commits take care of the latter two. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/arm')
-rw-r--r--hw/arm/collie.c5
-rw-r--r--hw/arm/gumstix.c5
-rw-r--r--hw/arm/highbank.c2
-rw-r--r--hw/arm/mainstone.c2
-rw-r--r--hw/arm/musicpal.c10
-rw-r--r--hw/arm/nseries.c3
-rw-r--r--hw/arm/omap1.c2
-rw-r--r--hw/arm/omap2.c2
-rw-r--r--hw/arm/omap_sx1.c5
-rw-r--r--hw/arm/pxa2xx.c4
-rw-r--r--hw/arm/realview.c2
-rw-r--r--hw/arm/spitz.c4
-rw-r--r--hw/arm/tosa.c3
-rw-r--r--hw/arm/versatilepb.c3
-rw-r--r--hw/arm/vexpress.c3
-rw-r--r--hw/arm/virt.c2
-rw-r--r--hw/arm/xilinx_zynq.c3
-rw-r--r--hw/arm/z2.c3
18 files changed, 25 insertions, 38 deletions
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
index 0247290..6c9b82f 100644
--- a/hw/arm/collie.c
+++ b/hw/arm/collie.c
@@ -16,7 +16,6 @@
#include "hw/arm/arm.h"
#include "hw/block/flash.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "exec/address-spaces.h"
static struct arm_boot_info collie_binfo = {
@@ -42,12 +41,12 @@ static void collie_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0);
pflash_cfi01_register(SA_CS0, NULL, "collie.fl1", 0x02000000,
- dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
(64 * 1024), 512, 4, 0x00, 0x00, 0x00, 0x00, 0);
dinfo = drive_get(IF_PFLASH, 0, 1);
pflash_cfi01_register(SA_CS1, NULL, "collie.fl2", 0x02000000,
- dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
(64 * 1024), 512, 4, 0x00, 0x00, 0x00, 0x00, 0);
sysbus_create_simple("scoop", 0x40800000, NULL);
diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c
index 49f9339..8103278 100644
--- a/hw/arm/gumstix.c
+++ b/hw/arm/gumstix.c
@@ -41,7 +41,6 @@
#include "hw/devices.h"
#include "hw/boards.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "exec/address-spaces.h"
#include "sysemu/qtest.h"
@@ -72,7 +71,7 @@ static void connex_init(MachineState *machine)
be = 0;
#endif
if (!pflash_cfi01_register(0x00000000, NULL, "connext.rom", connex_rom,
- dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, connex_rom / sector_len,
2, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n");
@@ -110,7 +109,7 @@ static void verdex_init(MachineState *machine)
be = 0;
#endif
if (!pflash_cfi01_register(0x00000000, NULL, "verdex.rom", verdex_rom,
- dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, verdex_rom / sector_len,
2, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n");
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index fa61e5f..30f744a 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -24,7 +24,7 @@
#include "net/net.h"
#include "sysemu/sysemu.h"
#include "hw/boards.h"
-#include "sysemu/blockdev.h"
+#include "sysemu/block-backend.h"
#include "exec/address-spaces.h"
#include "qemu/error-report.h"
diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
index a4a25b5..0da02a6 100644
--- a/hw/arm/mainstone.c
+++ b/hw/arm/mainstone.c
@@ -149,7 +149,7 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
if (!pflash_cfi01_register(mainstone_flash_base[i], NULL,
i ? "mainstone.flash1" : "mainstone.flash0",
MAINSTONE_FLASH,
- blk_bs(blk_by_legacy_dinfo(dinfo)),
+ blk_by_legacy_dinfo(dinfo),
sector_len, MAINSTONE_FLASH / sector_len,
4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n");
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 77ad4eb..3712de6 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -18,12 +18,10 @@
#include "hw/char/serial.h"
#include "qemu/timer.h"
#include "hw/ptimer.h"
-#include "block/block.h"
#include "hw/block/flash.h"
#include "ui/console.h"
#include "hw/i2c/i2c.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "exec/address-spaces.h"
#include "ui/pixel_ops.h"
@@ -1633,9 +1631,9 @@ static void musicpal_init(MachineState *machine)
/* Register flash */
dinfo = drive_get(IF_PFLASH, 0, 0);
if (dinfo) {
- BlockDriverState *bs = blk_bs(blk_by_legacy_dinfo(dinfo));
+ BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
- flash_size = bdrv_getlength(bs);
+ flash_size = blk_getlength(blk);
if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 &&
flash_size != 32*1024*1024) {
fprintf(stderr, "Invalid flash image size\n");
@@ -1650,14 +1648,14 @@ static void musicpal_init(MachineState *machine)
#ifdef TARGET_WORDS_BIGENDIAN
pflash_cfi02_register(0x100000000ULL-MP_FLASH_SIZE_MAX, NULL,
"musicpal.flash", flash_size,
- bs, 0x10000, (flash_size + 0xffff) >> 16,
+ blk, 0x10000, (flash_size + 0xffff) >> 16,
MP_FLASH_SIZE_MAX / flash_size,
2, 0x00BF, 0x236D, 0x0000, 0x0000,
0x5555, 0x2AAA, 1);
#else
pflash_cfi02_register(0x100000000ULL-MP_FLASH_SIZE_MAX, NULL,
"musicpal.flash", flash_size,
- bs, 0x10000, (flash_size + 0xffff) >> 16,
+ blk, 0x10000, (flash_size + 0xffff) >> 16,
MP_FLASH_SIZE_MAX / flash_size,
2, 0x00BF, 0x236D, 0x0000, 0x0000,
0x5555, 0x2AAA, 0);
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index 2536078..c7ebaa6 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -32,7 +32,6 @@
#include "hw/bt.h"
#include "hw/loader.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "hw/sysbus.h"
#include "exec/address-spaces.h"
@@ -175,7 +174,7 @@ static void n8x0_nand_setup(struct n800_s *s)
dinfo = drive_get(IF_MTD, 0, 0);
if (dinfo) {
qdev_prop_set_drive_nofail(s->nand, "drive",
- blk_bs(blk_by_legacy_dinfo(dinfo)));
+ blk_by_legacy_dinfo(dinfo));
}
qdev_init_nofail(s->nand);
sysbus_connect_irq(SYS_BUS_DEVICE(s->nand), 0,
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 74dac49..abb183c 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -3980,7 +3980,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
exit(1);
}
s->mmc = omap_mmc_init(0xfffb7800, system_memory,
- blk_bs(blk_by_legacy_dinfo(dinfo)),
+ blk_by_legacy_dinfo(dinfo),
qdev_get_gpio_in(s->ih[1], OMAP_INT_OQN),
&s->drq[OMAP_DMA_MMC_TX],
omap_findclk(s, "mmc_ck"));
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
index 0b6a95e..b083ebe 100644
--- a/hw/arm/omap2.c
+++ b/hw/arm/omap2.c
@@ -2463,7 +2463,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
exit(1);
}
s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9),
- blk_bs(blk_by_legacy_dinfo(dinfo)),
+ blk_by_legacy_dinfo(dinfo),
qdev_get_gpio_in(s->ih[0], OMAP_INT_24XX_MMC_IRQ),
&s->drq[OMAP24XX_DMA_MMC1_TX],
omap_findclk(s, "mmc_fclk"), omap_findclk(s, "mmc_iclk"));
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
index 0a4e740..671e02c 100644
--- a/hw/arm/omap_sx1.c
+++ b/hw/arm/omap_sx1.c
@@ -32,7 +32,6 @@
#include "hw/arm/arm.h"
#include "hw/block/flash.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "sysemu/qtest.h"
#include "exec/address-spaces.h"
@@ -155,7 +154,7 @@ static void sx1_init(MachineState *machine, const int version)
if ((dinfo = drive_get(IF_PFLASH, 0, fl_idx)) != NULL) {
if (!pflash_cfi01_register(OMAP_CS0_BASE, NULL,
"omap_sx1.flash0-1", flash_size,
- blk_bs(blk_by_legacy_dinfo(dinfo)),
+ blk_by_legacy_dinfo(dinfo),
sector_size, flash_size / sector_size,
4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory %d.\n",
@@ -179,7 +178,7 @@ static void sx1_init(MachineState *machine, const int version)
if (!pflash_cfi01_register(OMAP_CS1_BASE, NULL,
"omap_sx1.flash1-1", flash1_size,
- blk_bs(blk_by_legacy_dinfo(dinfo)),
+ blk_by_legacy_dinfo(dinfo),
sector_size, flash1_size / sector_size,
4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory %d.\n",
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 6b7abe1..693dfec 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -2087,7 +2087,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
exit(1);
}
s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,
- blk_bs(blk_by_legacy_dinfo(dinfo)),
+ blk_by_legacy_dinfo(dinfo),
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));
@@ -2220,7 +2220,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
exit(1);
}
s->mmc = pxa2xx_mmci_init(address_space, 0x41100000,
- blk_bs(blk_by_legacy_dinfo(dinfo)),
+ blk_by_legacy_dinfo(dinfo),
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));
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index 8bd3ff6..af65aa4 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -16,7 +16,7 @@
#include "sysemu/sysemu.h"
#include "hw/boards.h"
#include "hw/i2c/i2c.h"
-#include "sysemu/blockdev.h"
+#include "sysemu/block-backend.h"
#include "exec/address-spaces.h"
#include "qemu/error-report.h"
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
index ff12f9b..a16831c 100644
--- a/hw/arm/spitz.c
+++ b/hw/arm/spitz.c
@@ -22,11 +22,9 @@
#include "hw/devices.h"
#include "hw/arm/sharpsl.h"
#include "ui/console.h"
-#include "block/block.h"
#include "audio/audio.h"
#include "hw/boards.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "hw/sysbus.h"
#include "exec/address-spaces.h"
@@ -171,7 +169,7 @@ static int sl_nand_init(SysBusDevice *dev)
s->ctl = 0;
nand = drive_get(IF_MTD, 0, 0);
- s->nand = nand_init(nand ? blk_bs(blk_by_legacy_dinfo(nand)) : NULL,
+ s->nand = nand_init(nand ? blk_by_legacy_dinfo(nand) : NULL,
s->manf_id, s->chip_id);
memory_region_init_io(&s->iomem, OBJECT(s), &sl_ops, s, "sl", 0x40);
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
index 6c574bc..73572eb 100644
--- a/hw/arm/tosa.c
+++ b/hw/arm/tosa.c
@@ -17,11 +17,10 @@
#include "hw/devices.h"
#include "hw/arm/sharpsl.h"
#include "hw/pcmcia.h"
-#include "block/block.h"
#include "hw/boards.h"
#include "hw/i2c/i2c.h"
#include "hw/ssi.h"
-#include "sysemu/blockdev.h"
+#include "sysemu/block-backend.h"
#include "hw/sysbus.h"
#include "exec/address-spaces.h"
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 2ff46b0..e6ef0a2 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -16,7 +16,6 @@
#include "hw/i2c/i2c.h"
#include "hw/boards.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "exec/address-spaces.h"
#include "hw/block/flash.h"
@@ -340,7 +339,7 @@ static void versatile_init(MachineState *machine, int board_id)
dinfo = drive_get(IF_PFLASH, 0, 0);
if (!pflash_cfi01_register(VERSATILE_FLASH_ADDR, NULL, "versatile.flash",
VERSATILE_FLASH_SIZE,
- dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
VERSATILE_FLASH_SECT_SIZE,
VERSATILE_FLASH_SIZE / VERSATILE_FLASH_SECT_SIZE,
4, 0x0089, 0x0018, 0x0000, 0x0, 0)) {
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 828228c..7cbd13f 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -31,7 +31,6 @@
#include "hw/loader.h"
#include "exec/address-spaces.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "hw/block/flash.h"
#include "sysemu/device_tree.h"
#include "qemu/error-report.h"
@@ -493,7 +492,7 @@ static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name,
DeviceState *dev = qdev_create(NULL, "cfi.pflash01");
if (di && qdev_prop_set_drive(dev, "drive",
- blk_bs(blk_by_legacy_dinfo(di)))) {
+ blk_by_legacy_dinfo(di))) {
abort();
}
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e5fce2a..8ea592e 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -452,7 +452,7 @@ static void create_one_flash(const char *name, hwaddr flashbase,
const uint64_t sectorlength = 256 * 1024;
if (dinfo && qdev_prop_set_drive(dev, "drive",
- blk_bs(blk_by_legacy_dinfo(dinfo)))) {
+ blk_by_legacy_dinfo(dinfo))) {
abort();
}
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 415344f..b590392 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -23,7 +23,6 @@
#include "hw/boards.h"
#include "hw/block/flash.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "hw/loader.h"
#include "hw/ssi.h"
#include "qemu/error-report.h"
@@ -165,7 +164,7 @@ static void zynq_init(MachineState *machine)
/* AMD */
pflash_cfi02_register(0xe2000000, NULL, "zynq.pflash", FLASH_SIZE,
- dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
FLASH_SECTOR_SIZE,
FLASH_SIZE/FLASH_SECTOR_SIZE, 1,
1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa,
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 9b38a2b..1735547 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -21,7 +21,6 @@
#include "sysemu/sysemu.h"
#include "hw/block/flash.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "ui/console.h"
#include "audio/audio.h"
#include "exec/address-spaces.h"
@@ -337,7 +336,7 @@ static void z2_init(MachineState *machine)
if (!pflash_cfi01_register(Z2_FLASH_BASE,
NULL, "z2.flash0", Z2_FLASH_SIZE,
- dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
sector_len, Z2_FLASH_SIZE / sector_len,
4, 0, 0, 0, 0, be)) {
fprintf(stderr, "qemu: Error registering flash memory.\n");