aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc
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/ppc
parent2a30307f709e6a395d23cf94837e9aae15f8e8fa (diff)
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/ppc')
-rw-r--r--hw/ppc/mac_newworld.c2
-rw-r--r--hw/ppc/mac_oldworld.c2
-rw-r--r--hw/ppc/ppc405_boards.c26
-rw-r--r--hw/ppc/prep.c2
-rw-r--r--hw/ppc/spapr.c4
-rw-r--r--hw/ppc/virtex_ml507.c3
6 files changed, 18 insertions, 21 deletions
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 4094beb0ed..89aee716d4 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -65,7 +65,7 @@
#include "sysemu/kvm.h"
#include "kvm_ppc.h"
#include "hw/usb.h"
-#include "sysemu/blockdev.h"
+#include "sysemu/block-backend.h"
#include "exec/address-spaces.h"
#include "hw/sysbus.h"
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index ebd87fb8f5..32c21a4286 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -40,7 +40,7 @@
#include "elf.h"
#include "sysemu/kvm.h"
#include "kvm_ppc.h"
-#include "sysemu/blockdev.h"
+#include "sysemu/block-backend.h"
#include "exec/address-spaces.h"
#define MAX_IDE_BUS 2
diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index aeae45063c..1dcea7730e 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -28,7 +28,7 @@
#include "hw/block/flash.h"
#include "sysemu/sysemu.h"
#include "sysemu/qtest.h"
-#include "block/block.h"
+#include "sysemu/block-backend.h"
#include "hw/boards.h"
#include "qemu/log.h"
#include "qemu/error-report.h"
@@ -226,19 +226,19 @@ static void ref405ep_init(MachineState *machine)
#ifdef USE_FLASH_BIOS
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
- BlockDriverState *bs = blk_bs(blk_by_legacy_dinfo(dinfo));
+ BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
- bios_size = bdrv_getlength(bs);
+ bios_size = blk_getlength(blk);
fl_sectors = (bios_size + 65535) >> 16;
#ifdef DEBUG_BOARD_INIT
printf("Register parallel flash %d size %lx"
" at addr %lx '%s' %d\n",
fl_idx, bios_size, -bios_size,
- bdrv_get_device_name(bs), fl_sectors);
+ blk_name(blk), fl_sectors);
#endif
pflash_cfi02_register((uint32_t)(-bios_size),
NULL, "ef405ep.bios", bios_size,
- bs, 65536, fl_sectors, 1,
+ blk, 65536, fl_sectors, 1,
2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
@@ -551,9 +551,9 @@ static void taihu_405ep_init(MachineState *machine)
#if defined(USE_FLASH_BIOS)
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
- BlockDriverState *bs = blk_bs(blk_by_legacy_dinfo(dinfo));
+ BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
- bios_size = bdrv_getlength(bs);
+ bios_size = blk_getlength(blk);
/* XXX: should check that size is 2MB */
// bios_size = 2 * 1024 * 1024;
fl_sectors = (bios_size + 65535) >> 16;
@@ -561,11 +561,11 @@ static void taihu_405ep_init(MachineState *machine)
printf("Register parallel flash %d size %lx"
" at addr %lx '%s' %d\n",
fl_idx, bios_size, -bios_size,
- bdrv_get_device_name(bs), fl_sectors);
+ blk_name(blk), fl_sectors);
#endif
pflash_cfi02_register((uint32_t)(-bios_size),
NULL, "taihu_405ep.bios", bios_size,
- bs, 65536, fl_sectors, 1,
+ blk, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
@@ -600,9 +600,9 @@ static void taihu_405ep_init(MachineState *machine)
/* Register Linux flash */
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
- BlockDriverState *bs = blk_bs(blk_by_legacy_dinfo(dinfo));
+ BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
- bios_size = bdrv_getlength(bs);
+ bios_size = blk_getlength(blk);
/* XXX: should check that size is 32MB */
bios_size = 32 * 1024 * 1024;
fl_sectors = (bios_size + 65535) >> 16;
@@ -610,10 +610,10 @@ static void taihu_405ep_init(MachineState *machine)
printf("Register parallel flash %d size %lx"
" at addr " TARGET_FMT_lx " '%s'\n",
fl_idx, bios_size, (target_ulong)0xfc000000,
- bdrv_get_device_name(bs));
+ blk_name(blk));
#endif
pflash_cfi02_register(0xfc000000, NULL, "taihu_405ep.flash", bios_size,
- bs, 65536, fl_sectors, 1,
+ blk, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 9f484cdcb8..dd8433d0c9 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -38,7 +38,7 @@
#include "hw/loader.h"
#include "hw/timer/mc146818rtc.h"
#include "hw/isa/pc87312.h"
-#include "sysemu/blockdev.h"
+#include "sysemu/block-backend.h"
#include "sysemu/arch_init.h"
#include "sysemu/qtest.h"
#include "exec/address-spaces.h"
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 0605ce8205..45764a7032 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -30,7 +30,6 @@
#include "elf.h"
#include "net/net.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "sysemu/cpus.h"
#include "sysemu/kvm.h"
#include "kvm_ppc.h"
@@ -926,8 +925,7 @@ static void spapr_create_nvram(sPAPREnvironment *spapr)
DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
if (dinfo) {
- qdev_prop_set_drive_nofail(dev, "drive",
- blk_bs(blk_by_legacy_dinfo(dinfo)));
+ qdev_prop_set_drive_nofail(dev, "drive", blk_by_legacy_dinfo(dinfo));
}
qdev_init_nofail(dev);
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index a0ce447e9c..6ebd5bee8b 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -40,7 +40,6 @@
#include "ppc405.h"
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "qapi/qmp/qerror.h"
#define EPAPR_MAGIC (0x45504150)
@@ -228,7 +227,7 @@ static void virtex_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0);
pflash_cfi01_register(PFLASH_BASEADDR, NULL, "virtex.flash", FLASH_SIZE,
- dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
(64 * 1024), FLASH_SIZE >> 16,
1, 0x89, 0x18, 0x0000, 0x0, 1);