Revision c227f099 hw/pflash_cfi02.c

b/hw/pflash_cfi02.c
50 50
#define DPRINTF(fmt, ...) do { } while (0)
51 51
#endif
52 52

  
53
struct pflash {
53
struct pflash_t {
54 54
    BlockDriverState *bs;
55
    a_target_phys_addr base;
55
    target_phys_addr_t base;
56 56
    uint32_t sector_len;
57 57
    uint32_t chip_len;
58 58
    int mappings;
......
67 67
    uint8_t cfi_len;
68 68
    uint8_t cfi_table[0x52];
69 69
    QEMUTimer *timer;
70
    a_ram_addr off;
70
    ram_addr_t off;
71 71
    int fl_mem;
72 72
    int rom_mode;
73 73
    void *storage;
74 74
};
75 75

  
76
static void pflash_register_memory(a_pflash *pfl, int rom_mode)
76
static void pflash_register_memory(pflash_t *pfl, int rom_mode)
77 77
{
78 78
    unsigned long phys_offset = pfl->fl_mem;
79 79
    int i;
......
89 89

  
90 90
static void pflash_timer (void *opaque)
91 91
{
92
    a_pflash *pfl = opaque;
92
    pflash_t *pfl = opaque;
93 93

  
94 94
    DPRINTF("%s: command %02x done\n", __func__, pfl->cmd);
95 95
    /* Reset flash */
......
103 103
    pfl->cmd = 0;
104 104
}
105 105

  
106
static uint32_t pflash_read (a_pflash *pfl, uint32_t offset, int width)
106
static uint32_t pflash_read (pflash_t *pfl, uint32_t offset, int width)
107 107
{
108 108
    uint32_t boff;
109 109
    uint32_t ret;
......
208 208
}
209 209

  
210 210
/* update flash content on disk */
211
static void pflash_update(a_pflash *pfl, int offset,
211
static void pflash_update(pflash_t *pfl, int offset,
212 212
                          int size)
213 213
{
214 214
    int offset_end;
......
222 222
    }
223 223
}
224 224

  
225
static void pflash_write (a_pflash *pfl, uint32_t offset, uint32_t value,
225
static void pflash_write (pflash_t *pfl, uint32_t offset, uint32_t value,
226 226
                          int width)
227 227
{
228 228
    uint32_t boff;
......
451 451
}
452 452

  
453 453

  
454
static uint32_t pflash_readb (void *opaque, a_target_phys_addr addr)
454
static uint32_t pflash_readb (void *opaque, target_phys_addr_t addr)
455 455
{
456 456
    return pflash_read(opaque, addr, 1);
457 457
}
458 458

  
459
static uint32_t pflash_readw (void *opaque, a_target_phys_addr addr)
459
static uint32_t pflash_readw (void *opaque, target_phys_addr_t addr)
460 460
{
461
    a_pflash *pfl = opaque;
461
    pflash_t *pfl = opaque;
462 462

  
463 463
    return pflash_read(pfl, addr, 2);
464 464
}
465 465

  
466
static uint32_t pflash_readl (void *opaque, a_target_phys_addr addr)
466
static uint32_t pflash_readl (void *opaque, target_phys_addr_t addr)
467 467
{
468
    a_pflash *pfl = opaque;
468
    pflash_t *pfl = opaque;
469 469

  
470 470
    return pflash_read(pfl, addr, 4);
471 471
}
472 472

  
473
static void pflash_writeb (void *opaque, a_target_phys_addr addr,
473
static void pflash_writeb (void *opaque, target_phys_addr_t addr,
474 474
                           uint32_t value)
475 475
{
476 476
    pflash_write(opaque, addr, value, 1);
477 477
}
478 478

  
479
static void pflash_writew (void *opaque, a_target_phys_addr addr,
479
static void pflash_writew (void *opaque, target_phys_addr_t addr,
480 480
                           uint32_t value)
481 481
{
482
    a_pflash *pfl = opaque;
482
    pflash_t *pfl = opaque;
483 483

  
484 484
    pflash_write(pfl, addr, value, 2);
485 485
}
486 486

  
487
static void pflash_writel (void *opaque, a_target_phys_addr addr,
487
static void pflash_writel (void *opaque, target_phys_addr_t addr,
488 488
                           uint32_t value)
489 489
{
490
    a_pflash *pfl = opaque;
490
    pflash_t *pfl = opaque;
491 491

  
492 492
    pflash_write(pfl, addr, value, 4);
493 493
}
......
538 538
    return ret;
539 539
}
540 540

  
541
a_pflash *pflash_cfi02_register(a_target_phys_addr base, a_ram_addr off,
541
pflash_t *pflash_cfi02_register(target_phys_addr_t base, ram_addr_t off,
542 542
                                BlockDriverState *bs, uint32_t sector_len,
543 543
                                int nb_blocs, int nb_mappings, int width,
544 544
                                uint16_t id0, uint16_t id1,
545 545
                                uint16_t id2, uint16_t id3,
546 546
                                uint16_t unlock_addr0, uint16_t unlock_addr1)
547 547
{
548
    a_pflash *pfl;
548
    pflash_t *pfl;
549 549
    int32_t chip_len;
550 550
    int ret;
551 551

  
......
556 556
        total_len != (32 * 1024 * 1024) && total_len != (64 * 1024 * 1024))
557 557
        return NULL;
558 558
#endif
559
    pfl = qemu_mallocz(sizeof(a_pflash));
559
    pfl = qemu_mallocz(sizeof(pflash_t));
560 560
    /* FIXME: Allocate ram ourselves.  */
561 561
    pfl->storage = qemu_get_ram_ptr(off);
562 562
    pfl->fl_mem = cpu_register_io_memory(pflash_read_ops, pflash_write_ops,

Also available in: Unified diff