mirror of
https://github.com/qemu/qemu.git
synced 2024-12-02 08:13:34 +08:00
applesmc: replace register_ioport*
Convert over to memory regions to obsolete register_ioport*. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a8aec29569
commit
e3914e3ad8
@ -73,6 +73,8 @@ typedef struct AppleSMCState AppleSMCState;
|
||||
struct AppleSMCState {
|
||||
ISADevice parent_obj;
|
||||
|
||||
MemoryRegion io_data;
|
||||
MemoryRegion io_cmd;
|
||||
uint32_t iobase;
|
||||
uint8_t cmd;
|
||||
uint8_t status;
|
||||
@ -86,7 +88,8 @@ struct AppleSMCState {
|
||||
QLIST_HEAD(, AppleSMCData) data_def;
|
||||
};
|
||||
|
||||
static void applesmc_io_cmd_writeb(void *opaque, uint32_t addr, uint32_t val)
|
||||
static void applesmc_io_cmd_write(void *opaque, hwaddr addr, uint64_t val,
|
||||
unsigned size)
|
||||
{
|
||||
AppleSMCState *s = opaque;
|
||||
|
||||
@ -115,7 +118,8 @@ static void applesmc_fill_data(AppleSMCState *s)
|
||||
}
|
||||
}
|
||||
|
||||
static void applesmc_io_data_writeb(void *opaque, uint32_t addr, uint32_t val)
|
||||
static void applesmc_io_data_write(void *opaque, hwaddr addr, uint64_t val,
|
||||
unsigned size)
|
||||
{
|
||||
AppleSMCState *s = opaque;
|
||||
|
||||
@ -138,7 +142,8 @@ static void applesmc_io_data_writeb(void *opaque, uint32_t addr, uint32_t val)
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t applesmc_io_data_readb(void *opaque, uint32_t addr1)
|
||||
static uint64_t applesmc_io_data_read(void *opaque, hwaddr addr1,
|
||||
unsigned size)
|
||||
{
|
||||
AppleSMCState *s = opaque;
|
||||
uint8_t retval = 0;
|
||||
@ -162,7 +167,7 @@ static uint32_t applesmc_io_data_readb(void *opaque, uint32_t addr1)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static uint32_t applesmc_io_cmd_readb(void *opaque, uint32_t addr1)
|
||||
static uint64_t applesmc_io_cmd_read(void *opaque, hwaddr addr1, unsigned size)
|
||||
{
|
||||
AppleSMCState *s = opaque;
|
||||
|
||||
@ -201,18 +206,39 @@ static void qdev_applesmc_isa_reset(DeviceState *dev)
|
||||
applesmc_add_key(s, "MSSD", 1, "\0x3");
|
||||
}
|
||||
|
||||
static const MemoryRegionOps applesmc_data_io_ops = {
|
||||
.write = applesmc_io_data_write,
|
||||
.read = applesmc_io_data_read,
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
.impl = {
|
||||
.min_access_size = 1,
|
||||
.max_access_size = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static const MemoryRegionOps applesmc_cmd_io_ops = {
|
||||
.write = applesmc_io_cmd_write,
|
||||
.read = applesmc_io_cmd_read,
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
.impl = {
|
||||
.min_access_size = 1,
|
||||
.max_access_size = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static void applesmc_isa_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
AppleSMCState *s = APPLE_SMC(dev);
|
||||
|
||||
register_ioport_read(s->iobase + APPLESMC_DATA_PORT, 4, 1,
|
||||
applesmc_io_data_readb, s);
|
||||
register_ioport_read(s->iobase + APPLESMC_CMD_PORT, 4, 1,
|
||||
applesmc_io_cmd_readb, s);
|
||||
register_ioport_write(s->iobase + APPLESMC_DATA_PORT, 4, 1,
|
||||
applesmc_io_data_writeb, s);
|
||||
register_ioport_write(s->iobase + APPLESMC_CMD_PORT, 4, 1,
|
||||
applesmc_io_cmd_writeb, s);
|
||||
memory_region_init_io(&s->io_data, &applesmc_data_io_ops, s,
|
||||
"applesmc-data", 4);
|
||||
isa_register_ioport(&s->parent_obj, &s->io_data,
|
||||
s->iobase + APPLESMC_DATA_PORT);
|
||||
|
||||
memory_region_init_io(&s->io_cmd, &applesmc_cmd_io_ops, s,
|
||||
"applesmc-cmd", 4);
|
||||
isa_register_ioport(&s->parent_obj, &s->io_cmd,
|
||||
s->iobase + APPLESMC_CMD_PORT);
|
||||
|
||||
if (!s->osk || (strlen(s->osk) != 64)) {
|
||||
fprintf(stderr, "WARNING: Using AppleSMC with invalid key\n");
|
||||
|
Loading…
Reference in New Issue
Block a user