blob: f3bb27515952455b9ba29640c44340419c044502 [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>
Paul Brook1ad21342009-05-19 16:17:58 +010014//#include "cpu.h"
15#include "hw/hw.h"
aliguori59a703e2009-02-05 21:23:58 +000016#include "block.h"
aliguori244ab902009-02-05 21:23:50 +000017
18typedef struct {
Anthony Liguoric227f092009-10-01 16:12:16 -050019 target_phys_addr_t base;
20 target_phys_addr_t len;
aliguori244ab902009-02-05 21:23:50 +000021} ScatterGatherEntry;
22
23typedef struct {
24 ScatterGatherEntry *sg;
25 int nsg;
26 int nalloc;
Anthony Liguoric227f092009-10-01 16:12:16 -050027 target_phys_addr_t size;
aliguori244ab902009-02-05 21:23:50 +000028} QEMUSGList;
29
30void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
Anthony Liguoric227f092009-10-01 16:12:16 -050031void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
32 target_phys_addr_t len);
aliguori244ab902009-02-05 21:23:50 +000033void qemu_sglist_destroy(QEMUSGList *qsg);
34
aliguori59a703e2009-02-05 21:23:58 +000035BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
36 QEMUSGList *sg, uint64_t sector,
37 BlockDriverCompletionFunc *cb, void *opaque);
38BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
39 QEMUSGList *sg, uint64_t sector,
40 BlockDriverCompletionFunc *cb, void *opaque);
aliguori244ab902009-02-05 21:23:50 +000041#endif