/* This function is called by DiscoverIdeDevice() during its device identification. It sends out the ATA Identify Command to the specified device. Only ATA device responses to this command. If the command succeeds, it returns the Identify data structure which contains information about the device. This function extracts the information it needs to fill the IDE_BLK_IO_DEV data structure, including device type, media block size, media capacity, and etc. */
EFI_STATUS EFIAPI AtaIdentify(IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN UINT8 Channel, IN UINT8 Device, IN OUT EFI_IDENTIFY_DATA *Buffer, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock)
/* This function is called by DiscoverIdeDevice() during its device identification. It sends out the ATA Identify Command to the specified device. Only ATA device responses to this command. If the command succeeds, it returns the Identify data structure which contains information about the device. This function extracts the information it needs to fill the IDE_BLK_IO_DEV data structure, including device type, media block size, media capacity, and etc. */
EFI_STATUS EFIAPI AtaIdentify(IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN UINT8 Channel, IN UINT8 Device, IN OUT EFI_IDENTIFY_DATA *Buffer, IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock)
{
  EFI_STATUS             Status;
  EFI_ATA_COMMAND_BLOCK  AtaCommandBlock;
  ZeroMem (&AtaCommandBlock, sizeof (EFI_ATA_COMMAND_BLOCK));
  AtaCommandBlock.AtaCommand    = ATA_CMD_IDENTIFY_DRIVE;
  AtaCommandBlock.AtaDeviceHead = (UINT8)(Device << 0x4);
  Status = AtaPioDataInOut (
             Instance->PciIo,
             &Instance->IdeRegisters[Channel],
             Buffer,
             sizeof (EFI_IDENTIFY_DATA),
             TRUE,
             &AtaCommandBlock,
             AtaStatusBlock,
             ATA_ATAPI_TIMEOUT,
             NULL
             );
  return Status;
}