mirror of https://github.com/xemu-project/xemu.git
apic: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
3812ed0baa
commit
312b4234c6
25
hw/apic.c
25
hw/apic.c
|
@ -80,6 +80,7 @@ typedef struct APICState APICState;
|
||||||
|
|
||||||
struct APICState {
|
struct APICState {
|
||||||
SysBusDevice busdev;
|
SysBusDevice busdev;
|
||||||
|
MemoryRegion io_memory;
|
||||||
void *cpu_env;
|
void *cpu_env;
|
||||||
uint32_t apicbase;
|
uint32_t apicbase;
|
||||||
uint8_t id;
|
uint8_t id;
|
||||||
|
@ -979,31 +980,25 @@ static void apic_reset(DeviceState *d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc * const apic_mem_read[3] = {
|
static const MemoryRegionOps apic_io_ops = {
|
||||||
apic_mem_readb,
|
.old_mmio = {
|
||||||
apic_mem_readw,
|
.read = { apic_mem_readb, apic_mem_readw, apic_mem_readl, },
|
||||||
apic_mem_readl,
|
.write = { apic_mem_writeb, apic_mem_writew, apic_mem_writel, },
|
||||||
};
|
},
|
||||||
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
static CPUWriteMemoryFunc * const apic_mem_write[3] = {
|
|
||||||
apic_mem_writeb,
|
|
||||||
apic_mem_writew,
|
|
||||||
apic_mem_writel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int apic_init1(SysBusDevice *dev)
|
static int apic_init1(SysBusDevice *dev)
|
||||||
{
|
{
|
||||||
APICState *s = FROM_SYSBUS(APICState, dev);
|
APICState *s = FROM_SYSBUS(APICState, dev);
|
||||||
int apic_io_memory;
|
|
||||||
static int last_apic_idx;
|
static int last_apic_idx;
|
||||||
|
|
||||||
if (last_apic_idx >= MAX_APICS) {
|
if (last_apic_idx >= MAX_APICS) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
apic_io_memory = cpu_register_io_memory(apic_mem_read,
|
memory_region_init_io(&s->io_memory, &apic_io_ops, s, "apic",
|
||||||
apic_mem_write, NULL,
|
MSI_ADDR_SIZE);
|
||||||
DEVICE_NATIVE_ENDIAN);
|
sysbus_init_mmio_region(dev, &s->io_memory);
|
||||||
sysbus_init_mmio(dev, MSI_ADDR_SIZE, apic_io_memory);
|
|
||||||
|
|
||||||
s->timer = qemu_new_timer_ns(vm_clock, apic_timer, s);
|
s->timer = qemu_new_timer_ns(vm_clock, apic_timer, s);
|
||||||
s->idx = last_apic_idx++;
|
s->idx = last_apic_idx++;
|
||||||
|
|
Loading…
Reference in New Issue