aliguori | 244ab90 | 2009-02-05 21:23:50 +0000 | [diff] [blame] | 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> |
Paul Brook | 1ad2134 | 2009-05-19 16:17:58 +0100 | [diff] [blame] | 14 | //#include "cpu.h" |
| 15 | #include "hw/hw.h" |
aliguori | 59a703e | 2009-02-05 21:23:58 +0000 | [diff] [blame] | 16 | #include "block.h" |
aliguori | 244ab90 | 2009-02-05 21:23:50 +0000 | [diff] [blame] | 17 | |
| 18 | typedef struct { |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 19 | target_phys_addr_t base; |
| 20 | target_phys_addr_t len; |
aliguori | 244ab90 | 2009-02-05 21:23:50 +0000 | [diff] [blame] | 21 | } ScatterGatherEntry; |
| 22 | |
| 23 | typedef struct { |
| 24 | ScatterGatherEntry *sg; |
| 25 | int nsg; |
| 26 | int nalloc; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 27 | target_phys_addr_t size; |
aliguori | 244ab90 | 2009-02-05 21:23:50 +0000 | [diff] [blame] | 28 | } QEMUSGList; |
| 29 | |
| 30 | void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint); |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 31 | void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base, |
| 32 | target_phys_addr_t len); |
aliguori | 244ab90 | 2009-02-05 21:23:50 +0000 | [diff] [blame] | 33 | void qemu_sglist_destroy(QEMUSGList *qsg); |
| 34 | |
aliguori | 59a703e | 2009-02-05 21:23:58 +0000 | [diff] [blame] | 35 | BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs, |
| 36 | QEMUSGList *sg, uint64_t sector, |
| 37 | BlockDriverCompletionFunc *cb, void *opaque); |
| 38 | BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs, |
| 39 | QEMUSGList *sg, uint64_t sector, |
| 40 | BlockDriverCompletionFunc *cb, void *opaque); |
aliguori | 244ab90 | 2009-02-05 21:23:50 +0000 | [diff] [blame] | 41 | #endif |