diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-04-10 18:15:49 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-06-20 16:39:52 +0200 |
commit | df32fd1c9f53dd3b7abd28e29f851965039eabda (patch) | |
tree | 37996235c390c2c368f595090642b1aedea3b5db /hw/ide | |
parent | 96478592a93f93322ecc20d0a6eccb4d4ef33c7a (diff) | |
download | qemu-df32fd1c9f53dd3b7abd28e29f851965039eabda.zip qemu-df32fd1c9f53dd3b7abd28e29f851965039eabda.tar.gz qemu-df32fd1c9f53dd3b7abd28e29f851965039eabda.tar.bz2 |
dma: eliminate DMAContext
The DMAContext is a simple pointer to an AddressSpace that is now always
already available. Make everyone hold the address space directly,
and clean up the DMA API to use the AddressSpace directly.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/ahci.c | 18 | ||||
-rw-r--r-- | hw/ide/ahci.h | 4 | ||||
-rw-r--r-- | hw/ide/ich.c | 2 | ||||
-rw-r--r-- | hw/ide/macio.c | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index eab6096..1adfa0b 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -597,7 +597,7 @@ static void ahci_write_fis_d2h(AHCIDevice *ad, uint8_t *cmd_fis) if (!cmd_fis) { /* map cmd_fis */ uint64_t tbl_addr = le64_to_cpu(ad->cur_cmd->tbl_addr); - cmd_fis = dma_memory_map(ad->hba->dma, tbl_addr, &cmd_len, + cmd_fis = dma_memory_map(ad->hba->as, tbl_addr, &cmd_len, DMA_DIRECTION_TO_DEVICE); cmd_mapped = 1; } @@ -630,7 +630,7 @@ static void ahci_write_fis_d2h(AHCIDevice *ad, uint8_t *cmd_fis) ahci_trigger_irq(ad->hba, ad, PORT_IRQ_D2H_REG_FIS); if (cmd_mapped) { - dma_memory_unmap(ad->hba->dma, cmd_fis, cmd_len, + dma_memory_unmap(ad->hba->as, cmd_fis, cmd_len, DMA_DIRECTION_TO_DEVICE, cmd_len); } } @@ -657,7 +657,7 @@ static int ahci_populate_sglist(AHCIDevice *ad, QEMUSGList *sglist, int offset) } /* map PRDT */ - if (!(prdt = dma_memory_map(ad->hba->dma, prdt_addr, &prdt_len, + if (!(prdt = dma_memory_map(ad->hba->as, prdt_addr, &prdt_len, DMA_DIRECTION_TO_DEVICE))){ DPRINTF(ad->port_no, "map failed\n"); return -1; @@ -691,7 +691,7 @@ static int ahci_populate_sglist(AHCIDevice *ad, QEMUSGList *sglist, int offset) goto out; } - qemu_sglist_init(sglist, (sglist_alloc_hint - off_idx), ad->hba->dma); + qemu_sglist_init(sglist, (sglist_alloc_hint - off_idx), ad->hba->as); qemu_sglist_add(sglist, le64_to_cpu(tbl[off_idx].addr + off_pos), le32_to_cpu(tbl[off_idx].flags_size) + 1 - off_pos); @@ -703,7 +703,7 @@ static int ahci_populate_sglist(AHCIDevice *ad, QEMUSGList *sglist, int offset) } out: - dma_memory_unmap(ad->hba->dma, prdt, prdt_len, + dma_memory_unmap(ad->hba->as, prdt, prdt_len, DMA_DIRECTION_TO_DEVICE, prdt_len); return r; } @@ -836,7 +836,7 @@ static int handle_cmd(AHCIState *s, int port, int slot) tbl_addr = le64_to_cpu(cmd->tbl_addr); cmd_len = 0x80; - cmd_fis = dma_memory_map(s->dma, tbl_addr, &cmd_len, + cmd_fis = dma_memory_map(s->as, tbl_addr, &cmd_len, DMA_DIRECTION_FROM_DEVICE); if (!cmd_fis) { @@ -963,7 +963,7 @@ static int handle_cmd(AHCIState *s, int port, int slot) } out: - dma_memory_unmap(s->dma, cmd_fis, cmd_len, DMA_DIRECTION_FROM_DEVICE, + dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_FROM_DEVICE, cmd_len); if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) { @@ -1145,12 +1145,12 @@ static const IDEDMAOps ahci_dma_ops = { .reset = ahci_dma_reset, }; -void ahci_init(AHCIState *s, DeviceState *qdev, DMAContext *dma, int ports) +void ahci_init(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports) { qemu_irq *irqs; int i; - s->dma = dma; + s->as = as; s->ports = ports; s->dev = g_malloc0(sizeof(AHCIDevice) * ports); ahci_reg_init(s); diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h index 85f37fe..341a571 100644 --- a/hw/ide/ahci.h +++ b/hw/ide/ahci.h @@ -297,7 +297,7 @@ typedef struct AHCIState { uint32_t idp_index; /* Current IDP index */ int32_t ports; qemu_irq irq; - DMAContext *dma; + AddressSpace *as; } AHCIState; typedef struct AHCIPCIState { @@ -338,7 +338,7 @@ typedef struct NCQFrame { uint8_t reserved10; } QEMU_PACKED NCQFrame; -void ahci_init(AHCIState *s, DeviceState *qdev, DMAContext *dma, int ports); +void ahci_init(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports); void ahci_uninit(AHCIState *s); void ahci_reset(AHCIState *s); diff --git a/hw/ide/ich.c b/hw/ide/ich.c index ed1f1a2..6c0c0c2 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -104,7 +104,7 @@ static int pci_ich9_ahci_init(PCIDevice *dev) uint8_t *sata_cap; d = DO_UPCAST(struct AHCIPCIState, card, dev); - ahci_init(&d->ahci, &dev->qdev, pci_dma_context(dev), 6); + ahci_init(&d->ahci, &dev->qdev, pci_get_address_space(dev), 6); pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1); diff --git a/hw/ide/macio.c b/hw/ide/macio.c index e1e4f41..a1952b0 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -71,7 +71,7 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret) s->io_buffer_size = io->len; qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1, - &dma_context_memory); + &address_space_memory); qemu_sglist_add(&s->sg, io->addr, io->len); io->addr += io->len; io->len = 0; @@ -128,7 +128,7 @@ static void pmac_ide_transfer_cb(void *opaque, int ret) s->io_buffer_size = io->len; qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1, - &dma_context_memory); + &address_space_memory); qemu_sglist_add(&s->sg, io->addr, io->len); io->addr += io->len; io->len = 0; |