qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC v4 19/20] target-arm: Simplify pxa270 CPU classe


From: Andreas Färber
Subject: [Qemu-devel] [PATCH RFC v4 19/20] target-arm: Simplify pxa270 CPU classes
Date: Sat, 10 Mar 2012 17:53:55 +0100

Instead of having classes per CPUID value, keep just one pxa270 class
and use pxa270-a1 etc. as aliases that override default CPU properties.

Signed-off-by: Andreas Färber <address@hidden>
Cc: Paul Brook <address@hidden>
Cc: Peter Maydell <address@hidden>
---
 target-arm/cpu.c    |   27 +--------------------------
 target-arm/helper.c |   29 ++++++++++++++++++++++++-----
 2 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index ad33742..da5bb6e 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -539,36 +539,11 @@ static const ARMCPUInfo arm_cpus[] = {
         .class_init = pxa25x_class_init,
     },
     {
-        .name = "pxa270-a0",
+        .name = "pxa270",
         .id = 0x69054110,
         .class_init = pxa270_class_init,
     },
     {
-        .name = "pxa270-a1",
-        .id = 0x69054111,
-        .class_init = pxa270_class_init,
-    },
-    {
-        .name = "pxa270-b0",
-        .id = 0x69054112,
-        .class_init = pxa270_class_init,
-    },
-    {
-        .name = "pxa270-b1",
-        .id = 0x69054113,
-        .class_init = pxa270_class_init,
-    },
-    {
-        .name = "pxa270-c0",
-        .id = 0x69054114,
-        .class_init = pxa270_class_init,
-    },
-    {
-        .name = "pxa270-c5",
-        .id = 0x69054117,
-        .class_init = pxa270_class_init,
-    },
-    {
         .name = "any",
         .id = 0xffffffff,
         .features = ARM_FEATURE(V7) |
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 2d6331d..f66f500 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -64,22 +64,41 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, 
int reg)
 
 CPUARMState *cpu_arm_init(const char *cpu_model)
 {
+    const char *cpu_typename = cpu_model;
     ObjectClass *klass;
     ARMCPU *cpu;
     CPUARMState *env;
     static int inited = 0;
 
-    /* One legacy alias to check */
-    if (strcmp(cpu_model, "pxa270") == 0) {
-        cpu_model = "pxa270-a0";
+    /* Map legacy aliases to base class */
+    if (strcmp(cpu_model, "pxa270-a0") == 0 ||
+        strcmp(cpu_model, "pxa270-a1") == 0 ||
+        strcmp(cpu_model, "pxa270-b0") == 0 ||
+        strcmp(cpu_model, "pxa270-b1") == 0 ||
+        strcmp(cpu_model, "pxa270-c0") == 0 ||
+        strcmp(cpu_model, "pxa270-c5") == 0) {
+        cpu_typename = "pxa270";
     }
 
-    klass = object_class_by_name(cpu_model);
+    klass = object_class_by_name(cpu_typename);
     if (klass == NULL) {
         return NULL;
     }
-    cpu = ARM_CPU(object_new(cpu_model));
+    cpu = ARM_CPU(object_new(cpu_typename));
     env = &cpu->env;
+    env->cpu_model_str = cpu_model;
+    /* Set properties on base object */
+    if (strcmp(cpu_model, "pxa270-a1") == 0) {
+        object_property_set_int(OBJECT(cpu), 0x1, "cpuid-revision", NULL);
+    } else if (strcmp(cpu_model, "pxa270-b0") == 0) {
+        object_property_set_int(OBJECT(cpu), 0x2, "cpuid-revision", NULL);
+    } else if (strcmp(cpu_model, "pxa270-b1") == 0) {
+        object_property_set_int(OBJECT(cpu), 0x3, "cpuid-revision", NULL);
+    } else if (strcmp(cpu_model, "pxa270-c0") == 0) {
+        object_property_set_int(OBJECT(cpu), 0x4, "cpuid-revision", NULL);
+    } else if (strcmp(cpu_model, "pxa270-c5") == 0) {
+        object_property_set_int(OBJECT(cpu), 0x7, "cpuid-revision", NULL);
+    }
 
     if (tcg_enabled() && !inited) {
         inited = 1;
-- 
1.7.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]