mirror of https://github.com/xemu-project/xemu.git
sun4m_iommu: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
847b52c107
commit
d224136c7b
|
@ -128,13 +128,15 @@
|
||||||
|
|
||||||
typedef struct IOMMUState {
|
typedef struct IOMMUState {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
|
MemoryRegion iomem;
|
||||||
uint32_t regs[IOMMU_NREGS];
|
uint32_t regs[IOMMU_NREGS];
|
||||||
target_phys_addr_t iostart;
|
target_phys_addr_t iostart;
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
} IOMMUState;
|
} IOMMUState;
|
||||||
|
|
||||||
static uint32_t iommu_mem_readl(void *opaque, target_phys_addr_t addr)
|
static uint64_t iommu_mem_read(void *opaque, target_phys_addr_t addr,
|
||||||
|
unsigned size)
|
||||||
{
|
{
|
||||||
IOMMUState *s = opaque;
|
IOMMUState *s = opaque;
|
||||||
target_phys_addr_t saddr;
|
target_phys_addr_t saddr;
|
||||||
|
@ -155,8 +157,8 @@ static uint32_t iommu_mem_readl(void *opaque, target_phys_addr_t addr)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iommu_mem_writel(void *opaque, target_phys_addr_t addr,
|
static void iommu_mem_write(void *opaque, target_phys_addr_t addr,
|
||||||
uint32_t val)
|
uint64_t val, unsigned size)
|
||||||
{
|
{
|
||||||
IOMMUState *s = opaque;
|
IOMMUState *s = opaque;
|
||||||
target_phys_addr_t saddr;
|
target_phys_addr_t saddr;
|
||||||
|
@ -237,16 +239,14 @@ static void iommu_mem_writel(void *opaque, target_phys_addr_t addr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc * const iommu_mem_read[3] = {
|
static const MemoryRegionOps iommu_mem_ops = {
|
||||||
NULL,
|
.read = iommu_mem_read,
|
||||||
NULL,
|
.write = iommu_mem_write,
|
||||||
iommu_mem_readl,
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
.valid = {
|
||||||
|
.min_access_size = 4,
|
||||||
static CPUWriteMemoryFunc * const iommu_mem_write[3] = {
|
.max_access_size = 4,
|
||||||
NULL,
|
},
|
||||||
NULL,
|
|
||||||
iommu_mem_writel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint32_t iommu_page_get_flags(IOMMUState *s, target_phys_addr_t addr)
|
static uint32_t iommu_page_get_flags(IOMMUState *s, target_phys_addr_t addr)
|
||||||
|
@ -347,13 +347,12 @@ static void iommu_reset(DeviceState *d)
|
||||||
static int iommu_init1(SysBusDevice *dev)
|
static int iommu_init1(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
IOMMUState *s = FROM_SYSBUS(IOMMUState, dev);
|
IOMMUState *s = FROM_SYSBUS(IOMMUState, dev);
|
||||||
int io;
|
|
||||||
|
|
||||||
sysbus_init_irq(dev, &s->irq);
|
sysbus_init_irq(dev, &s->irq);
|
||||||
|
|
||||||
io = cpu_register_io_memory(iommu_mem_read, iommu_mem_write, s,
|
memory_region_init_io(&s->iomem, &iommu_mem_ops, s, "iommu",
|
||||||
DEVICE_NATIVE_ENDIAN);
|
IOMMU_NREGS * sizeof(uint32_t));
|
||||||
sysbus_init_mmio(dev, IOMMU_NREGS * sizeof(uint32_t), io);
|
sysbus_init_mmio_region(dev, &s->iomem);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue