/* The function is used to read/write UFS device descriptors. The consumer of this API is responsible for allocating the data buffer pointed by Descriptor. */
EFI_STATUS EFIAPI UfsRwUfsDescriptor(IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This, IN BOOLEAN Read, IN UINT8 DescId, IN UINT8 Index, IN UINT8 Selector, IN OUT UINT8 *Descriptor, IN OUT UINT32 *DescSize)
/* The function is used to read/write UFS device descriptors. The consumer of this API is responsible for allocating the data buffer pointed by Descriptor. */
EFI_STATUS EFIAPI UfsRwUfsDescriptor(IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This, IN BOOLEAN Read, IN UINT8 DescId, IN UINT8 Index, IN UINT8 Selector, IN OUT UINT8 *Descriptor, IN OUT UINT32 *DescSize)
{
  EFI_STATUS                  Status;
  UFS_PASS_THRU_PRIVATE_DATA  *Private;
  Private = UFS_PASS_THRU_PRIVATE_DATA_FROM_DEV_CONFIG (This);
  if ((This == NULL) || (Descriptor == NULL) || (DescSize == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  Status = UfsRwDeviceDesc (
             Private,
             Read,
             DescId,
             Index,
             Selector,
             Descriptor,
             DescSize
             );
  if (Status == EFI_TIMEOUT) {
    Status = EFI_DEVICE_ERROR;
  }
  return Status;
}