/* Retrieve ACPI UID of UART from device path */
BOOLEAN RetrieveUartUid(IN EFI_HANDLE Handle, IN OUT UINT32 *AcpiUid)
/* Retrieve ACPI UID of UART from device path */
BOOLEAN RetrieveUartUid(IN EFI_HANDLE Handle, IN OUT UINT32 *AcpiUid)
{
  EFI_STATUS                Status;
  ACPI_HID_DEVICE_PATH      *Acpi;
  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
  Status = gBS->HandleProtocol (
                  Handle,
                  &gEfiDevicePathProtocolGuid,
                  (VOID **)&DevicePath
                  );
  if (EFI_ERROR (Status)) {
    return FALSE;
  }
  Acpi = NULL;
  for ( ; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
    if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePath) == MSG_UART_DP)) {
      break;
    }
    Acpi = (ACPI_HID_DEVICE_PATH *)DevicePath;
  }
  if ((Acpi != NULL) && IsIsaSerialNode (Acpi)) {
    if (AcpiUid != NULL) {
      CopyMem (AcpiUid, &Acpi->UID, sizeof (UINT32));
    }
    return TRUE;
  } else {
    return FALSE;
  }
}