15d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner/*
25d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner * DMA helper functions
35d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner *
45d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner * Copyright (c) 2009 Red Hat
55d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner *
65d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner * This work is licensed under the terms of the GNU General Public License
75d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner * (GNU GPL), version 2 or later.
85d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner */
95d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner
105d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner#ifndef DMA_H
115d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner#define DMA_H
125d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner
135d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner#include <stdio.h>
145d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner//#include "cpu.h"
155d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner#include "hw/hw.h"
16e1e03df288d5a44bfbffbd86588395c7cbbc27dfDavid 'Digit' Turner#include "block/block.h"
175d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner
185d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turnertypedef struct {
19bcde1092aca184dbd7860078af020de7d1e4e22fDavid 'Digit' Turner    hwaddr base;
20bcde1092aca184dbd7860078af020de7d1e4e22fDavid 'Digit' Turner    hwaddr len;
215d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner} ScatterGatherEntry;
225d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner
231befd3440439e8181a31140674e847f2d3e1481eDavid 'Digit' Turnerstruct QEMUSGList {
245d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner    ScatterGatherEntry *sg;
255d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner    int nsg;
265d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner    int nalloc;
27bcde1092aca184dbd7860078af020de7d1e4e22fDavid 'Digit' Turner    hwaddr size;
281befd3440439e8181a31140674e847f2d3e1481eDavid 'Digit' Turner};
295d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner
305d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turnervoid qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
31bcde1092aca184dbd7860078af020de7d1e4e22fDavid 'Digit' Turnervoid qemu_sglist_add(QEMUSGList *qsg, hwaddr base,
32bcde1092aca184dbd7860078af020de7d1e4e22fDavid 'Digit' Turner                     hwaddr len);
335d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turnervoid qemu_sglist_destroy(QEMUSGList *qsg);
345d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner
355d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' TurnerBlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
365d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner                                QEMUSGList *sg, uint64_t sector,
375d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner                                BlockDriverCompletionFunc *cb, void *opaque);
385d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' TurnerBlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
395d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner                                 QEMUSGList *sg, uint64_t sector,
405d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner                                 BlockDriverCompletionFunc *cb, void *opaque);
415d8f37ad78fc66901af50c762029a501561f3b23David 'Digit' Turner#endif
42