diff options
author | Avi Kivity <avi@redhat.com> | 2011-08-04 15:55:30 +0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-09-04 17:46:51 +0300 |
commit | cfe5f011042456ad6ebd815f5ce4177befedd79a (patch) | |
tree | 9f5620f326451109ea9f43d27a8eb98d1f24541a /hw/mips_r4k.c | |
parent | ccbecf6237db9eed57923b961d48a75c77c7aebd (diff) | |
download | qemu-cfe5f011042456ad6ebd815f5ce4177befedd79a.tar.gz qemu-cfe5f011042456ad6ebd815f5ce4177befedd79a.tar.bz2 qemu-cfe5f011042456ad6ebd815f5ce4177befedd79a.zip |
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.
In order to get the correct opaque into the MemoryRegion object, the
allocation scheme is changed so that the flash emulation code allocates
memory, instead of the caller. This clears a FIXME in the flash code.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/mips_r4k.c')
-rw-r--r-- | hw/mips_r4k.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c index 9d90568e4e..5d002c5a2b 100644 --- a/hw/mips_r4k.c +++ b/hw/mips_r4k.c @@ -23,6 +23,7 @@ #include "elf.h" #include "mc146818rtc.h" #include "blockdev.h" +#include "exec-memory.h" #define MAX_IDE_BUS 2 @@ -163,7 +164,7 @@ void mips_r4k_init (ram_addr_t ram_size, { char *filename; ram_addr_t ram_offset; - ram_addr_t bios_offset; + MemoryRegion *bios; int bios_size; CPUState *env; ResetData *reset_info; @@ -227,15 +228,15 @@ void mips_r4k_init (ram_addr_t ram_size, be = 0; #endif if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { - bios_offset = qemu_ram_alloc(NULL, "mips_r4k.bios", BIOS_SIZE); - cpu_register_physical_memory(0x1fc00000, BIOS_SIZE, - bios_offset | IO_MEM_ROM); + bios = g_new(MemoryRegion, 1); + memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE); + memory_region_set_readonly(bios, true); + memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios); load_image_targphys(filename, 0x1fc00000, BIOS_SIZE); } else if ((dinfo = drive_get(IF_PFLASH, 0, 0)) != NULL) { uint32_t mips_rom = 0x00400000; - bios_offset = qemu_ram_alloc(NULL, "mips_r4k.bios", mips_rom); - if (!pflash_cfi01_register(0x1fc00000, bios_offset, + if (!pflash_cfi01_register(0x1fc00000, NULL, "mips_r4k.bios", mips_rom, dinfo->bdrv, sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, be)) { |