[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220429091615.1064585-1-tien.sung.ang@intel.com>
Date: Fri, 29 Apr 2022 17:16:15 +0800
From: tien.sung.ang@...el.com
To: Dinh Nguyen <dinguyen@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Ang Tien Sung <tien.sung.ang@...el.com>
Subject: [PATCH] firmware: stratix10-svc: To support a command ATF Get Version
From: Ang Tien Sung <tien.sung.ang@...el.com>
We are to support a new SMC Command of hexadecimal 0x200 that returns
the ATF Firmware major and minor version.
Signed-off-by: Ang Tien Sung <tien.sung.ang@...el.com>
---
drivers/firmware/stratix10-svc.c | 10 ++++++++++
include/linux/firmware/intel/stratix10-smc.h | 17 +++++++++++++++++
.../linux/firmware/intel/stratix10-svc-client.h | 5 +++++
3 files changed, 32 insertions(+)
diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
index 8177a0fae11d..999ffa83e8b3 100644
--- a/drivers/firmware/stratix10-svc.c
+++ b/drivers/firmware/stratix10-svc.c
@@ -310,6 +310,11 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data,
cb_data->status = BIT(SVC_STATUS_OK);
cb_data->kaddr1 = &res.a1;
break;
+ case COMMAND_SMC_SVC_VERSION:
+ cb_data->status = BIT(SVC_STATUS_OK);
+ cb_data->kaddr1 = &res.a1;
+ cb_data->kaddr2 = &res.a2;
+ break;
case COMMAND_RSU_DCMF_VERSION:
cb_data->status = BIT(SVC_STATUS_OK);
cb_data->kaddr1 = &res.a1;
@@ -428,6 +433,11 @@ static int svc_normal_to_secure_thread(void *data)
a1 = 0;
a2 = 0;
break;
+ case COMMAND_SMC_SVC_VERSION:
+ a0 = INTEL_SIP_SMC_SVC_VERSION;
+ a1 = 0;
+ a2 = 0;
+ break;
default:
pr_warn("it shouldn't happen\n");
break;
diff --git a/include/linux/firmware/intel/stratix10-smc.h b/include/linux/firmware/intel/stratix10-smc.h
index aad497a9ad8b..d44605d2aa71 100644
--- a/include/linux/firmware/intel/stratix10-smc.h
+++ b/include/linux/firmware/intel/stratix10-smc.h
@@ -420,4 +420,21 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
#define INTEL_SIP_SMC_FIRMWARE_VERSION \
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FIRMWARE_VERSION)
+/**
+ * Request INTEL_SIP_SMC_SVC_VERSION
+ *
+ * Sync call used to query the SIP SMC API Version
+ *
+ * Call register usage:
+ * a0 INTEL_SIP_SMC_SVC_VERSION
+ * a1-a7 not used
+ *
+ * Return status:
+ * a0 INTEL_SIP_SMC_STATUS_OK
+ * a1 Major
+ * a2 Minor
+ */
+#define INTEL_SIP_SMC_SVC_FUNCID_VERSION 512
+#define INTEL_SIP_SMC_SVC_VERSION \
+ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_SVC_FUNCID_VERSION)
#endif
diff --git a/include/linux/firmware/intel/stratix10-svc-client.h b/include/linux/firmware/intel/stratix10-svc-client.h
index 18c1841fdb1f..0dfd4672b346 100644
--- a/include/linux/firmware/intel/stratix10-svc-client.h
+++ b/include/linux/firmware/intel/stratix10-svc-client.h
@@ -107,6 +107,9 @@ struct stratix10_svc_chan;
*
* @COMMAND_FIRMWARE_VERSION: query running firmware version, return status
* is SVC_STATUS_OK or SVC_STATUS_ERROR
+ *
+ * @COMMAND_SMC_SVC_VERSION: Non-mailbox SMC SVC API Version,
+ * return status is SVC_STATUS_OK
*/
enum stratix10_svc_command_code {
COMMAND_NOOP = 0,
@@ -121,6 +124,8 @@ enum stratix10_svc_command_code {
COMMAND_RSU_MAX_RETRY,
COMMAND_RSU_DCMF_VERSION,
COMMAND_FIRMWARE_VERSION,
+ /* Non-mailbox SMC Call */
+ COMMAND_SMC_SVC_VERSION = 200
};
/**
--
2.25.1
Powered by blists - more mailing lists