]>
git.proxmox.com Git - qemu.git/blob - dma-helpers.c
4 * Copyright (c) 2009 Red Hat
6 * This work is licensed under the terms of the GNU General Public License
7 * (GNU GPL), version 2 or later.
13 void qemu_sglist_init(QEMUSGList
*qsg
, int alloc_hint
)
15 qsg
->sg
= qemu_malloc(alloc_hint
* sizeof(ScatterGatherEntry
));
17 qsg
->nalloc
= alloc_hint
;
21 void qemu_sglist_add(QEMUSGList
*qsg
, target_phys_addr_t base
,
22 target_phys_addr_t len
)
24 if (qsg
->nsg
== qsg
->nalloc
) {
25 qsg
->nalloc
= 2 * qsg
->nalloc
+ 1;
26 qsg
->sg
= qemu_realloc(qsg
->sg
, qsg
->nalloc
* sizeof(ScatterGatherEntry
));
28 qsg
->sg
[qsg
->nsg
].base
= base
;
29 qsg
->sg
[qsg
->nsg
].len
= len
;
34 void qemu_sglist_destroy(QEMUSGList
*qsg
)