Revision aa941b94 hw/pxa2xx_mmci.c

b/hw/pxa2xx_mmci.c
443 443
    pxa2xx_mmci_writew
444 444
};
445 445

  
446
static void pxa2xx_mmci_save(QEMUFile *f, void *opaque)
447
{
448
    struct pxa2xx_mmci_s *s = (struct pxa2xx_mmci_s *) opaque;
449
    int i;
450

  
451
    qemu_put_be32s(f, &s->status);
452
    qemu_put_be32s(f, &s->clkrt);
453
    qemu_put_be32s(f, &s->spi);
454
    qemu_put_be32s(f, &s->cmdat);
455
    qemu_put_be32s(f, &s->resp_tout);
456
    qemu_put_be32s(f, &s->read_tout);
457
    qemu_put_be32(f, s->blklen);
458
    qemu_put_be32(f, s->numblk);
459
    qemu_put_be32s(f, &s->intmask);
460
    qemu_put_be32s(f, &s->intreq);
461
    qemu_put_be32(f, s->cmd);
462
    qemu_put_be32s(f, &s->arg);
463
    qemu_put_be32(f, s->cmdreq);
464
    qemu_put_be32(f, s->active);
465
    qemu_put_be32(f, s->bytesleft);
466

  
467
    qemu_put_byte(f, s->tx_len);
468
    for (i = 0; i < s->tx_len; i ++)
469
        qemu_put_byte(f, s->tx_fifo[(s->tx_start + i) & 63]);
470

  
471
    qemu_put_byte(f, s->rx_len);
472
    for (i = 0; i < s->rx_len; i ++)
473
        qemu_put_byte(f, s->rx_fifo[(s->rx_start + i) & 31]);
474

  
475
    qemu_put_byte(f, s->resp_len);
476
    for (i = s->resp_len; i < 9; i ++)
477
        qemu_put_be16s(f, &s->resp_fifo[i]);
478
}
479

  
480
static int pxa2xx_mmci_load(QEMUFile *f, void *opaque, int version_id)
481
{
482
    struct pxa2xx_mmci_s *s = (struct pxa2xx_mmci_s *) opaque;
483
    int i;
484

  
485
    qemu_get_be32s(f, &s->status);
486
    qemu_get_be32s(f, &s->clkrt);
487
    qemu_get_be32s(f, &s->spi);
488
    qemu_get_be32s(f, &s->cmdat);
489
    qemu_get_be32s(f, &s->resp_tout);
490
    qemu_get_be32s(f, &s->read_tout);
491
    s->blklen = qemu_get_be32(f);
492
    s->numblk = qemu_get_be32(f);
493
    qemu_get_be32s(f, &s->intmask);
494
    qemu_get_be32s(f, &s->intreq);
495
    s->cmd = qemu_get_be32(f);
496
    qemu_get_be32s(f, &s->arg);
497
    s->cmdreq = qemu_get_be32(f);
498
    s->active = qemu_get_be32(f);
499
    s->bytesleft = qemu_get_be32(f);
500

  
501
    s->tx_len = qemu_get_byte(f);
502
    s->tx_start = 0;
503
    if (s->tx_len >= sizeof(s->tx_fifo) || s->tx_len < 0)
504
        return -EINVAL;
505
    for (i = 0; i < s->tx_len; i ++)
506
        s->tx_fifo[i] = qemu_get_byte(f);
507

  
508
    s->rx_len = qemu_get_byte(f);
509
    s->rx_start = 0;
510
    if (s->rx_len >= sizeof(s->rx_fifo) || s->rx_len < 0)
511
        return -EINVAL;
512
    for (i = 0; i < s->rx_len; i ++)
513
        s->rx_fifo[i] = qemu_get_byte(f);
514

  
515
    s->resp_len = qemu_get_byte(f);
516
    if (s->resp_len > 9 || s->resp_len < 0)
517
        return -EINVAL;
518
    for (i = s->resp_len; i < 9; i ++)
519
         qemu_get_be16s(f, &s->resp_fifo[i]);
520

  
521
    return 0;
522
}
523

  
446 524
struct pxa2xx_mmci_s *pxa2xx_mmci_init(target_phys_addr_t base,
447 525
                qemu_irq irq, void *dma)
448 526
{
......
461 539
    /* Instantiate the actual storage */
462 540
    s->card = sd_init(sd_bdrv);
463 541

  
542
    register_savevm("pxa2xx_mmci", 0, 0,
543
                    pxa2xx_mmci_save, pxa2xx_mmci_load, s);
544

  
464 545
    return s;
465 546
}
466 547

  

Also available in: Unified diff