Browse Source

[libcpu/aarch64] 消除不必要的条件编译;
增加rt_hw_secondary_cpu_idle_exec的条件编译;

wangxiaoyao 3 years ago
parent
commit
87d3e4c1f8
3 changed files with 9 additions and 13 deletions
  1. 7 6
      libcpu/aarch64/common/cpu.c
  2. 2 0
      libcpu/aarch64/common/cpu.h
  3. 0 7
      libcpu/aarch64/common/psci.c

+ 7 - 6
libcpu/aarch64/common/cpu.c

@@ -314,6 +314,13 @@ int rt_hw_cpu_init()
 #endif /* RT_USING_FDT */
 }
 
+RT_WEAK void rt_hw_secondary_cpu_idle_exec(void)
+{
+    asm volatile("wfe" ::
+                     : "memory", "cc");
+}
+
+
 #endif /*RT_USING_SMP*/
 
 /**
@@ -334,10 +341,4 @@ void rt_hw_cpu_shutdown()
     }
 }
 
-RT_WEAK void rt_hw_secondary_cpu_idle_exec(void)
-{
-    asm volatile("wfe" ::
-                     : "memory", "cc");
-}
-
 /*@}*/

+ 2 - 0
libcpu/aarch64/common/cpu.h

@@ -45,6 +45,8 @@ extern int rt_hw_cpu_init();
 
 extern int rt_hw_cpu_boot_secondary(int num_cpus, rt_uint64_t *cpu_hw_ids, struct cpu_ops_t *cpu_ops[]);
 
+extern void rt_hw_secondary_cpu_idle_exec(void);
+
 extern struct cpu_ops_t cpu_ops_psci;
 
 extern struct cpu_ops_t cpu_ops_spin_tbl;

+ 0 - 7
libcpu/aarch64/common/psci.c

@@ -124,7 +124,6 @@ static rt_uint32_t cpu_off_0_1;
 static rt_uint32_t cpu_on_0_1;
 static rt_uint32_t migrate_0_1;
 
-#ifdef RT_USING_FDT
 /* basic operations TEMPLATE for API since 0.1 version */
 COMMON_PSCI_OPS_TEMPLATE(0_1, cpu_suspend_0_1, cpu_off_0_1, cpu_on_0_1, migrate_0_1);
 
@@ -148,7 +147,6 @@ COMMON_PSCI_OPS_TEMPLATE(0_1, cpu_suspend_0_1, cpu_off_0_1, cpu_on_0_1, migrate_
 
 static int psci_0_1_init()
 {
-#ifdef RT_USING_FDT
     // reading function id from fdt
     rt_uint32_t *funcid;
     PROBE_AND_SET(cpu_suspend);
@@ -156,13 +154,8 @@ static int psci_0_1_init()
     PROBE_AND_SET(cpu_on);
     PROBE_AND_SET(migrate);
     return 0;
-#else
-    return -1;
-#endif
 }
 
-#endif /* RT_USING_FDT */
-
 COMMON_PSCI_OPS_TEMPLATE(0_2, PSCI_FN_NATIVE(0_2, CPU_SUSPEND), PSCI_0_2_FN_CPU_OFF, PSCI_FN_NATIVE(0_2, CPU_ON), PSCI_FN_NATIVE(0_2, MIGRATE));
 
 static rt_uint32_t psci_0_2_get_version(void)