mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
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>
This commit is contained in:
parent
2a30307f70
commit
4be746345f
110 changed files with 1127 additions and 798 deletions
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue