aboutsummaryrefslogtreecommitdiff
path: root/hw/sparc64/niagara.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/sparc64/niagara.c')
-rw-r--r--hw/sparc64/niagara.c53
1 files changed, 23 insertions, 30 deletions
diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c
index 4fa8cb2904..ab3c4ec346 100644
--- a/hw/sparc64/niagara.c
+++ b/hw/sparc64/niagara.c
@@ -23,25 +23,23 @@
*/
#include "qemu/osdep.h"
+#include "block/block_int-common.h"
#include "qemu/units.h"
-#include "qemu-common.h"
#include "cpu.h"
-#include "hw/hw.h"
#include "hw/boards.h"
#include "hw/char/serial.h"
-#include "hw/empty_slot.h"
+#include "hw/misc/unimp.h"
#include "hw/loader.h"
#include "hw/sparc/sparc64.h"
-#include "hw/timer/sun4v-rtc.h"
-#include "exec/address-spaces.h"
+#include "hw/rtc/sun4v-rtc.h"
#include "sysemu/block-backend.h"
#include "qemu/error-report.h"
#include "sysemu/qtest.h"
-
+#include "sysemu/sysemu.h"
+#include "qapi/error.h"
typedef struct NiagaraBoardState {
MemoryRegion hv_ram;
- MemoryRegion partition_ram;
MemoryRegion nvram;
MemoryRegion md_rom;
MemoryRegion hv_rom;
@@ -70,7 +68,6 @@ typedef struct NiagaraBoardState {
#define NIAGARA_VDISK_BASE 0x1f40000000ULL
#define NIAGARA_RTC_BASE 0xfff0c1fff8ULL
-#define NIAGARA_UART_BASE 0x1f10000000ULL
/* Firmware layout
*
@@ -102,33 +99,30 @@ static void add_rom_or_fail(const char *file, const hwaddr addr)
static void niagara_init(MachineState *machine)
{
NiagaraBoardState *s = g_new(NiagaraBoardState, 1);
- DriveInfo *dinfo = drive_get_next(IF_PFLASH);
+ DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
MemoryRegion *sysmem = get_system_memory();
/* init CPUs */
sparc64_cpu_devinit(machine->cpu_type, NIAGARA_PROM_BASE);
/* set up devices */
- memory_region_allocate_system_memory(&s->hv_ram, NULL, "sun4v-hv.ram",
- NIAGARA_HV_RAM_SIZE);
+ memory_region_init_ram(&s->hv_ram, NULL, "sun4v-hv.ram",
+ NIAGARA_HV_RAM_SIZE, &error_fatal);
memory_region_add_subregion(sysmem, NIAGARA_HV_RAM_BASE, &s->hv_ram);
- memory_region_allocate_system_memory(&s->partition_ram, NULL,
- "sun4v-partition.ram",
- machine->ram_size);
memory_region_add_subregion(sysmem, NIAGARA_PARTITION_RAM_BASE,
- &s->partition_ram);
+ machine->ram);
- memory_region_allocate_system_memory(&s->nvram, NULL,
- "sun4v.nvram", NIAGARA_NVRAM_SIZE);
+ memory_region_init_ram(&s->nvram, NULL, "sun4v.nvram", NIAGARA_NVRAM_SIZE,
+ &error_fatal);
memory_region_add_subregion(sysmem, NIAGARA_NVRAM_BASE, &s->nvram);
- memory_region_allocate_system_memory(&s->md_rom, NULL,
- "sun4v-md.rom", NIAGARA_MD_ROM_SIZE);
+ memory_region_init_ram(&s->md_rom, NULL, "sun4v-md.rom",
+ NIAGARA_MD_ROM_SIZE, &error_fatal);
memory_region_add_subregion(sysmem, NIAGARA_MD_ROM_BASE, &s->md_rom);
- memory_region_allocate_system_memory(&s->hv_rom, NULL,
- "sun4v-hv.rom", NIAGARA_HV_ROM_SIZE);
+ memory_region_init_ram(&s->hv_rom, NULL, "sun4v-hv.rom",
+ NIAGARA_HV_ROM_SIZE, &error_fatal);
memory_region_add_subregion(sysmem, NIAGARA_HV_ROM_BASE, &s->hv_rom);
- memory_region_allocate_system_memory(&s->prom, NULL,
- "sun4v.prom", PROM_SIZE_MAX);
+ memory_region_init_ram(&s->prom, NULL, "sun4v.prom", PROM_SIZE_MAX,
+ &error_fatal);
memory_region_add_subregion(sysmem, NIAGARA_PROM_BASE, &s->prom);
add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE);
@@ -145,8 +139,8 @@ static void niagara_init(MachineState *machine)
BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
int size = blk_getlength(blk);
if (size > 0) {
- memory_region_allocate_system_memory(&s->vdisk_ram, NULL,
- "sun4v_vdisk.ram", size);
+ memory_region_init_ram(&s->vdisk_ram, NULL, "sun4v_vdisk.ram", size,
+ &error_fatal);
memory_region_add_subregion(get_system_memory(),
NIAGARA_VDISK_BASE, &s->vdisk_ram);
dinfo->is_default = 1;
@@ -157,11 +151,9 @@ static void niagara_init(MachineState *machine)
exit(1);
}
}
- if (serial_hd(0)) {
- serial_mm_init(sysmem, NIAGARA_UART_BASE, 0, NULL, 115200,
- serial_hd(0), DEVICE_BIG_ENDIAN);
- }
- empty_slot_init(NIAGARA_IOBBASE, NIAGARA_IOBSIZE);
+ serial_mm_init(sysmem, NIAGARA_UART_BASE, 0, NULL,
+ 115200, serial_hd(0), DEVICE_BIG_ENDIAN);
+ create_unimplemented_device("sun4v-iob", NIAGARA_IOBBASE, NIAGARA_IOBSIZE);
sun4v_rtc_init(NIAGARA_RTC_BASE);
}
@@ -174,6 +166,7 @@ static void niagara_class_init(ObjectClass *oc, void *data)
mc->max_cpus = 1; /* XXX for now */
mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Sun-UltraSparc-T1");
+ mc->default_ram_id = "sun4v-partition.ram";
}
static const TypeInfo niagara_type = {