dma.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #ifndef DMA_H
  10. #define DMA_H
  11. #include <stdio.h>
  12. #include "cpu.h"
  13. #include "block.h"
  14. typedef struct {
  15. target_phys_addr_t base;
  16. target_phys_addr_t len;
  17. } ScatterGatherEntry;
  18. typedef struct {
  19. ScatterGatherEntry *sg;
  20. int nsg;
  21. int nalloc;
  22. target_phys_addr_t size;
  23. } QEMUSGList;
  24. void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint);
  25. void qemu_sglist_add(QEMUSGList *qsg, target_phys_addr_t base,
  26. target_phys_addr_t len);
  27. void qemu_sglist_destroy(QEMUSGList *qsg);
  28. BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs,
  29. QEMUSGList *sg, uint64_t sector,
  30. BlockDriverCompletionFunc *cb, void *opaque);
  31. BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs,
  32. QEMUSGList *sg, uint64_t sector,
  33. BlockDriverCompletionFunc *cb, void *opaque);
  34. void dma_helper_init(void);
  35. #endif