uint32_t sector_len = 0x10000;
PXA2xxState *cpu;
DriveInfo *dinfo;
- int be;
+ const MemoryRegionOps *flash_ops;
void *z2_lcd;
i2c_bus *bus;
DeviceState *wm;
+ MemoryRegion *flash = g_new(MemoryRegion, 1);
if (!cpu_model) {
cpu_model = "pxa270-c5";
cpu = pxa270_init(z2_binfo.ram_size, cpu_model);
#ifdef TARGET_WORDS_BIGENDIAN
- be = 1;
+ flash_ops = &pflash_cfi01_ops_be;
#else
- be = 0;
+ flash_ops = &pflash_cfi01_ops_le;
#endif
dinfo = drive_get(IF_PFLASH, 0, 0);
if (!dinfo) {
exit(1);
}
- if (!pflash_cfi01_register(Z2_FLASH_BASE,
- qemu_ram_alloc(NULL, "z2.flash0", Z2_FLASH_SIZE),
+ memory_region_init_rom_device(flash, flash_ops,
+ NULL, "z2.flash0", Z2_FLASH_SIZE);
+ if (!pflash_cfi01_register(Z2_FLASH_BASE, flash,
dinfo->bdrv, sector_len,
- Z2_FLASH_SIZE / sector_len, 4, 0, 0, 0, 0,
- be)) {
+ Z2_FLASH_SIZE / sector_len, 4, 0, 0, 0, 0)) {
fprintf(stderr, "qemu: Error registering flash memory.\n");
exit(1);
}