/* Traverse the attached ATA devices list to find out the device with given Port and PortMultiplierPort. */
PEI_AHCI_ATA_DEVICE_DATA* SearchDeviceByPort(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT16 Port, IN UINT16 PortMultiplierPort)
/* Traverse the attached ATA devices list to find out the device with given Port and PortMultiplierPort. */
PEI_AHCI_ATA_DEVICE_DATA* SearchDeviceByPort(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private, IN UINT16 Port, IN UINT16 PortMultiplierPort)
{
  PEI_AHCI_ATA_DEVICE_DATA  *DeviceData;
  LIST_ENTRY                *Node;
  Node = GetFirstNode (&Private->DeviceList);
  while (!IsNull (&Private->DeviceList, Node)) {
    DeviceData = AHCI_PEI_ATA_DEVICE_INFO_FROM_THIS (Node);
    if ((DeviceData->Port == Port) &&
        (DeviceData->PortMultiplier == PortMultiplierPort))
    {
      return DeviceData;
    }
    Node = GetNextNode (&Private->DeviceList, Node);
  }
  return NULL;
}