From c8a50e596c8eeb41bf5718df5bad6be4080f40c7 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 4 Aug 2011 15:55:30 +0300 Subject: 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 Signed-off-by: Avi Kivity --- hw/lm32_boards.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'hw/lm32_boards.c') diff --git a/hw/lm32_boards.c b/hw/lm32_boards.c index d18aad7435..f032bc0f64 100644 --- a/hw/lm32_boards.c +++ b/hw/lm32_boards.c @@ -77,7 +77,7 @@ static void lm32_evr_init(ram_addr_t ram_size_not_used, CPUState *env; DriveInfo *dinfo; ram_addr_t phys_ram; - ram_addr_t phys_flash; + MemoryRegion *phys_flash = g_new(MemoryRegion, 1); qemu_irq *cpu_irq, irq[32]; ResetInfo *reset_info; int i; @@ -108,13 +108,14 @@ static void lm32_evr_init(ram_addr_t ram_size_not_used, phys_ram = qemu_ram_alloc(NULL, "lm32_evr.sdram", ram_size); cpu_register_physical_memory(ram_base, ram_size, phys_ram | IO_MEM_RAM); - phys_flash = qemu_ram_alloc(NULL, "lm32_evr.flash", flash_size); + memory_region_init_rom_device(phys_flash, &pflash_cfi02_ops_be, + NULL, "lm32_evr.flash", flash_size); dinfo = drive_get(IF_PFLASH, 0, 0); /* Spansion S29NS128P */ pflash_cfi02_register(flash_base, phys_flash, dinfo ? dinfo->bdrv : NULL, flash_sector_size, flash_size / flash_sector_size, 1, 2, - 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); + 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa); /* create irq lines */ cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1); @@ -165,7 +166,7 @@ static void lm32_uclinux_init(ram_addr_t ram_size_not_used, CPUState *env; DriveInfo *dinfo; ram_addr_t phys_ram; - ram_addr_t phys_flash; + MemoryRegion *phys_flash = g_new(MemoryRegion, 1); qemu_irq *cpu_irq, irq[32]; HWSetup *hw; ResetInfo *reset_info; @@ -203,13 +204,14 @@ static void lm32_uclinux_init(ram_addr_t ram_size_not_used, phys_ram = qemu_ram_alloc(NULL, "lm32_uclinux.sdram", ram_size); cpu_register_physical_memory(ram_base, ram_size, phys_ram | IO_MEM_RAM); - phys_flash = qemu_ram_alloc(NULL, "lm32_uclinux.flash", flash_size); + memory_region_init_rom_device(phys_flash, &pflash_cfi01_ops_be, + NULL, "lm32_uclinux.flash", flash_size); dinfo = drive_get(IF_PFLASH, 0, 0); /* Spansion S29NS128P */ pflash_cfi02_register(flash_base, phys_flash, dinfo ? dinfo->bdrv : NULL, flash_sector_size, flash_size / flash_sector_size, 1, 2, - 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); + 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa); /* create irq lines */ cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1); -- cgit v1.2.3-55-g7522