X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EmbeddedPkg%2FDrivers%2FFdtPlatformDxe%2FFdtPlatform.c;fp=EmbeddedPkg%2FDrivers%2FFdtPlatformDxe%2FFdtPlatform.c;h=b6f5c3e58d3ae1e20b2e5d0d2e932419f4bc01ba;hp=38f31005f3a59d790a23f9828fa823f5d079d98a;hb=b0866ad398ba5034ddd298b7d5d7b1fff752d19a;hpb=3d7f1060859b69ef0c33d699fa9d8e9f2a383241 diff --git a/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c b/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c index 38f31005f3..b6f5c3e58d 100644 --- a/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c +++ b/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c @@ -20,8 +20,6 @@ #include -#include - // // 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; }