]> Git Repo - qemu.git/blob - dma.h
block: directly invoke .bdrv_* from emulation functions
[qemu.git] / dma.h
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>
14 //#include "cpu.h"
15 #include "hw/hw.h"
16 #include "block.h"
17
18 typedef struct ScatterGatherEntry ScatterGatherEntry;
19
20 #if defined(TARGET_PHYS_ADDR_BITS)
21 struct ScatterGatherEntry {
22     target_phys_addr_t base;
23     target_phys_addr_t len;
24 };
25
26 struct QEMUSGList {
27     ScatterGatherEntry *sg;
28     int nsg;
29     int nalloc;
30     target_phys_addr_t size;
31 };
32
33 void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
34 void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
35                      target_phys_addr_t len);
36 void qemu_sglist_destroy(QEMUSGList *qsg);
37 #endif
38
39 typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num,
40                                  QEMUIOVector *iov, int nb_sectors,
41                                  BlockDriverCompletionFunc *cb, void *opaque);
42
43 BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs,
44                               QEMUSGList *sg, uint64_t sector_num,
45                               DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
46                               void *opaque, bool to_dev);
47 BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
48                                 QEMUSGList *sg, uint64_t sector,
49                                 BlockDriverCompletionFunc *cb, void *opaque);
50 BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
51                                  QEMUSGList *sg, uint64_t sector,
52                                  BlockDriverCompletionFunc *cb, void *opaque);
53 #endif
This page took 0.023966 seconds and 4 git commands to generate.