Annotation of qemu/dma.h, revision 1.1.1.6

1.1       root        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>
1.1.1.3   root       14: #include "hw/hw.h"
1.1       root       15: #include "block.h"
                     16: 
1.1.1.5   root       17: typedef struct ScatterGatherEntry ScatterGatherEntry;
1.1       root       18: 
1.1.1.5   root       19: typedef enum {
                     20:     DMA_DIRECTION_TO_DEVICE = 0,
                     21:     DMA_DIRECTION_FROM_DEVICE = 1,
                     22: } DMADirection;
                     23: 
                     24: struct QEMUSGList {
1.1       root       25:     ScatterGatherEntry *sg;
                     26:     int nsg;
                     27:     int nalloc;
1.1.1.6 ! root       28:     size_t size;
        !            29: };
        !            30: 
        !            31: #if defined(TARGET_PHYS_ADDR_BITS)
        !            32: typedef target_phys_addr_t dma_addr_t;
        !            33: 
        !            34: #define DMA_ADDR_FMT TARGET_FMT_plx
        !            35: 
        !            36: struct ScatterGatherEntry {
        !            37:     dma_addr_t base;
        !            38:     dma_addr_t len;
1.1.1.5   root       39: };
1.1       root       40: 
                     41: void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
1.1.1.5   root       42: void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len);
1.1       root       43: void qemu_sglist_destroy(QEMUSGList *qsg);
1.1.1.5   root       44: #endif
1.1       root       45: 
1.1.1.4   root       46: typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num,
                     47:                                  QEMUIOVector *iov, int nb_sectors,
                     48:                                  BlockDriverCompletionFunc *cb, void *opaque);
                     49: 
                     50: BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs,
                     51:                               QEMUSGList *sg, uint64_t sector_num,
                     52:                               DMAIOFunc *io_func, BlockDriverCompletionFunc *cb,
1.1.1.6 ! root       53:                               void *opaque, DMADirection dir);
1.1       root       54: BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
                     55:                                 QEMUSGList *sg, uint64_t sector,
                     56:                                 BlockDriverCompletionFunc *cb, void *opaque);
                     57: BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
                     58:                                  QEMUSGList *sg, uint64_t sector,
                     59:                                  BlockDriverCompletionFunc *cb, void *opaque);
1.1.1.6 ! root       60: uint64_t dma_buf_read(uint8_t *ptr, int32_t len, QEMUSGList *sg);
        !            61: uint64_t dma_buf_write(uint8_t *ptr, int32_t len, QEMUSGList *sg);
        !            62: 
        !            63: void dma_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie,
        !            64:                     QEMUSGList *sg, enum BlockAcctType type);
        !            65: 
1.1       root       66: #endif

unix.superglobalmegacorp.com