diff mbox series

[RFC,28/40] target/arm: Split out xscale*_class_init

Message ID 20230103181646.55711-29-richard.henderson@linaro.org
State New
Headers show
Series Toward class init of cpu features | expand

Commit Message

Richard Henderson Jan. 3, 2023, 6:16 p.m. UTC
Use two intermediate functions to share code between
the 13 variants of pxa*_class_init.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/cpu_tcg.c | 81 +++++++++++++-------------------------------
 1 file changed, 23 insertions(+), 58 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 5, 2023, 10:13 p.m. UTC | #1
On 3/1/23 19:16, Richard Henderson wrote:
> Use two intermediate functions to share code between
> the 13 variants of pxa*_class_init.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/cpu_tcg.c | 81 +++++++++++++-------------------------------
>   1 file changed, 23 insertions(+), 58 deletions(-)

Yay :)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
index c6d50f326e..a3b6940040 100644
--- a/target/arm/cpu_tcg.c
+++ b/target/arm/cpu_tcg.c
@@ -857,120 +857,85 @@  static void sa1110_class_init(ARMCPUClass *acc)
     acc->midr = 0x6901B119;
 }
 
-static void pxa250_class_init(ARMCPUClass *acc)
+static void xscale_class_init(ARMCPUClass *acc)
 {
     acc->dtb_compatible = "marvell,xscale";
     set_class_feature(acc, ARM_FEATURE_V5);
     set_class_feature(acc, ARM_FEATURE_XSCALE);
-    acc->midr = 0x69052100;
     acc->ctr = 0xd172172;
     acc->reset_sctlr = 0x00000078;
 }
 
+static void pxa250_class_init(ARMCPUClass *acc)
+{
+    xscale_class_init(acc);
+    acc->midr = 0x69052100;
+}
+
 static void pxa255_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
+    xscale_class_init(acc);
     acc->midr = 0x69052d00;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 static void pxa260_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
+    xscale_class_init(acc);
     acc->midr = 0x69052903;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 static void pxa261_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
+    xscale_class_init(acc);
     acc->midr = 0x69052d05;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 static void pxa262_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
+    xscale_class_init(acc);
     acc->midr = 0x69052d06;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
+}
+
+static void xscale_iwmmxt_class_init(ARMCPUClass *acc)
+{
+    xscale_class_init(acc);
+    set_class_feature(acc, ARM_FEATURE_IWMMXT);
 }
 
 static void pxa270a0_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
-    set_class_feature(acc, ARM_FEATURE_IWMMXT);
+    xscale_iwmmxt_class_init(acc);
     acc->midr = 0x69054110;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 static void pxa270a1_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
-    set_class_feature(acc, ARM_FEATURE_IWMMXT);
+    xscale_iwmmxt_class_init(acc);
     acc->midr = 0x69054111;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 static void pxa270b0_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
-    set_class_feature(acc, ARM_FEATURE_IWMMXT);
+    xscale_iwmmxt_class_init(acc);
     acc->midr = 0x69054112;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 static void pxa270b1_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
-    set_class_feature(acc, ARM_FEATURE_IWMMXT);
+    xscale_iwmmxt_class_init(acc);
     acc->midr = 0x69054113;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 static void pxa270c0_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
-    set_class_feature(acc, ARM_FEATURE_IWMMXT);
+    xscale_iwmmxt_class_init(acc);
     acc->midr = 0x69054114;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 static void pxa270c5_class_init(ARMCPUClass *acc)
 {
-    acc->dtb_compatible = "marvell,xscale";
-    set_class_feature(acc, ARM_FEATURE_V5);
-    set_class_feature(acc, ARM_FEATURE_XSCALE);
-    set_class_feature(acc, ARM_FEATURE_IWMMXT);
+    xscale_iwmmxt_class_init(acc);
     acc->midr = 0x69054117;
-    acc->ctr = 0xd172172;
-    acc->reset_sctlr = 0x00000078;
 }
 
 #ifdef CONFIG_TCG