Revision e3914e3a hw/misc/applesmc.c

b/hw/misc/applesmc.c
73 73
struct AppleSMCState {
74 74
    ISADevice parent_obj;
75 75

  
76
    MemoryRegion io_data;
77
    MemoryRegion io_cmd;
76 78
    uint32_t iobase;
77 79
    uint8_t cmd;
78 80
    uint8_t status;
......
86 88
    QLIST_HEAD(, AppleSMCData) data_def;
87 89
};
88 90

  
89
static void applesmc_io_cmd_writeb(void *opaque, uint32_t addr, uint32_t val)
91
static void applesmc_io_cmd_write(void *opaque, hwaddr addr, uint64_t val,
92
                                  unsigned size)
90 93
{
91 94
    AppleSMCState *s = opaque;
92 95

  
......
115 118
    }
116 119
}
117 120

  
118
static void applesmc_io_data_writeb(void *opaque, uint32_t addr, uint32_t val)
121
static void applesmc_io_data_write(void *opaque, hwaddr addr, uint64_t val,
122
                                   unsigned size)
119 123
{
120 124
    AppleSMCState *s = opaque;
121 125

  
......
138 142
    }
139 143
}
140 144

  
141
static uint32_t applesmc_io_data_readb(void *opaque, uint32_t addr1)
145
static uint64_t applesmc_io_data_read(void *opaque, hwaddr addr1,
146
                                      unsigned size)
142 147
{
143 148
    AppleSMCState *s = opaque;
144 149
    uint8_t retval = 0;
......
162 167
    return retval;
163 168
}
164 169

  
165
static uint32_t applesmc_io_cmd_readb(void *opaque, uint32_t addr1)
170
static uint64_t applesmc_io_cmd_read(void *opaque, hwaddr addr1, unsigned size)
166 171
{
167 172
    AppleSMCState *s = opaque;
168 173

  
......
201 206
    applesmc_add_key(s, "MSSD", 1, "\0x3");
202 207
}
203 208

  
209
static const MemoryRegionOps applesmc_data_io_ops = {
210
    .write = applesmc_io_data_write,
211
    .read = applesmc_io_data_read,
212
    .endianness = DEVICE_NATIVE_ENDIAN,
213
    .impl = {
214
        .min_access_size = 1,
215
        .max_access_size = 1,
216
    },
217
};
218

  
219
static const MemoryRegionOps applesmc_cmd_io_ops = {
220
    .write = applesmc_io_cmd_write,
221
    .read = applesmc_io_cmd_read,
222
    .endianness = DEVICE_NATIVE_ENDIAN,
223
    .impl = {
224
        .min_access_size = 1,
225
        .max_access_size = 1,
226
    },
227
};
228

  
204 229
static void applesmc_isa_realize(DeviceState *dev, Error **errp)
205 230
{
206 231
    AppleSMCState *s = APPLE_SMC(dev);
207 232

  
208
    register_ioport_read(s->iobase + APPLESMC_DATA_PORT, 4, 1,
209
                         applesmc_io_data_readb, s);
210
    register_ioport_read(s->iobase + APPLESMC_CMD_PORT, 4, 1,
211
                         applesmc_io_cmd_readb, s);
212
    register_ioport_write(s->iobase + APPLESMC_DATA_PORT, 4, 1,
213
                          applesmc_io_data_writeb, s);
214
    register_ioport_write(s->iobase + APPLESMC_CMD_PORT, 4, 1,
215
                          applesmc_io_cmd_writeb, s);
233
    memory_region_init_io(&s->io_data, &applesmc_data_io_ops, s,
234
                          "applesmc-data", 4);
235
    isa_register_ioport(&s->parent_obj, &s->io_data,
236
                        s->iobase + APPLESMC_DATA_PORT);
237

  
238
    memory_region_init_io(&s->io_cmd, &applesmc_cmd_io_ops, s,
239
                          "applesmc-cmd", 4);
240
    isa_register_ioport(&s->parent_obj, &s->io_cmd,
241
                        s->iobase + APPLESMC_CMD_PORT);
216 242

  
217 243
    if (!s->osk || (strlen(s->osk) != 64)) {
218 244
        fprintf(stderr, "WARNING: Using AppleSMC with invalid key\n");

Also available in: Unified diff