dma.h 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 * DMA helper functions
 *
 * Copyright (c) 2009 Red Hat
 *
 * This work is licensed under the terms of the GNU General Public License
 * (GNU GPL), version 2 or later.
 */

#ifndef DMA_H
#define DMA_H

#include <stdio.h>
P
Paul Brook 已提交
14 15
//#include "cpu.h"
#include "hw/hw.h"
16
#include "block.h"
17 18

typedef struct {
M
malc 已提交
19 20
    a_target_phys_addr base;
    a_target_phys_addr len;
21 22 23 24 25 26
} ScatterGatherEntry;

typedef struct {
    ScatterGatherEntry *sg;
    int nsg;
    int nalloc;
M
malc 已提交
27
    a_target_phys_addr size;
28 29 30
} QEMUSGList;

void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
M
malc 已提交
31 32
void qemu_sglist_add(QEMUSGList *qsg, a_target_phys_addr base,
                     a_target_phys_addr len);
33 34
void qemu_sglist_destroy(QEMUSGList *qsg);

35 36 37 38 39 40
BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
                                QEMUSGList *sg, uint64_t sector,
                                BlockDriverCompletionFunc *cb, void *opaque);
BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
                                 QEMUSGList *sg, uint64_t sector,
                                 BlockDriverCompletionFunc *cb, void *opaque);
41
#endif