/* This function parse the value got from TPM2_GetCapability and return the TPM FirmwareVersion. */
EFI_STATUS EFIAPI Tpm2GetCapabilityFirmwareVersion(OUT UINT32 *FirmwareVersion1, OUT UINT32 *FirmwareVersion2)
/* This function parse the value got from TPM2_GetCapability and return the TPM FirmwareVersion. */
EFI_STATUS EFIAPI Tpm2GetCapabilityFirmwareVersion(OUT UINT32 *FirmwareVersion1, OUT UINT32 *FirmwareVersion2)
{
  TPMS_CAPABILITY_DATA  TpmCap;
  TPMI_YES_NO           MoreData;
  EFI_STATUS            Status;
  Status = Tpm2GetCapability (
             TPM_CAP_TPM_PROPERTIES,
             TPM_PT_FIRMWARE_VERSION_1,
             1,
             &MoreData,
             &TpmCap
             );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  *FirmwareVersion1 = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);
  Status = Tpm2GetCapability (
             TPM_CAP_TPM_PROPERTIES,
             TPM_PT_FIRMWARE_VERSION_2,
             1,
             &MoreData,
             &TpmCap
             );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  *FirmwareVersion2 = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);
  return EFI_SUCCESS;
}