Received: from eggs.gnu.org ([208.118.235.92]:41636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6PYc-0006eE-Ua for qemu-devel@nongnu.org; Sat, 10 Mar 2012 11:54:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S6PYa-0001ZI-Rd for qemu-devel@nongnu.org; Sat, 10 Mar 2012 11:54:14 -0500 Received: from cantor2.suse.de ([195.135.220.15]:42678 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6PYa-0001VX-J2 for qemu-devel@nongnu.org; Sat, 10 Mar 2012 11:54:12 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 10 Mar 2012 17:53:55 +0100 Message-Id: <1331398436-20761-20-git-send-email-afaerber@suse.de> In-Reply-To: <1331398436-20761-1-git-send-email-afaerber@suse.de> References: <1330893156-26569-1-git-send-email-afaerber@suse.de> <1331398436-20761-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH RFC v4 19/20] target-arm: Simplify pxa270 CPU classes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paul Brook 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=C3=A4rber Cc: Paul Brook Cc: Peter Maydell --- 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[] =3D { .class_init =3D pxa25x_class_init, }, { - .name =3D "pxa270-a0", + .name =3D "pxa270", .id =3D 0x69054110, .class_init =3D pxa270_class_init, }, { - .name =3D "pxa270-a1", - .id =3D 0x69054111, - .class_init =3D pxa270_class_init, - }, - { - .name =3D "pxa270-b0", - .id =3D 0x69054112, - .class_init =3D pxa270_class_init, - }, - { - .name =3D "pxa270-b1", - .id =3D 0x69054113, - .class_init =3D pxa270_class_init, - }, - { - .name =3D "pxa270-c0", - .id =3D 0x69054114, - .class_init =3D pxa270_class_init, - }, - { - .name =3D "pxa270-c5", - .id =3D 0x69054117, - .class_init =3D pxa270_class_init, - }, - { .name =3D "any", .id =3D 0xffffffff, .features =3D 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) =20 CPUARMState *cpu_arm_init(const char *cpu_model) { + const char *cpu_typename =3D cpu_model; ObjectClass *klass; ARMCPU *cpu; CPUARMState *env; static int inited =3D 0; =20 - /* One legacy alias to check */ - if (strcmp(cpu_model, "pxa270") =3D=3D 0) { - cpu_model =3D "pxa270-a0"; + /* Map legacy aliases to base class */ + if (strcmp(cpu_model, "pxa270-a0") =3D=3D 0 || + strcmp(cpu_model, "pxa270-a1") =3D=3D 0 || + strcmp(cpu_model, "pxa270-b0") =3D=3D 0 || + strcmp(cpu_model, "pxa270-b1") =3D=3D 0 || + strcmp(cpu_model, "pxa270-c0") =3D=3D 0 || + strcmp(cpu_model, "pxa270-c5") =3D=3D 0) { + cpu_typename =3D "pxa270"; } =20 - klass =3D object_class_by_name(cpu_model); + klass =3D object_class_by_name(cpu_typename); if (klass =3D=3D NULL) { return NULL; } - cpu =3D ARM_CPU(object_new(cpu_model)); + cpu =3D ARM_CPU(object_new(cpu_typename)); env =3D &cpu->env; + env->cpu_model_str =3D cpu_model; + /* Set properties on base object */ + if (strcmp(cpu_model, "pxa270-a1") =3D=3D 0) { + object_property_set_int(OBJECT(cpu), 0x1, "cpuid-revision", NULL= ); + } else if (strcmp(cpu_model, "pxa270-b0") =3D=3D 0) { + object_property_set_int(OBJECT(cpu), 0x2, "cpuid-revision", NULL= ); + } else if (strcmp(cpu_model, "pxa270-b1") =3D=3D 0) { + object_property_set_int(OBJECT(cpu), 0x3, "cpuid-revision", NULL= ); + } else if (strcmp(cpu_model, "pxa270-c0") =3D=3D 0) { + object_property_set_int(OBJECT(cpu), 0x4, "cpuid-revision", NULL= ); + } else if (strcmp(cpu_model, "pxa270-c5") =3D=3D 0) { + object_property_set_int(OBJECT(cpu), 0x7, "cpuid-revision", NULL= ); + } =20 if (tcg_enabled() && !inited) { inited =3D 1; --=20 1.7.7