Patchwork [RFC,v4,17/20] target-arm: Kill off cpu_reset_model_id()

login
register
mail settings
Submitter Andreas Färber
Date March 10, 2012, 4:53 p.m.
Message ID <1331398436-20761-18-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/145889/
State New
Headers show

Comments

Andreas Färber - March 10, 2012, 4:53 p.m.
Move last remaining TI925T bits to ti925t_reset().

This reduces cpu_state_reset() to triviality and lets us reset the CPU
directly from arm_cpu_initfn().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/cpu.c    |    4 ++++
 target-arm/helper.c |   20 --------------------
 2 files changed, 4 insertions(+), 20 deletions(-)

Patch

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 9f571a1..8917a20 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -217,6 +217,8 @@  static void ti925t_reset(CPUState *c)
     arm_cpu_reset(c);
 
     env->cp15.c0_cpuid = ARM_CPUID_TI925T; /* Depends on wiring. */
+    env->cp15.c15_i_max = 0x000;
+    env->cp15.c15_i_min = 0xff0;
 }
 
 static void ti925t_class_init(ARMCPUClass *klass, const ARMCPUInfo *info)
@@ -550,6 +552,8 @@  static void arm_cpu_initfn(Object *obj)
 
     cpu->env.cpu_model_str = object_get_typename(obj);
     cpu->env.cp15.c0_cpuid = cpu_class->cp15.c0_cpuid;
+
+    cpu_reset(CPU(cpu));
 }
 
 static void arm_cpu_class_init(ObjectClass *klass, void *data)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index ba8a4ae..2d6331d 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -5,28 +5,9 @@ 
 #include "sysemu.h"
 #include "cpu-qom.h"
 
-static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
-{
-    switch (id) {
-    case ARM_CPUID_TI915T:
-    case ARM_CPUID_TI925T:
-        env->cp15.c15_i_max = 0x000;
-        env->cp15.c15_i_min = 0xff0;
-        break;
-    default:
-        break;
-    }
-}
-
 void cpu_state_reset(CPUARMState *env)
 {
-    uint32_t id;
-
     cpu_reset(ENV_GET_CPU(env));
-
-    id = env->cp15.c0_cpuid;
-    if (id)
-        cpu_reset_model_id(env, id);
 }
 
 static int vfp_gdb_get_reg(CPUARMState *env, uint8_t *buf, int reg)
@@ -105,7 +86,6 @@  CPUARMState *cpu_arm_init(const char *cpu_model)
         arm_translate_init();
     }
 
-    cpu_state_reset(env);
     if (arm_feature(env, ARM_FEATURE_NEON)) {
         gdb_register_coprocessor(env, vfp_gdb_get_reg, vfp_gdb_set_reg,
                                  51, "arm-neon.xml", 0);