Revision df32fd1c include/hw/pci/pci.h
b/include/hw/pci/pci.h | ||
---|---|---|
242 | 242 |
PCIIORegion io_regions[PCI_NUM_REGIONS]; |
243 | 243 |
AddressSpace bus_master_as; |
244 | 244 |
MemoryRegion bus_master_enable_region; |
245 |
DMAContext *dma; |
|
246 | 245 |
|
247 | 246 |
/* do not access the following fields */ |
248 | 247 |
PCIConfigReadFunc *config_read; |
... | ... | |
639 | 638 |
} |
640 | 639 |
|
641 | 640 |
/* DMA access functions */ |
642 |
static inline DMAContext *pci_dma_context(PCIDevice *dev)
|
|
641 |
static inline AddressSpace *pci_get_address_space(PCIDevice *dev)
|
|
643 | 642 |
{ |
644 |
return dev->dma;
|
|
643 |
return &dev->bus_master_as;
|
|
645 | 644 |
} |
646 | 645 |
|
647 | 646 |
static inline int pci_dma_rw(PCIDevice *dev, dma_addr_t addr, |
648 | 647 |
void *buf, dma_addr_t len, DMADirection dir) |
649 | 648 |
{ |
650 |
dma_memory_rw(pci_dma_context(dev), addr, buf, len, dir);
|
|
649 |
dma_memory_rw(pci_get_address_space(dev), addr, buf, len, dir);
|
|
651 | 650 |
return 0; |
652 | 651 |
} |
653 | 652 |
|
... | ... | |
667 | 666 |
static inline uint##_bits##_t ld##_l##_pci_dma(PCIDevice *dev, \ |
668 | 667 |
dma_addr_t addr) \ |
669 | 668 |
{ \ |
670 |
return ld##_l##_dma(pci_dma_context(dev), addr); \
|
|
669 |
return ld##_l##_dma(pci_get_address_space(dev), addr); \
|
|
671 | 670 |
} \ |
672 | 671 |
static inline void st##_s##_pci_dma(PCIDevice *dev, \ |
673 | 672 |
dma_addr_t addr, uint##_bits##_t val) \ |
674 | 673 |
{ \ |
675 |
st##_s##_dma(pci_dma_context(dev), addr, val); \
|
|
674 |
st##_s##_dma(pci_get_address_space(dev), addr, val); \
|
|
676 | 675 |
} |
677 | 676 |
|
678 | 677 |
PCI_DMA_DEFINE_LDST(ub, b, 8); |
... | ... | |
690 | 689 |
{ |
691 | 690 |
void *buf; |
692 | 691 |
|
693 |
buf = dma_memory_map(pci_dma_context(dev), addr, plen, dir);
|
|
692 |
buf = dma_memory_map(pci_get_address_space(dev), addr, plen, dir);
|
|
694 | 693 |
return buf; |
695 | 694 |
} |
696 | 695 |
|
697 | 696 |
static inline void pci_dma_unmap(PCIDevice *dev, void *buffer, dma_addr_t len, |
698 | 697 |
DMADirection dir, dma_addr_t access_len) |
699 | 698 |
{ |
700 |
dma_memory_unmap(pci_dma_context(dev), buffer, len, dir, access_len);
|
|
699 |
dma_memory_unmap(pci_get_address_space(dev), buffer, len, dir, access_len);
|
|
701 | 700 |
} |
702 | 701 |
|
703 | 702 |
static inline void pci_dma_sglist_init(QEMUSGList *qsg, PCIDevice *dev, |
704 | 703 |
int alloc_hint) |
705 | 704 |
{ |
706 |
qemu_sglist_init(qsg, alloc_hint, pci_dma_context(dev));
|
|
705 |
qemu_sglist_init(qsg, alloc_hint, pci_get_address_space(dev));
|
|
707 | 706 |
} |
708 | 707 |
|
709 | 708 |
extern const VMStateDescription vmstate_pci_device; |
Also available in: Unified diff