[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 6/8] ppc: simplify access to PReP I/O region
From: |
Hervé Poussineau |
Subject: |
[Qemu-devel] [PATCH v2 6/8] ppc: simplify access to PReP I/O region |
Date: |
Sun, 9 Jun 2013 01:44:04 +0800 |
We can now simply use address_space_rw instead of the more convoluted
cpu_in() and cpu_out() functions.
Signed-off-by: Hervé Poussineau <address@hidden>
---
hw/ppc/prep.c | 65 ++++++++-------------------------------------------------
1 file changed, 9 insertions(+), 56 deletions(-)
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index be8a50e..bb77e1f 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -341,75 +341,28 @@ static inline hwaddr prep_IO_address(sysctrl_t *sysctrl,
return addr;
}
-static void PPC_prep_io_writeb (void *opaque, hwaddr addr,
- uint32_t value)
+static uint64_t PPC_prep_io_read(void *opaque, hwaddr addr, unsigned int size)
{
sysctrl_t *sysctrl = opaque;
+ uint64_t data = 0;
addr = prep_IO_address(sysctrl, addr);
- cpu_outb(addr, value);
+ address_space_read(&address_space_io, addr, (uint8_t *)&data, size);
+ return data;
}
-static uint32_t PPC_prep_io_readb (void *opaque, hwaddr addr)
+static void PPC_prep_io_write(void *opaque, hwaddr addr, uint64_t data,
+ unsigned int size)
{
sysctrl_t *sysctrl = opaque;
- uint32_t ret;
addr = prep_IO_address(sysctrl, addr);
- ret = cpu_inb(addr);
-
- return ret;
-}
-
-static void PPC_prep_io_writew (void *opaque, hwaddr addr,
- uint32_t value)
-{
- sysctrl_t *sysctrl = opaque;
-
- addr = prep_IO_address(sysctrl, addr);
- PPC_IO_DPRINTF("0x" TARGET_FMT_plx " => 0x%08" PRIx32 "\n", addr, value);
- cpu_outw(addr, value);
-}
-
-static uint32_t PPC_prep_io_readw (void *opaque, hwaddr addr)
-{
- sysctrl_t *sysctrl = opaque;
- uint32_t ret;
-
- addr = prep_IO_address(sysctrl, addr);
- ret = cpu_inw(addr);
- PPC_IO_DPRINTF("0x" TARGET_FMT_plx " <= 0x%08" PRIx32 "\n", addr, ret);
-
- return ret;
-}
-
-static void PPC_prep_io_writel (void *opaque, hwaddr addr,
- uint32_t value)
-{
- sysctrl_t *sysctrl = opaque;
-
- addr = prep_IO_address(sysctrl, addr);
- PPC_IO_DPRINTF("0x" TARGET_FMT_plx " => 0x%08" PRIx32 "\n", addr, value);
- cpu_outl(addr, value);
-}
-
-static uint32_t PPC_prep_io_readl (void *opaque, hwaddr addr)
-{
- sysctrl_t *sysctrl = opaque;
- uint32_t ret;
-
- addr = prep_IO_address(sysctrl, addr);
- ret = cpu_inl(addr);
- PPC_IO_DPRINTF("0x" TARGET_FMT_plx " <= 0x%08" PRIx32 "\n", addr, ret);
-
- return ret;
+ address_space_write(&address_space_io, addr, (uint8_t *)&data, size);
}
static const MemoryRegionOps PPC_prep_io_ops = {
- .old_mmio = {
- .read = { PPC_prep_io_readb, PPC_prep_io_readw, PPC_prep_io_readl },
- .write = { PPC_prep_io_writeb, PPC_prep_io_writew, PPC_prep_io_writel
},
- },
+ .read = PPC_prep_io_read,
+ .write = PPC_prep_io_write,
.endianness = DEVICE_LITTLE_ENDIAN,
};
--
1.7.10.4
- [Qemu-devel] [PATCH v2 0/8] memory: remove old_portio usage, Hervé Poussineau, 2013/06/08
- [Qemu-devel] [PATCH v2 2/8] memory: handle old_portio accesses in MMIO path, Hervé Poussineau, 2013/06/08
- [Qemu-devel] [PATCH v2 1/8] isa: fix documentation of isa_register_portio_list, Hervé Poussineau, 2013/06/08
- [Qemu-devel] [PATCH v2 3/8] ioport: register memory regions for I/O port lists, Hervé Poussineau, 2013/06/08
- [Qemu-devel] [PATCH v2 4/8] memory: remove code dealing with old_portio, Hervé Poussineau, 2013/06/08
- [Qemu-devel] [PATCH v2 5/8] ioport: reimplement cpu_in/cpu_out using address_space_rw, Hervé Poussineau, 2013/06/08
- [Qemu-devel] [PATCH v2 6/8] ppc: simplify access to PReP I/O region,
Hervé Poussineau <=
- [Qemu-devel] [PATCH v2 7/8] PPC: pseries: Remove hack for PIO window, Hervé Poussineau, 2013/06/08
- [Qemu-devel] [PATCH v2 8/8] isa_mmio: simplify access to system I/O region, Hervé Poussineau, 2013/06/08
- Re: [Qemu-devel] [PATCH v2 0/8] memory: remove old_portio usage, Hervé Poussineau, 2013/06/16
- Re: [Qemu-devel] [PATCH v2 0/8] memory: remove old_portio usage, Paolo Bonzini, 2013/06/17
- Re: [Qemu-devel] [PATCH v2 0/8] memory: remove old_portio usage, Jan Kiszka, 2013/06/17
- Re: [Qemu-devel] [PATCH v2 0/8] memory: remove old_portio usage, Hervé Poussineau, 2013/06/17
- Re: [Qemu-devel] [PATCH v2 0/8] memory: remove old_portio usage, Jan Kiszka, 2013/06/18
- Re: [Qemu-devel] [PATCH v2 0/8] memory: remove old_portio usage, Hervé Poussineau, 2013/06/18
- Re: [Qemu-devel] [PATCH v2 0/8] memory: remove old_portio usage, Jan Kiszka, 2013/06/21