]> git.proxmox.com Git - qemu.git/blame - dma.h
Merge remote-tracking branch 'qemu-kvm-tmp/uq/master' into staging
[qemu.git] / dma.h
CommitLineData
244ab90e
AL
1/*
2 * DMA helper functions
3 *
4 * Copyright (c) 2009 Red Hat
5 *
6 * This work is licensed under the terms of the GNU General Public License
7 * (GNU GPL), version 2 or later.
8 */
9
10#ifndef DMA_H
11#define DMA_H
12
13#include <stdio.h>
1ad2134f
PB
14//#include "cpu.h"
15#include "hw/hw.h"
59a703eb 16#include "block.h"
244ab90e 17
10dc8aef
PB
18typedef struct ScatterGatherEntry ScatterGatherEntry;
19
20#if defined(TARGET_PHYS_ADDR_BITS)
21struct ScatterGatherEntry {
c227f099
AL
22 target_phys_addr_t base;
23 target_phys_addr_t len;
10dc8aef 24};
244ab90e 25
d35bf9ad 26struct QEMUSGList {
244ab90e
AL
27 ScatterGatherEntry *sg;
28 int nsg;
29 int nalloc;
c227f099 30 target_phys_addr_t size;
d35bf9ad 31};
244ab90e
AL
32
33void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
c227f099
AL
34void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
35 target_phys_addr_t len);
244ab90e 36void qemu_sglist_destroy(QEMUSGList *qsg);
10dc8aef 37#endif
244ab90e 38
cb144ccb
CH
39typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num,
40 QEMUIOVector *iov, int nb_sectors,
41 BlockDriverCompletionFunc *cb, void *opaque);
42
43BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs,
44 QEMUSGList *sg, uint64_t sector_num,
45 DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
bbca72c6 46 void *opaque, bool to_dev);
59a703eb
AL
47BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
48 QEMUSGList *sg, uint64_t sector,
49 BlockDriverCompletionFunc *cb, void *opaque);
50BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
51 QEMUSGList *sg, uint64_t sector,
52 BlockDriverCompletionFunc *cb, void *opaque);
244ab90e 53#endif