[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/11] bonito: convert cop to memory API
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [PATCH 11/11] bonito: convert cop to memory API |
Date: |
Tue, 22 Nov 2011 15:23:28 +0100 |
Signed-off-by: Benoît Canet <address@hidden>
---
hw/bonito.c | 40 +++++++++++++++++-----------------------
1 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/hw/bonito.c b/hw/bonito.c
index 8972f55..a92675c 100644
--- a/hw/bonito.c
+++ b/hw/bonito.c
@@ -205,6 +205,7 @@ typedef struct PCIBonitoState
MemoryRegion iomem_pciconf;
MemoryRegion iomem_spciconf;
MemoryRegion iomem_ldma;
+ MemoryRegion iomem_cop;
target_phys_addr_t bonito_pciio_start;
target_phys_addr_t bonito_pciio_length;
@@ -214,10 +215,6 @@ typedef struct PCIBonitoState
target_phys_addr_t bonito_localio_length;
int bonito_localio_handle;
- target_phys_addr_t bonito_cop_start;
- target_phys_addr_t bonito_cop_length;
- int bonito_cop_handle;
-
} PCIBonitoState;
PCIBonitoState * bonito_state;
@@ -372,7 +369,8 @@ static const MemoryRegionOps bonito_ldma_ops = {
},
};
-static uint32_t bonito_cop_readl(void *opaque, target_phys_addr_t addr)
+static uint64_t bonito_cop_readl(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
uint32_t val;
PCIBonitoState *s = opaque;
@@ -383,23 +381,21 @@ static uint32_t bonito_cop_readl(void *opaque,
target_phys_addr_t addr)
}
static void bonito_cop_writel(void *opaque, target_phys_addr_t addr,
- uint32_t val)
+ uint64_t val, unsigned size)
{
PCIBonitoState *s = opaque;
((uint32_t *)(&s->boncop))[addr/sizeof(uint32_t)] = val & 0xffffffff;
}
-static CPUWriteMemoryFunc * const bonito_cop_write[] = {
- NULL,
- NULL,
- bonito_cop_writel,
-};
-
-static CPUReadMemoryFunc * const bonito_cop_read[] = {
- NULL,
- NULL,
- bonito_cop_readl,
+static const MemoryRegionOps bonito_cop_ops = {
+ .read = bonito_cop_readl,
+ .write = bonito_cop_writel,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
};
static uint32_t bonito_sbridge_pciaddr(void *opaque, target_phys_addr_t addr)
@@ -710,14 +706,12 @@ static int bonito_initfn(PCIDevice *dev)
sysbus_init_mmio_region(sysbus, &s->iomem_ldma);
sysbus_mmio_map(sysbus, 3, 0xbfe00200);
- s->bonito_cop_handle = cpu_register_io_memory(bonito_cop_read,
- bonito_cop_write, s,
- DEVICE_NATIVE_ENDIAN);
- s->bonito_cop_start = 0xbfe00300;
- s->bonito_cop_length = 0x100;
- cpu_register_physical_memory(s->bonito_cop_start, s->bonito_cop_length,
- s->bonito_cop_handle);
+ memory_region_init_io(&s->iomem_cop, &bonito_cop_ops, s,
+ "cop", 0x100);
+ sysbus_init_mmio_region(sysbus, &s->iomem_cop);
+ sysbus_mmio_map(sysbus, 4, 0xbfe00300);
+ /* end */
/* Map PCI IO Space 0x1fd0 0000 - 0x1fd1 0000 */
s->bonito_pciio_start = BONITO_PCIIO_BASE;
s->bonito_pciio_length = BONITO_PCIIO_SIZE;
--
1.7.7.3
- [Qemu-devel] [PATCH 02/11] mcf_uart: convert to memory API, (continued)
- [Qemu-devel] [PATCH 02/11] mcf_uart: convert to memory API, Benoît Canet, 2011/11/22
- [Qemu-devel] [PATCH 04/11] mcf_intc: convert to memory API, Benoît Canet, 2011/11/22
- [Qemu-devel] [PATCH 03/11] mcf_fec: convert to memory API, Benoît Canet, 2011/11/22
- [Qemu-devel] [PATCH 09/11] bonito: convert south bridge pci config to memory API, Benoît Canet, 2011/11/22
- [Qemu-devel] [PATCH 07/11] bonito: convert north bridge register mapping to memory API, Benoît Canet, 2011/11/22
- [Qemu-devel] [PATCH 10/11] bonito: convert ldma to memory API, Benoît Canet, 2011/11/22
- [Qemu-devel] [PATCH 05/11] lm32_uart: convert to memory API, Benoît Canet, 2011/11/22
- [Qemu-devel] [PATCH 06/11] lm32_sys: convert to memory API, Benoît Canet, 2011/11/22
- [Qemu-devel] [PATCH 11/11] bonito: convert cop to memory API,
Benoît Canet <=
- [Qemu-devel] [PATCH 08/11] bonito: convert north bridge pci config to memory API, Benoît Canet, 2011/11/22