Patchwork [next,v2,10/74] sun4u: Use cpu_sparc_init() to obtain SPARCCPU

login
register
mail settings
Submitter Andreas Färber
Date May 10, 2012, 12:13 a.m.
Message ID <1336608892-30501-11-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/158123/
State New
Headers show

Comments

Andreas Färber - May 10, 2012, 12:13 a.m.
This prepares using it in sun4uv_init().

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/sun4u.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/sun4u.c b/hw/sun4u.c
index fe33138..8bb8557 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -746,6 +746,7 @@  static TypeInfo ram_info = {
 
 static CPUSPARCState *cpu_devinit(const char *cpu_model, const struct hwdef *hwdef)
 {
+    SPARCCPU *cpu;
     CPUSPARCState *env;
     ResetData *reset_info;
 
@@ -753,13 +754,15 @@  static CPUSPARCState *cpu_devinit(const char *cpu_model, const struct hwdef *hwd
     uint32_t  stick_frequency = 100*1000000;
     uint32_t hstick_frequency = 100*1000000;
 
-    if (!cpu_model)
+    if (cpu_model == NULL) {
         cpu_model = hwdef->default_cpu_model;
-    env = cpu_init(cpu_model);
-    if (!env) {
+    }
+    cpu = cpu_sparc_init(cpu_model);
+    if (cpu == NULL) {
         fprintf(stderr, "Unable to find Sparc CPU definition\n");
         exit(1);
     }
+    env = &cpu->env;
 
     env->tick = cpu_timer_create("tick", env, tick_irq,
                                   tick_frequency, TICK_NPT_MASK);