ArmPlatformPkg/EblCmdLib: Add the 'devicepaths' EBL command

This command start alls the available drivers and prints out all the
device paths of the platform.



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11801 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2011-06-11 11:59:31 +00:00
parent ea46ebbe6a
commit 6a15908fd6
2 changed files with 111 additions and 65 deletions

View File

@ -29,11 +29,13 @@
#include <Library/PeCoffGetEntryPointLib.h> #include <Library/PeCoffGetEntryPointLib.h>
#include <Library/PerformanceLib.h> #include <Library/PerformanceLib.h>
#include <Library/TimerLib.h> #include <Library/TimerLib.h>
#include <Library/BdsLib.h>
#include <Guid/DebugImageInfoTable.h> #include <Guid/DebugImageInfoTable.h>
#include <Protocol/DebugSupport.h> #include <Protocol/DebugSupport.h>
#include <Protocol/LoadedImage.h> #include <Protocol/LoadedImage.h>
#include <Protocol/DevicePathToText.h>
EFI_STATUS EFI_STATUS
EblDumpMmu ( EblDumpMmu (
@ -183,7 +185,7 @@ ImageHandleToPdbFileName (
} }
CHAR8 *mTokenList[] = { STATIC CHAR8 *mTokenList[] = {
/*"SEC",*/ /*"SEC",*/
"PEI", "PEI",
"DXE", "DXE",
@ -282,8 +284,7 @@ EblDumpGcd (
AsciiPrint (" Address Range Image Device Attributes\n"); AsciiPrint (" Address Range Image Device Attributes\n");
AsciiPrint ("__________________________________________________________\n"); AsciiPrint ("__________________________________________________________\n");
for (i=0; i < NumberOfDescriptors; i++) { for (i=0; i < NumberOfDescriptors; i++) {
//AsciiPrint ("%016lx - %016lx",MemorySpaceMap[i].BaseAddress,MemorySpaceMap[i].BaseAddress+MemorySpaceMap[i].Length); AsciiPrint ("MEM %016lx - %016lx",(UINT64)MemorySpaceMap[i].BaseAddress,MemorySpaceMap[i].BaseAddress+MemorySpaceMap[i].Length-1);
AsciiPrint ("MEM %08lx - %08lx",(UINT64)MemorySpaceMap[i].BaseAddress,MemorySpaceMap[i].BaseAddress+MemorySpaceMap[i].Length-1);
AsciiPrint (" %08x %08x",MemorySpaceMap[i].ImageHandle,MemorySpaceMap[i].DeviceHandle); AsciiPrint (" %08x %08x",MemorySpaceMap[i].ImageHandle,MemorySpaceMap[i].DeviceHandle);
if (MemorySpaceMap[i].Attributes & EFI_MEMORY_RUNTIME) if (MemorySpaceMap[i].Attributes & EFI_MEMORY_RUNTIME)
@ -341,6 +342,43 @@ EblDumpGcd (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
EFI_STATUS
EblDevicePaths (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
UINTN Index;
CHAR16* String;
EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
BdsConnectAllDrivers();
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
if (EFI_ERROR (Status)) {
AsciiPrint ("Did not find the DevicePathToTextProtocol.\n");
return EFI_SUCCESS;
}
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiDevicePathProtocolGuid, NULL, &HandleCount, &HandleBuffer);
if (EFI_ERROR (Status)) {
AsciiPrint ("No device path found\n");
return EFI_SUCCESS;
}
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);
String = DevicePathToTextProtocol->ConvertDevicePathToText(DevicePathProtocol,TRUE,TRUE);
Print (L"[0x%X] %s\n",(UINT32)HandleBuffer[Index], String);
}
return EFI_SUCCESS;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] = GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =
{ {
{ {
@ -372,6 +410,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =
" dump MMU Table", " dump MMU Table",
NULL, NULL,
EblDumpMmu EblDumpMmu
},
{
"devicepaths",
" list all the Device Paths",
NULL,
EblDevicePaths
} }
}; };

View File

@ -1,6 +1,6 @@
#/** @file #/** @file
# #
# Copyright (c) 2010, ARM Ltd. All rights reserved.<BR> # Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # which accompanies this distribution. The full text of the license may be found at
@ -44,10 +44,12 @@
ArmDisassemblerLib ArmDisassemblerLib
PerformanceLib PerformanceLib
TimerLib TimerLib
BdsLib
[Protocols] [Protocols]
gEfiDebugSupportProtocolGuid gEfiDebugSupportProtocolGuid
gEfiLoadedImageProtocolGuid gEfiLoadedImageProtocolGuid
gEfiDevicePathToTextProtocolGuid
[Guids] [Guids]
gEfiDebugImageInfoTableGuid gEfiDebugImageInfoTableGuid