mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07: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:
committed by
Kevin Wolf
parent
2a30307f70
commit
4be746345f
@@ -237,3 +237,265 @@ void blk_hide_on_behalf_of_do_drive_del(BlockBackend *blk)
|
||||
bdrv_make_anon(blk->bs);
|
||||
}
|
||||
}
|
||||
|
||||
void blk_iostatus_enable(BlockBackend *blk)
|
||||
{
|
||||
bdrv_iostatus_enable(blk->bs);
|
||||
}
|
||||
|
||||
int blk_attach_dev(BlockBackend *blk, void *dev)
|
||||
{
|
||||
return bdrv_attach_dev(blk->bs, dev);
|
||||
}
|
||||
|
||||
void blk_attach_dev_nofail(BlockBackend *blk, void *dev)
|
||||
{
|
||||
bdrv_attach_dev_nofail(blk->bs, dev);
|
||||
}
|
||||
|
||||
void blk_detach_dev(BlockBackend *blk, void *dev)
|
||||
{
|
||||
bdrv_detach_dev(blk->bs, dev);
|
||||
}
|
||||
|
||||
void *blk_get_attached_dev(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_get_attached_dev(blk->bs);
|
||||
}
|
||||
|
||||
void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque)
|
||||
{
|
||||
bdrv_set_dev_ops(blk->bs, ops, opaque);
|
||||
}
|
||||
|
||||
int blk_read(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
|
||||
int nb_sectors)
|
||||
{
|
||||
return bdrv_read(blk->bs, sector_num, buf, nb_sectors);
|
||||
}
|
||||
|
||||
int blk_read_unthrottled(BlockBackend *blk, int64_t sector_num, uint8_t *buf,
|
||||
int nb_sectors)
|
||||
{
|
||||
return bdrv_read_unthrottled(blk->bs, sector_num, buf, nb_sectors);
|
||||
}
|
||||
|
||||
int blk_write(BlockBackend *blk, int64_t sector_num, const uint8_t *buf,
|
||||
int nb_sectors)
|
||||
{
|
||||
return bdrv_write(blk->bs, sector_num, buf, nb_sectors);
|
||||
}
|
||||
|
||||
BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num,
|
||||
int nb_sectors, BdrvRequestFlags flags,
|
||||
BlockCompletionFunc *cb, void *opaque)
|
||||
{
|
||||
return bdrv_aio_write_zeroes(blk->bs, sector_num, nb_sectors, flags,
|
||||
cb, opaque);
|
||||
}
|
||||
|
||||
int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int count)
|
||||
{
|
||||
return bdrv_pread(blk->bs, offset, buf, count);
|
||||
}
|
||||
|
||||
int blk_pwrite(BlockBackend *blk, int64_t offset, const void *buf, int count)
|
||||
{
|
||||
return bdrv_pwrite(blk->bs, offset, buf, count);
|
||||
}
|
||||
|
||||
int64_t blk_getlength(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_getlength(blk->bs);
|
||||
}
|
||||
|
||||
void blk_get_geometry(BlockBackend *blk, uint64_t *nb_sectors_ptr)
|
||||
{
|
||||
bdrv_get_geometry(blk->bs, nb_sectors_ptr);
|
||||
}
|
||||
|
||||
BlockAIOCB *blk_aio_readv(BlockBackend *blk, int64_t sector_num,
|
||||
QEMUIOVector *iov, int nb_sectors,
|
||||
BlockCompletionFunc *cb, void *opaque)
|
||||
{
|
||||
return bdrv_aio_readv(blk->bs, sector_num, iov, nb_sectors, cb, opaque);
|
||||
}
|
||||
|
||||
BlockAIOCB *blk_aio_writev(BlockBackend *blk, int64_t sector_num,
|
||||
QEMUIOVector *iov, int nb_sectors,
|
||||
BlockCompletionFunc *cb, void *opaque)
|
||||
{
|
||||
return bdrv_aio_writev(blk->bs, sector_num, iov, nb_sectors, cb, opaque);
|
||||
}
|
||||
|
||||
BlockAIOCB *blk_aio_flush(BlockBackend *blk,
|
||||
BlockCompletionFunc *cb, void *opaque)
|
||||
{
|
||||
return bdrv_aio_flush(blk->bs, cb, opaque);
|
||||
}
|
||||
|
||||
BlockAIOCB *blk_aio_discard(BlockBackend *blk,
|
||||
int64_t sector_num, int nb_sectors,
|
||||
BlockCompletionFunc *cb, void *opaque)
|
||||
{
|
||||
return bdrv_aio_discard(blk->bs, sector_num, nb_sectors, cb, opaque);
|
||||
}
|
||||
|
||||
void blk_aio_cancel(BlockAIOCB *acb)
|
||||
{
|
||||
bdrv_aio_cancel(acb);
|
||||
}
|
||||
|
||||
void blk_aio_cancel_async(BlockAIOCB *acb)
|
||||
{
|
||||
bdrv_aio_cancel_async(acb);
|
||||
}
|
||||
|
||||
int blk_aio_multiwrite(BlockBackend *blk, BlockRequest *reqs, int num_reqs)
|
||||
{
|
||||
return bdrv_aio_multiwrite(blk->bs, reqs, num_reqs);
|
||||
}
|
||||
|
||||
int blk_ioctl(BlockBackend *blk, unsigned long int req, void *buf)
|
||||
{
|
||||
return bdrv_ioctl(blk->bs, req, buf);
|
||||
}
|
||||
|
||||
BlockAIOCB *blk_aio_ioctl(BlockBackend *blk, unsigned long int req, void *buf,
|
||||
BlockCompletionFunc *cb, void *opaque)
|
||||
{
|
||||
return bdrv_aio_ioctl(blk->bs, req, buf, cb, opaque);
|
||||
}
|
||||
|
||||
int blk_flush(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_flush(blk->bs);
|
||||
}
|
||||
|
||||
int blk_flush_all(void)
|
||||
{
|
||||
return bdrv_flush_all();
|
||||
}
|
||||
|
||||
void blk_drain_all(void)
|
||||
{
|
||||
bdrv_drain_all();
|
||||
}
|
||||
|
||||
BlockdevOnError blk_get_on_error(BlockBackend *blk, bool is_read)
|
||||
{
|
||||
return bdrv_get_on_error(blk->bs, is_read);
|
||||
}
|
||||
|
||||
BlockErrorAction blk_get_error_action(BlockBackend *blk, bool is_read,
|
||||
int error)
|
||||
{
|
||||
return bdrv_get_error_action(blk->bs, is_read, error);
|
||||
}
|
||||
|
||||
void blk_error_action(BlockBackend *blk, BlockErrorAction action,
|
||||
bool is_read, int error)
|
||||
{
|
||||
bdrv_error_action(blk->bs, action, is_read, error);
|
||||
}
|
||||
|
||||
int blk_is_read_only(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_is_read_only(blk->bs);
|
||||
}
|
||||
|
||||
int blk_is_sg(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_is_sg(blk->bs);
|
||||
}
|
||||
|
||||
int blk_enable_write_cache(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_enable_write_cache(blk->bs);
|
||||
}
|
||||
|
||||
void blk_set_enable_write_cache(BlockBackend *blk, bool wce)
|
||||
{
|
||||
bdrv_set_enable_write_cache(blk->bs, wce);
|
||||
}
|
||||
|
||||
int blk_is_inserted(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_is_inserted(blk->bs);
|
||||
}
|
||||
|
||||
void blk_lock_medium(BlockBackend *blk, bool locked)
|
||||
{
|
||||
bdrv_lock_medium(blk->bs, locked);
|
||||
}
|
||||
|
||||
void blk_eject(BlockBackend *blk, bool eject_flag)
|
||||
{
|
||||
bdrv_eject(blk->bs, eject_flag);
|
||||
}
|
||||
|
||||
int blk_get_flags(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_get_flags(blk->bs);
|
||||
}
|
||||
|
||||
void blk_set_guest_block_size(BlockBackend *blk, int align)
|
||||
{
|
||||
bdrv_set_guest_block_size(blk->bs, align);
|
||||
}
|
||||
|
||||
void *blk_blockalign(BlockBackend *blk, size_t size)
|
||||
{
|
||||
return qemu_blockalign(blk ? blk->bs : NULL, size);
|
||||
}
|
||||
|
||||
bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp)
|
||||
{
|
||||
return bdrv_op_is_blocked(blk->bs, op, errp);
|
||||
}
|
||||
|
||||
void blk_op_unblock(BlockBackend *blk, BlockOpType op, Error *reason)
|
||||
{
|
||||
bdrv_op_unblock(blk->bs, op, reason);
|
||||
}
|
||||
|
||||
void blk_op_block_all(BlockBackend *blk, Error *reason)
|
||||
{
|
||||
bdrv_op_block_all(blk->bs, reason);
|
||||
}
|
||||
|
||||
void blk_op_unblock_all(BlockBackend *blk, Error *reason)
|
||||
{
|
||||
bdrv_op_unblock_all(blk->bs, reason);
|
||||
}
|
||||
|
||||
AioContext *blk_get_aio_context(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_get_aio_context(blk->bs);
|
||||
}
|
||||
|
||||
void blk_set_aio_context(BlockBackend *blk, AioContext *new_context)
|
||||
{
|
||||
bdrv_set_aio_context(blk->bs, new_context);
|
||||
}
|
||||
|
||||
void blk_io_plug(BlockBackend *blk)
|
||||
{
|
||||
bdrv_io_plug(blk->bs);
|
||||
}
|
||||
|
||||
void blk_io_unplug(BlockBackend *blk)
|
||||
{
|
||||
bdrv_io_unplug(blk->bs);
|
||||
}
|
||||
|
||||
BlockAcctStats *blk_get_stats(BlockBackend *blk)
|
||||
{
|
||||
return bdrv_get_stats(blk->bs);
|
||||
}
|
||||
|
||||
void *blk_aio_get(const AIOCBInfo *aiocb_info, BlockBackend *blk,
|
||||
BlockCompletionFunc *cb, void *opaque)
|
||||
{
|
||||
return qemu_aio_get(aiocb_info, blk_bs(blk), cb, opaque);
|
||||
}
|
||||
|
||||
+3
-9
@@ -111,10 +111,10 @@ void override_max_devs(BlockInterfaceType type, int max_devs)
|
||||
* automatic deletion, and generic qdev code calls blockdev_auto_del()
|
||||
* when deletion is actually safe.
|
||||
*/
|
||||
void blockdev_mark_auto_del(BlockDriverState *bs)
|
||||
void blockdev_mark_auto_del(BlockBackend *blk)
|
||||
{
|
||||
BlockBackend *blk = bs->blk;
|
||||
DriveInfo *dinfo = blk_legacy_dinfo(blk);
|
||||
BlockDriverState *bs = blk_bs(blk);
|
||||
|
||||
if (dinfo && !dinfo->enable_auto_del) {
|
||||
return;
|
||||
@@ -128,9 +128,8 @@ void blockdev_mark_auto_del(BlockDriverState *bs)
|
||||
}
|
||||
}
|
||||
|
||||
void blockdev_auto_del(BlockDriverState *bs)
|
||||
void blockdev_auto_del(BlockBackend *blk)
|
||||
{
|
||||
BlockBackend *blk = bs->blk;
|
||||
DriveInfo *dinfo = blk_legacy_dinfo(blk);
|
||||
|
||||
if (dinfo && dinfo->auto_del) {
|
||||
@@ -266,11 +265,6 @@ DriveInfo *drive_get_next(BlockInterfaceType type)
|
||||
return drive_get(type, 0, next_block_unit[type]++);
|
||||
}
|
||||
|
||||
DriveInfo *drive_get_by_blockdev(BlockDriverState *bs)
|
||||
{
|
||||
return bs->blk ? blk_legacy_dinfo(bs->blk) : NULL;
|
||||
}
|
||||
|
||||
static void bdrv_format_print(void *opaque, const char *name)
|
||||
{
|
||||
error_printf(" %s", name);
|
||||
|
||||
+31
-30
@@ -7,6 +7,7 @@
|
||||
* (GNU GPL), version 2 or later.
|
||||
*/
|
||||
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/dma.h"
|
||||
#include "trace.h"
|
||||
#include "qemu/range.h"
|
||||
@@ -68,7 +69,7 @@ void qemu_sglist_destroy(QEMUSGList *qsg)
|
||||
|
||||
typedef struct {
|
||||
BlockAIOCB common;
|
||||
BlockDriverState *bs;
|
||||
BlockBackend *blk;
|
||||
BlockAIOCB *acb;
|
||||
QEMUSGList *sg;
|
||||
uint64_t sector_num;
|
||||
@@ -80,7 +81,7 @@ typedef struct {
|
||||
DMAIOFunc *io_func;
|
||||
} DMAAIOCB;
|
||||
|
||||
static void dma_bdrv_cb(void *opaque, int ret);
|
||||
static void dma_blk_cb(void *opaque, int ret);
|
||||
|
||||
static void reschedule_dma(void *opaque)
|
||||
{
|
||||
@@ -88,7 +89,7 @@ static void reschedule_dma(void *opaque)
|
||||
|
||||
qemu_bh_delete(dbs->bh);
|
||||
dbs->bh = NULL;
|
||||
dma_bdrv_cb(dbs, 0);
|
||||
dma_blk_cb(dbs, 0);
|
||||
}
|
||||
|
||||
static void continue_after_map_failure(void *opaque)
|
||||
@@ -99,7 +100,7 @@ static void continue_after_map_failure(void *opaque)
|
||||
qemu_bh_schedule(dbs->bh);
|
||||
}
|
||||
|
||||
static void dma_bdrv_unmap(DMAAIOCB *dbs)
|
||||
static void dma_blk_unmap(DMAAIOCB *dbs)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -115,7 +116,7 @@ static void dma_complete(DMAAIOCB *dbs, int ret)
|
||||
{
|
||||
trace_dma_complete(dbs, ret, dbs->common.cb);
|
||||
|
||||
dma_bdrv_unmap(dbs);
|
||||
dma_blk_unmap(dbs);
|
||||
if (dbs->common.cb) {
|
||||
dbs->common.cb(dbs->common.opaque, ret);
|
||||
}
|
||||
@@ -127,13 +128,13 @@ static void dma_complete(DMAAIOCB *dbs, int ret)
|
||||
qemu_aio_unref(dbs);
|
||||
}
|
||||
|
||||
static void dma_bdrv_cb(void *opaque, int ret)
|
||||
static void dma_blk_cb(void *opaque, int ret)
|
||||
{
|
||||
DMAAIOCB *dbs = (DMAAIOCB *)opaque;
|
||||
dma_addr_t cur_addr, cur_len;
|
||||
void *mem;
|
||||
|
||||
trace_dma_bdrv_cb(dbs, ret);
|
||||
trace_dma_blk_cb(dbs, ret);
|
||||
|
||||
dbs->acb = NULL;
|
||||
dbs->sector_num += dbs->iov.size / 512;
|
||||
@@ -142,7 +143,7 @@ static void dma_bdrv_cb(void *opaque, int ret)
|
||||
dma_complete(dbs, ret);
|
||||
return;
|
||||
}
|
||||
dma_bdrv_unmap(dbs);
|
||||
dma_blk_unmap(dbs);
|
||||
|
||||
while (dbs->sg_cur_index < dbs->sg->nsg) {
|
||||
cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;
|
||||
@@ -168,8 +169,8 @@ static void dma_bdrv_cb(void *opaque, int ret)
|
||||
qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & ~BDRV_SECTOR_MASK);
|
||||
}
|
||||
|
||||
dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov,
|
||||
dbs->iov.size / 512, dma_bdrv_cb, dbs);
|
||||
dbs->acb = dbs->io_func(dbs->blk, dbs->sector_num, &dbs->iov,
|
||||
dbs->iov.size / 512, dma_blk_cb, dbs);
|
||||
assert(dbs->acb);
|
||||
}
|
||||
|
||||
@@ -180,7 +181,7 @@ static void dma_aio_cancel(BlockAIOCB *acb)
|
||||
trace_dma_aio_cancel(dbs);
|
||||
|
||||
if (dbs->acb) {
|
||||
bdrv_aio_cancel_async(dbs->acb);
|
||||
blk_aio_cancel_async(dbs->acb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,17 +191,17 @@ static const AIOCBInfo dma_aiocb_info = {
|
||||
.cancel_async = dma_aio_cancel,
|
||||
};
|
||||
|
||||
BlockAIOCB *dma_bdrv_io(
|
||||
BlockDriverState *bs, QEMUSGList *sg, uint64_t sector_num,
|
||||
BlockAIOCB *dma_blk_io(
|
||||
BlockBackend *blk, QEMUSGList *sg, uint64_t sector_num,
|
||||
DMAIOFunc *io_func, BlockCompletionFunc *cb,
|
||||
void *opaque, DMADirection dir)
|
||||
{
|
||||
DMAAIOCB *dbs = qemu_aio_get(&dma_aiocb_info, bs, cb, opaque);
|
||||
DMAAIOCB *dbs = blk_aio_get(&dma_aiocb_info, blk, cb, opaque);
|
||||
|
||||
trace_dma_bdrv_io(dbs, bs, sector_num, (dir == DMA_DIRECTION_TO_DEVICE));
|
||||
trace_dma_blk_io(dbs, blk, sector_num, (dir == DMA_DIRECTION_TO_DEVICE));
|
||||
|
||||
dbs->acb = NULL;
|
||||
dbs->bs = bs;
|
||||
dbs->blk = blk;
|
||||
dbs->sg = sg;
|
||||
dbs->sector_num = sector_num;
|
||||
dbs->sg_cur_index = 0;
|
||||
@@ -209,25 +210,25 @@ BlockAIOCB *dma_bdrv_io(
|
||||
dbs->io_func = io_func;
|
||||
dbs->bh = NULL;
|
||||
qemu_iovec_init(&dbs->iov, sg->nsg);
|
||||
dma_bdrv_cb(dbs, 0);
|
||||
dma_blk_cb(dbs, 0);
|
||||
return &dbs->common;
|
||||
}
|
||||
|
||||
|
||||
BlockAIOCB *dma_bdrv_read(BlockDriverState *bs,
|
||||
BlockAIOCB *dma_blk_read(BlockBackend *blk,
|
||||
QEMUSGList *sg, uint64_t sector,
|
||||
void (*cb)(void *opaque, int ret), void *opaque)
|
||||
{
|
||||
return dma_blk_io(blk, sg, sector, blk_aio_readv, cb, opaque,
|
||||
DMA_DIRECTION_FROM_DEVICE);
|
||||
}
|
||||
|
||||
BlockAIOCB *dma_blk_write(BlockBackend *blk,
|
||||
QEMUSGList *sg, uint64_t sector,
|
||||
void (*cb)(void *opaque, int ret), void *opaque)
|
||||
{
|
||||
return dma_bdrv_io(bs, sg, sector, bdrv_aio_readv, cb, opaque,
|
||||
DMA_DIRECTION_FROM_DEVICE);
|
||||
}
|
||||
|
||||
BlockAIOCB *dma_bdrv_write(BlockDriverState *bs,
|
||||
QEMUSGList *sg, uint64_t sector,
|
||||
void (*cb)(void *opaque, int ret), void *opaque)
|
||||
{
|
||||
return dma_bdrv_io(bs, sg, sector, bdrv_aio_writev, cb, opaque,
|
||||
DMA_DIRECTION_TO_DEVICE);
|
||||
return dma_blk_io(blk, sg, sector, blk_aio_writev, cb, opaque,
|
||||
DMA_DIRECTION_TO_DEVICE);
|
||||
}
|
||||
|
||||
|
||||
@@ -262,8 +263,8 @@ uint64_t dma_buf_write(uint8_t *ptr, int32_t len, QEMUSGList *sg)
|
||||
return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_TO_DEVICE);
|
||||
}
|
||||
|
||||
void dma_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie,
|
||||
void dma_acct_start(BlockBackend *blk, BlockAcctCookie *cookie,
|
||||
QEMUSGList *sg, enum BlockAcctType type)
|
||||
{
|
||||
block_acct_start(bdrv_get_stats(bs), cookie, sg->size, type);
|
||||
block_acct_start(blk_get_stats(blk), cookie, sg->size, type);
|
||||
}
|
||||
|
||||
+2
-3
@@ -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);
|
||||
|
||||
+2
-3
@@ -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");
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
|
||||
+1
-1
@@ -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");
|
||||
|
||||
+4
-6
@@ -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);
|
||||
|
||||
+1
-2
@@ -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,
|
||||
|
||||
+1
-1
@@ -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"));
|
||||
|
||||
+1
-1
@@ -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"));
|
||||
|
||||
+2
-3
@@ -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",
|
||||
|
||||
+2
-2
@@ -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));
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
|
||||
+1
-3
@@ -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);
|
||||
|
||||
+1
-2
@@ -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"
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
+1
-2
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user