summaryrefslogtreecommitdiffstats
path: root/hw/z2.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-08-04 15:55:30 +0300
committerAvi Kivity <avi@redhat.com>2011-08-25 10:56:33 +0300
commitc8a50e596c8eeb41bf5718df5bad6be4080f40c7 (patch)
tree589bfb006ec42863a518debd4775d88a3abfe185 /hw/z2.c
parenta1807ef2954d3ddbf9a9bca3949bd0c69fd45a0e (diff)
downloadhqemu-c8a50e596c8eeb41bf5718df5bad6be4080f40c7.zip
hqemu-c8a50e596c8eeb41bf5718df5bad6be4080f40c7.tar.gz
pflash_cfi01/pflash_cfi02: convert to memory API
cfi02 is annoying in that is ignores some address bits; we probably want explicit support in the memory API for that. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/z2.c')
-rw-r--r--hw/z2.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/hw/z2.c b/hw/z2.c
index f93a1bf..d7b8d53 100644
--- a/hw/z2.c
+++ b/hw/z2.c
@@ -280,10 +280,11 @@ static void z2_init(ram_addr_t ram_size,
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";
@@ -293,9 +294,9 @@ static void z2_init(ram_addr_t ram_size,
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) {
@@ -304,11 +305,11 @@ static void z2_init(ram_addr_t ram_size,
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);
}
OpenPOWER on IntegriCloud