[U-Boot] [PATCH v3 02/11] ARM: PSCI: change PSCI related macros definition style

macro.wave.z at gmail.com macro.wave.z at gmail.com
Wed May 18 11:10:25 CEST 2016


From: Wang Dongsheng <dongsheng.wang at nxp.com>

Since we are already under the directory of arch/arm/, the prefix ARM_ for
macros isn't so necessary, and with more PSCI interfaces being added later,
there will be much more redundant ARM_ prefixes, what's more, there are no
ARM_/arm_ prefixes for other PSCI variables and functions either, so this patch
updates these macro definitions to make them concise and consistent.

Signed-off-by: Wang Dongsheng <dongsheng.wang at nxp.com>
Signed-off-by: Hongbo Zhang <hongbo.zhang at nxp.com>
---
 arch/arm/cpu/armv7/ls102xa/psci.S     |  2 +-
 arch/arm/cpu/armv7/psci.S             | 12 ++++++------
 arch/arm/cpu/armv7/sunxi/psci_sun6i.S |  2 +-
 arch/arm/cpu/armv7/sunxi/psci_sun7i.S |  2 +-
 arch/arm/cpu/armv7/virt-dt.c          |  8 ++++----
 arch/arm/include/asm/psci.h           | 24 +++++++++++++-----------
 arch/arm/mach-tegra/psci.S            |  2 +-
 7 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/arch/arm/cpu/armv7/ls102xa/psci.S b/arch/arm/cpu/armv7/ls102xa/psci.S
index cf5cd48..0b067d9 100644
--- a/arch/arm/cpu/armv7/ls102xa/psci.S
+++ b/arch/arm/cpu/armv7/ls102xa/psci.S
@@ -99,7 +99,7 @@ holdoff_release:
 	dsb
 
 	@ Return
-	mov	r0, #ARM_PSCI_RET_SUCCESS
+	mov	r0, #PSCI_RET_SUCCESS
 
 	pop	{lr}
 	bx	lr
diff --git a/arch/arm/cpu/armv7/psci.S b/arch/arm/cpu/armv7/psci.S
index 87c0c0b..e1fcb5d 100644
--- a/arch/arm/cpu/armv7/psci.S
+++ b/arch/arm/cpu/armv7/psci.S
@@ -50,7 +50,7 @@ ENTRY(psci_cpu_suspend)
 ENTRY(psci_cpu_off)
 ENTRY(psci_cpu_on)
 ENTRY(psci_migrate)
-	mov	r0, #ARM_PSCI_RET_NI	@ Return -1 (Not Implemented)
+	mov	r0, #PSCI_RET_NOT_SUPPORTED	@ Return -1 (Not Supported)
 	mov	pc, lr
 ENDPROC(psci_migrate)
 ENDPROC(psci_cpu_on)
@@ -62,13 +62,13 @@ ENDPROC(psci_cpu_suspend)
 .weak psci_migrate
 
 _psci_table:
-	.word	ARM_PSCI_FN_CPU_SUSPEND
+	.word	PSCI_FN_CPU_SUSPEND
 	.word	psci_cpu_suspend
-	.word	ARM_PSCI_FN_CPU_OFF
+	.word	PSCI_FN_CPU_OFF
 	.word	psci_cpu_off
-	.word	ARM_PSCI_FN_CPU_ON
+	.word	PSCI_FN_CPU_ON
 	.word	psci_cpu_on
-	.word	ARM_PSCI_FN_MIGRATE
+	.word	PSCI_FN_MIGRATE
 	.word	psci_migrate
 	.word	0
 	.word	0
@@ -86,7 +86,7 @@ _smc_psci:
 1:	ldr	r5, [r4]		@ Load PSCI function ID
 	ldr	r6, [r4, #4]		@ Load target PC
 	cmp	r5, #0			@ If reach the end, bail out
-	moveq	r0, #ARM_PSCI_RET_INVAL	@ Return -2 (Invalid)
+	moveq	r0, #PSCI_RET_INVALID_PARAMS	@ Return -2 (Invalid)
 	beq	2f
 	cmp	r0, r5			@ If not matching, try next entry
 	addne	r4, r4, #8
diff --git a/arch/arm/cpu/armv7/sunxi/psci_sun6i.S b/arch/arm/cpu/armv7/sunxi/psci_sun6i.S
index 90b5bfd..ac722e4 100644
--- a/arch/arm/cpu/armv7/sunxi/psci_sun6i.S
+++ b/arch/arm/cpu/armv7/sunxi/psci_sun6i.S
@@ -204,7 +204,7 @@ psci_cpu_on:
 	orr	r6, r6, r4
 	str	r6, [r0, #0x1e4]
 
-	mov	r0, #ARM_PSCI_RET_SUCCESS	@ Return PSCI_RET_SUCCESS
+	mov	r0, #PSCI_RET_SUCCESS	@ Return PSCI_RET_SUCCESS
 	pop	{pc}
 
 .globl	psci_cpu_off
diff --git a/arch/arm/cpu/armv7/sunxi/psci_sun7i.S b/arch/arm/cpu/armv7/sunxi/psci_sun7i.S
index e15d587..59d7ff0 100644
--- a/arch/arm/cpu/armv7/sunxi/psci_sun7i.S
+++ b/arch/arm/cpu/armv7/sunxi/psci_sun7i.S
@@ -179,7 +179,7 @@ psci_cpu_on:
 	orr	r6, r6, r4
 	str	r6, [r0, #0x1e4]
 
-	mov	r0, #ARM_PSCI_RET_SUCCESS	@ Return PSCI_RET_SUCCESS
+	mov	r0, #PSCI_RET_SUCCESS	@ Return PSCI_RET_SUCCESS
 	pop	{pc}
 
 .globl	psci_cpu_off
diff --git a/arch/arm/cpu/armv7/virt-dt.c b/arch/arm/cpu/armv7/virt-dt.c
index 32c368f..f1251d1 100644
--- a/arch/arm/cpu/armv7/virt-dt.c
+++ b/arch/arm/cpu/armv7/virt-dt.c
@@ -73,16 +73,16 @@ static int fdt_psci(void *fdt)
 	tmp = fdt_setprop_string(fdt, nodeoff, "method", "smc");
 	if (tmp)
 		return tmp;
-	tmp = fdt_setprop_u32(fdt, nodeoff, "cpu_suspend", ARM_PSCI_FN_CPU_SUSPEND);
+	tmp = fdt_setprop_u32(fdt, nodeoff, "cpu_suspend", PSCI_FN_CPU_SUSPEND);
 	if (tmp)
 		return tmp;
-	tmp = fdt_setprop_u32(fdt, nodeoff, "cpu_off", ARM_PSCI_FN_CPU_OFF);
+	tmp = fdt_setprop_u32(fdt, nodeoff, "cpu_off", PSCI_FN_CPU_OFF);
 	if (tmp)
 		return tmp;
-	tmp = fdt_setprop_u32(fdt, nodeoff, "cpu_on", ARM_PSCI_FN_CPU_ON);
+	tmp = fdt_setprop_u32(fdt, nodeoff, "cpu_on", PSCI_FN_CPU_ON);
 	if (tmp)
 		return tmp;
-	tmp = fdt_setprop_u32(fdt, nodeoff, "migrate", ARM_PSCI_FN_MIGRATE);
+	tmp = fdt_setprop_u32(fdt, nodeoff, "migrate", PSCI_FN_MIGRATE);
 	if (tmp)
 		return tmp;
 #endif
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
index a4a19e3..7c3450c 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -18,19 +18,21 @@
 #ifndef __ARM_PSCI_H__
 #define __ARM_PSCI_H__
 
-/* PSCI interface */
-#define ARM_PSCI_FN_BASE		0x84000000
-#define ARM_PSCI_FN(n)			(ARM_PSCI_FN_BASE + (n))
 
-#define ARM_PSCI_FN_CPU_SUSPEND		ARM_PSCI_FN(1)
-#define ARM_PSCI_FN_CPU_OFF		ARM_PSCI_FN(2)
-#define ARM_PSCI_FN_CPU_ON		ARM_PSCI_FN(3)
-#define ARM_PSCI_FN_MIGRATE		ARM_PSCI_FN(5)
+/* PSCI interfaces */
+#define PSCI_FN_BASE			0x84000000
+#define PSCI_FN_ID(n)			(PSCI_FN_BASE + (n))
 
-#define ARM_PSCI_RET_SUCCESS		0
-#define ARM_PSCI_RET_NI			(-1)
-#define ARM_PSCI_RET_INVAL		(-2)
-#define ARM_PSCI_RET_DENIED		(-3)
+#define PSCI_FN_CPU_SUSPEND		PSCI_FN_ID(1)
+#define PSCI_FN_CPU_OFF			PSCI_FN_ID(2)
+#define PSCI_FN_CPU_ON			PSCI_FN_ID(3)
+#define PSCI_FN_MIGRATE			PSCI_FN_ID(5)
+
+/* PSCI return values */
+#define PSCI_RET_SUCCESS		0
+#define PSCI_RET_NOT_SUPPORTED		(-1)
+#define PSCI_RET_INVALID_PARAMS		(-2)
+#define PSCI_RET_DENIED			(-3)
 
 #ifndef __ASSEMBLY__
 int psci_update_dt(void *fdt);
diff --git a/arch/arm/mach-tegra/psci.S b/arch/arm/mach-tegra/psci.S
index b836da1..5f326c9 100644
--- a/arch/arm/mach-tegra/psci.S
+++ b/arch/arm/mach-tegra/psci.S
@@ -105,7 +105,7 @@ ENTRY(psci_cpu_on)
 	mov	r5, #(CSR_IMMEDIATE_WAKE | CSR_ENABLE)
 	str	r5, [r6, r2]
 
-	mov	r0, #ARM_PSCI_RET_SUCCESS	@ Return PSCI_RET_SUCCESS
+	mov	r0, #PSCI_RET_SUCCESS	@ Return PSCI_RET_SUCCESS
 	pop	{pc}
 ENDPROC(psci_cpu_on)
 
-- 
2.1.4



More information about the U-Boot mailing list