mirror of https://github.com/xqemu/xqemu.git
empty_slot: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
1c7af35f96
commit
b0a941b02a
|
@ -24,31 +24,27 @@
|
||||||
|
|
||||||
typedef struct EmptySlot {
|
typedef struct EmptySlot {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
|
MemoryRegion iomem;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
} EmptySlot;
|
} EmptySlot;
|
||||||
|
|
||||||
static uint32_t empty_slot_readl(void *opaque, target_phys_addr_t addr)
|
static uint64_t empty_slot_read(void *opaque, target_phys_addr_t addr,
|
||||||
|
unsigned size)
|
||||||
{
|
{
|
||||||
DPRINTF("read from " TARGET_FMT_plx "\n", addr);
|
DPRINTF("read from " TARGET_FMT_plx "\n", addr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void empty_slot_writel(void *opaque, target_phys_addr_t addr,
|
static void empty_slot_write(void *opaque, target_phys_addr_t addr,
|
||||||
uint32_t val)
|
uint64_t val, unsigned size)
|
||||||
{
|
{
|
||||||
DPRINTF("write 0x%x to " TARGET_FMT_plx "\n", val, addr);
|
DPRINTF("write 0x%x to " TARGET_FMT_plx "\n", (unsigned)val, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPUReadMemoryFunc * const empty_slot_read[3] = {
|
static const MemoryRegionOps empty_slot_ops = {
|
||||||
empty_slot_readl,
|
.read = empty_slot_read,
|
||||||
empty_slot_readl,
|
.write = empty_slot_write,
|
||||||
empty_slot_readl,
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
|
||||||
|
|
||||||
static CPUWriteMemoryFunc * const empty_slot_write[3] = {
|
|
||||||
empty_slot_writel,
|
|
||||||
empty_slot_writel,
|
|
||||||
empty_slot_writel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void empty_slot_init(target_phys_addr_t addr, uint64_t slot_size)
|
void empty_slot_init(target_phys_addr_t addr, uint64_t slot_size)
|
||||||
|
@ -73,12 +69,10 @@ void empty_slot_init(target_phys_addr_t addr, uint64_t slot_size)
|
||||||
static int empty_slot_init1(SysBusDevice *dev)
|
static int empty_slot_init1(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
EmptySlot *s = FROM_SYSBUS(EmptySlot, dev);
|
EmptySlot *s = FROM_SYSBUS(EmptySlot, dev);
|
||||||
ram_addr_t empty_slot_offset;
|
|
||||||
|
|
||||||
empty_slot_offset = cpu_register_io_memory(empty_slot_read,
|
memory_region_init_io(&s->iomem, &empty_slot_ops, s,
|
||||||
empty_slot_write, s,
|
"empty-slot", s->size);
|
||||||
DEVICE_NATIVE_ENDIAN);
|
sysbus_init_mmio_region(dev, &s->iomem);
|
||||||
sysbus_init_mmio(dev, s->size, empty_slot_offset | IO_MEM_RAM);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue