Add a scatter-gather list type and accessors (Avi Kivity)
[qemu] / dma.h
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>
14 #include "cpu.h"
15
16 typedef struct {
17     target_phys_addr_t base;
18     target_phys_addr_t len;
19 } ScatterGatherEntry;
20
21 typedef struct {
22     ScatterGatherEntry *sg;
23     int nsg;
24     int nalloc;
25     target_phys_addr_t size;
26 } QEMUSGList;
27
28 void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
29 void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
30                      target_phys_addr_t len);
31 void qemu_sglist_destroy(QEMUSGList *qsg);
32
33 #endif