Merge "feat(zynqmp): protect eFuses from non-secure access" into integration
diff --git a/plat/xilinx/versal/bl31_versal_setup.c b/plat/xilinx/versal/bl31_versal_setup.c
index 593cdc4..b8db4a6 100644
--- a/plat/xilinx/versal/bl31_versal_setup.c
+++ b/plat/xilinx/versal/bl31_versal_setup.c
@@ -73,7 +73,7 @@
 	if (VERSAL_CONSOLE_IS(pl011) || (VERSAL_CONSOLE_IS(pl011_1))) {
 		static console_t versal_runtime_console;
 		/* Initialize the console to provide early debug support */
-		int32_t rc = console_pl011_register((unsigned long)VERSAL_UART_BASE,
+		int32_t rc = console_pl011_register((uintptr_t)VERSAL_UART_BASE,
 						(uint32_t)VERSAL_UART_CLOCK,
 						(uint32_t)VERSAL_UART_BAUDRATE,
 						&versal_runtime_console);
diff --git a/plat/xilinx/versal/include/versal_def.h b/plat/xilinx/versal/include/versal_def.h
index 766cafa..4b0b311 100644
--- a/plat/xilinx/versal/include/versal_def.h
+++ b/plat/xilinx/versal/include/versal_def.h
@@ -81,15 +81,15 @@
 # define VERSAL_UART_BAUDRATE	115200
 # define VERSAL_CPU_CLOCK	100000000
 #elif VERSAL_PLATFORM_IS(spp_itr6)
-# define PLATFORM_NAME          "SPP ITR6"
-# define VERSAL_UART_CLOCK      25000000
-# define VERSAL_UART_BAUDRATE   115200
-# define VERSAL_CPU_CLOCK       2720000
+# define PLATFORM_NAME		"SPP ITR6"
+# define VERSAL_UART_CLOCK	25000000
+# define VERSAL_UART_BAUDRATE	115200
+# define VERSAL_CPU_CLOCK	2720000
 #elif VERSAL_PLATFORM_IS(emu_itr6)
-# define PLATFORM_NAME          "EMU ITR6"
-# define VERSAL_UART_CLOCK      212000
-# define VERSAL_UART_BAUDRATE   9600
-# define VERSAL_CPU_CLOCK       212000
+# define PLATFORM_NAME		"EMU ITR6"
+# define VERSAL_UART_CLOCK	212000
+# define VERSAL_UART_BAUDRATE	9600
+# define VERSAL_CPU_CLOCK	212000
 #endif
 
 /* Access control register defines */
diff --git a/plat/xilinx/versal/plat_psci.c b/plat/xilinx/versal/plat_psci.c
index acecbb1..6787f31 100644
--- a/plat/xilinx/versal/plat_psci.c
+++ b/plat/xilinx/versal/plat_psci.c
@@ -238,7 +238,7 @@
 /*******************************************************************************
  * Export the platform specific power ops.
  ******************************************************************************/
-int plat_setup_psci_ops(uintptr_t sec_entrypoint,
+int32_t plat_setup_psci_ops(uintptr_t sec_entrypoint,
 			const struct plat_psci_ops **psci_ops)
 {
 	versal_sec_entry = sec_entrypoint;
diff --git a/plat/xilinx/versal/pm_service/pm_api_sys.h b/plat/xilinx/versal/pm_service/pm_api_sys.h
index 6fa65c2..e391ea0 100644
--- a/plat/xilinx/versal/pm_service/pm_api_sys.h
+++ b/plat/xilinx/versal/pm_service/pm_api_sys.h
@@ -17,7 +17,7 @@
 #define LOADER_MODULE_ID	0x7U
 
 #define  MODE			0x80000000U
-#define  MODULE_ID_MASK		0x0000ff00
+#define  MODULE_ID_MASK		0x0000ff00U
 /**********************************************************
  * PM API function declarations
  **********************************************************/
diff --git a/plat/xilinx/versal/pm_service/pm_defs.h b/plat/xilinx/versal/pm_service/pm_defs.h
index 5491555..2922b5d 100644
--- a/plat/xilinx/versal/pm_service/pm_defs.h
+++ b/plat/xilinx/versal/pm_service/pm_defs.h
@@ -39,9 +39,7 @@
 
 /* PM API Versions */
 #define PM_API_BASE_VERSION		1U
-#define PM_API_VERSION_2                2U
-
-#define PM_API_QUERY_DATA_VERSION	2U
+#define PM_API_VERSION_2		2U
 
 /* PM API ids */
 #define PM_REGISTER_NOTIFIER		5U
diff --git a/plat/xilinx/versal/pm_service/pm_svc_main.c b/plat/xilinx/versal/pm_service/pm_svc_main.c
index 4b0f5e0..382a148 100644
--- a/plat/xilinx/versal/pm_service/pm_svc_main.c
+++ b/plat/xilinx/versal/pm_service/pm_svc_main.c
@@ -59,7 +59,7 @@
  * Update the SGI number to be used.
  *
  */
-int pm_register_sgi(uint32_t sgi_num, uint32_t reset)
+int32_t pm_register_sgi(uint32_t sgi_num, uint32_t reset)
 {
 	if (reset == 1U) {
 		sgi = INVALID_SGI;
@@ -91,7 +91,7 @@
  * Called from sip_svc_setup initialization function with the
  * rt_svc_init signature.
  */
-int pm_setup(void)
+int32_t pm_setup(void)
 {
 	int32_t status, ret = 0;
 
@@ -146,7 +146,7 @@
 		if (ret == PM_RET_ERROR_NOTSUPPORTED)
 			return (uintptr_t)0;
 
-		SMC_RET1(handle, (uint64_t)ret | ((uint64_t)value) << 32);
+		SMC_RET1(handle, (uint64_t)ret | ((uint64_t)value) << 32U);
 	}
 
 	case PM_QUERY_DATA:
@@ -156,8 +156,8 @@
 		ret = pm_query_data(pm_arg[0], pm_arg[1], pm_arg[2],
 				      pm_arg[3], data, security_flag);
 
-		SMC_RET2(handle, (uint64_t)ret  | ((uint64_t)data[0] << 32U),
-				 (uint64_t)data[1] | ((uint64_t)data[2] << 32U));
+		SMC_RET2(handle, (uint64_t)ret | ((uint64_t)data[0] << 32U),
+			(uint64_t)data[1] | ((uint64_t)data[2] << 32U));
 	}
 
 	case PM_FEATURE_CHECK:
@@ -201,24 +201,24 @@
 	case PM_SELF_SUSPEND:
 		ret = pm_self_suspend(pm_arg[0], pm_arg[1], pm_arg[2],
 				      pm_arg[3], security_flag);
-		SMC_RET1(handle, (uint64_t)ret);
+		SMC_RET1(handle, (u_register_t)ret);
 
 	case PM_FORCE_POWERDOWN:
 		ret = pm_force_powerdown(pm_arg[0], pm_arg[1], security_flag);
-		SMC_RET1(handle, (uint64_t)ret);
+		SMC_RET1(handle, (u_register_t)ret);
 
 	case PM_REQ_SUSPEND:
 		ret = pm_req_suspend(pm_arg[0], pm_arg[1], pm_arg[2],
 				     pm_arg[3], security_flag);
-		SMC_RET1(handle, (uint64_t)ret);
+		SMC_RET1(handle, (u_register_t)ret);
 
 	case PM_ABORT_SUSPEND:
 		ret = pm_abort_suspend(pm_arg[0], security_flag);
-		SMC_RET1(handle, (uint64_t)ret);
+		SMC_RET1(handle, (u_register_t)ret);
 
 	case PM_SYSTEM_SHUTDOWN:
 		ret = pm_system_shutdown(pm_arg[0], pm_arg[1], security_flag);
-		SMC_RET1(handle, (uint64_t)ret);
+		SMC_RET1(handle, (u_register_t)ret);
 
 	default:
 		return (uintptr_t)0;
@@ -297,13 +297,13 @@
 		if ((pm_arg[0] == XPM_QID_CLOCK_GET_NAME ||
 		    pm_arg[0] == XPM_QID_PINCTRL_GET_FUNCTION_NAME) &&
 		    ret == PM_RET_SUCCESS) {
-			SMC_RET2(handle, (uint64_t)buf[0] | ((uint64_t)buf[1] << 32),
-				(uint64_t)buf[2] | ((uint64_t)buf[3] << 32));
+			SMC_RET2(handle, (uint64_t)buf[0] | ((uint64_t)buf[1] << 32U),
+				(uint64_t)buf[2] | ((uint64_t)buf[3] << 32U));
 		}
 	}
 
-	SMC_RET2(handle, (uint64_t)ret | ((uint64_t)buf[0] << 32),
-		 (uint64_t)buf[1] | ((uint64_t)buf[2] << 32));
+	SMC_RET2(handle, (uint64_t)ret | ((uint64_t)buf[0] << 32U),
+		 (uint64_t)buf[1] | ((uint64_t)buf[2] << 32U));
 }
 
 /**
@@ -345,9 +345,9 @@
 	}
 
 	pm_arg[0] = (uint32_t)x1;
-	pm_arg[1] = (uint32_t)(x1 >> 32);
+	pm_arg[1] = (uint32_t)(x1 >> 32U);
 	pm_arg[2] = (uint32_t)x2;
-	pm_arg[3] = (uint32_t)(x2 >> 32);
+	pm_arg[3] = (uint32_t)(x2 >> 32U);
 	pm_arg[4] = (uint32_t)x3;
 	(void)(x4);
 	api_id = smc_fid & FUNCID_NUM_MASK;
diff --git a/plat/xilinx/zynqmp/platform.mk b/plat/xilinx/zynqmp/platform.mk
index 1f04a95..dd82bc0 100644
--- a/plat/xilinx/zynqmp/platform.mk
+++ b/plat/xilinx/zynqmp/platform.mk
@@ -21,7 +21,7 @@
 
 WORKAROUND_CVE_2017_5715	:=	0
 
-ARM_XLAT_TABLES_LIB_V1         :=      1
+ARM_XLAT_TABLES_LIB_V1		:=	1
 $(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1))
 $(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1))