]> git.baikalelectronics.ru Git - kernel.git/commitdiff
firmware: stratix10-svc: To support a command ATF Get Version
authorAng Tien Sung <tien.sung.ang@intel.com>
Mon, 11 Jul 2022 22:31:40 +0000 (17:31 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Jul 2022 14:55:09 +0000 (16:55 +0200)
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@intel.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220711223140.2307945-6-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/stratix10-svc.c
include/linux/firmware/intel/stratix10-smc.h
include/linux/firmware/intel/stratix10-svc-client.h

index 7fea94fe2ca083bc871e1bb723259a1fedaf912c..b4081f4d88a37f860b9130dce89393b24d5e9aea 100644 (file)
@@ -343,6 +343,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;
@@ -524,6 +529,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;
index 8fc4aa450517595b60125e438dcae89b75326289..a718f853d45785462699d4659e0380231d682b11 100644 (file)
@@ -466,6 +466,24 @@ 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)
+
 /**
  * SMC call protocol for FPGA Crypto Service (FCS)
  * FUNCID starts from 90
index 82a20e62f15f0c570a88de38aa82c5fb073686de..a776a787ac7535ba74831dd04af94ca2b13fc1dd 100644 (file)
@@ -114,6 +114,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
+ *
  * @COMMAND_RSU_DCMF_STATUS: query firmware for the DCMF status
  * return status is SVC_STATUS_OK or SVC_STATUS_ERROR
  *
@@ -160,6 +163,8 @@ enum stratix10_svc_command_code {
        COMMAND_FCS_RANDOM_NUMBER_GEN,
        /* for general status poll */
        COMMAND_POLL_SERVICE_STATUS = 40,
+       /* Non-mailbox SMC Call */
+       COMMAND_SMC_SVC_VERSION = 200,
 };
 
 /**