/* This function returns the capacity of the ATA device if it follows ATA 6 to support 48 bit addressing. */
EFI_LBA GetAtapi6Capacity(IN ATA_DEVICE *AtaDevice)
/* This function returns the capacity of the ATA device if it follows ATA 6 to support 48 bit addressing. */
EFI_LBA GetAtapi6Capacity(IN ATA_DEVICE *AtaDevice)
{
  EFI_LBA            Capacity;
  EFI_LBA            TmpLba;
  UINTN              Index;
  ATA_IDENTIFY_DATA  *IdentifyData;
  IdentifyData = AtaDevice->IdentifyData;
  if ((IdentifyData->command_set_supported_83 & BIT10) == 0) {
    return 0;
  }
  Capacity = 0;
  for (Index = 0; Index < 4; Index++) {
    TmpLba    = IdentifyData->maximum_lba_for_48bit_addressing[Index];
    Capacity |= LShiftU64 (TmpLba, 16 * Index);
  }
  return Capacity;
}