@@ -43,6 +43,7 @@ struct psci_ops_t psci_ops;
4343
4444#ifdef RT_USING_FDT
4545#include "dtb_node.h"
46+ #endif /* RT_USING_FDT */
4647
4748#if __SIZE_WIDTH__ == 64
4849#define PSCI_FN_NATIVE (version , name ) PSCI_##version##_FN64_##name
@@ -66,13 +67,14 @@ static rt_uint32_t psci_call(unsigned long a0, unsigned long a1, unsigned long a
6667 return res .a0 ;
6768}
6869
69- static int _psci_probe_version (char * version , int * major , int * minor );
7070static int _psci_init_with_version (int major , int minor );
7171
72- static struct dtb_node * psci_node ;
72+ #ifdef RT_USING_FDT
73+ static int _psci_probe_version (char * version , int * major , int * minor );
7374
7475static int psci_ver_major ;
7576static int psci_ver_minor ;
77+ static struct dtb_node * psci_node ;
7678
7779/**
7880 * @brief init psci operations.
@@ -81,7 +83,7 @@ static int psci_ver_minor;
8183 *
8284 * @return int 0 on success
8385 */
84- int psci_init ()
86+ int psci_init (void )
8587{
8688 void * root = get_dtb_node_head ();
8789 psci_node = dtb_node_get_dtb_node_by_path (root , "/psci" );
@@ -158,6 +160,14 @@ static int psci_0_1_init()
158160 PROBE_AND_SET (migrate );
159161 return 0 ;
160162}
163+ #else
164+ int psci_init (void )
165+ {
166+ smccc_call = arm_smccc_smc ;
167+ _psci_init_with_version (0 , 2 );
168+ return 0 ;
169+ }
170+ #endif /* RT_USING_FDT */
161171
162172COMMON_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 ));
163173
@@ -230,6 +240,7 @@ static int psci_1_0_init()
230240 return 0 ;
231241}
232242
243+ #ifdef RT_USING_FDT
233244/* probe psci version from fdt or SMC call */
234245static int _psci_probe_version (char * version , int * major , int * minor )
235246{
@@ -255,6 +266,7 @@ static int _psci_probe_version(char *version, int *major, int *minor)
255266 LOG_D ("Using PSCI v%d.%d" , * major , * minor );
256267 return retval ;
257268}
269+ #endif /* RT_USING_FDT */
258270
259271/* init psci ops with version info */
260272static int _psci_init_with_version (int major , int minor )
@@ -265,7 +277,9 @@ static int _psci_init_with_version(int major, int minor)
265277 // for v0.1, psci function id was provided fdt
266278 if (minor == 1 )
267279 {
280+ #ifdef RT_USING_FDT
268281 retval = psci_0_1_init ();
282+ #endif
269283 }
270284 else if (minor == 2 )
271285 {
@@ -284,5 +298,3 @@ static int _psci_init_with_version(int major, int minor)
284298 }
285299 return retval ;
286300}
287-
288- #endif /* RT_USING_FDT */
0 commit comments