aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-07-21 10:46:23 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-07-21 10:46:23 +0000
commit7b833f5b2188b354e5f03ebf24a8ed1fa06dbfdd (patch)
treee4cbd266437a66f5857d2356d4b0f1417a0d7bb8 /hw
parentbda42033253c0615cf8d3d4db9ad2fc38bfe5403 (diff)
Sparc64: refactor CPU init
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/sun4u.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 9a31b08fa8..5e1da4c432 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -458,32 +458,14 @@ static void ram_register_devices(void)
device_init(ram_register_devices);
-static void sun4uv_init(ram_addr_t RAM_size,
- const char *boot_devices,
- const char *kernel_filename, const char *kernel_cmdline,
- const char *initrd_filename, const char *cpu_model,
- const struct hwdef *hwdef)
+static CPUState *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef)
{
CPUState *env;
- m48t59_t *nvram;
- int linux_boot;
- unsigned int i;
- long initrd_size, kernel_size;
- PCIBus *pci_bus, *pci_bus2, *pci_bus3;
QEMUBH *bh;
- qemu_irq *irq;
- int drive_index;
- BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
- BlockDriverState *fd[MAX_FD];
- void *fw_cfg;
ResetData *reset_info;
- linux_boot = (kernel_filename != NULL);
-
- /* init CPUs */
if (!cpu_model)
cpu_model = hwdef->default_cpu_model;
-
env = cpu_init(cpu_model);
if (!env) {
fprintf(stderr, "Unable to find Sparc CPU definition\n");
@@ -510,6 +492,32 @@ static void sun4uv_init(ram_addr_t RAM_size,
env->pc = hwdef->prom_addr + 0x20ULL;
env->npc = env->pc + 4;
+ return env;
+}
+
+static void sun4uv_init(ram_addr_t RAM_size,
+ const char *boot_devices,
+ const char *kernel_filename, const char *kernel_cmdline,
+ const char *initrd_filename, const char *cpu_model,
+ const struct hwdef *hwdef)
+{
+ CPUState *env;
+ m48t59_t *nvram;
+ int linux_boot;
+ unsigned int i;
+ long initrd_size, kernel_size;
+ PCIBus *pci_bus, *pci_bus2, *pci_bus3;
+ qemu_irq *irq;
+ int drive_index;
+ BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
+ BlockDriverState *fd[MAX_FD];
+ void *fw_cfg;
+
+ linux_boot = (kernel_filename != NULL);
+
+ /* init CPUs */
+ env = cpu_devinit(cpu_model, hwdef);
+
/* set up devices */
ram_init(0, RAM_size);