Patchwork [RFC,v3,07/21] target-arm: Overwrite reset handler for ti925t

login
register
mail settings
Submitter Andreas Färber
Date Feb. 3, 2012, 2:59 a.m.
Message ID <1328237992-14953-8-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/139277/
State New
Headers show

Comments

Andreas Färber - Feb. 3, 2012, 2:59 a.m.
The OMAPCP feature allows to switch between TI915T and TI925T via
cp15 c15_ticonfig register. Move reset into ti925t-specific callback.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/cpu.c    |   18 ++++++++++++++++++
 target-arm/helper.c |    1 -
 2 files changed, 18 insertions(+), 1 deletions(-)
Peter Maydell - Feb. 7, 2012, 5:30 p.m.
On 3 February 2012 02:59, Andreas Färber <afaerber@suse.de> wrote:
> The OMAPCP feature allows to switch between TI915T and TI925T via
> cp15 c15_ticonfig register. Move reset into ti925t-specific callback.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target-arm/cpu.c    |   18 ++++++++++++++++++
>  target-arm/helper.c |    1 -
>  2 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
> index b794ec1..a6dbad3 100644
> --- a/target-arm/cpu.c
> +++ b/target-arm/cpu.c
> @@ -99,6 +99,23 @@ typedef struct ARMCPUInfo {
>     void (*class_init)(ARMCPUClass *klass, const struct ARMCPUInfo *info);
>  } ARMCPUInfo;
>
> +static void ti925t_reset(CPU *c)
> +{
> +    ARMCPU *cpu = ARM_CPU(c);
> +    CPUARMState *env = &cpu->env;
> +
> +    arm_cpu_reset(c);
> +
> +    env->cp15.c0_cpuid = ARM_CPUID_TI925T; /* Depends on wiring. */
> +}

If/when I finish my cp15 cleanup series this will become unnecessary, because
c0_cpuid will just be another cp15 register among many which the CPU defines
in its init function somewhere (and the cp15 register struct will include
"reset value for this cp15 register" and arm_cpu_reset() will just enumerate
them all and set them to their reset values).

-- PMM

Patch

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index b794ec1..a6dbad3 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -99,6 +99,23 @@  typedef struct ARMCPUInfo {
     void (*class_init)(ARMCPUClass *klass, const struct ARMCPUInfo *info);
 } ARMCPUInfo;
 
+static void ti925t_reset(CPU *c)
+{
+    ARMCPU *cpu = ARM_CPU(c);
+    CPUARMState *env = &cpu->env;
+
+    arm_cpu_reset(c);
+
+    env->cp15.c0_cpuid = ARM_CPUID_TI925T; /* Depends on wiring. */
+}
+
+static void ti925t_class_init(ARMCPUClass *klass, const ARMCPUInfo *info)
+{
+    CPUClass *cpu_class = CPU_CLASS(klass);
+
+    cpu_class->reset = ti925t_reset;
+}
+
 static const ARMCPUInfo arm_cpus[] = {
     {
         .name = "arm926",
@@ -151,6 +168,7 @@  static const ARMCPUInfo arm_cpus[] = {
     {
         .name = "ti925t",
         .id = 0x54029252,
+        .class_init = ti925t_class_init,
     },
     {
         .name = "sa1100",
diff --git a/target-arm/helper.c b/target-arm/helper.c
index c5ba7fd..e877c3f 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -201,7 +201,6 @@  static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
     case ARM_CPUID_TI925T:
         set_feature(env, ARM_FEATURE_V4T);
         set_feature(env, ARM_FEATURE_OMAPCP);
-        env->cp15.c0_cpuid = ARM_CPUID_TI925T; /* Depends on wiring.  */
         env->cp15.c0_cachetype = 0x5109149;
         env->cp15.c1_sys = 0x00000070;
         env->cp15.c15_i_max = 0x000;