mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 01:08:13 -04:00
firmware: stratix10-svc: Add support to query Arm Trusted Firmware (ATF) version
Add entry in Stratix10 service layer that allow client to retrieve the ATF version at runtime, which is useful for system diagnostics, compatibility checks, and ensuring the correct secure firmware is in use. The change introduces: - A new service command definition in the Stratix10 service layer to initiate the ATF version query. - A corresponding macro definition in the header file to expose the command ID for use by other components. The service layer uses a Secure Monitor Call (SMC) to communicate with the ATF and retrieve the version string, which can then be logged or validated by client application. Signed-off-by: Tze Yee Ng <tze.yee.ng@altera.com> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
This commit is contained in:
@@ -486,6 +486,12 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data,
|
||||
cb_data->kaddr1 = &res.a1;
|
||||
cb_data->kaddr2 = &res.a2;
|
||||
break;
|
||||
case COMMAND_SMC_ATF_BUILD_VER:
|
||||
cb_data->status = BIT(SVC_STATUS_OK);
|
||||
cb_data->kaddr1 = &res.a1;
|
||||
cb_data->kaddr2 = &res.a2;
|
||||
cb_data->kaddr3 = &res.a3;
|
||||
break;
|
||||
case COMMAND_RSU_DCMF_VERSION:
|
||||
cb_data->status = BIT(SVC_STATUS_OK);
|
||||
cb_data->kaddr1 = &res.a1;
|
||||
@@ -704,6 +710,12 @@ static int svc_normal_to_secure_thread(void *data)
|
||||
a1 = 0;
|
||||
a2 = 0;
|
||||
break;
|
||||
case COMMAND_SMC_ATF_BUILD_VER:
|
||||
a0 = INTEL_SIP_SMC_ATF_BUILD_VER;
|
||||
a1 = 0;
|
||||
a2 = 0;
|
||||
a3 = 0;
|
||||
break;
|
||||
case COMMAND_MBOX_SEND_CMD:
|
||||
a0 = INTEL_SIP_SMC_MBOX_SEND_CMD;
|
||||
a1 = pdata->arg[0];
|
||||
|
||||
@@ -514,6 +514,25 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
|
||||
#define INTEL_SIP_SMC_SVC_VERSION \
|
||||
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_SVC_FUNCID_VERSION)
|
||||
|
||||
/**
|
||||
* Request INTEL_SIP_SMC_ATF_BUILD_VER
|
||||
*
|
||||
* Sync call used to query the ATF Build Version
|
||||
*
|
||||
* Call register usage:
|
||||
* a0 INTEL_SIP_SMC_ATF_BUILD_VER
|
||||
* a1-a7 not used
|
||||
*
|
||||
* Return status:
|
||||
* a0 INTEL_SIP_SMC_STATUS_OK
|
||||
* a1 Major
|
||||
* a2 Minor
|
||||
* a3 Patch
|
||||
*/
|
||||
#define INTEL_SIP_SMC_ATF_BUILD_VERSION 155
|
||||
#define INTEL_SIP_SMC_ATF_BUILD_VER \
|
||||
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_ATF_BUILD_VERSION)
|
||||
|
||||
/**
|
||||
* SMC call protocol for FPGA Crypto Service (FCS)
|
||||
* FUNCID starts from 90
|
||||
|
||||
@@ -154,6 +154,10 @@ struct stratix10_svc_chan;
|
||||
*
|
||||
* @COMMAND_HWMON_READVOLT: query the voltage from the hardware monitor,
|
||||
* return status is SVC_STATUS_OK or SVC_STATUS_ERROR
|
||||
*
|
||||
* @COMMAND_SMC_ATF_BUILD_VER: Non-mailbox SMC ATF Build Version,
|
||||
* return status is SVC_STATUS_OK
|
||||
*
|
||||
*/
|
||||
enum stratix10_svc_command_code {
|
||||
/* for FPGA */
|
||||
@@ -187,7 +191,8 @@ enum stratix10_svc_command_code {
|
||||
COMMAND_SMC_SVC_VERSION = 200,
|
||||
/* for HWMON */
|
||||
COMMAND_HWMON_READTEMP,
|
||||
COMMAND_HWMON_READVOLT
|
||||
COMMAND_HWMON_READVOLT,
|
||||
COMMAND_SMC_ATF_BUILD_VER
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user