Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14505 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ruiyu Ni
2013-07-26 03:14:08 +00:00
committed by niruiyu
parent 4d0a30a494
commit 863986b3c8
59 changed files with 191 additions and 4922 deletions

View File

@@ -31,7 +31,6 @@
#include <Protocol/DriverBinding.h>
#include <Protocol/ComponentName2.h>
#include <Protocol/DevicePath.h>
#include <Protocol/DevicePathToText.h>
#include <Guid/Performance.h>
@@ -204,7 +203,6 @@ GetNameFromHandle (
UINTN StringSize;
CHAR8 *PlatformLanguage;
EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText;
//
// Method 1: Get the name string from image PDB
@@ -320,19 +318,12 @@ GetNameFromHandle (
//
// Method 5: Get the name string from image DevicePath
//
Status = gBS->LocateProtocol (
&gEfiDevicePathToTextProtocolGuid,
NULL,
(VOID **) &DevicePathToText
);
if (!EFI_ERROR (Status)) {
NameString = DevicePathToText->ConvertDevicePathToText (LoadedImageDevicePath, TRUE, FALSE);
if (NameString != NULL) {
StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
FreePool (NameString);
return;
}
NameString = ConvertDevicePathToText (LoadedImageDevicePath, TRUE, FALSE);
if (NameString != NULL) {
StrnCpy (mGaugeString, NameString, DP_GAUGE_STRING_LENGTH);
mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;
FreePool (NameString);
return;
}
}
}

View File

@@ -25,7 +25,6 @@ extern EFI_GUID gDpHiiGuid;
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePathToText.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>

View File

@@ -62,13 +62,13 @@
UefiBootServicesTableLib
SortLib
PrintLib
DevicePathLib
[Protocols]
gEfiLoadedImageProtocolGuid # ALWAYS_CONSUMED
gEfiDriverBindingProtocolGuid # SOMETIMES_CONSUMED
gEfiComponentName2ProtocolGuid # SOMETIMES_CONSUMED
gEfiLoadedImageDevicePathProtocolGuid # SOMETIMES_CONSUMED
gEfiDevicePathToTextProtocolGuid # SOMETIMES_CONSUMED
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize

View File

@@ -414,19 +414,15 @@ DevicePathProtocolDumpInformation(
CHAR16 *Temp;
CHAR16 *Temp2;
EFI_STATUS Status;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;
Temp = NULL;
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID**)&DevPathToText);
Status = gBS->OpenProtocol(TheHandle, &gEfiDevicePathProtocolGuid, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (!EFI_ERROR(Status)) {
Status = gBS->OpenProtocol(TheHandle, &gEfiDevicePathProtocolGuid, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (!EFI_ERROR(Status)) {
//
// I cannot decide whether to allow shortcuts here (the second BOOLEAN on the next line)
//
Temp = DevPathToText->ConvertDevicePathToText(DevPath, TRUE, TRUE);
gBS->CloseProtocol(TheHandle, &gEfiDevicePathProtocolGuid, gImageHandle, NULL);
}
//
// I cannot decide whether to allow shortcuts here (the second BOOLEAN on the next line)
//
Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE);
gBS->CloseProtocol(TheHandle, &gEfiDevicePathProtocolGuid, gImageHandle, NULL);
}
if (!Verbose && Temp != NULL && StrLen(Temp) > 30) {
Temp2 = NULL;

View File

@@ -30,7 +30,6 @@ STATIC BUFFER_LIST mFileHandleList;
// global variables required by library class.
EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation = NULL;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *gDevPathToText = NULL;
SHELL_MAP_LIST gShellMapList;
SHELL_MAP_LIST *gShellCurDir = NULL;
@@ -58,12 +57,6 @@ CommandInit(
return (EFI_DEVICE_ERROR);
}
}
if (gDevPathToText == NULL) {
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID**)&gDevPathToText);
if (EFI_ERROR(Status)) {
return (EFI_DEVICE_ERROR);
}
}
return (EFI_SUCCESS);
}
@@ -184,7 +177,6 @@ ShellCommandLibDestructor (
}
gUnicodeCollation = NULL;
gDevPathToText = NULL;
gShellCurDir = NULL;
return (RETURN_SUCCESS);

View File

@@ -1,7 +1,7 @@
## @file
# Provides interface to shell internal functions for shell commands.
#
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved. <BR>
# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved. <BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -52,7 +52,6 @@
gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED
gEfiShellProtocolGuid # ALWAYS_CONSUMED
gEfiShellParametersProtocolGuid # ALWAYS_CONSUMED
gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED
[Guids]
gEfiSasDevicePathGuid # ALWAYS_CONSUMED

View File

@@ -1,7 +1,7 @@
/** @file
Main file for bcfg shell Debug1 function.
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -1052,7 +1052,7 @@ BcfgDisplayDumpDebug1(
if ((*(UINT16*)(Buffer+4)) != 0) {
DevPath = AllocateZeroPool(*(UINT16*)(Buffer+4));
CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));
DevPathString = gDevPathToText->ConvertDevicePathToText(DevPath, TRUE, FALSE);
DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
} else {
DevPath = NULL;
DevPathString = NULL;

View File

@@ -1,7 +1,7 @@
/** @file
Main file for SetVar shell Debug1 function.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -49,7 +49,6 @@ ShellCommandRunSetVar (
UINTN Size;
UINTN LoopVar;
EFI_DEVICE_PATH_PROTOCOL *DevPath;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *DevPathFromText;
ShellStatus = SHELL_SUCCESS;
Status = EFI_SUCCESS;
@@ -226,9 +225,7 @@ ShellCommandRunSetVar (
//
Data++;
Data++;
Status = gBS->LocateProtocol(&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID**)&DevPathFromText);
ASSERT_EFI_ERROR(Status);
DevPath = DevPathFromText->ConvertTextToDevicePath(Data);
DevPath = ConvertTextToDevicePath(Data);
if (DevPath == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_DPFT), gShellDebug1HiiHandle, Status);
ShellStatus = SHELL_INVALID_PARAMETER;

View File

@@ -1,7 +1,7 @@
/** @file
Main file for NULL named library for Profile1 shell command functions.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -29,7 +29,6 @@
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePathToText.h>
#include <Protocol/DriverDiagnostics2.h>
#include <Protocol/DriverDiagnostics.h>
#include <Protocol/PlatformDriverOverride.h>
@@ -38,7 +37,6 @@
#include <Protocol/DriverSupportedEfiVersion.h>
#include <Protocol/DriverFamilyOverride.h>
#include <Protocol/DriverHealth.h>
#include <Protocol/DevicePathFromText.h>
#include <Protocol/SimplePointer.h>
#include <Protocol/PciRootBridgeIo.h>

View File

@@ -1,7 +1,7 @@
/** @file
Main file for Dh shell Driver1 function.
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -260,7 +260,7 @@ GetDriverImageName (
return (Status);
}
DevicePath = LoadedImage->FilePath;
*Name = gDevPathToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE);
*Name = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
return (EFI_SUCCESS);
}
@@ -354,7 +354,7 @@ DisplayDriverModelHandle (
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DH_OUTPUT_DRIVER1), gShellDriver1HiiHandle, TempStringPointer!=NULL?TempStringPointer:L"<Unknown>");
SHELL_FREE_NON_NULL(TempStringPointer);
TempStringPointer = gDevPathToText->ConvertDevicePathToText(DevicePath, TRUE, FALSE);
TempStringPointer = ConvertDevicePathToText(DevicePath, TRUE, FALSE);
ShellPrintHiiEx(
-1,
-1,

View File

@@ -1,7 +1,7 @@
/** @file
Main file for Drivers shell Driver1 function.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -80,7 +80,7 @@ GetDevicePathTextForHandle(
}
RetVal = gEfiShellProtocol->GetFilePathFromDevicePath(FinalPath);
if (RetVal == NULL) {
RetVal = gDevPathToText->ConvertDevicePathToText(FinalPath, TRUE, TRUE);
RetVal = ConvertDevicePathToText(FinalPath, TRUE, TRUE);
}
FreePool(FinalPath);
return (RetVal);

View File

@@ -1,7 +1,7 @@
/** @file
Main file for DrvCfg shell Driver1 function.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -406,7 +406,7 @@ ConfigFromFile(
//
// print out an error.
//
TempDevPathString = gDevPathToText->ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), TRUE, TRUE);
TempDevPathString = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), TRUE, TRUE);
ShellPrintHiiEx(
-1,
-1,

View File

@@ -1,7 +1,7 @@
/** @file
Main file for NULL named library for Profile1 shell command functions.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -28,7 +28,6 @@
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePathToText.h>
#include <Protocol/DriverDiagnostics2.h>
#include <Protocol/DriverDiagnostics.h>
#include <Protocol/PlatformDriverOverride.h>

View File

@@ -1,7 +1,7 @@
/** @file
Main file for Unload shell Driver1 function.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -67,7 +67,6 @@ DumpLoadedImageProtocolInfo (
{
EFI_LOADED_IMAGE_PROTOCOL *Image;
EFI_STATUS Status;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText;
CHAR16 *DevicePathText;
CHAR16 *CodeTypeText;
CHAR16 *DataTypeText;
@@ -79,23 +78,10 @@ DumpLoadedImageProtocolInfo (
if (EFI_ERROR(Status)) {
return (EFI_INVALID_PARAMETER);
}
Status = gBS->LocateProtocol(
&gEfiDevicePathToTextProtocolGuid,
NULL,
(VOID**)&DevicePathToText);
//
// we now have the device path to text protocol
//
if (!EFI_ERROR(Status)) {
DevicePathText = DevicePathToText->ConvertDevicePathToText(Image->FilePath, TRUE, TRUE);
} else {
DevicePathText = NULL;
}
CodeTypeText = ConvertMemoryType(Image->ImageCodeType);
DataTypeText = ConvertMemoryType(Image->ImageDataType);
PdbPointer = (CHAR8*)PeCoffLoaderGetPdbPointer(Image->ImageBase);
DevicePathText = ConvertDevicePathToText(Image->FilePath, TRUE, TRUE);
CodeTypeText = ConvertMemoryType(Image->ImageCodeType);
DataTypeText = ConvertMemoryType(Image->ImageDataType);
PdbPointer = (CHAR8*)PeCoffLoaderGetPdbPointer(Image->ImageBase);
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_UNLOAD_VERBOSE), gShellDriver1HiiHandle,
ConvertHandleToHandleIndex(TheHandle),
TheHandle,

View File

@@ -1050,7 +1050,7 @@ BcfgDisplayDumpInstall1(
if ((*(UINT16*)(Buffer+4)) != 0) {
DevPath = AllocateZeroPool(*(UINT16*)(Buffer+4));
CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));
DevPathString = gDevPathToText->ConvertDevicePathToText(DevPath, TRUE, FALSE);
DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
} else {
DevPath = NULL;
DevPathString = NULL;

View File

@@ -1,7 +1,7 @@
/** @file
Main file for NULL named library for install 1 shell command functions.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -25,7 +25,6 @@
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePathToText.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>

View File

@@ -1,7 +1,7 @@
/** @file
Main file for NULL named library for level 1 shell command functions.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -25,7 +25,6 @@
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePathToText.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>

View File

@@ -421,7 +421,7 @@ PerformSingleMappingDisplay(
if (TempSpot != NULL) {
*TempSpot = CHAR_NULL;
}
DevPathString = gDevPathToText->ConvertDevicePathToText(DevPath, TRUE, FALSE);
DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);
if (!SFO) {
TempLen = StrLen(CurrentName);
ShellPrintHiiEx (

View File

@@ -9,7 +9,7 @@
* functions are non-interactive only
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
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
@@ -33,7 +33,6 @@
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePathToText.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>

View File

@@ -1,7 +1,7 @@
## @file
# Provides shell level 2 functions
#
# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR>
# Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved. <BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -65,6 +65,7 @@
HiiLib
HandleParsingLib
PathLib
DevicePathLib
[Protocols]
gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED
@@ -73,7 +74,6 @@
gEfiDevicePathProtocolGuid # ALWAYS_CONSUMED
gEfiLoadedImageProtocolGuid # ALWAYS_CONSUMED
gEfiSimpleFileSystemProtocolGuid # ALWAYS_CONSUMED
gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED
[Pcd.common]
gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel # ALWAYS_CONSUMED

View File

@@ -25,7 +25,6 @@
#include <Protocol/DevicePath.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePathToText.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>

View File

@@ -17,7 +17,6 @@
#include <Protocol/UnicodeCollation.h>
#include <Protocol/DevicePath.h>
#include <Protocol/DevicePathToText.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
@@ -25,8 +24,8 @@
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/SortLib.h>
#include <Library/DevicePathLib.h>
STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathToText = NULL;
STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
@@ -224,15 +223,6 @@ DevicePathCompare (
return 1;
}
if (mDevicePathToText == NULL) {
Status = gBS->LocateProtocol(
&gEfiDevicePathToTextProtocolGuid,
NULL,
(VOID**)&mDevicePathToText);
ASSERT_EFI_ERROR(Status);
}
if (mUnicodeCollation == NULL) {
Status = gBS->LocateProtocol(
&gEfiUnicodeCollation2ProtocolGuid,
@@ -242,12 +232,12 @@ DevicePathCompare (
ASSERT_EFI_ERROR(Status);
}
TextPath1 = mDevicePathToText->ConvertDevicePathToText(
TextPath1 = ConvertDevicePathToText(
DevicePath1,
FALSE,
FALSE);
TextPath2 = mDevicePathToText->ConvertDevicePathToText(
TextPath2 = ConvertDevicePathToText(
DevicePath2,
FALSE,
FALSE);

View File

@@ -1,7 +1,7 @@
## @file
# Library used for sorting routines.
#
# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR>
# Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved. <BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -38,9 +38,9 @@
BaseMemoryLib
DebugLib
UefiBootServicesTableLib
DevicePathLib
[Protocols]
gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED
gEfiDevicePathProtocolGuid # ALWAYS_CONSUMED
gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED