/** @file Definition for Device Path Tool. Copyright (c) 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "UefiDevicePathLib.h" // // Utility Name // #define UTILITY_NAME "DevicePath" // // Utility version information // #define UTILITY_MAJOR_VERSION 0 #define UTILITY_MINOR_VERSION 1 EFI_GUID gEfiDebugPortDevicePathGuid = DEVICE_PATH_MESSAGING_DEBUGPORT; EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID; EFI_GUID gEfiVT100Guid = EFI_VT_100_GUID; EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID; EFI_GUID gEfiVTUTF8Guid = EFI_VT_UTF8_GUID; EFI_GUID gEfiUartDevicePathGuid = EFI_UART_DEVICE_PATH_GUID; EFI_GUID gEfiSasDevicePathGuid = EFI_SAS_DEVICE_PATH_GUID; EFI_GUID gEfiVirtualDiskGuid = EFI_VIRTUAL_DISK_GUID; EFI_GUID gEfiVirtualCdGuid = EFI_VIRTUAL_CD_GUID; EFI_GUID gEfiPersistentVirtualDiskGuid = EFI_PERSISTENT_VIRTUAL_DISK_GUID; EFI_GUID gEfiPersistentVirtualCdGuid = EFI_PERSISTENT_VIRTUAL_CD_GUID; STATIC VOID Version ( VOID ) /*++ Routine Description: Displays the standard utility information to SDTOUT Arguments: None Returns: None --*/ { fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION); } STATIC VOID Usage ( VOID ) /*++ Routine Description: Displays the utility usage syntax to STDOUT Arguments: None Returns: None --*/ { // // Summary usage // fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME); // // Copyright declaration // fprintf (stdout, "Copyright (c) 2017, Intel Corporation. All rights reserved.\n\n"); // // Details Option // fprintf (stdout, "Options:\n"); fprintf (stdout, " DevicePathString Device Path string is specified, no space character.\n" " Example: \"PciRoot(0)/Pci(0,0)\"\n"); fprintf (stdout, " --version Show program's version number and exit.\n"); fprintf (stdout, " -h, --help Show this help message and exit.\n"); } void print_mem(void const *vp, size_t n) { unsigned char const *p = vp; for (size_t i=0; iType == END_DEVICE_PATH_TYPE) && (DevicePath->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)) ) { print_mem(DevicePath, (DevicePath->Length[0] | DevicePath->Length[1] << 8)); DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)DevicePath + (DevicePath->Length[0] | DevicePath->Length[1] << 8)); } print_mem(DevicePath, (DevicePath->Length[0] | DevicePath->Length[1] << 8)); putchar('\n'); return STATUS_SUCCESS; }