/* This function parse the value got from TPM2_GetCapability and return the max command size and response size */
EFI_STATUS EFIAPI Tpm2GetCapabilityMaxCommandResponseSize(OUT UINT32 *MaxCommandSize, OUT UINT32 *MaxResponseSize)
/* This function parse the value got from TPM2_GetCapability and return the max command size and response size */
EFI_STATUS EFIAPI Tpm2GetCapabilityMaxCommandResponseSize(OUT UINT32 *MaxCommandSize, OUT UINT32 *MaxResponseSize)
{
  TPMS_CAPABILITY_DATA  TpmCap;
  TPMI_YES_NO           MoreData;
  EFI_STATUS            Status;
  Status = Tpm2GetCapability (
             TPM_CAP_TPM_PROPERTIES,
             TPM_PT_MAX_COMMAND_SIZE,
             1,
             &MoreData,
             &TpmCap
             );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  *MaxCommandSize = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);
  Status = Tpm2GetCapability (
             TPM_CAP_TPM_PROPERTIES,
             TPM_PT_MAX_RESPONSE_SIZE,
             1,
             &MoreData,
             &TpmCap
             );
  if (EFI_ERROR (Status)) {
    return Status;
  }
  *MaxResponseSize = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value);
  return EFI_SUCCESS;
}