EmbeddedPkg/FdtPlatformDxe: Introduce EFI Shell command 'dumfdt'
This command dumps the Flat Device Tree currently installed in the EFI Configuration Table. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Ronald Cron <Ronald.Cron@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17303 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
committed by
oliviermartin
parent
3d7f106085
commit
b0866ad398
@@ -20,8 +20,6 @@
|
||||
|
||||
#include <Protocol/DevicePath.h>
|
||||
|
||||
#include <libfdt.h>
|
||||
|
||||
//
|
||||
// Internal variables
|
||||
//
|
||||
@@ -32,6 +30,12 @@ STATIC CONST EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mShellDynCmdProtocolSetFdt = {
|
||||
ShellDynCmdSetFdtGetHelp // GetHelp
|
||||
};
|
||||
|
||||
STATIC CONST EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mShellDynCmdProtocolDumpFdt = {
|
||||
L"dumpfdt", // Name of the command
|
||||
ShellDynCmdDumpFdtHandler, // Handler
|
||||
ShellDynCmdDumpFdtGetHelp // GetHelp
|
||||
};
|
||||
|
||||
STATIC CONST EFI_GUID mFdtPlatformDxeHiiGuid = {
|
||||
0x8afa7610, 0x62b1, 0x46aa,
|
||||
{0xb5, 0x34, 0xc3, 0xde, 0xff, 0x39, 0x77, 0x8c}
|
||||
@@ -159,6 +163,7 @@ FdtPlatformEntryPoint (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
//
|
||||
// Install the Device Tree from its expected location
|
||||
@@ -168,14 +173,7 @@ FdtPlatformEntryPoint (
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// If the development features are enabled, install the dynamic shell
|
||||
// command "setfdt" to be able to define a device path for the FDT
|
||||
// that has precedence over the device paths defined by
|
||||
// "PcdFdtDevicePaths".
|
||||
//
|
||||
|
||||
if (FeaturePcdGet (PcdOverridePlatformFdt)) {
|
||||
if (FeaturePcdGet (PcdOverridePlatformFdt) || FeaturePcdGet (PcdDumpFdtShellCommand)) {
|
||||
//
|
||||
// Register the strings for the user interface in the HII Database.
|
||||
// This shows the way to the multi-language support, even if
|
||||
@@ -192,10 +190,22 @@ FdtPlatformEntryPoint (
|
||||
FdtPlatformDxeStrings,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// If the development features are enabled, install the dynamic shell
|
||||
// command "setfdt" to be able to define a device path for the FDT
|
||||
// that has precedence over the device paths defined by
|
||||
// "PcdFdtDevicePaths".
|
||||
//
|
||||
|
||||
if (FeaturePcdGet (PcdOverridePlatformFdt)) {
|
||||
if (mFdtPlatformDxeHiiHandle != NULL) {
|
||||
// We install dynamic EFI command on separate handles as we cannot register
|
||||
// more than one protocol of the same protocol interface on the same handle.
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&ImageHandle,
|
||||
&Handle,
|
||||
&gEfiShellDynamicCommandProtocolGuid,
|
||||
&mShellDynCmdProtocolSetFdt,
|
||||
NULL
|
||||
@@ -215,6 +225,32 @@ FdtPlatformEntryPoint (
|
||||
}
|
||||
}
|
||||
|
||||
if (FeaturePcdGet (PcdDumpFdtShellCommand)) {
|
||||
if (mFdtPlatformDxeHiiHandle != NULL) {
|
||||
// We install dynamic EFI command on separate handles as we cannot register
|
||||
// more than one protocol of the same protocol interface on the same handle.
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Handle,
|
||||
&gEfiShellDynamicCommandProtocolGuid,
|
||||
&mShellDynCmdProtocolDumpFdt,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
HiiRemovePackages (mFdtPlatformDxeHiiHandle);
|
||||
}
|
||||
} else {
|
||||
Status = EFI_LOAD_ERROR;
|
||||
}
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((
|
||||
EFI_D_WARN,
|
||||
"Unable to install \"dumpfdt\" EFI Shell command - %r \n",
|
||||
Status
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user