summaryrefslogtreecommitdiff
path: root/hw/ppc
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-10-07 13:59:13 +0200
committerKevin Wolf <kwolf@redhat.com>2014-10-20 13:41:27 +0200
commitfa1d36df7466ebbef0331b79d0ce3c5e140695c9 (patch)
tree09c705b3c00506d246b712a330deef215f483e2a /hw/ppc
parent7f06d47eff9d26cca87855273f20786502f8c57e (diff)
downloadqemu-fa1d36df7466ebbef0331b79d0ce3c5e140695c9.tar.gz
block: Eliminate DriveInfo member bdrv, use blk_by_legacy_dinfo()
The patch is big, but all it really does is replacing dinfo->bdrv by blk_bs(blk_by_legacy_dinfo(dinfo)) The replacement is repetitive, but the conversion of device models to BlockBackend is imminent, and will shorten it to just blk_legacy_dinfo(dinfo). Line wrapping muddies the waters a bit. I also omit tests whether dinfo->bdrv is null, because it never is. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: BenoƮt Canet <benoit.canet@nodalink.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/ppc405_boards.c25
-rw-r--r--hw/ppc/spapr.c4
-rw-r--r--hw/ppc/virtex_ml507.c5
3 files changed, 22 insertions, 12 deletions
diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index 18a4ec5e79..aeae45063c 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -33,6 +33,7 @@
#include "qemu/log.h"
#include "qemu/error-report.h"
#include "hw/loader.h"
+#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "exec/address-spaces.h"
@@ -225,17 +226,19 @@ static void ref405ep_init(MachineState *machine)
#ifdef USE_FLASH_BIOS
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
- bios_size = bdrv_getlength(dinfo->bdrv);
+ BlockDriverState *bs = blk_bs(blk_by_legacy_dinfo(dinfo));
+
+ bios_size = bdrv_getlength(bs);
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(dinfo->bdrv), fl_sectors);
+ bdrv_get_device_name(bs), fl_sectors);
#endif
pflash_cfi02_register((uint32_t)(-bios_size),
NULL, "ef405ep.bios", bios_size,
- dinfo->bdrv, 65536, fl_sectors, 1,
+ bs, 65536, fl_sectors, 1,
2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
@@ -548,7 +551,9 @@ static void taihu_405ep_init(MachineState *machine)
#if defined(USE_FLASH_BIOS)
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
- bios_size = bdrv_getlength(dinfo->bdrv);
+ BlockDriverState *bs = blk_bs(blk_by_legacy_dinfo(dinfo));
+
+ bios_size = bdrv_getlength(bs);
/* XXX: should check that size is 2MB */
// bios_size = 2 * 1024 * 1024;
fl_sectors = (bios_size + 65535) >> 16;
@@ -556,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(dinfo->bdrv), fl_sectors);
+ bdrv_get_device_name(bs), fl_sectors);
#endif
pflash_cfi02_register((uint32_t)(-bios_size),
NULL, "taihu_405ep.bios", bios_size,
- dinfo->bdrv, 65536, fl_sectors, 1,
+ bs, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
@@ -595,7 +600,9 @@ static void taihu_405ep_init(MachineState *machine)
/* Register Linux flash */
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
if (dinfo) {
- bios_size = bdrv_getlength(dinfo->bdrv);
+ BlockDriverState *bs = blk_bs(blk_by_legacy_dinfo(dinfo));
+
+ bios_size = bdrv_getlength(bs);
/* XXX: should check that size is 32MB */
bios_size = 32 * 1024 * 1024;
fl_sectors = (bios_size + 65535) >> 16;
@@ -603,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(dinfo->bdrv));
+ bdrv_get_device_name(bs));
#endif
pflash_cfi02_register(0xfc000000, NULL, "taihu_405ep.flash", bios_size,
- dinfo->bdrv, 65536, fl_sectors, 1,
+ bs, 65536, fl_sectors, 1,
4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
1);
fl_idx++;
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 2becc9ff07..0605ce8205 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -29,6 +29,7 @@
#include "hw/fw-path-provider.h"
#include "elf.h"
#include "net/net.h"
+#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "sysemu/cpus.h"
#include "sysemu/kvm.h"
@@ -925,7 +926,8 @@ static void spapr_create_nvram(sPAPREnvironment *spapr)
DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
if (dinfo) {
- qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv);
+ qdev_prop_set_drive_nofail(dev, "drive",
+ blk_bs(blk_by_legacy_dinfo(dinfo)));
}
qdev_init_nofail(dev);
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index 0de51481f3..a0ce447e9c 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -39,6 +39,7 @@
#include "hw/ppc/ppc4xx.h"
#include "ppc405.h"
+#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "qapi/qmp/qerror.h"
@@ -227,8 +228,8 @@ static void virtex_init(MachineState *machine)
dinfo = drive_get(IF_PFLASH, 0, 0);
pflash_cfi01_register(PFLASH_BASEADDR, NULL, "virtex.flash", FLASH_SIZE,
- dinfo ? dinfo->bdrv : NULL, (64 * 1024),
- FLASH_SIZE >> 16,
+ dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,
+ (64 * 1024), FLASH_SIZE >> 16,
1, 0x89, 0x18, 0x0000, 0x0, 1);
cpu_irq = (qemu_irq *) &env->irq_inputs[PPC40x_INPUT_INT];