slavio_misc: convert apc 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
							
								
									0dc31f3b32
								
							
						
					
					
						commit
						9c48dee672
					
				@ -48,6 +48,7 @@ typedef struct MiscState {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
typedef struct APCState {
 | 
					typedef struct APCState {
 | 
				
			||||||
    SysBusDevice busdev;
 | 
					    SysBusDevice busdev;
 | 
				
			||||||
 | 
					    MemoryRegion iomem;
 | 
				
			||||||
    qemu_irq cpu_halt;
 | 
					    qemu_irq cpu_halt;
 | 
				
			||||||
} APCState;
 | 
					} APCState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -270,7 +271,8 @@ static CPUWriteMemoryFunc * const slavio_aux2_mem_write[3] = {
 | 
				
			|||||||
    NULL,
 | 
					    NULL,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void apc_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
 | 
					static void apc_mem_writeb(void *opaque, target_phys_addr_t addr,
 | 
				
			||||||
 | 
					                           uint64_t val, unsigned size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    APCState *s = opaque;
 | 
					    APCState *s = opaque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -278,7 +280,8 @@ static void apc_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
 | 
				
			|||||||
    qemu_irq_raise(s->cpu_halt);
 | 
					    qemu_irq_raise(s->cpu_halt);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static uint32_t apc_mem_readb(void *opaque, target_phys_addr_t addr)
 | 
					static uint64_t apc_mem_readb(void *opaque, target_phys_addr_t addr,
 | 
				
			||||||
 | 
					                              unsigned size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    uint32_t ret = 0;
 | 
					    uint32_t ret = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -286,16 +289,14 @@ static uint32_t apc_mem_readb(void *opaque, target_phys_addr_t addr)
 | 
				
			|||||||
    return ret;
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static CPUReadMemoryFunc * const apc_mem_read[3] = {
 | 
					static const MemoryRegionOps apc_mem_ops = {
 | 
				
			||||||
    apc_mem_readb,
 | 
					    .read = apc_mem_readb,
 | 
				
			||||||
    NULL,
 | 
					    .write = apc_mem_writeb,
 | 
				
			||||||
    NULL,
 | 
					    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
				
			||||||
};
 | 
					    .valid = {
 | 
				
			||||||
 | 
					        .min_access_size = 1,
 | 
				
			||||||
static CPUWriteMemoryFunc * const apc_mem_write[3] = {
 | 
					        .max_access_size = 1,
 | 
				
			||||||
    apc_mem_writeb,
 | 
					    }
 | 
				
			||||||
    NULL,
 | 
					 | 
				
			||||||
    NULL,
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static uint32_t slavio_sysctrl_mem_readl(void *opaque, target_phys_addr_t addr)
 | 
					static uint32_t slavio_sysctrl_mem_readl(void *opaque, target_phys_addr_t addr)
 | 
				
			||||||
@ -407,14 +408,13 @@ static const VMStateDescription vmstate_misc = {
 | 
				
			|||||||
static int apc_init1(SysBusDevice *dev)
 | 
					static int apc_init1(SysBusDevice *dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    APCState *s = FROM_SYSBUS(APCState, dev);
 | 
					    APCState *s = FROM_SYSBUS(APCState, dev);
 | 
				
			||||||
    int io;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sysbus_init_irq(dev, &s->cpu_halt);
 | 
					    sysbus_init_irq(dev, &s->cpu_halt);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Power management (APC) XXX: not a Slavio device */
 | 
					    /* Power management (APC) XXX: not a Slavio device */
 | 
				
			||||||
    io = cpu_register_io_memory(apc_mem_read, apc_mem_write, s,
 | 
					    memory_region_init_io(&s->iomem, &apc_mem_ops, s,
 | 
				
			||||||
                                DEVICE_NATIVE_ENDIAN);
 | 
					                          "apc", MISC_SIZE);
 | 
				
			||||||
    sysbus_init_mmio(dev, MISC_SIZE, io);
 | 
					    sysbus_init_mmio_region(dev, &s->iomem);
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user