コード例 #1
0
ファイル: dpath.c プロジェクト: SvenDowideit/clearlinux
/*
  Type: 2 (ACPI Device Path) SubType: 1 (ACPI Device Path)
 */
static VOID
_DevPathAcpi (
    IN OUT POOL_PRINT       *Str,
    IN VOID                 *DevPath
    )
{
    ACPI_HID_DEVICE_PATH        *Acpi;

    Acpi = DevPath;
    if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
        switch ( EISA_ID_TO_NUM( Acpi-> HID ) ) {
            case 0x301 : {
                CatPrint( Str , L"Keyboard(%d)" , Acpi-> UID ) ;
                break ;
            }
            case 0x401 : {
                CatPrint( Str , L"ParallelPort(%d)" , Acpi-> UID ) ;
                break ;
            }
            case 0x501 : {
                CatPrint( Str , L"Serial(%d)" , Acpi-> UID ) ;
                break ;
            }
            case 0x604 : {
                CatPrint( Str , L"Floppy(%d)" , Acpi-> UID ) ;
                break ;
            }
            case 0xa03 : {
                CatPrint( Str , L"PciRoot(%d)" , Acpi-> UID ) ;
                break ;
            }
            case 0xa08 : {
                CatPrint( Str , L"PcieRoot(%d)" , Acpi-> UID ) ;
                break ;
            }
            default : {
                CatPrint( Str , L"Acpi(PNP%04x" , EISA_ID_TO_NUM( Acpi-> HID ) ) ;
                if ( Acpi-> UID ) CatPrint( Str , L",%d" , Acpi-> UID ) ;
                CatPrint( Str , L")" ) ;
                break ;
            }
	}
    } else {
        CatPrint( Str , L"Acpi(0x%X" , Acpi-> HID ) ;
        if ( Acpi-> UID ) CatPrint( Str , L",%d" , Acpi-> UID ) ;
        CatPrint( Str , L")" , Acpi-> HID , Acpi-> UID ) ;
    }
}
コード例 #2
0
ファイル: ConsistMapping.c プロジェクト: B-Rich/edk2
/**
  Function to determine if a device path node is Hi or not.

  @param[in] DevicePathNode   The node to check.

  @retval TRUE    The node is Hi.
  @retval FALSE   The node is not Hi.
**/
BOOLEAN
EFIAPI
IsHIDevicePathNode (
  IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
  )
{
  ACPI_HID_DEVICE_PATH  *Acpi;

  ASSERT(DevicePathNode != NULL);

  if (DevicePathNode->Type == HARDWARE_DEVICE_PATH) {
    return TRUE;
  }

  if (DevicePathNode->Type == ACPI_DEVICE_PATH) {
    Acpi = (ACPI_HID_DEVICE_PATH *) DevicePathNode;
    switch (EISA_ID_TO_NUM (Acpi->HID)) {
    case 0x0301:
    case 0x0401:
    case 0x0501:
    case 0x0604:
      return FALSE;
    }

    return TRUE;
  }

  return FALSE;
}
コード例 #3
0
ファイル: BisBBTestMain.c プロジェクト: jljusten/efi-sct
/**
 *  Get the device path of floppy disk.
 */
EFI_STATUS
GetFloppyDevicePath (
  OUT EFI_DEVICE_PATH_PROTOCOL        **FloppyDevicePath
  )
{
  EFI_STATUS                      Status;
  UINTN                           NoHandle;
  EFI_HANDLE                      *Buffer;
  UINTN                           Index;
  EFI_DEVICE_PATH_PROTOCOL        *DevicePath;
  EFI_DEVICE_PATH_PROTOCOL        *RemainPath;
  EFI_DEVICE_PATH_PROTOCOL        *LastNode;
  ACPI_HID_DEVICE_PATH            *AcpiNode;

  Status = gtBS->LocateHandleBuffer (
                   ByProtocol,
                   &gEfiDevicePathProtocolGuid,
                   NULL,
                   &NoHandle,
                   &Buffer
               );
  if (EFI_ERROR(Status)) {
    return Status;
  }

  for (Index = 0; Index < NoHandle; Index++) {
    Status = gtBS->HandleProtocol (
                     Buffer[Index],
                     &gEfiDevicePathProtocolGuid,
                     &DevicePath
                 );
    RemainPath = DevicePath;
    LastNode = DevicePath;
    while (!IsDevicePathEnd (RemainPath)) {
      LastNode = RemainPath;
      RemainPath = NextDevicePathNode (RemainPath);
    }
    //
    // Is LastNode ACPI device path node ?
    //
    if ((DevicePathType (LastNode) == 2) &&
        (DevicePathSubType (LastNode) == 1)) {
      AcpiNode = (ACPI_HID_DEVICE_PATH*)LastNode;
      //
      // Is floppy device path ?
      //
      if (EISA_ID_TO_NUM(AcpiNode->HID) == 0x0604) {
        *FloppyDevicePath = DevicePath;
        return EFI_SUCCESS;
      }
    }
  }
  return EFI_NOT_FOUND;
}
コード例 #4
0
ファイル: dpath.c プロジェクト: mfleming/gnu-efi
VOID
_DevPathAcpi (
    IN OUT POOL_PRINT       *Str,
    IN VOID                 *DevPath
    )
{
    ACPI_HID_DEVICE_PATH        *Acpi;

    Acpi = DevPath;
    if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
        CatPrint(Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
    } else {
        CatPrint(Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
    }
}
コード例 #5
0
VOID
_DevPathSerialAcpi (
  IN EFI_DEVICE_PATH_PROTOCOL     *DevicePathNode,
  IN DEVICE_CONSIST_MAPPING_INFO  *MappingItem
  )
{
  ACPI_HID_DEVICE_PATH  *Acpi;

  ASSERT(DevicePathNode != NULL);
  ASSERT(MappingItem != NULL);

  Acpi = (ACPI_HID_DEVICE_PATH *) DevicePathNode;
  if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
    if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) {
      MappingItem->MTD = MTDTypeFloppy;
      AppendCSDNum (MappingItem, Acpi->UID);
    }
  }
}
コード例 #6
0
ファイル: BmBootDescription.c プロジェクト: M1cha/edk2
/**
  For a bootable Device path, return its boot type.

  @param  DevicePath        The bootable device Path to check

  @retval AcpiFloppyBoot    If given device path contains ACPI_DEVICE_PATH type device path node
                            which HID is floppy device.
  @retval MessageAtapiBoot  If given device path contains MESSAGING_DEVICE_PATH type device path node
                            and its last device path node's subtype is MSG_ATAPI_DP.
  @retval MessageSataBoot   If given device path contains MESSAGING_DEVICE_PATH type device path node
                            and its last device path node's subtype is MSG_SATA_DP.
  @retval MessageScsiBoot   If given device path contains MESSAGING_DEVICE_PATH type device path node
                            and its last device path node's subtype is MSG_SCSI_DP.
  @retval MessageUsbBoot    If given device path contains MESSAGING_DEVICE_PATH type device path node
                            and its last device path node's subtype is MSG_USB_DP.
  @retval BmMiscBoot        If tiven device path doesn't match the above condition.

**/
BM_BOOT_TYPE
BmDevicePathType (
  IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath
  )
{
  EFI_DEVICE_PATH_PROTOCOL      *Node;
  EFI_DEVICE_PATH_PROTOCOL      *NextNode;

  ASSERT (DevicePath != NULL);

  for (Node = DevicePath; !IsDevicePathEndType (Node); Node = NextDevicePathNode (Node)) {
    switch (DevicePathType (Node)) {

      case ACPI_DEVICE_PATH:
        if (EISA_ID_TO_NUM (((ACPI_HID_DEVICE_PATH *) Node)->HID) == 0x0604) {
          return BmAcpiFloppyBoot;
        }
        break;

      case HARDWARE_DEVICE_PATH:
        if (DevicePathSubType (Node) == HW_CONTROLLER_DP) {
          return BmHardwareDeviceBoot;
        }
        break;

      case MESSAGING_DEVICE_PATH:
        //
        // Skip LUN device node
        //
        NextNode = Node;
        do {
          NextNode = NextDevicePathNode (NextNode);
        } while (
            (DevicePathType (NextNode) == MESSAGING_DEVICE_PATH) &&
            (DevicePathSubType(NextNode) == MSG_DEVICE_LOGICAL_UNIT_DP)
            );

        //
        // If the device path not only point to driver device, it is not a messaging device path,
        //
        if (!IsDevicePathEndType (NextNode)) {
          continue;
        }

        switch (DevicePathSubType (Node)) {
        case MSG_ATAPI_DP:
          return BmMessageAtapiBoot;
          break;

        case MSG_SATA_DP:
          return BmMessageSataBoot;
          break;

        case MSG_USB_DP:
          return BmMessageUsbBoot;
          break;

        case MSG_SCSI_DP:
          return BmMessageScsiBoot;
          break;
        }
    }
  }

  return BmMiscBoot;
}
コード例 #7
0
ファイル: QemuBootOrder.c プロジェクト: JohnTroony/vector-edk
/**
  Append some of the unselected active boot options to the boot order.

  This function should accommodate any further policy changes in "boot option
  survival". Currently we're adding back everything that starts with neither
  PciRoot() nor HD().

  @param[in,out] BootOrder     The structure holding the boot order to
                               complete. The caller is responsible for
                               initializing (and potentially populating) it
                               before calling this function.

  @param[in,out] ActiveOption  The array of active boot options to scan.
                               Entries marked as Appended will be skipped.
                               Those of the rest that satisfy the survival
                               policy will be added to BootOrder with
                               BootOrderAppend().

  @param[in]     ActiveCount   Number of elements in ActiveOption.


  @retval RETURN_SUCCESS  BootOrder has been extended with any eligible boot
                          options.

  @return                 Error codes returned by BootOrderAppend().
**/
STATIC
RETURN_STATUS
BootOrderComplete (
  IN OUT  BOOT_ORDER    *BootOrder,
  IN OUT  ACTIVE_OPTION *ActiveOption,
  IN      UINTN         ActiveCount
  )
{
  RETURN_STATUS Status;
  UINTN         Idx;

  Status = RETURN_SUCCESS;
  Idx = 0;
  while (!RETURN_ERROR (Status) && Idx < ActiveCount) {
    if (!ActiveOption[Idx].Appended) {
      CONST BDS_COMMON_OPTION        *Current;
      CONST EFI_DEVICE_PATH_PROTOCOL *FirstNode;

      Current = ActiveOption[Idx].BootOption;
      FirstNode = Current->DevicePath;
      if (FirstNode != NULL) {
        CHAR16        *Converted;
        STATIC CHAR16 ConvFallBack[] = L"<unable to convert>";
        BOOLEAN       Keep;

        Converted = ConvertDevicePathToText (FirstNode, FALSE, FALSE);
        if (Converted == NULL) {
          Converted = ConvFallBack;
        }

        Keep = TRUE;
        if (DevicePathType(FirstNode) == MEDIA_DEVICE_PATH &&
            DevicePathSubType(FirstNode) == MEDIA_HARDDRIVE_DP) {
          //
          // drop HD()
          //
          Keep = FALSE;
        } else if (DevicePathType(FirstNode) == ACPI_DEVICE_PATH &&
                   DevicePathSubType(FirstNode) == ACPI_DP) {
          ACPI_HID_DEVICE_PATH *Acpi;

          Acpi = (ACPI_HID_DEVICE_PATH *) FirstNode;
          if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST &&
              EISA_ID_TO_NUM (Acpi->HID) == 0x0a03) {
            //
            // drop PciRoot()
            //
            Keep = FALSE;
          }
        }

        if (Keep) {
          Status = BootOrderAppend (BootOrder, &ActiveOption[Idx]);
          if (!RETURN_ERROR (Status)) {
            DEBUG ((DEBUG_VERBOSE, "%a: keeping \"%s\"\n", __FUNCTION__,
              Converted));
          }
        } else {
          DEBUG ((DEBUG_VERBOSE, "%a: dropping \"%s\"\n", __FUNCTION__,
            Converted));
        }

        if (Converted != ConvFallBack) {
          FreePool (Converted);
        }
      }
    }
    ++Idx;
  }
  return Status;
}
コード例 #8
0
//
// TDS 3.2
//
EFI_STATUS
BBTestWholeDevicePathConformanceAutoTest (
    IN EFI_BB_TEST_PROTOCOL       *This,
    IN VOID                       *ClientInterface,
    IN EFI_TEST_LEVEL             TestLevel,
    IN EFI_HANDLE                 SupportHandle
)
{
    EFI_STANDARD_TEST_LIBRARY_PROTOCOL   *StandardLib;
    EFI_STATUS                           Status;
    EFI_DEVICE_PATH_PROTOCOL             *DevicePath;
    EFI_TEST_ASSERTION                   AssertionType;
    UINT16                               Type;
    UINT16                               SubType;
    UINT16                               Length;
    UINT16                               Count;
    UINT16                               PCIRootFirst;
    UINT16                               SCSICount;
    UINT16                               ATAPICount;
    ACPI_HID_DEVICE_PATH                 *Acpi;
    CHAR16                               *DevStr;

    //
    // Verify whether it is one of IHV interfaces
    //
    if (! IsIhvInterface (ClientInterface, SupportHandle)) {
        return EFI_UNSUPPORTED;
    }

    //
    // Get the Standard Library Interface
    //
    Status = gtBS->HandleProtocol (
                 SupportHandle,
                 &gEfiStandardTestLibraryGuid,
                 &StandardLib
             );

    if (EFI_ERROR(Status)) {
        StandardLib->RecordAssertion (
            StandardLib,
            EFI_TEST_ASSERTION_FAILED,
            gTestGenericFailureGuid,
            L"BS.HandleProtocol - Handle standard test library",
            L"%a:%d:Status - %r",
            __FILE__,
            __LINE__,
            Status
        );
        return Status;
    }

    DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)ClientInterface;

    DevStr = DevicePathToStr (DevicePath);
    StandardLib->RecordMessage (
        StandardLib,
        EFI_VERBOSE_LEVEL_QUIET,
        L"\nVerifying device path: %s\n",
        DevStr
    );
    gtBS->FreePool (DevStr);

    Count = 0;
    PCIRootFirst = 0;
    SCSICount = 0;
    ATAPICount = 0;

    while (!IsDevicePathEnd (DevicePath)) {
        Type    = (UINT16)DevicePathType (DevicePath);
        SubType = (UINT16)DevicePathSubType (DevicePath);
        Length  = (UINT16)DevicePathNodeLength (DevicePath);

        Count++;
        //
        // Assertion Point 3.2.2.1
        // BIOS Root Specification Device Path
        //
        if ((Type == 5) && (SubType == 1)) {
            if (Count != 1) {
                AssertionType = EFI_TEST_ASSERTION_FAILED;
            } else {
                DevicePath = NextDevicePathNode (DevicePath);
                if(IsDevicePathEnd (DevicePath)) {
                    AssertionType = EFI_TEST_ASSERTION_PASSED;
                } else {
                    AssertionType = EFI_TEST_ASSERTION_FAILED;
                }
            }

            StandardLib->RecordAssertion (
                StandardLib,
                AssertionType,
                gDevicePathBBTestFunctionAssertionGuid030,
                L"EFI_DEVICE_PATH_PROTOCOL - BIOS Root Specification Device Path",
                L"%a:%d:Type - %d, Subtype - %d, Length - %d",
                __FILE__,
                __LINE__,
                Type,
                SubType,
                Length
            );
            break;
        }
        //
        // Assertion Point 3.2.2.2
        // PCI Root Bus Device Path Node
        //
        else if ((Type == 2) && (SubType == 1 || SubType == 2)) {
            Acpi = (ACPI_HID_DEVICE_PATH*)DevicePath;
            if (EISA_ID_TO_NUM(Acpi->HID) == 0x0A03) {
                if (Count == 1) {
                    PCIRootFirst++;
                    AssertionType = EFI_TEST_ASSERTION_PASSED;
                } else {
                    AssertionType = EFI_TEST_ASSERTION_FAILED;
                }

                StandardLib->RecordAssertion (
                    StandardLib,
                    AssertionType,
                    gDevicePathBBTestFunctionAssertionGuid031,
                    L"EFI_DEVICE_PATH_PROTOCOL - PCI Root Bus Device Path Node",
                    L"%a:%d:Type - %d, Subtype - %d, Length - %d",
                    __FILE__,
                    __LINE__,
                    Type,
                    SubType,
                    Length
                );
            }
            //
            // Assertion Point 3.2.2.5
            // EISA Device Path Node
            //
            else if ((EISA_ID_TO_NUM(Acpi->HID) == 0x0604) ||
                     (EISA_ID_TO_NUM(Acpi->HID) == 0x0303) ||
                     (EISA_ID_TO_NUM(Acpi->HID) == 0x0F03) ||
                     (EISA_ID_TO_NUM(Acpi->HID) == 0x0501) ||
                     (EISA_ID_TO_NUM(Acpi->HID) == 0x0401)) {
                if (Count == (PCIRootFirst + 1)) {
                    AssertionType = EFI_TEST_ASSERTION_PASSED;
                } else {
                    AssertionType = EFI_TEST_ASSERTION_FAILED;
                }
                StandardLib->RecordAssertion (
                    StandardLib,
                    AssertionType,
                    gDevicePathBBTestFunctionAssertionGuid032,
                    L"EFI_DEVICE_PATH_PROTOCOL - EISA Device Path Node",
                    L"%a:%d:Type - %d, Subtype - %d, Length - %d",
                    __FILE__,
                    __LINE__,
                    Type,
                    SubType,
                    Length
                );
            }
        }
        //
        // Assertion Point 3.2.2.3
        // PCI Device Path Node
        //
        else if ((Type == 1) && (SubType == 1)) {
            if (Count == (PCIRootFirst + 1)) {
                PCIRootFirst++;
                AssertionType = EFI_TEST_ASSERTION_PASSED;
            } else {
                AssertionType = EFI_TEST_ASSERTION_FAILED;
            }

            StandardLib->RecordAssertion (
                StandardLib,
                AssertionType,
                gDevicePathBBTestFunctionAssertionGuid033,
                L"EFI_DEVICE_PATH_PROTOCOL - PCI Device Path Node",
                L"%a:%d:Type - %d, Subtype - %d, Length - %d",
                __FILE__,
                __LINE__,
                Type,
                SubType,
                Length
            );
        }
        //
        // Assertion Point 3.2.2.4
        // Memory Mapped Device Path Node
        //
        else if ((Type == 1) && (SubType == 3)) {
            if (Count == 1) {
                AssertionType = EFI_TEST_ASSERTION_PASSED;
            } else {
                AssertionType = EFI_TEST_ASSERTION_FAILED;
            }

            StandardLib->RecordAssertion (
                StandardLib,
                AssertionType,
                gDevicePathBBTestFunctionAssertionGuid034,
                L"EFI_DEVICE_PATH_PROTOCOL - Memory Mapped Device Path Node",
                L"%a:%d:Type - %d, Subtype - %d, Length - %d",
                __FILE__,
                __LINE__,
                Type,
                SubType,
                Length
            );
        }
        //
        // Assertion Point 3.2.2.6
        // ATAPI Device Path Node
        //
        else if ((Type == 3) && (SubType == 1)) {
            if (Count == (PCIRootFirst + 1)) {
                ATAPICount = (UINT16)(PCIRootFirst + 1);
                AssertionType = EFI_TEST_ASSERTION_PASSED;
            } else {
                AssertionType = EFI_TEST_ASSERTION_FAILED;
            }

            StandardLib->RecordAssertion (
                StandardLib,
                AssertionType,
                gDevicePathBBTestFunctionAssertionGuid035,
                L"EFI_DEVICE_PATH_PROTOCOL - ATAPI Device Path Node",
                L"%a:%d:Type - %d, Subtype - %d, Length - %d",
                __FILE__,
                __LINE__,
                Type,
                SubType,
                Length
            );
        }

        DevicePath = NextDevicePathNode (DevicePath);
    }
    //
    // Assertion Point 3.2.2.10
    // Device Path must be terminated
    //
    Type    = (UINT16)DevicePathType (DevicePath);
    SubType = (UINT16)DevicePathSubType (DevicePath);
    Length  = (UINT16)DevicePathNodeLength (DevicePath);

    if ((Type == 0x7F || Type == 0xFF) && (SubType == 0xFF)) {
        AssertionType = EFI_TEST_ASSERTION_PASSED;
    } else {
        AssertionType = EFI_TEST_ASSERTION_FAILED;
    }

    StandardLib->RecordAssertion (
        StandardLib,
        AssertionType,
        gDevicePathBBTestFunctionAssertionGuid039,
        L"EFI_DEVICE_PATH_PROTOCOL - Device Path must be terminated",
        L"%a:%d:Type - %d, Subtype - %d, Length - %d",
        __FILE__,
        __LINE__,
        Type,
        SubType,
        Length
    );

    return EFI_SUCCESS;
}
コード例 #9
0
ファイル: main.c プロジェクト: Digital-Chaos/freebsd
static int
has_keyboard(void)
{
	EFI_STATUS status;
	EFI_DEVICE_PATH *path;
	EFI_HANDLE *hin, *hin_end, *walker;
	UINTN sz;
	int retval = 0;
	
	/*
	 * Find all the handles that support the SIMPLE_TEXT_INPUT_PROTOCOL and
	 * do the typical dance to get the right sized buffer.
	 */
	sz = 0;
	hin = NULL;
	status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz, 0);
	if (status == EFI_BUFFER_TOO_SMALL) {
		hin = (EFI_HANDLE *)malloc(sz);
		status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz,
		    hin);
		if (EFI_ERROR(status))
			free(hin);
	}
	if (EFI_ERROR(status))
		return retval;

	/*
	 * Look at each of the handles. If it supports the device path protocol,
	 * use it to get the device path for this handle. Then see if that
	 * device path matches either the USB device path for keyboards or the
	 * legacy device path for keyboards.
	 */
	hin_end = &hin[sz / sizeof(*hin)];
	for (walker = hin; walker < hin_end; walker++) {
		status = BS->HandleProtocol(*walker, &devid, (VOID **)&path);
		if (EFI_ERROR(status))
			continue;

		while (!IsDevicePathEnd(path)) {
			/*
			 * Check for the ACPI keyboard node. All PNP3xx nodes
			 * are keyboards of different flavors. Note: It is
			 * unclear of there's always a keyboard node when
			 * there's a keyboard controller, or if there's only one
			 * when a keyboard is detected at boot.
			 */
			if (DevicePathType(path) == ACPI_DEVICE_PATH &&
			    (DevicePathSubType(path) == ACPI_DP ||
				DevicePathSubType(path) == ACPI_EXTENDED_DP)) {
				ACPI_HID_DEVICE_PATH  *acpi;

				acpi = (ACPI_HID_DEVICE_PATH *)(void *)path;
				if ((EISA_ID_TO_NUM(acpi->HID) & 0xff00) == 0x300 &&
				    (acpi->HID & 0xffff) == PNP_EISA_ID_CONST) {
					retval = 1;
					goto out;
				}
			/*
			 * Check for USB keyboard node, if present. Unlike a
			 * PS/2 keyboard, these definitely only appear when
			 * connected to the system.
			 */
			} else if (DevicePathType(path) == MESSAGING_DEVICE_PATH &&
			    DevicePathSubType(path) == MSG_USB_CLASS_DP) {
				USB_CLASS_DEVICE_PATH *usb;
			       
				usb = (USB_CLASS_DEVICE_PATH *)(void *)path;
				if (usb->DeviceClass == 3 && /* HID */
				    usb->DeviceSubClass == 1 && /* Boot devices */
				    usb->DeviceProtocol == 1) { /* Boot keyboards */
					retval = 1;
					goto out;
				}
			}
			path = NextDevicePathNode(path);
		}
	}
out:
	free(hin);
	return retval;
}
コード例 #10
0
ファイル: dprot.c プロジェクト: DYX884877791/edk-Shell
VOID
SEnvAcpiDevicePathEntry (
  IN EFI_DEVICE_PATH_PROTOCOL      *DevicePath
  )
/*++

Routine Description:

Arguments:

  DevicePath - The device path

Returns:

--*/
{
  ACPI_HID_DEVICE_PATH                   *AcpiDevicePath;
  ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *AcpiExDevicepath;
  ACPI_ADR_DEVICE_PATH                   *AcpiAdrDevicePath;
  UINT16                                 Index;
  UINT16                                 Length;
  UINT16                                 AdditionalAdrCount;
  CHAR8                                  *HIDString;
  CHAR8                                  *UIDString;
  CHAR8                                  *CIDString;
  CHAR8                                  NullString[5];

  if (DevicePathType (DevicePath) != ACPI_DEVICE_PATH) {
    return ;
  }
  //
  // Process ACPI device path entry
  //
  switch (DevicePathSubType (DevicePath)) {
  case ACPI_DP:
    AcpiDevicePath = (ACPI_HID_DEVICE_PATH *) DevicePath;
    if ((AcpiDevicePath->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
      PrintToken (
        STRING_TOKEN (STR_SHELLENV_DPROT_HIDPNP_UID),
        HiiEnvHandle,
        EISA_ID_TO_NUM (AcpiDevicePath->HID),
        AcpiDevicePath->UID
        );
    } else {
       PrintToken (
        STRING_TOKEN (STR_SHELLENV_DPROT_HID_UID),
        HiiEnvHandle,
        AcpiDevicePath->HID,
        AcpiDevicePath->UID
        );
    }
    break;
  case ACPI_EXTENDED_DP:
    AcpiExDevicepath = (ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *) DevicePath;
    HIDString        = AcpiExDevicepath->HidUidCidStr;
    UIDString        = NextStrA (HIDString);
    CIDString        = NextStrA (UIDString);
    CopyMem (NullString, "NULL", sizeof (NullString));
    if (*HIDString == '\0') {
      HIDString = NullString;
    }
    if (*UIDString == '\0') {
      UIDString = NullString;
    }
    if (*CIDString == '\0') {
      CIDString = NullString;
    }
    if ((AcpiExDevicepath->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
      if ((AcpiExDevicepath->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
        PrintToken (
          STRING_TOKEN (STR_SHELLENV_DPROT_HIDPNP_CIDPNP_UID),
          HiiEnvHandle,
          EISA_ID_TO_NUM (AcpiExDevicepath->HID),
          EISA_ID_TO_NUM (AcpiExDevicepath->CID),
          AcpiExDevicepath->UID,
          HIDString,
          CIDString,
          UIDString
          );
      } else {
        PrintToken (
          STRING_TOKEN (STR_SHELLENV_DPROT_HIDPNP_CID_UID),
          HiiEnvHandle,
          EISA_ID_TO_NUM (AcpiExDevicepath->HID),
          AcpiExDevicepath->CID,
          AcpiExDevicepath->UID,
          HIDString,
          CIDString,
          UIDString
          );
      }
    } else {
      if ((AcpiExDevicepath->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
        PrintToken (
          STRING_TOKEN (STR_SHELLENV_DPROT_HID_CIDPNP_UID),
          HiiEnvHandle,
          AcpiExDevicepath->HID,
          EISA_ID_TO_NUM (AcpiExDevicepath->CID),
          AcpiExDevicepath->UID,
          HIDString,
          CIDString,
          UIDString
          );
      } else {
        PrintToken (
          STRING_TOKEN (STR_SHELLENV_DPROT_HID_CID_UID),
          HiiEnvHandle,
          AcpiExDevicepath->HID,
          AcpiExDevicepath->CID,
          AcpiExDevicepath->UID,
          HIDString,
          CIDString,
          UIDString
          );
      }
    }
    break;
  case ACPI_ADR_DP:
    AcpiAdrDevicePath  = (ACPI_ADR_DEVICE_PATH *) DevicePath;
    Length             = DevicePathNodeLength (DevicePath);
    AdditionalAdrCount = (Length - 8) / 4;

    PrintToken (STRING_TOKEN (STR_SHELLENV_DPROT_ADR), HiiEnvHandle);
    Print (L"%hx", AcpiAdrDevicePath->ADR);
    for (Index = 0; Index < AdditionalAdrCount; Index++) {
      Print (L",%hx", *(UINT32 *) ((UINT8 *) AcpiAdrDevicePath + 8 + Index * 4));
    }
    break;
  default:
    break;
  }
}