mirror of https://github.com/acidanthera/audk.git
ShellPkg/dh: Modify the dump of "ImageDevicePath" and "DevicePath"
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Huajing Li <huajing.li@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
parent
7f04c46026
commit
f6e0c4b401
|
@ -847,6 +847,50 @@ ConvertDevicePathToShortText(
|
|||
return (Temp);
|
||||
}
|
||||
|
||||
/**
|
||||
Function to dump protocol information.
|
||||
|
||||
This will allocate the return buffer from boot services pool.
|
||||
|
||||
@param[in] TheHandle The handle that has the protocol installed.
|
||||
@param[in] Verbose TRUE for additional information, FALSE otherwise.
|
||||
@param[in] Protocol The protocol is needed to dump.
|
||||
|
||||
@retval A pointer to a string containing the information.
|
||||
**/
|
||||
STATIC CHAR16*
|
||||
EFIAPI
|
||||
DevicePathProtocolDumpInformationEx (
|
||||
IN CONST EFI_HANDLE TheHandle,
|
||||
IN CONST BOOLEAN Verbose,
|
||||
IN EFI_GUID *Protocol
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||
CHAR16 *DevPathStr;
|
||||
CHAR16 *DevPathStrTemp;
|
||||
UINTN Size;
|
||||
EFI_STATUS Status;
|
||||
DevPathStr = NULL;
|
||||
DevPathStrTemp = NULL;
|
||||
Status = gBS->OpenProtocol(TheHandle, Protocol, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
DevPathStr = ConvertDevicePathToShortText (DevPath, Verbose, 30);
|
||||
if (Verbose) {
|
||||
Size = StrSize(DevPathStr) + sizeof(CHAR16) * 2;
|
||||
DevPathStrTemp = AllocateZeroPool (Size);
|
||||
if (DevPathStrTemp != NULL) {
|
||||
StrnCatS (DevPathStrTemp, Size/sizeof(CHAR16), L" ", 2);
|
||||
StrnCatS (DevPathStrTemp, Size/sizeof(CHAR16), DevPathStr, StrLen (DevPathStr));
|
||||
}
|
||||
FreePool (DevPathStr);
|
||||
DevPathStr = DevPathStrTemp;
|
||||
}
|
||||
gBS->CloseProtocol(TheHandle, Protocol, gImageHandle, NULL);
|
||||
}
|
||||
return DevPathStr;
|
||||
}
|
||||
|
||||
/**
|
||||
Function to dump information about DevicePath protocol.
|
||||
|
||||
|
@ -864,17 +908,7 @@ DevicePathProtocolDumpInformation(
|
|||
IN CONST BOOLEAN Verbose
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||
CHAR16 *Temp;
|
||||
EFI_STATUS Status;
|
||||
Temp = NULL;
|
||||
|
||||
Status = gBS->OpenProtocol(TheHandle, &gEfiDevicePathProtocolGuid, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Temp = ConvertDevicePathToShortText (DevPath, Verbose, 30);
|
||||
gBS->CloseProtocol(TheHandle, &gEfiDevicePathProtocolGuid, gImageHandle, NULL);
|
||||
}
|
||||
return (Temp);
|
||||
return DevicePathProtocolDumpInformationEx (TheHandle, Verbose, &gEfiDevicePathProtocolGuid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -894,17 +928,7 @@ LoadedImageDevicePathProtocolDumpInformation(
|
|||
IN CONST BOOLEAN Verbose
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevPath;
|
||||
CHAR16 *Temp;
|
||||
EFI_STATUS Status;
|
||||
Temp = NULL;
|
||||
|
||||
Status = gBS->OpenProtocol(TheHandle, &gEfiLoadedImageDevicePathProtocolGuid, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Temp = ConvertDevicePathToShortText (DevPath, Verbose, 30);
|
||||
gBS->CloseProtocol(TheHandle, &gEfiDevicePathProtocolGuid, gImageHandle, NULL);
|
||||
}
|
||||
return (Temp);
|
||||
return DevicePathProtocolDumpInformationEx (TheHandle, Verbose, &gEfiLoadedImageDevicePathProtocolGuid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue