Revision 075790c2

b/hw/pl022.c
239 239
   pl022_write
240 240
};
241 241

  
242
static void pl022_save(QEMUFile *f, void *opaque)
243
{
244
    pl022_state *s = (pl022_state *)opaque;
245
    int i;
246

  
247
    qemu_put_be32(f, s->cr0);
248
    qemu_put_be32(f, s->cr1);
249
    qemu_put_be32(f, s->bitmask);
250
    qemu_put_be32(f, s->sr);
251
    qemu_put_be32(f, s->cpsr);
252
    qemu_put_be32(f, s->is);
253
    qemu_put_be32(f, s->im);
254
    qemu_put_be32(f, s->tx_fifo_head);
255
    qemu_put_be32(f, s->rx_fifo_head);
256
    qemu_put_be32(f, s->tx_fifo_len);
257
    qemu_put_be32(f, s->rx_fifo_len);
258
    for (i = 0; i < 8; i++) {
259
        qemu_put_be16(f, s->tx_fifo[i]);
260
        qemu_put_be16(f, s->rx_fifo[i]);
261
    }
262
}
263

  
264
static int pl022_load(QEMUFile *f, void *opaque, int version_id)
265
{
266
    pl022_state *s = (pl022_state *)opaque;
267
    int i;
268

  
269
    if (version_id != 1)
270
        return -EINVAL;
271

  
272
    s->cr0 = qemu_get_be32(f);
273
    s->cr1 = qemu_get_be32(f);
274
    s->bitmask = qemu_get_be32(f);
275
    s->sr = qemu_get_be32(f);
276
    s->cpsr = qemu_get_be32(f);
277
    s->is = qemu_get_be32(f);
278
    s->im = qemu_get_be32(f);
279
    s->tx_fifo_head = qemu_get_be32(f);
280
    s->rx_fifo_head = qemu_get_be32(f);
281
    s->tx_fifo_len = qemu_get_be32(f);
282
    s->rx_fifo_len = qemu_get_be32(f);
283
    for (i = 0; i < 8; i++) {
284
        s->tx_fifo[i] = qemu_get_be16(f);
285
        s->rx_fifo[i] = qemu_get_be16(f);
242
static const VMStateDescription vmstate_pl022 = {
243
    .name = "pl022_ssp",
244
    .version_id = 1,
245
    .minimum_version_id = 1,
246
    .minimum_version_id_old = 1,
247
    .fields      = (VMStateField[]) {
248
        VMSTATE_UINT32(cr0, pl022_state),
249
        VMSTATE_UINT32(cr1, pl022_state),
250
        VMSTATE_UINT32(bitmask, pl022_state),
251
        VMSTATE_UINT32(sr, pl022_state),
252
        VMSTATE_UINT32(cpsr, pl022_state),
253
        VMSTATE_UINT32(is, pl022_state),
254
        VMSTATE_UINT32(im, pl022_state),
255
        VMSTATE_INT32(tx_fifo_head, pl022_state),
256
        VMSTATE_INT32(rx_fifo_head, pl022_state),
257
        VMSTATE_INT32(tx_fifo_len, pl022_state),
258
        VMSTATE_INT32(rx_fifo_len, pl022_state),
259
        VMSTATE_UINT16(tx_fifo[0], pl022_state),
260
        VMSTATE_UINT16(rx_fifo[0], pl022_state),
261
        VMSTATE_UINT16(tx_fifo[1], pl022_state),
262
        VMSTATE_UINT16(rx_fifo[1], pl022_state),
263
        VMSTATE_UINT16(tx_fifo[2], pl022_state),
264
        VMSTATE_UINT16(rx_fifo[2], pl022_state),
265
        VMSTATE_UINT16(tx_fifo[3], pl022_state),
266
        VMSTATE_UINT16(rx_fifo[3], pl022_state),
267
        VMSTATE_UINT16(tx_fifo[4], pl022_state),
268
        VMSTATE_UINT16(rx_fifo[4], pl022_state),
269
        VMSTATE_UINT16(tx_fifo[5], pl022_state),
270
        VMSTATE_UINT16(rx_fifo[5], pl022_state),
271
        VMSTATE_UINT16(tx_fifo[6], pl022_state),
272
        VMSTATE_UINT16(rx_fifo[6], pl022_state),
273
        VMSTATE_UINT16(tx_fifo[7], pl022_state),
274
        VMSTATE_UINT16(rx_fifo[7], pl022_state),
275
        VMSTATE_END_OF_LIST()
286 276
    }
287

  
288
    return 0;
289
}
277
};
290 278

  
291 279
static int pl022_init(SysBusDevice *dev)
292 280
{
......
300 288
    sysbus_init_irq(dev, &s->irq);
301 289
    s->ssi = ssi_create_bus(&dev->qdev, "ssi");
302 290
    pl022_reset(s);
303
    register_savevm(&dev->qdev, "pl022_ssp", -1, 1, pl022_save, pl022_load, s);
291
    vmstate_register(&dev->qdev, -1, &vmstate_pl022, s);
304 292
    return 0;
305 293
}
306 294

  

Also available in: Unified diff