3 Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/UefiLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/UefiBootServicesTableLib.h>
19 #include <Library/UefiRuntimeServicesTableLib.h>
20 #include <Library/PcdLib.h>
21 #include <Library/DevicePathLib.h>
22 #include <Library/MemoryAllocationLib.h>
23 #include <Library/HiiLib.h>
24 #include <Library/BdsLib.h>
25 #include <Library/ShellLib.h>
27 #include <Protocol/DevicePathToText.h>
28 #include <Protocol/DevicePathFromText.h>
29 #include <Protocol/DevicePath.h>
30 #include <Protocol/EfiShell.h>
31 #include <Protocol/EfiShellDynamicCommand.h>
41 STATIC SHELL_STATUS EFIAPI
ShellDynCmdSetFdtHandler (
42 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
43 IN EFI_SYSTEM_TABLE
*SystemTable
,
44 IN EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
45 IN EFI_SHELL_PROTOCOL
*Shell
48 STATIC CHAR16
* EFIAPI
ShellDynCmdSetFdtGetHelp (
49 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
50 IN CONST CHAR8
*Language
53 STATIC VOID
DisplayFdtDevicePaths (
57 STATIC SHELL_STATUS
UpdateFdtTextDevicePath (
58 IN EFI_SHELL_PROTOCOL
*Shell
,
59 IN CONST CHAR16
*FilePath
62 STATIC SHELL_STATUS
EfiCodeToShellCode (
70 STATIC CONST EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mShellDynCmdProtocolSetFdt
= {
71 L
"setfdt", // Name of the command
72 ShellDynCmdSetFdtHandler
, // Handler
73 ShellDynCmdSetFdtGetHelp
// GetHelp
76 STATIC CONST EFI_GUID mFdtPlatformDxeHiiGuid
= {
77 0x8afa7610, 0x62b1, 0x46aa,
78 {0xb5, 0x34, 0xc3, 0xde, 0xff, 0x39, 0x77, 0x8c}
80 STATIC CONST SHELL_PARAM_ITEM ParamList
[] = {
85 STATIC EFI_HANDLE mFdtPlatformDxeHiiHandle
;
88 Install the FDT specified by its device path in text form.
90 @param[in] TextDevicePath Device path of the FDT to install in text form
92 @retval EFI_SUCCESS The FDT was installed.
93 @retval EFI_NOT_FOUND Failed to locate a protocol or a file.
94 @retval EFI_INVALID_PARAMETER Invalid device path.
95 @retval EFI_UNSUPPORTED Device path not supported.
96 @retval EFI_OUT_OF_RESOURCES An allocation failed.
101 IN CONST CHAR16
* TextDevicePath
105 EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL
*EfiDevicePathFromTextProtocol
;
106 EFI_DEVICE_PATH
*DevicePath
;
107 EFI_PHYSICAL_ADDRESS FdtBlobBase
;
110 EFI_PHYSICAL_ADDRESS FdtConfigurationTableBase
;
112 Status
= gBS
->LocateProtocol (
113 &gEfiDevicePathFromTextProtocolGuid
,
115 (VOID
**)&EfiDevicePathFromTextProtocol
117 if (EFI_ERROR (Status
)) {
118 DEBUG ((EFI_D_ERROR
, "InstallFdt() - Failed to locate EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL protocol\n"));
122 DevicePath
= (EFI_DEVICE_PATH
*)EfiDevicePathFromTextProtocol
->ConvertTextToDevicePath (TextDevicePath
);
123 if (DevicePath
== NULL
) {
124 return EFI_INVALID_PARAMETER
;
128 // Load the FDT given its device path.
129 // This operation may fail if the device path is not supported.
133 Status
= BdsLoadImage (DevicePath
, AllocateAnyPages
, &FdtBlobBase
, &FdtBlobSize
);
134 if (EFI_ERROR (Status
)) {
138 // Check the FDT header is valid. We only make this check in DEBUG mode in
139 // case the FDT header change on production device and this ASSERT() becomes
141 ASSERT (fdt_check_header ((VOID
*)(UINTN
)FdtBlobBase
) == 0);
144 // Ensure the Size of the Device Tree is smaller than the size of the read file
146 ASSERT ((UINTN
)fdt_totalsize ((VOID
*)(UINTN
)FdtBlobBase
) <= FdtBlobSize
);
149 // Store the FDT as Runtime Service Data to prevent the Kernel from
150 // overwritting its data.
152 NumPages
= EFI_SIZE_TO_PAGES (FdtBlobSize
);
153 Status
= gBS
->AllocatePages (
154 AllocateAnyPages
, EfiRuntimeServicesData
,
155 NumPages
, &FdtConfigurationTableBase
157 if (EFI_ERROR (Status
)) {
161 (VOID
*)(UINTN
)FdtConfigurationTableBase
,
162 (VOID
*)(UINTN
)FdtBlobBase
,
167 // Install the FDT into the Configuration Table
169 Status
= gBS
->InstallConfigurationTable (
171 (VOID
*)(UINTN
)FdtConfigurationTableBase
173 if (EFI_ERROR (Status
)) {
174 gBS
->FreePages (FdtConfigurationTableBase
, NumPages
);
178 if (FdtBlobBase
!= 0) {
179 gBS
->FreePages (FdtBlobBase
, NumPages
);
181 FreePool (DevicePath
);
187 Main entry point of the FDT platform driver.
189 @param[in] ImageHandle The firmware allocated handle for the present driver
191 @param[in] *SystemTable A pointer to the EFI System table.
193 @retval EFI_SUCCESS The driver was initialized.
194 @retval EFI_OUT_OF_RESOURCES The "End of DXE" event could not be allocated or
195 there was not enough memory in pool to install
196 the Shell Dynamic Command protocol.
197 @retval EFI_LOAD_ERROR Unable to add the HII package.
201 FdtPlatformEntryPoint (
202 IN EFI_HANDLE ImageHandle
,
203 IN EFI_SYSTEM_TABLE
*SystemTable
209 // Install the Device Tree from its expected location
211 Status
= RunFdtInstallation (NULL
);
212 if (EFI_ERROR (Status
)) {
217 // If the development features are enabled, install the dynamic shell
218 // command "setfdt" to be able to define a device path for the FDT
219 // that has precedence over the device paths defined by
220 // "PcdFdtDevicePaths".
223 if (FeaturePcdGet (PcdOverridePlatformFdt
)) {
225 // Register the strings for the user interface in the HII Database.
226 // This shows the way to the multi-language support, even if
227 // only the English language is actually supported. The strings to register
228 // are stored in the "FdtPlatformDxeStrings[]" array. This array is
229 // built by the building process from the "*.uni" file associated to
230 // the present driver (cf. FdtPlatfromDxe.inf). Examine your Build
231 // folder under your package's DEBUG folder and you will find the array
232 // defined in a xxxStrDefs.h file.
234 mFdtPlatformDxeHiiHandle
= HiiAddPackages (
235 &mFdtPlatformDxeHiiGuid
,
237 FdtPlatformDxeStrings
,
241 if (mFdtPlatformDxeHiiHandle
!= NULL
) {
242 Status
= gBS
->InstallMultipleProtocolInterfaces (
244 &gEfiShellDynamicCommandProtocolGuid
,
245 &mShellDynCmdProtocolSetFdt
,
248 if (EFI_ERROR (Status
)) {
249 HiiRemovePackages (mFdtPlatformDxeHiiHandle
);
252 Status
= EFI_LOAD_ERROR
;
254 if (EFI_ERROR (Status
)) {
257 "Unable to install \"setfdt\" EFI Shell command - %r \n",
267 Run the FDT installation process.
269 Loop in priority order over the device paths from which the FDT has
270 been asked to be retrieved for. For each device path, try to install
271 the FDT. Stop as soon as an installation succeeds.
273 @param[in] SuccessfullDevicePath If not NULL, address where to store the
274 pointer to the text device path from
275 which the FDT was successfully retrieved.
276 Not used if the FDT installation failed.
277 The returned address is the address of
278 an allocated buffer that has to be
281 @retval EFI_SUCCESS The FDT was installed.
282 @retval EFI_NOT_FOUND Failed to locate a protocol or a file.
283 @retval EFI_INVALID_PARAMETER Invalid device path.
284 @retval EFI_UNSUPPORTED Device path not supported.
285 @retval EFI_OUT_OF_RESOURCES An allocation failed.
291 OUT CHAR16
**SuccessfullDevicePath
296 CHAR16
*TextDevicePath
;
297 CHAR16
*TextDevicePathStart
;
298 CHAR16
*TextDevicePathSeparator
;
299 UINTN TextDevicePathLen
;
301 TextDevicePath
= NULL
;
303 // For development purpose, if enabled through the "PcdOverridePlatformFdt"
304 // feature PCD, try first to install the FDT specified by the device path in
305 // text form stored in the "Fdt" UEFI variable.
307 if (FeaturePcdGet (PcdOverridePlatformFdt
)) {
309 Status
= gRT
->GetVariable (
318 // Keep going only if the "Fdt" variable is defined.
321 if (Status
== EFI_BUFFER_TOO_SMALL
) {
322 TextDevicePath
= AllocatePool (DataSize
);
323 if (TextDevicePath
== NULL
) {
324 Status
= EFI_OUT_OF_RESOURCES
;
328 Status
= gRT
->GetVariable (
335 if (EFI_ERROR (Status
)) {
336 FreePool (TextDevicePath
);
340 Status
= InstallFdt (TextDevicePath
);
341 if (!EFI_ERROR (Status
)) {
344 "Installation of the FDT using the device path <%s> completed.\n",
351 "Installation of the FDT specified by the \"Fdt\" UEFI variable failed - %r\n",
354 FreePool (TextDevicePath
);
359 // Loop over the device path list provided by "PcdFdtDevicePaths". The device
360 // paths are in text form and separated by a semi-colon.
363 Status
= EFI_NOT_FOUND
;
364 for (TextDevicePathStart
= (CHAR16
*)PcdGetPtr (PcdFdtDevicePaths
);
365 *TextDevicePathStart
!= L
'\0' ; ) {
366 TextDevicePathSeparator
= StrStr (TextDevicePathStart
, L
";");
369 // Last device path of the list
371 if (TextDevicePathSeparator
== NULL
) {
372 TextDevicePathLen
= StrLen (TextDevicePathStart
);
374 TextDevicePathLen
= (UINTN
)(TextDevicePathSeparator
- TextDevicePathStart
);
377 TextDevicePath
= AllocateCopyPool (
378 (TextDevicePathLen
+ 1) * sizeof (CHAR16
),
381 if (TextDevicePath
== NULL
) {
382 Status
= EFI_OUT_OF_RESOURCES
;
385 TextDevicePath
[TextDevicePathLen
] = L
'\0';
387 Status
= InstallFdt (TextDevicePath
);
388 if (!EFI_ERROR (Status
)) {
389 DEBUG ((EFI_D_WARN
, "Installation of the FDT using the device path <%s> completed.\n",
395 DEBUG ((EFI_D_WARN
, "Installation of the FDT using the device path <%s> failed - %r.\n",
396 TextDevicePath
, Status
398 FreePool (TextDevicePath
);
400 if (TextDevicePathSeparator
== NULL
) {
403 TextDevicePathStart
= TextDevicePathSeparator
+ 1;
409 if (EFI_ERROR (Status
)) {
410 DEBUG ((EFI_D_ERROR
, "Failed to install the FDT - %r.\n", Status
));
414 if (SuccessfullDevicePath
!= NULL
) {
415 *SuccessfullDevicePath
= TextDevicePath
;
417 FreePool (TextDevicePath
);
424 This is the shell command "setfdt" handler function. This function handles
425 the command when it is invoked in the shell.
427 @param[in] This The instance of the
428 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
429 @param[in] SystemTable The pointer to the UEFI system table.
430 @param[in] ShellParameters The parameters associated with the command.
431 @param[in] Shell The instance of the shell protocol used in the
432 context of processing this command.
434 @return SHELL_SUCCESS The operation was successful.
435 @return SHELL_ABORTED Operation aborted due to internal error.
436 @return SHELL_INVALID_PARAMETER The parameters of the command are not valid.
437 @return SHELL_INVALID_PARAMETER The EFI Shell file path is not valid.
438 @return SHELL_NOT_FOUND Failed to locate a protocol or a file.
439 @return SHELL_UNSUPPORTED Device path not supported.
440 @return SHELL_OUT_OF_RESOURCES A memory allocation failed.
441 @return SHELL_DEVICE_ERROR The "Fdt" variable could not be saved due to a hardware failure.
442 @return SHELL_ACCESS_DENIED The "Fdt" variable is read-only.
443 @return SHELL_ACCESS_DENIED The "Fdt" variable cannot be deleted.
444 @return SHELL_ACCESS_DENIED The "Fdt" variable could not be written due to security violation.
450 ShellDynCmdSetFdtHandler (
451 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
452 IN EFI_SYSTEM_TABLE
*SystemTable
,
453 IN EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
454 IN EFI_SHELL_PROTOCOL
*Shell
457 SHELL_STATUS ShellStatus
;
459 LIST_ENTRY
*ParamPackage
;
461 CONST CHAR16
*ValueStr
;
462 CHAR16
*TextDevicePath
;
464 ShellStatus
= SHELL_SUCCESS
;
469 // Install the Shell and Shell Parameters Protocols on the driver
470 // image. This is necessary for the initialisation of the Shell
471 // Library to succeed in the next step.
473 Status
= gBS
->InstallMultipleProtocolInterfaces (
475 &gEfiShellProtocolGuid
, Shell
,
476 &gEfiShellParametersProtocolGuid
, ShellParameters
,
479 if (EFI_ERROR (Status
)) {
480 return SHELL_ABORTED
;
484 // Initialise the Shell Library as we are going to use it.
485 // Assert that the return code is EFI_SUCCESS as it should.
486 // To anticipate any change is the codes returned by
487 // ShellInitialize(), leave in case of error.
489 Status
= ShellInitialize ();
490 if (EFI_ERROR (Status
)) {
491 ASSERT_EFI_ERROR (Status
);
492 return SHELL_ABORTED
;
495 Status
= ShellCommandLineParse (ParamList
, &ParamPackage
, NULL
, TRUE
);
496 if (!EFI_ERROR (Status
)) {
497 switch (ShellCommandLineGetCount (ParamPackage
)) {
500 // Case "setfdt" or "setfdt -i"
502 if (!ShellCommandLineGetFlag (ParamPackage
, L
"-i")) {
503 DisplayFdtDevicePaths ();
509 // Case "setfdt file_path" or
510 // "setfdt -i file_path" or
511 // "setfdt file_path -i"
517 Status
= EFI_INVALID_PARAMETER
;
520 if (EFI_ERROR (Status
)) {
521 ShellStatus
= EfiCodeToShellCode (Status
);
524 STRING_TOKEN (STR_SETFDT_ERROR
),
525 mFdtPlatformDxeHiiHandle
,
532 // Update the preferred device path for the FDT if asked for.
535 ValueStr
= ShellCommandLineGetRawValue (ParamPackage
, 1);
538 STRING_TOKEN (STR_SETFDT_UPDATING
),
539 mFdtPlatformDxeHiiHandle
541 ShellStatus
= UpdateFdtTextDevicePath (Shell
, ValueStr
);
542 if (ShellStatus
!= SHELL_SUCCESS
) {
548 // Run the FDT installation process if asked for.
550 if (ShellCommandLineGetFlag (ParamPackage
, L
"-i")) {
553 STRING_TOKEN (STR_SETFDT_INSTALLING
),
554 mFdtPlatformDxeHiiHandle
556 Status
= RunFdtInstallation (&TextDevicePath
);
557 ShellStatus
= EfiCodeToShellCode (Status
);
558 if (!EFI_ERROR (Status
)) {
561 STRING_TOKEN (STR_SETFDT_INSTALL_SUCCEEDED
),
562 mFdtPlatformDxeHiiHandle
,
565 FreePool (TextDevicePath
);
567 if (Status
== EFI_INVALID_PARAMETER
) {
570 STRING_TOKEN (STR_SETFDT_INVALID_DEVICE_PATH
),
571 mFdtPlatformDxeHiiHandle
576 STRING_TOKEN (STR_SETFDT_ERROR
),
577 mFdtPlatformDxeHiiHandle
,
581 DisplayFdtDevicePaths ();
586 gBS
->UninstallMultipleProtocolInterfaces (
588 &gEfiShellProtocolGuid
, Shell
,
589 &gEfiShellParametersProtocolGuid
, ShellParameters
,
592 ShellCommandLineFreeVarList (ParamPackage
);
598 This is the shell command "setfdt" help handler function. This
599 function returns the formatted help for the "setfdt" command.
600 The format matchs that in Appendix B of the revision 2.1 of the
601 UEFI Shell Specification.
603 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
604 @param[in] Language The pointer to the language string to use.
606 @return CHAR16* Pool allocated help string, must be freed by caller.
611 ShellDynCmdSetFdtGetHelp (
612 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
613 IN CONST CHAR8
*Language
617 // This allocates memory. The caller has to free the allocated memory.
619 return HiiGetString (
620 mFdtPlatformDxeHiiHandle
,
621 STRING_TOKEN (STR_GET_HELP_SETFDT
),
627 Display FDT device paths.
629 Display in text form the device paths used to install the FDT from the
630 highest to the lowest priority.
635 DisplayFdtDevicePaths (
641 CHAR16
*TextDevicePath
;
642 CHAR16
*TextDevicePaths
;
643 CHAR16
*TextDevicePathSeparator
;
647 STRING_TOKEN (STR_SETFDT_DEVICE_PATH_LIST
),
648 mFdtPlatformDxeHiiHandle
651 if (FeaturePcdGet (PcdOverridePlatformFdt
)) {
653 Status
= gRT
->GetVariable (
662 // Keep going only if the "Fdt" variable is defined.
665 if (Status
== EFI_BUFFER_TOO_SMALL
) {
666 TextDevicePath
= AllocatePool (DataSize
);
667 if (TextDevicePath
== NULL
) {
671 Status
= gRT
->GetVariable (
678 if (!EFI_ERROR (Status
)) {
681 STRING_TOKEN (STR_SETFDT_DEVICE_PATH
),
682 mFdtPlatformDxeHiiHandle
,
687 FreePool (TextDevicePath
);
692 // Loop over the device path list provided by "PcdFdtDevicePaths". The device
693 // paths are in text form and separated by a semi-colon.
696 TextDevicePaths
= AllocateCopyPool (
697 StrSize ((CHAR16
*)PcdGetPtr (PcdFdtDevicePaths
)),
698 (CHAR16
*)PcdGetPtr (PcdFdtDevicePaths
)
700 if (TextDevicePaths
== NULL
) {
704 for (TextDevicePath
= TextDevicePaths
;
705 *TextDevicePath
!= L
'\0' ; ) {
706 TextDevicePathSeparator
= StrStr (TextDevicePath
, L
";");
708 if (TextDevicePathSeparator
!= NULL
) {
709 *TextDevicePathSeparator
= L
'\0';
714 STRING_TOKEN (STR_SETFDT_DEVICE_PATH
),
715 mFdtPlatformDxeHiiHandle
,
719 if (TextDevicePathSeparator
== NULL
) {
722 TextDevicePath
= TextDevicePathSeparator
+ 1;
725 FreePool (TextDevicePaths
);
730 Update the text device path stored in the "Fdt" UEFI variable given
731 an EFI Shell file path or a text device path.
733 This function is a subroutine of the ShellDynCmdSetFdtHandler() function
734 to make its code easier to read.
736 @param[in] Shell The instance of the shell protocol used in the
737 context of processing the "setfdt" command.
738 @param[in] FilePath EFI Shell path or the device path to the FDT file.
740 @return SHELL_SUCCESS The text device path was succesfully updated.
741 @return SHELL_INVALID_PARAMETER The Shell file path is not valid.
742 @return SHELL_OUT_OF_RESOURCES A memory allocation failed.
743 @return SHELL_DEVICE_ERROR The "Fdt" variable could not be saved due to a hardware failure.
744 @return SHELL_ACCESS_DENIED The "Fdt" variable is read-only.
745 @return SHELL_ACCESS_DENIED The "Fdt" variable cannot be deleted.
746 @return SHELL_ACCESS_DENIED The "Fdt" variable could not be written due to security violation.
747 @return SHELL_NOT_FOUND Device path to text protocol not found.
748 @return SHELL_ABORTED Operation aborted.
753 UpdateFdtTextDevicePath (
754 IN EFI_SHELL_PROTOCOL
*Shell
,
755 IN CONST CHAR16
*FilePath
759 EFI_DEVICE_PATH
*DevicePath
;
760 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
*EfiDevicePathToTextProtocol
;
761 CHAR16
*TextDevicePath
;
762 CHAR16
*FdtVariableValue
;
763 EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL
*EfiDevicePathFromTextProtocol
;
764 SHELL_STATUS ShellStatus
;
766 ASSERT (FilePath
!= NULL
);
768 TextDevicePath
= NULL
;
769 FdtVariableValue
= NULL
;
771 if (*FilePath
!= L
'\0') {
772 DevicePath
= Shell
->GetDevicePathFromFilePath (FilePath
);
773 if (DevicePath
!= NULL
) {
774 Status
= gBS
->LocateProtocol (
775 &gEfiDevicePathToTextProtocolGuid
,
777 (VOID
**)&EfiDevicePathToTextProtocol
779 if (EFI_ERROR (Status
)) {
783 TextDevicePath
= EfiDevicePathToTextProtocol
->ConvertDevicePathToText (
788 if (TextDevicePath
== NULL
) {
789 Status
= EFI_OUT_OF_RESOURCES
;
792 FdtVariableValue
= TextDevicePath
;
795 // Try to convert back the EFI Device Path String into a EFI device Path
796 // to ensure the format is valid
798 Status
= gBS
->LocateProtocol (
799 &gEfiDevicePathFromTextProtocolGuid
,
801 (VOID
**)&EfiDevicePathFromTextProtocol
803 if (EFI_ERROR (Status
)) {
807 DevicePath
= EfiDevicePathFromTextProtocol
->ConvertTextToDevicePath (
810 if (DevicePath
== NULL
) {
811 Status
= EFI_INVALID_PARAMETER
;
814 FdtVariableValue
= (CHAR16
*)FilePath
;
818 Status
= gRT
->SetVariable (
821 EFI_VARIABLE_RUNTIME_ACCESS
|
822 EFI_VARIABLE_NON_VOLATILE
|
823 EFI_VARIABLE_BOOTSERVICE_ACCESS
,
824 (FdtVariableValue
!= NULL
) ?
825 StrSize (FdtVariableValue
) : 0,
830 ShellStatus
= EfiCodeToShellCode (Status
);
831 if (!EFI_ERROR (Status
)) {
832 if (FdtVariableValue
!= NULL
) {
835 STRING_TOKEN (STR_SETFDT_UPDATE_SUCCEEDED
),
836 mFdtPlatformDxeHiiHandle
,
842 STRING_TOKEN (STR_SETFDT_UPDATE_DELETED
),
843 mFdtPlatformDxeHiiHandle
847 if (Status
== EFI_INVALID_PARAMETER
) {
850 STRING_TOKEN (STR_SETFDT_INVALID_PATH
),
851 mFdtPlatformDxeHiiHandle
,
857 STRING_TOKEN (STR_SETFDT_ERROR
),
858 mFdtPlatformDxeHiiHandle
,
864 if (DevicePath
!= NULL
) {
865 FreePool (DevicePath
);
867 if (TextDevicePath
!= NULL
) {
868 FreePool (TextDevicePath
);
875 Transcode one of the EFI return code used by the model into an EFI Shell return code.
877 @param[in] Status EFI return code.
879 @return Transcoded EFI Shell return code.
888 SHELL_STATUS ShellStatus
;
892 ShellStatus
= SHELL_SUCCESS
;
895 case EFI_INVALID_PARAMETER
:
896 ShellStatus
= SHELL_INVALID_PARAMETER
;
899 case EFI_UNSUPPORTED
:
900 ShellStatus
= SHELL_UNSUPPORTED
;
903 case EFI_DEVICE_ERROR
:
904 ShellStatus
= SHELL_DEVICE_ERROR
;
907 case EFI_WRITE_PROTECTED
:
908 case EFI_SECURITY_VIOLATION
:
909 ShellStatus
= SHELL_ACCESS_DENIED
;
912 case EFI_OUT_OF_RESOURCES
:
913 ShellStatus
= SHELL_OUT_OF_RESOURCES
;
917 ShellStatus
= SHELL_NOT_FOUND
;
921 ShellStatus
= SHELL_ABORTED
;