\r
#include <Protocol/DevicePath.h>\r
\r
-#include <libfdt.h>\r
-\r
//\r
// Internal variables\r
//\r
ShellDynCmdSetFdtGetHelp // GetHelp\r
};\r
\r
+STATIC CONST EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mShellDynCmdProtocolDumpFdt = {\r
+ L"dumpfdt", // Name of the command\r
+ ShellDynCmdDumpFdtHandler, // Handler\r
+ ShellDynCmdDumpFdtGetHelp // GetHelp\r
+};\r
+\r
STATIC CONST EFI_GUID mFdtPlatformDxeHiiGuid = {\r
0x8afa7610, 0x62b1, 0x46aa,\r
{0xb5, 0x34, 0xc3, 0xde, 0xff, 0x39, 0x77, 0x8c}\r
)\r
{\r
EFI_STATUS Status;\r
+ EFI_HANDLE Handle;\r
\r
//\r
// Install the Device Tree from its expected location\r
return Status;\r
}\r
\r
- //\r
- // If the development features are enabled, install the dynamic shell\r
- // command "setfdt" to be able to define a device path for the FDT\r
- // that has precedence over the device paths defined by\r
- // "PcdFdtDevicePaths".\r
- //\r
-\r
- if (FeaturePcdGet (PcdOverridePlatformFdt)) {\r
+ if (FeaturePcdGet (PcdOverridePlatformFdt) || FeaturePcdGet (PcdDumpFdtShellCommand)) {\r
//\r
// Register the strings for the user interface in the HII Database.\r
// This shows the way to the multi-language support, even if\r
FdtPlatformDxeStrings,\r
NULL\r
);\r
+ }\r
+\r
+ //\r
+ // If the development features are enabled, install the dynamic shell\r
+ // command "setfdt" to be able to define a device path for the FDT\r
+ // that has precedence over the device paths defined by\r
+ // "PcdFdtDevicePaths".\r
+ //\r
\r
+ if (FeaturePcdGet (PcdOverridePlatformFdt)) {\r
if (mFdtPlatformDxeHiiHandle != NULL) {\r
+ // We install dynamic EFI command on separate handles as we cannot register\r
+ // more than one protocol of the same protocol interface on the same handle.\r
+ Handle = NULL;\r
Status = gBS->InstallMultipleProtocolInterfaces (\r
- &ImageHandle,\r
+ &Handle,\r
&gEfiShellDynamicCommandProtocolGuid,\r
&mShellDynCmdProtocolSetFdt,\r
NULL\r
}\r
}\r
\r
+ if (FeaturePcdGet (PcdDumpFdtShellCommand)) {\r
+ if (mFdtPlatformDxeHiiHandle != NULL) {\r
+ // We install dynamic EFI command on separate handles as we cannot register\r
+ // more than one protocol of the same protocol interface on the same handle.\r
+ Handle = NULL;\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &Handle,\r
+ &gEfiShellDynamicCommandProtocolGuid,\r
+ &mShellDynCmdProtocolDumpFdt,\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ HiiRemovePackages (mFdtPlatformDxeHiiHandle);\r
+ }\r
+ } else {\r
+ Status = EFI_LOAD_ERROR;\r
+ }\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((\r
+ EFI_D_WARN,\r
+ "Unable to install \"dumpfdt\" EFI Shell command - %r \n",\r
+ Status\r
+ ));\r
+ }\r
+ }\r
+\r
return Status;\r
}\r
\r