4 * Copyright (c) 2009 Red Hat
6 * This work is licensed under the terms of the GNU General Public License
7 * (GNU GPL), version 2 or later.
18 typedef struct ScatterGatherEntry ScatterGatherEntry
;
20 #if defined(TARGET_PHYS_ADDR_BITS)
21 typedef target_phys_addr_t dma_addr_t
;
23 #define DMA_ADDR_FMT TARGET_FMT_plx
26 DMA_DIRECTION_TO_DEVICE
= 0,
27 DMA_DIRECTION_FROM_DEVICE
= 1,
30 struct ScatterGatherEntry
{
36 ScatterGatherEntry
*sg
;
42 void qemu_sglist_init(QEMUSGList
*qsg
, int alloc_hint
);
43 void qemu_sglist_add(QEMUSGList
*qsg
, dma_addr_t base
, dma_addr_t len
);
44 void qemu_sglist_destroy(QEMUSGList
*qsg
);
47 typedef BlockDriverAIOCB
*DMAIOFunc(BlockDriverState
*bs
, int64_t sector_num
,
48 QEMUIOVector
*iov
, int nb_sectors
,
49 BlockDriverCompletionFunc
*cb
, void *opaque
);
51 BlockDriverAIOCB
*dma_bdrv_io(BlockDriverState
*bs
,
52 QEMUSGList
*sg
, uint64_t sector_num
,
53 DMAIOFunc
*io_func
, BlockDriverCompletionFunc
*cb
,
54 void *opaque
, bool to_dev
);
55 BlockDriverAIOCB
*dma_bdrv_read(BlockDriverState
*bs
,
56 QEMUSGList
*sg
, uint64_t sector
,
57 BlockDriverCompletionFunc
*cb
, void *opaque
);
58 BlockDriverAIOCB
*dma_bdrv_write(BlockDriverState
*bs
,
59 QEMUSGList
*sg
, uint64_t sector
,
60 BlockDriverCompletionFunc
*cb
, void *opaque
);