Lines Matching +full:version +full:- +full:minor

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Interface Over FF-A (DEN0138).
29 /* version encoding */
42 * defined in FF-A specification:
46 * w3-w7: Implementation defined, free to be used below
50 * Returns the version of the interface that is available
54 * w5-w7: Reserved (MBZ)
59 * w5: TPM service interface version
60 * Bits[31:16]: major version
61 * Bits[15:0]: minor version
62 * w6-w7: Reserved (MBZ)
65 * CRB_FFA_OK_RESULTS_RETURNED: The version of the interface has been
81 * -If the start function qualifier is 0, identifies the locality
83 * -If the start function qualifier is 1, identifies the locality
85 * w6-w7: Reserved (MBZ)
90 * w5-w7: Reserved (MBZ)
106 /* lock to protect sending of FF-A messages: */
125 rc = -ENOENT; in tpm_crb_ffa_to_linux_errno()
128 rc = -EPERM; in tpm_crb_ffa_to_linux_errno()
131 rc = -EINVAL; in tpm_crb_ffa_to_linux_errno()
134 rc = -ENOEXEC; in tpm_crb_ffa_to_linux_errno()
137 rc = -EEXIST; in tpm_crb_ffa_to_linux_errno()
140 rc = -EACCES; in tpm_crb_ffa_to_linux_errno()
143 rc = -ENOMEM; in tpm_crb_ffa_to_linux_errno()
146 rc = -EINVAL; in tpm_crb_ffa_to_linux_errno()
153 * tpm_crb_ffa_init - called by the CRB driver to do any needed initialization
157 * yet, returns -ENOENT in order to force a retry. If th ffa_crb
158 * driver had been probed but failed with an error, returns -ENODEV
166 return -ENOENT; in tpm_crb_ffa_init()
169 return -ENODEV; in tpm_crb_ffa_init()
184 return -ENOENT; in __tpm_crb_ffa_send_recieve()
186 msg_ops = tpm_crb_ffa->ffa_dev->ops->msg_ops; in __tpm_crb_ffa_send_recieve()
188 memset(&tpm_crb_ffa->direct_msg_data, 0x00, in __tpm_crb_ffa_send_recieve()
191 tpm_crb_ffa->direct_msg_data.data1 = func_id; in __tpm_crb_ffa_send_recieve()
192 tpm_crb_ffa->direct_msg_data.data2 = a0; in __tpm_crb_ffa_send_recieve()
193 tpm_crb_ffa->direct_msg_data.data3 = a1; in __tpm_crb_ffa_send_recieve()
194 tpm_crb_ffa->direct_msg_data.data4 = a2; in __tpm_crb_ffa_send_recieve()
196 ret = msg_ops->sync_send_receive(tpm_crb_ffa->ffa_dev, in __tpm_crb_ffa_send_recieve()
197 &tpm_crb_ffa->direct_msg_data); in __tpm_crb_ffa_send_recieve()
199 ret = tpm_crb_ffa_to_linux_errno(tpm_crb_ffa->direct_msg_data.data1); in __tpm_crb_ffa_send_recieve()
205 * tpm_crb_ffa_get_interface_version() - gets the ABI version of the TPM service
206 * @major: Pointer to caller-allocated buffer to hold the major version
208 * @minor: Pointer to caller-allocated buffer to hold the minor version
211 * Returns the major and minor version of the ABI of the FF-A based TPM.
212 * Allows the caller to evaluate its compatibility with the version of
217 int tpm_crb_ffa_get_interface_version(u16 *major, u16 *minor) in tpm_crb_ffa_get_interface_version() argument
222 return -ENOENT; in tpm_crb_ffa_get_interface_version()
225 return -ENODEV; in tpm_crb_ffa_get_interface_version()
227 if (!major || !minor) in tpm_crb_ffa_get_interface_version()
228 return -EINVAL; in tpm_crb_ffa_get_interface_version()
230 guard(mutex)(&tpm_crb_ffa->msg_data_lock); in tpm_crb_ffa_get_interface_version()
234 *major = CRB_FFA_MAJOR_VERSION(tpm_crb_ffa->direct_msg_data.data2); in tpm_crb_ffa_get_interface_version()
235 *minor = CRB_FFA_MINOR_VERSION(tpm_crb_ffa->direct_msg_data.data2); in tpm_crb_ffa_get_interface_version()
243 * tpm_crb_ffa_start() - signals the TPM that a field has changed in the CRB
258 return -ENOENT; in tpm_crb_ffa_start()
261 return -ENODEV; in tpm_crb_ffa_start()
263 guard(mutex)(&tpm_crb_ffa->msg_data_lock); in tpm_crb_ffa_start()
276 return -EEXIST; in tpm_crb_ffa_probe()
278 tpm_crb_ffa = ERR_PTR(-ENODEV); // set tpm_crb_ffa so we can detect probe failure in tpm_crb_ffa_probe()
282 return -EINVAL; in tpm_crb_ffa_probe()
287 return -ENOMEM; in tpm_crb_ffa_probe()
290 mutex_init(&tpm_crb_ffa->msg_data_lock); in tpm_crb_ffa_probe()
291 tpm_crb_ffa->ffa_dev = ffa_dev; in tpm_crb_ffa_probe()
294 /* if TPM is aarch32 use 32-bit SMCs */ in tpm_crb_ffa_probe()
296 ffa_dev->ops->msg_ops->mode_32bit_set(ffa_dev); in tpm_crb_ffa_probe()
298 /* verify compatibility of TPM service version number */ in tpm_crb_ffa_probe()
299 rc = tpm_crb_ffa_get_interface_version(&tpm_crb_ffa->major_version, in tpm_crb_ffa_probe()
300 &tpm_crb_ffa->minor_version); in tpm_crb_ffa_probe()
302 pr_err("failed to get crb interface version. rc:%d", rc); in tpm_crb_ffa_probe()
306 pr_info("ABI version %u.%u", tpm_crb_ffa->major_version, in tpm_crb_ffa_probe()
307 tpm_crb_ffa->minor_version); in tpm_crb_ffa_probe()
309 if (tpm_crb_ffa->major_version != CRB_FFA_VERSION_MAJOR || in tpm_crb_ffa_probe()
310 (tpm_crb_ffa->minor_version > 0 && in tpm_crb_ffa_probe()
311 tpm_crb_ffa->minor_version < CRB_FFA_VERSION_MINOR)) { in tpm_crb_ffa_probe()
312 pr_err("Incompatible ABI version"); in tpm_crb_ffa_probe()
320 tpm_crb_ffa = ERR_PTR(-ENODEV); in tpm_crb_ffa_probe()
321 return -EINVAL; in tpm_crb_ffa_probe()
331 /* 17b862a4-1806-4faf-86b3-089a58353861 */
338 .name = "ffa-crb",