diff options
author | Avi Kivity <avi@redhat.com> | 2011-08-04 15:55:30 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-08-25 10:56:33 +0300 |
commit | c8a50e596c8eeb41bf5718df5bad6be4080f40c7 (patch) | |
tree | 589bfb006ec42863a518debd4775d88a3abfe185 /hw/gumstix.c | |
parent | a1807ef2954d3ddbf9a9bca3949bd0c69fd45a0e (diff) |
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/gumstix.c')
-rw-r--r-- | hw/gumstix.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/hw/gumstix.c b/hw/gumstix.c index 853f7e1ee8..d3a4bb4c67 100644 --- a/hw/gumstix.c +++ b/hw/gumstix.c @@ -48,7 +48,8 @@ static void connex_init(ram_addr_t ram_size, { PXA2xxState *cpu; DriveInfo *dinfo; - int be; + const MemoryRegionOps *flash_ops; + MemoryRegion *flash = g_new(MemoryRegion, 1); uint32_t connex_rom = 0x01000000; uint32_t connex_ram = 0x04000000; @@ -63,14 +64,15 @@ static void connex_init(ram_addr_t ram_size, } #ifdef TARGET_WORDS_BIGENDIAN - be = 1; + flash_ops = &pflash_cfi01_ops_be; #else - be = 0; + flash_ops = &pflash_cfi01_ops_le; #endif - if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(NULL, "connext.rom", - connex_rom), + memory_region_init_rom_device(flash, flash_ops, + NULL, "connext.rom", connex_rom); + if (!pflash_cfi01_register(0x00000000, flash, dinfo->bdrv, sector_len, connex_rom / sector_len, - 2, 0, 0, 0, 0, be)) { + 2, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); exit(1); } @@ -87,7 +89,8 @@ static void verdex_init(ram_addr_t ram_size, { PXA2xxState *cpu; DriveInfo *dinfo; - int be; + MemoryRegion *flash = g_new(MemoryRegion, 1); + const MemoryRegionOps *flash_ops; uint32_t verdex_rom = 0x02000000; uint32_t verdex_ram = 0x10000000; @@ -102,14 +105,15 @@ static void verdex_init(ram_addr_t ram_size, } #ifdef TARGET_WORDS_BIGENDIAN - be = 1; + flash_ops = &pflash_cfi01_ops_be; #else - be = 0; + flash_ops = &pflash_cfi01_ops_le; #endif - if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(NULL, "verdex.rom", - verdex_rom), + memory_region_init_rom_device(flash, flash_ops, + NULL, "verdex.rom", verdex_rom); + if (!pflash_cfi01_register(0x00000000, flash, dinfo->bdrv, sector_len, verdex_rom / sector_len, - 2, 0, 0, 0, 0, be)) { + 2, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); exit(1); } |