From 381b901f22a3d78ac15bb6d9ea5f88ed365d1fbf Mon Sep 17 00:00:00 2001
From: Carlo Caione <ccaione@baylibre.com>
Date: Mon, 26 Aug 2019 13:04:12 +0100
Subject: [PATCH] amlogic: Fix prefixes in the SIP/SVC code

All the SIP/SVC related code is currently the same between GXL and GXBB.
Rename function names and register names to avoid hardcoding the GXBB
prefix.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Change-Id: I7e58ab68489df8d4762663fc01fb64e6899cc8bf
---
 plat/amlogic/common/aml_scpi.c    |  4 ++--
 plat/amlogic/common/aml_sip_svc.c | 28 ++++++++++++++--------------
 plat/amlogic/gxbb/gxbb_def.h      | 28 ++++++++++++++--------------
 plat/amlogic/gxl/gxl_def.h        | 28 ++++++++++++++--------------
 4 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/plat/amlogic/common/aml_scpi.c b/plat/amlogic/common/aml_scpi.c
index 6727029671..28837a2c50 100644
--- a/plat/amlogic/common/aml_scpi.c
+++ b/plat/amlogic/common/aml_scpi.c
@@ -89,9 +89,9 @@ uint32_t scpi_sys_power_state(uint64_t system_state)
 
 void scpi_jtag_set_state(uint32_t state, uint8_t select)
 {
-	assert(state <= GXBB_JTAG_STATE_OFF);
+	assert(state <= AML_JTAG_STATE_OFF);
 
-	if (select > GXBB_JTAG_A53_EE) {
+	if (select > AML_JTAG_A53_EE) {
 		WARN("BL31: Invalid JTAG select (0x%x).\n", select);
 		return;
 	}
diff --git a/plat/amlogic/common/aml_sip_svc.c b/plat/amlogic/common/aml_sip_svc.c
index b358997840..6736a816a7 100644
--- a/plat/amlogic/common/aml_sip_svc.c
+++ b/plat/amlogic/common/aml_sip_svc.c
@@ -15,7 +15,7 @@
 /*******************************************************************************
  * This function is responsible for handling all SiP calls
  ******************************************************************************/
-static uintptr_t gxbb_sip_handler(uint32_t smc_fid,
+static uintptr_t aml_sip_handler(uint32_t smc_fid,
 				  u_register_t x1, u_register_t x2,
 				  u_register_t x3, u_register_t x4,
 				  void *cookie, void *handle,
@@ -23,28 +23,28 @@ static uintptr_t gxbb_sip_handler(uint32_t smc_fid,
 {
 	switch (smc_fid) {
 
-	case GXBB_SM_GET_SHARE_MEM_INPUT_BASE:
-		SMC_RET1(handle, GXBB_SHARE_MEM_INPUT_BASE);
+	case AML_SM_GET_SHARE_MEM_INPUT_BASE:
+		SMC_RET1(handle, AML_SHARE_MEM_INPUT_BASE);
 
-	case GXBB_SM_GET_SHARE_MEM_OUTPUT_BASE:
-		SMC_RET1(handle, GXBB_SHARE_MEM_OUTPUT_BASE);
+	case AML_SM_GET_SHARE_MEM_OUTPUT_BASE:
+		SMC_RET1(handle, AML_SHARE_MEM_OUTPUT_BASE);
 
-	case GXBB_SM_EFUSE_READ:
+	case AML_SM_EFUSE_READ:
 	{
-		void *dst = (void *)GXBB_SHARE_MEM_OUTPUT_BASE;
+		void *dst = (void *)AML_SHARE_MEM_OUTPUT_BASE;
 		uint64_t ret = aml_efuse_read(dst, (uint32_t)x1, x2);
 
 		SMC_RET1(handle, ret);
 	}
-	case GXBB_SM_EFUSE_USER_MAX:
+	case AML_SM_EFUSE_USER_MAX:
 		SMC_RET1(handle,  aml_efuse_user_max());
 
-	case GXBB_SM_JTAG_ON:
-		scpi_jtag_set_state(GXBB_JTAG_STATE_ON, x1);
+	case AML_SM_JTAG_ON:
+		scpi_jtag_set_state(AML_JTAG_STATE_ON, x1);
 		SMC_RET1(handle, 0);
 
-	case GXBB_SM_JTAG_OFF:
-		scpi_jtag_set_state(GXBB_JTAG_STATE_OFF, x1);
+	case AML_SM_JTAG_OFF:
+		scpi_jtag_set_state(AML_JTAG_STATE_OFF, x1);
 		SMC_RET1(handle, 0);
 
 	default:
@@ -56,11 +56,11 @@ static uintptr_t gxbb_sip_handler(uint32_t smc_fid,
 }
 
 DECLARE_RT_SVC(
-	gxbb_sip_handler,
+	aml_sip_handler,
 
 	OEN_SIP_START,
 	OEN_SIP_END,
 	SMC_TYPE_FAST,
 	NULL,
-	gxbb_sip_handler
+	aml_sip_handler
 );
diff --git a/plat/amlogic/gxbb/gxbb_def.h b/plat/amlogic/gxbb/gxbb_def.h
index e888aa6068..1b781d9572 100644
--- a/plat/amlogic/gxbb/gxbb_def.h
+++ b/plat/amlogic/gxbb/gxbb_def.h
@@ -28,8 +28,8 @@
 #define BL31_LIMIT				(BL31_BASE + BL31_SIZE)
 
 /* Shared memory used for SMC services */
-#define GXBB_SHARE_MEM_INPUT_BASE		UL(0x100FE000)
-#define GXBB_SHARE_MEM_OUTPUT_BASE		UL(0x100FF000)
+#define AML_SHARE_MEM_INPUT_BASE		UL(0x100FE000)
+#define AML_SHARE_MEM_OUTPUT_BASE		UL(0x100FF000)
 
 #define GXBB_SEC_DEVICE0_BASE			UL(0xC0000000)
 #define GXBB_SEC_DEVICE0_SIZE			UL(0x09000000)
@@ -98,21 +98,21 @@
 /*******************************************************************************
  * System Monitor Call IDs and arguments
  ******************************************************************************/
-#define GXBB_SM_GET_SHARE_MEM_INPUT_BASE	U(0x82000020)
-#define GXBB_SM_GET_SHARE_MEM_OUTPUT_BASE	U(0x82000021)
+#define AML_SM_GET_SHARE_MEM_INPUT_BASE		U(0x82000020)
+#define AML_SM_GET_SHARE_MEM_OUTPUT_BASE	U(0x82000021)
 
-#define GXBB_SM_EFUSE_READ			U(0x82000030)
-#define GXBB_SM_EFUSE_USER_MAX			U(0x82000033)
+#define AML_SM_EFUSE_READ			U(0x82000030)
+#define AML_SM_EFUSE_USER_MAX			U(0x82000033)
 
-#define GXBB_SM_JTAG_ON				U(0x82000040)
-#define GXBB_SM_JTAG_OFF			U(0x82000041)
+#define AML_SM_JTAG_ON				U(0x82000040)
+#define AML_SM_JTAG_OFF				U(0x82000041)
 
-#define GXBB_JTAG_STATE_ON			U(0)
-#define GXBB_JTAG_STATE_OFF			U(1)
+#define AML_JTAG_STATE_ON			U(0)
+#define AML_JTAG_STATE_OFF			U(1)
 
-#define GXBB_JTAG_M3_AO				U(0)
-#define GXBB_JTAG_M3_EE				U(1)
-#define GXBB_JTAG_A53_AO			U(2)
-#define GXBB_JTAG_A53_EE			U(3)
+#define AML_JTAG_M3_AO				U(0)
+#define AML_JTAG_M3_EE				U(1)
+#define AML_JTAG_A53_AO				U(2)
+#define AML_JTAG_A53_EE				U(3)
 
 #endif /* GXBB_DEF_H */
diff --git a/plat/amlogic/gxl/gxl_def.h b/plat/amlogic/gxl/gxl_def.h
index 3cc7a1c03c..1149d072f3 100644
--- a/plat/amlogic/gxl/gxl_def.h
+++ b/plat/amlogic/gxl/gxl_def.h
@@ -28,8 +28,8 @@
 #define BL31_LIMIT				(BL31_BASE + BL31_SIZE)
 
 /* Shared memory used for SMC services */
-#define GXBB_SHARE_MEM_INPUT_BASE		UL(0x050FE000)
-#define GXBB_SHARE_MEM_OUTPUT_BASE		UL(0x050FF000)
+#define AML_SHARE_MEM_INPUT_BASE		UL(0x050FE000)
+#define AML_SHARE_MEM_OUTPUT_BASE		UL(0x050FF000)
 
 #define GXBB_SEC_DEVICE0_BASE			UL(0xC0000000)
 #define GXBB_SEC_DEVICE0_SIZE			UL(0x09000000)
@@ -108,21 +108,21 @@
 /*******************************************************************************
  * System Monitor Call IDs and arguments
  ******************************************************************************/
-#define GXBB_SM_GET_SHARE_MEM_INPUT_BASE	U(0x82000020)
-#define GXBB_SM_GET_SHARE_MEM_OUTPUT_BASE	U(0x82000021)
+#define AML_SM_GET_SHARE_MEM_INPUT_BASE		U(0x82000020)
+#define AML_SM_GET_SHARE_MEM_OUTPUT_BASE	U(0x82000021)
 
-#define GXBB_SM_EFUSE_READ			U(0x82000030)
-#define GXBB_SM_EFUSE_USER_MAX			U(0x82000033)
+#define AML_SM_EFUSE_READ			U(0x82000030)
+#define AML_SM_EFUSE_USER_MAX			U(0x82000033)
 
-#define GXBB_SM_JTAG_ON				U(0x82000040)
-#define GXBB_SM_JTAG_OFF			U(0x82000041)
+#define AML_SM_JTAG_ON				U(0x82000040)
+#define AML_SM_JTAG_OFF				U(0x82000041)
 
-#define GXBB_JTAG_STATE_ON			U(0)
-#define GXBB_JTAG_STATE_OFF			U(1)
+#define AML_JTAG_STATE_ON			U(0)
+#define AML_JTAG_STATE_OFF			U(1)
 
-#define GXBB_JTAG_M3_AO				U(0)
-#define GXBB_JTAG_M3_EE				U(1)
-#define GXBB_JTAG_A53_AO			U(2)
-#define GXBB_JTAG_A53_EE			U(3)
+#define AML_JTAG_M3_AO				U(0)
+#define AML_JTAG_M3_EE				U(1)
+#define AML_JTAG_A53_AO				U(2)
+#define AML_JTAG_A53_EE				U(3)
 
 #endif /* GXBB_DEF_H */
-- 
GitLab