slavio_misc: convert diagnostic to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
dd703aae47
commit
96891e593e
@ -37,6 +37,7 @@
|
||||
typedef struct MiscState {
|
||||
SysBusDevice busdev;
|
||||
MemoryRegion cfg_iomem;
|
||||
MemoryRegion diag_iomem;
|
||||
qemu_irq irq;
|
||||
qemu_irq fdc_tc;
|
||||
uint32_t dummy;
|
||||
@ -133,7 +134,7 @@ static const MemoryRegionOps slavio_cfg_mem_ops = {
|
||||
};
|
||||
|
||||
static void slavio_diag_mem_writeb(void *opaque, target_phys_addr_t addr,
|
||||
uint32_t val)
|
||||
uint64_t val, unsigned size)
|
||||
{
|
||||
MiscState *s = opaque;
|
||||
|
||||
@ -141,7 +142,8 @@ static void slavio_diag_mem_writeb(void *opaque, target_phys_addr_t addr,
|
||||
s->diag = val & 0xff;
|
||||
}
|
||||
|
||||
static uint32_t slavio_diag_mem_readb(void *opaque, target_phys_addr_t addr)
|
||||
static uint64_t slavio_diag_mem_readb(void *opaque, target_phys_addr_t addr,
|
||||
unsigned size)
|
||||
{
|
||||
MiscState *s = opaque;
|
||||
uint32_t ret = 0;
|
||||
@ -151,16 +153,14 @@ static uint32_t slavio_diag_mem_readb(void *opaque, target_phys_addr_t addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static CPUReadMemoryFunc * const slavio_diag_mem_read[3] = {
|
||||
slavio_diag_mem_readb,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static CPUWriteMemoryFunc * const slavio_diag_mem_write[3] = {
|
||||
slavio_diag_mem_writeb,
|
||||
NULL,
|
||||
NULL,
|
||||
static const MemoryRegionOps slavio_diag_mem_ops = {
|
||||
.read = slavio_diag_mem_readb,
|
||||
.write = slavio_diag_mem_writeb,
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
.valid = {
|
||||
.min_access_size = 1,
|
||||
.max_access_size = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static void slavio_mdm_mem_writeb(void *opaque, target_phys_addr_t addr,
|
||||
@ -433,10 +433,9 @@ static int slavio_misc_init1(SysBusDevice *dev)
|
||||
sysbus_init_mmio_region(dev, &s->cfg_iomem);
|
||||
|
||||
/* Diagnostics */
|
||||
io = cpu_register_io_memory(slavio_diag_mem_read,
|
||||
slavio_diag_mem_write, s,
|
||||
DEVICE_NATIVE_ENDIAN);
|
||||
sysbus_init_mmio(dev, MISC_SIZE, io);
|
||||
memory_region_init_io(&s->diag_iomem, &slavio_diag_mem_ops, s,
|
||||
"diagnostic", MISC_SIZE);
|
||||
sysbus_init_mmio_region(dev, &s->diag_iomem);
|
||||
|
||||
/* Modem control */
|
||||
io = cpu_register_io_memory(slavio_mdm_mem_read,
|
||||
|
Loading…
Reference in New Issue
Block a user