From 863986b3c8e67736d361b68e293d01e6f92f825c Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Fri, 26 Jul 2013 03:14:08 +0000 Subject: Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib. Signed-off-by: Ruiyu Ni Reviewed-by: Feng Tian Reviewed-by: Elvin Li Reviewed-by: Eric Dong Reviewed-by: Star Zeng Reviewed-by: Jaben Carsey Reviewed-by: Guo Dong git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14505 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Application/Shell/Shell.inf | 3 +- ShellPkg/Application/Shell/ShellProtocol.c | 55 ++++++++++-------------------- 2 files changed, 19 insertions(+), 39 deletions(-) (limited to 'ShellPkg/Application/Shell') diff --git a/ShellPkg/Application/Shell/Shell.inf b/ShellPkg/Application/Shell/Shell.inf index 756e84137e..c3af617430 100644 --- a/ShellPkg/Application/Shell/Shell.inf +++ b/ShellPkg/Application/Shell/Shell.inf @@ -1,7 +1,7 @@ ## @file # This is the shell application # -# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2013, 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 @@ -93,7 +93,6 @@ gEfiComponentName2ProtocolGuid # ALWAYS_CONSUMED gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED gEfiDevicePathProtocolGuid # ALWAYS_CONSUMED - gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED [Pcd] gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel # ALWAYS_CONSUMED diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index df4874a23c..d39114f50e 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -115,27 +115,18 @@ InternalShellProtocolDebugPrintMessage ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath ) { - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText; EFI_STATUS Status; CHAR16 *Temp; - Status = EFI_SUCCESS; DEBUG_CODE_BEGIN(); - DevicePathToText = NULL; - Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, - NULL, - (VOID**)&DevicePathToText); if (Mapping != NULL) { DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping)); } - if (!EFI_ERROR(Status)) { - if (DevicePath != NULL) { - Temp = DevicePathToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE); - DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp)); - FreePool(Temp); - } - } + Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE); + DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp)); + FreePool(Temp); + DEBUG_CODE_END(); return (Status); } @@ -647,7 +638,6 @@ EfiShellGetDeviceName( { EFI_STATUS Status; EFI_COMPONENT_NAME2_PROTOCOL *CompName2; - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText; EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_HANDLE *HandleList; UINTN HandleCount; @@ -815,28 +805,19 @@ EfiShellGetDeviceName( } } if ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) != 0) { - Status = gBS->LocateProtocol( - &gEfiDevicePathToTextProtocolGuid, + Status = gBS->OpenProtocol( + DeviceHandle, + &gEfiDevicePathProtocolGuid, + (VOID**)&DevicePath, + gImageHandle, NULL, - (VOID**)&DevicePathToText); - // - // we now have the device path to text protocol - // + EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (!EFI_ERROR(Status)) { - Status = gBS->OpenProtocol( - DeviceHandle, - &gEfiDevicePathProtocolGuid, - (VOID**)&DevicePath, - gImageHandle, - NULL, - EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (!EFI_ERROR(Status)) { - // - // use device path to text on the device path - // - *BestDeviceName = DevicePathToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE); - return (EFI_SUCCESS); - } + // + // use device path to text on the device path + // + *BestDeviceName = ConvertDevicePathToText(DevicePath, TRUE, TRUE); + return (EFI_SUCCESS); } } // @@ -1583,11 +1564,11 @@ EfiShellExecute( DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath); DEBUG_CODE_BEGIN(); - Temp = gDevPathToText->ConvertDevicePathToText(ShellInfoObject.FileDevPath, TRUE, TRUE); + Temp = ConvertDevicePathToText(ShellInfoObject.FileDevPath, TRUE, TRUE); FreePool(Temp); - Temp = gDevPathToText->ConvertDevicePathToText(ShellInfoObject.ImageDevPath, TRUE, TRUE); + Temp = ConvertDevicePathToText(ShellInfoObject.ImageDevPath, TRUE, TRUE); FreePool(Temp); - Temp = gDevPathToText->ConvertDevicePathToText(DevPath, TRUE, TRUE); + Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE); FreePool(Temp); DEBUG_CODE_END(); -- cgit v1.2.3