[FOSS_TLK]platform: tegra: 64-bit Trusted OS/App SMCs
Varun Wadekar [Fri, 2 Jan 2015 10:24:08 +0000 (15:24 +0530)]
Switch the Function IDs to 64-bit versions as the SMC calling entity (linux
kernel) is 64-bit. Keep legacy SMCs alive till the linux driver is in sync
with the Trusted OS. We re-use the same SMCs for a 32-bit calling entity in
order to avoid code bloat.

Also remove some unused/legacy cruft while we are at it.

Change-Id: I28f41efb471796f3b7fe61222c63ed441bf75c2c
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/715770
Reviewed-by: Automatic_Commit_Validation_User

platform/tegra/common/pm.c
platform/tegra/common/tz.c
platform/tegra/include/platform/platform_ta.h
platform/tegra/include/platform/platform_tos.h

index 2c7f9b6..4b33a9d 100644 (file)
@@ -318,7 +318,6 @@ void pm_handle_platform_smc(struct tz_monitor_frame *frame)
                        pm_handle_smc_l2(frame->r[1]);
                        break;
 
-               case SMC_SIP_CPU_RESET_VECTOR_LEGACY:
                case SMC_SIP_CPU_RESET_VECTOR:
                        _ns_addr_secondary_cpus = frame->r[1];
                        if (frame->r[1] == 0)
index 2d158f5..5ed8e7f 100644 (file)
@@ -241,14 +241,17 @@ void tz_handle_system_smc(struct tz_monitor_frame *frame)
        switch (frame->r[0]) {
 
                case SMC_TOS_SS_REGISTER_HANDLER:
+               case SMC_TOS_SS_REGISTER_HANDLER_LEGACY:
                        error = platform_ss_register_handler(frame);
                        break;
 
                case SMC_TOS_NS_REG_REQPARAM_BUF:
+               case SMC_TOS_NS_REG_REQPARAM_BUF_LEGACY:
                        error = tz_register_req_param_buf(frame);
                        break;
 
                case SMC_TOS_INIT_LOGGER:
+               case SMC_TOS_INIT_LOGGER_LEGACY:
                        _ns_cb_struct_addr = frame->r[1];
 
                        if (!_ns_cb_struct_addr) {
@@ -270,11 +273,6 @@ void tz_handle_system_smc(struct tz_monitor_frame *frame)
                        dprintf(CRITICAL, "%s", early_logbuf);
 
                        break;
-#if !defined(WITH_MONITOR_BIN)
-               case SMC_TOS_PROGRAM_VPR:
-                       error = platform_program_vpr(frame->r[1], frame->r[2]);
-                       break;
-#endif
        }
 
        frame->r[0] = error;
@@ -452,12 +450,15 @@ static void tz_handle_trusted_app_smc(struct tz_monitor_frame *frame)
 
        switch (frame->r[0]) {
                case SMC_TA_OPEN_SESSION:
+               case SMC_TA_OPEN_SESSION_LEGACY:
                        result = te_handle_open_session(req, false);
                        break;
                case SMC_TA_CLOSE_SESSION:
+               case SMC_TA_CLOSE_SESSION_LEGACY:
                        result = te_handle_close_session(req, false);
                        break;
                case SMC_TA_LAUNCH_OPERATION:
+               case SMC_TA_LAUNCH_OPERATION_LEGACY:
                        result = te_handle_launch_op(req, false);
                        break;
        }
@@ -473,7 +474,8 @@ static void tz_handle_trusted_app_smc(struct tz_monitor_frame *frame)
        /* move request results back to caller struct */
        caller_req->result = req->result;
        caller_req->result_origin = req->result_origin;
-       if (frame->r[0] == SMC_TA_OPEN_SESSION) {
+       if ((frame->r[0] == SMC_TA_OPEN_SESSION) ||
+           (frame->r[0] == SMC_TA_OPEN_SESSION_LEGACY)) {
                caller_req->session_id = req->session_id;
        }
 
@@ -493,15 +495,18 @@ void tz_stdcall_handler(struct tz_monitor_frame *frame)
        case SMC_TOS_SS_REGISTER_HANDLER:
        case SMC_TOS_NS_REG_REQPARAM_BUF:
        case SMC_TOS_INIT_LOGGER:
-#if !defined(WITH_MONITOR_BIN)
-       case SMC_TOS_PROGRAM_VPR:
-#endif
+       case SMC_TOS_SS_REGISTER_HANDLER_LEGACY:
+       case SMC_TOS_NS_REG_REQPARAM_BUF_LEGACY:
+       case SMC_TOS_INIT_LOGGER_LEGACY:
                tz_handle_system_smc(frame);
                break;
 
        case SMC_TA_OPEN_SESSION:
        case SMC_TA_CLOSE_SESSION:
        case SMC_TA_LAUNCH_OPERATION:
+       case SMC_TA_OPEN_SESSION_LEGACY:
+       case SMC_TA_CLOSE_SESSION_LEGACY:
+       case SMC_TA_LAUNCH_OPERATION_LEGACY:
                tz_handle_trusted_app_smc(frame);
                break;
 
@@ -519,7 +524,6 @@ void tz_fastcall_handler(struct tz_monitor_frame *frame)
 #if !defined(WITH_MONITOR_BIN)
        case SMC_SIP_L2_MANAGEMENT:
        case SMC_SIP_CPU_RESET_VECTOR:
-       case SMC_SIP_CPU_RESET_VECTOR_LEGACY:
        case SMC_SIP_DEVICE_SUSPEND:
                pm_handle_platform_smc(frame);
                break;
index 9192c46..0726c74 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved
+ * Copyright (c) 2012-2015, NVIDIA CORPORATION. All rights reserved
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/* Trusted Application Calls */
-#define SMC_TA_OPEN_SESSION                    0x30000001
-#define SMC_TA_CLOSE_SESSION                   0x30000002
-#define SMC_TA_LAUNCH_OPERATION                        0x30000003
+/*
+ * Trusted Application Calls, defined according to ARM_DEN0028A specs.
+ *
+ * Bit 30 - 1: SMC64 calling convention, 0: SMC32 calling convention
+ * Bits 29:24 - (0x30000000 - 0x31000000) Trusted Application calls
+ * Bits 15:0 - Function number
+ *
+ */
+#define SMC_TA_OPEN_SESSION                    0x70000001
+#define SMC_TA_CLOSE_SESSION                   0x70000002
+#define SMC_TA_LAUNCH_OPERATION                        0x70000003
+
+/* Trusted Application Calls (legacy) */
+#define SMC_TA_OPEN_SESSION_LEGACY             0x30000001
+#define SMC_TA_CLOSE_SESSION_LEGACY            0x30000002
+#define SMC_TA_LAUNCH_OPERATION_LEGACY         0x30000003
index def6383..07c41fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved
+ * Copyright (c) 2012-2015, NVIDIA CORPORATION. All rights reserved
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/* Trusted OS calls */
-#define SMC_TOS_NS_FS_PARAMS                   0x32000001
-#define SMC_TOS_NS_REG_REQPARAM_BUF            0x32000002
-#define SMC_TOS_PROGRAM_VPR                    0x32000003
-#define SMC_TOS_NS_IRQ_PENDING_VECTOR          0x32000004
-#define SMC_TOS_NS_RETURN_FROM_IRQ             0x32000005
-#define SMC_TOS_FS_OP_DONE                     0x32000006
-#define SMC_TOS_INIT_LOGGER                    0x32000007
-#define SMC_TOS_SS_REQ_COMPLETE                        0x32000009
-#define SMC_TOS_SS_REGISTER_HANDLER            0x32000010
+/*
+ * Trusted OS Calls, defined according to ARM_DEN0028A specs.
+ *
+ * Bit 30 - 1: SMC64 calling convention, 0: SMC32 calling convention
+ * Bits 29:24 - (0x32000000 - 0x3F000000) Trusted OS calls
+ * Bits 15:0 - Function number
+ *
+ */
+#define SMC_TOS_NS_REG_REQPARAM_BUF            0x72000001
+#define SMC_TOS_INIT_LOGGER                    0x72000002
+#define SMC_TOS_SS_REGISTER_HANDLER            0x72000003
+
+/* Trusted OS calls (legacy) */
+#define SMC_TOS_NS_REG_REQPARAM_BUF_LEGACY     0x32000002
+#define SMC_TOS_INIT_LOGGER_LEGACY             0x32000007
+#define SMC_TOS_SS_REGISTER_HANDLER_LEGACY     0x32000010