pc: Convert port92 to isa_register_ioport
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
0a039dc700
commit
23af670e53
16
hw/pc.c
16
hw/pc.c
@ -428,6 +428,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
|
|||||||
/* port 92 stuff: could be split off */
|
/* port 92 stuff: could be split off */
|
||||||
typedef struct Port92State {
|
typedef struct Port92State {
|
||||||
ISADevice dev;
|
ISADevice dev;
|
||||||
|
MemoryRegion io;
|
||||||
uint8_t outport;
|
uint8_t outport;
|
||||||
qemu_irq *a20_out;
|
qemu_irq *a20_out;
|
||||||
} Port92State;
|
} Port92State;
|
||||||
@ -479,13 +480,22 @@ static void port92_reset(DeviceState *d)
|
|||||||
s->outport &= ~1;
|
s->outport &= ~1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const MemoryRegionPortio port92_portio[] = {
|
||||||
|
{ 0, 1, 1, .read = port92_read, .write = port92_write },
|
||||||
|
PORTIO_END_OF_LIST(),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const MemoryRegionOps port92_ops = {
|
||||||
|
.old_portio = port92_portio
|
||||||
|
};
|
||||||
|
|
||||||
static int port92_initfn(ISADevice *dev)
|
static int port92_initfn(ISADevice *dev)
|
||||||
{
|
{
|
||||||
Port92State *s = DO_UPCAST(Port92State, dev, dev);
|
Port92State *s = DO_UPCAST(Port92State, dev, dev);
|
||||||
|
|
||||||
register_ioport_read(0x92, 1, 1, port92_read, s);
|
memory_region_init_io(&s->io, &port92_ops, s, "port92", 1);
|
||||||
register_ioport_write(0x92, 1, 1, port92_write, s);
|
isa_register_ioport(dev, &s->io, 0x92);
|
||||||
isa_init_ioport(dev, 0x92);
|
|
||||||
s->outport = 0;
|
s->outport = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user