aboutsummaryrefslogtreecommitdiff
path: root/hw/lm32_boards.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-08-08 21:05:07 +0300
committerAvi Kivity <avi@redhat.com>2011-08-25 10:56:33 +0300
commit4c9e975d646f1633093e10a27da6cf655a6d9dcf (patch)
tree3d6d53d8133380140630e71d1d20425194ac2e54 /hw/lm32_boards.c
parent82afb3a70796f3e600ac84bbaff21e4af0759291 (diff)
lm32_boards: convert to memory API
Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/lm32_boards.c')
-rw-r--r--hw/lm32_boards.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/lm32_boards.c b/hw/lm32_boards.c
index f032bc0f64..a84007b0ed 100644
--- a/hw/lm32_boards.c
+++ b/hw/lm32_boards.c
@@ -28,6 +28,7 @@
#include "elf.h"
#include "lm32_hwsetup.h"
#include "lm32.h"
+#include "exec-memory.h"
typedef struct {
CPUState *env;
@@ -76,7 +77,8 @@ static void lm32_evr_init(ram_addr_t ram_size_not_used,
{
CPUState *env;
DriveInfo *dinfo;
- ram_addr_t phys_ram;
+ MemoryRegion *address_space_mem = get_system_memory();
+ MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
MemoryRegion *phys_flash = g_new(MemoryRegion, 1);
qemu_irq *cpu_irq, irq[32];
ResetInfo *reset_info;
@@ -105,8 +107,8 @@ static void lm32_evr_init(ram_addr_t ram_size_not_used,
reset_info->flash_base = flash_base;
- phys_ram = qemu_ram_alloc(NULL, "lm32_evr.sdram", ram_size);
- cpu_register_physical_memory(ram_base, ram_size, phys_ram | IO_MEM_RAM);
+ memory_region_init_ram(phys_ram, NULL, "lm32_evr.sdram", ram_size);
+ memory_region_add_subregion(address_space_mem, ram_base, phys_ram);
memory_region_init_rom_device(phys_flash, &pflash_cfi02_ops_be,
NULL, "lm32_evr.flash", flash_size);
@@ -165,7 +167,8 @@ static void lm32_uclinux_init(ram_addr_t ram_size_not_used,
{
CPUState *env;
DriveInfo *dinfo;
- ram_addr_t phys_ram;
+ MemoryRegion *address_space_mem = get_system_memory();
+ MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
MemoryRegion *phys_flash = g_new(MemoryRegion, 1);
qemu_irq *cpu_irq, irq[32];
HWSetup *hw;
@@ -201,8 +204,8 @@ static void lm32_uclinux_init(ram_addr_t ram_size_not_used,
reset_info->flash_base = flash_base;
- phys_ram = qemu_ram_alloc(NULL, "lm32_uclinux.sdram", ram_size);
- cpu_register_physical_memory(ram_base, ram_size, phys_ram | IO_MEM_RAM);
+ memory_region_init_ram(phys_ram, NULL, "lm32_uclinux.sdram", ram_size);
+ memory_region_add_subregion(address_space_mem, ram_base, phys_ram);
memory_region_init_rom_device(phys_flash, &pflash_cfi01_ops_be,
NULL, "lm32_uclinux.flash", flash_size);