/* Allocate device info data structure to contain device info. And insert the data structure to the tail of device list for tracing. */
EFI_STATUS EFIAPI CreateNewDeviceInfo(IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN UINT16 Port, IN UINT16 PortMultiplier, IN EFI_ATA_DEVICE_TYPE DeviceType, IN EFI_IDENTIFY_DATA *IdentifyData)
/* Allocate device info data structure to contain device info. And insert the data structure to the tail of device list for tracing. */
EFI_STATUS EFIAPI CreateNewDeviceInfo(IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance, IN UINT16 Port, IN UINT16 PortMultiplier, IN EFI_ATA_DEVICE_TYPE DeviceType, IN EFI_IDENTIFY_DATA *IdentifyData)
{
  EFI_ATA_DEVICE_INFO  *DeviceInfo;
  DeviceInfo = AllocateZeroPool (sizeof (EFI_ATA_DEVICE_INFO));
  if (DeviceInfo == NULL) {
    return EFI_OUT_OF_RESOURCES;
  }
  DeviceInfo->Signature      = ATA_ATAPI_DEVICE_SIGNATURE;
  DeviceInfo->Port           = Port;
  DeviceInfo->PortMultiplier = PortMultiplier;
  DeviceInfo->Type           = DeviceType;
  if (IdentifyData != NULL) {
    DeviceInfo->IdentifyData = AllocateCopyPool (sizeof (EFI_IDENTIFY_DATA), IdentifyData);
    if (DeviceInfo->IdentifyData == NULL) {
      FreePool (DeviceInfo);
      return EFI_OUT_OF_RESOURCES;
    }
  }
  InsertTailList (&Instance->DeviceList, &DeviceInfo->Link);
  return EFI_SUCCESS;
}