blob: d596717f14351133e587359a0c934ebf656330aa [file] [log] [blame]
aliguori244ab902009-02-05 21:23:50 +00001/*
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"
aliguori59a703e2009-02-05 21:23:58 +000015#include "block.h"
aliguori244ab902009-02-05 21:23:50 +000016
17typedef struct {
18 target_phys_addr_t base;
19 target_phys_addr_t len;
20} ScatterGatherEntry;
21
22typedef struct {
23 ScatterGatherEntry *sg;
24 int nsg;
25 int nalloc;
26 target_phys_addr_t size;
27} QEMUSGList;
28
29void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
30void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
31 target_phys_addr_t len);
32void qemu_sglist_destroy(QEMUSGList *qsg);
33
aliguori59a703e2009-02-05 21:23:58 +000034BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
35 QEMUSGList *sg, uint64_t sector,
36 BlockDriverCompletionFunc *cb, void *opaque);
37BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
38 QEMUSGList *sg, uint64_t sector,
39 BlockDriverCompletionFunc *cb, void *opaque);
40
aliguori244ab902009-02-05 21:23:50 +000041#endif