[SLOF] [PATCH 13/16] Add TPM firmware API call get-maximum-cmd-size
Stefan Berger
stefanb at linux.vnet.ibm.com
Fri Nov 13 02:23:24 AEDT 2015
On 11/12/2015 01:19 AM, Nikunj A Dadhania wrote:
> Stefan Berger <stefanb at linux.vnet.ibm.com> writes:
>> @@ -1461,3 +1468,40 @@ uint32_t tpm_measure_scrtm(void)
>>
>> return rc;
>> }
>> +
>> +/*
>> + * tpm_get_maximum_cmd_size: Function for interfacing with the firmware API
>> + *
>> + * This function returns the maximum size a TPM command (or response) may have.
>> + */
>> +uint32_t tpm_get_maximum_cmd_size(void)
>> +{
>> + uint32_t rc;
>> + uint32_t returnCode;
>> + struct tpm_res_getcap_buffersize buffersize;
>> + uint32_t result;
>> + struct tpm_driver *td = tpm_state.tpm_driver_to_use;
>> +
>> + if (!has_working_tpm())
>> + return 0;
>> +
>> + rc = build_and_send_cmd(TPM_ORD_GetCapability,
>> + GetCapability_BufferSize,
>> + sizeof(GetCapability_BufferSize),
>> + (uint8_t *)&buffersize, sizeof(buffersize),
>> + &returnCode, TPM_DURATION_TYPE_SHORT);
>> +
>> + if (rc || returnCode)
>> + goto err_exit;
>> +
>> + result = MIN(cpu_to_be32(buffersize.buffersize), td->getbuffersize());
>> +
>> + return result;
>> +
>> +err_exit:
>> + dprintf("TPM malfunctioning (line %d).\n", __LINE__);
>> +
>> + tpm_state.tpm_working = 0;
> A helper to set this will be good for debugging. As sometimes it can be
> difficult to trace where the TPM changed this to not working state.
Yes, so this line has been replaced everywhere with calls to
tpm_set_failure().
More information about the SLOF
mailing list