]> git.proxmox.com Git - mirror_edk2.git/blob - EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c
EmbeddedPkg : Add FdtPlatformDxe driver
[mirror_edk2.git] / EmbeddedPkg / Drivers / FdtPlatformDxe / FdtPlatform.c
1 /** @file
2
3 Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>
4
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
9
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.
12
13 **/
14 #include <Uefi.h>
15
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
24 #include <Library/BdsLib.h>
25
26 #include <Protocol/DevicePathFromText.h>
27 #include <Protocol/DevicePath.h>
28
29 #include <Guid/EventGroup.h>
30 #include <Guid/Fdt.h>
31
32 #include <libfdt.h>
33
34 //
35 // Internal types
36 //
37 STATIC VOID OnEndOfDxe (
38 IN EFI_EVENT Event,
39 IN VOID *Context
40 );
41 STATIC EFI_STATUS RunFdtInstallation (
42 VOID
43 );
44 STATIC EFI_STATUS InstallFdt (
45 IN CONST CHAR16* TextDevicePath
46 );
47
48 /**
49 Main entry point of the FDT platform driver.
50
51 @param[in] ImageHandle The firmware allocated handle for the present driver
52 UEFI image.
53 @param[in] *SystemTable A pointer to the EFI System table.
54
55 @retval EFI_SUCCESS The driver was initialized.
56 @retval EFI_OUT_OF_RESOURCES The "End of DXE" event could not be allocated.
57
58 **/
59 EFI_STATUS
60 FdtPlatformEntryPoint (
61 IN EFI_HANDLE ImageHandle,
62 IN EFI_SYSTEM_TABLE *SystemTable
63 )
64 {
65 EFI_STATUS Status;
66 EFI_EVENT EndOfDxeEvent;
67
68 //
69 // Create an event belonging to the "gEfiEndOfDxeEventGroupGuid" group.
70 // The "OnEndOfDxe()" function is declared as the call back function.
71 // It will be called at the end of the DXE phase when an event of the
72 // same group is signalled to inform about the end of the DXE phase.
73 //
74 Status = gBS->CreateEventEx (
75 EVT_NOTIFY_SIGNAL,
76 TPL_CALLBACK,
77 OnEndOfDxe,
78 NULL,
79 &gEfiEndOfDxeEventGroupGuid,
80 &EndOfDxeEvent
81 );
82
83 return Status;
84 }
85
86 /**
87 Notification function of the event defined as belonging to the
88 EFI_END_OF_DXE_EVENT_GROUP_GUID event group that was created in
89 the entry point of the driver.
90
91 This function is called when an event belonging to the
92 EFI_END_OF_DXE_EVENT_GROUP_GUID event group is signalled. Such an
93 event is signalled once at the end of the dispatching of all
94 drivers (end of the so called DXE phase).
95
96 @param[in] Event Event declared in the entry point of the driver whose
97 notification function is being invoked.
98 @param[in] Context NULL
99
100 **/
101 STATIC
102 VOID
103 OnEndOfDxe (
104 IN EFI_EVENT Event,
105 IN VOID *Context
106 )
107 {
108 RunFdtInstallation ();
109 gBS->CloseEvent (Event);
110 }
111
112 /**
113 Run the FDT installation process.
114
115 Loop in priority order over the device paths from which the FDT has
116 been asked to be retrieved for. For each device path, try to install
117 the FDT. Stop as soon as an installation succeeds.
118
119 @retval EFI_SUCCESS The FDT was installed.
120 @retval EFI_NOT_FOUND Failed to locate a protocol or a file.
121 @retval EFI_INVALID_PARAMETER Invalid device path.
122 @retval EFI_UNSUPPORTED Device path not supported.
123 @retval EFI_OUT_OF_RESOURCES An allocation failed.
124
125 **/
126 STATIC
127 EFI_STATUS
128 RunFdtInstallation (
129 VOID
130 )
131 {
132 EFI_STATUS Status;
133 UINTN DataSize;
134 VOID *Data;
135 CHAR16 *TextDevicePathStart;
136 CHAR16 *TextDevicePathSeparator;
137 UINTN TextDevicePathLen;
138 CHAR16 *TextDevicePath;
139
140 //
141 // For development purpose, if enabled through the "PcdOverridePlatformFdt"
142 // feature PCD, try first to install the FDT specified by the device path in
143 // text form stored in the "Fdt" UEFI variable.
144 //
145 if (FeaturePcdGet (PcdOverridePlatformFdt)) {
146 Data = NULL;
147 DataSize = 0;
148 Status = gRT->GetVariable (
149 L"Fdt",
150 &gFdtVariableGuid,
151 NULL,
152 &DataSize,
153 Data
154 );
155
156 //
157 // Keep going only if the "Fdt" variable is defined.
158 //
159
160 if (Status == EFI_BUFFER_TOO_SMALL) {
161 Data = AllocatePool (DataSize);
162 if (Data == NULL) {
163 Status = EFI_OUT_OF_RESOURCES;
164 } else {
165 Status = gRT->GetVariable (
166 L"Fdt",
167 &gFdtVariableGuid,
168 NULL,
169 &DataSize,
170 Data
171 );
172 if (!EFI_ERROR (Status)) {
173 Status = InstallFdt ((CHAR16*)Data);
174 if (!EFI_ERROR (Status)) {
175 DEBUG ((
176 EFI_D_WARN,
177 "Installation of the FDT using the device path <%s> completed.\n",
178 (CHAR16*)Data
179 ));
180 }
181 }
182 FreePool (Data);
183 }
184
185 if (EFI_ERROR (Status)) {
186 DEBUG ((
187 EFI_D_ERROR,
188 "Installation of the FDT specified by the \"Fdt\" UEFI variable failed - %r\n",
189 Status
190 ));
191 } else {
192 return Status;
193 }
194 }
195 }
196
197 //
198 // Loop over the device path list provided by "PcdFdtDevicePaths". The device
199 // paths are in text form and separated by a semi-colon.
200 //
201
202 Status = EFI_SUCCESS;
203 for (TextDevicePathStart = (CHAR16*)PcdGetPtr (PcdFdtDevicePaths);
204 *TextDevicePathStart != L'\0' ; ) {
205 TextDevicePathSeparator = StrStr (TextDevicePathStart, L";");
206
207 //
208 // Last device path of the list
209 //
210 if (TextDevicePathSeparator == NULL) {
211 TextDevicePath = TextDevicePathStart;
212 } else {
213 TextDevicePathLen = (UINTN)(TextDevicePathSeparator - TextDevicePathStart);
214 TextDevicePath = AllocateCopyPool (
215 (TextDevicePathLen + 1) * sizeof (CHAR16),
216 TextDevicePathStart
217 );
218 if (TextDevicePath == NULL) {
219 Status = EFI_OUT_OF_RESOURCES;
220 DEBUG ((EFI_D_ERROR, "Memory allocation error during FDT installation process.\n"));
221 break;
222 }
223 TextDevicePath[TextDevicePathLen] = L'\0';
224 }
225
226 Status = InstallFdt (TextDevicePath);
227 if (EFI_ERROR (Status)) {
228 DEBUG ((EFI_D_WARN, "Installation of the FDT using the device path <%s> failed - %r.\n",
229 TextDevicePath, Status
230 ));
231 } else {
232 DEBUG ((EFI_D_WARN, "Installation of the FDT using the device path <%s> completed.\n",
233 TextDevicePath
234 ));
235 }
236
237 if (TextDevicePathSeparator == NULL) {
238 break;
239 } else {
240 FreePool (TextDevicePath);
241 if (!EFI_ERROR (Status)) {
242 break;
243 }
244 TextDevicePathStart = TextDevicePathSeparator + 1;
245 }
246 }
247
248 if (EFI_ERROR (Status)) {
249 DEBUG ((EFI_D_ERROR, "Failed to install the FDT - %r.\n", Status));
250 }
251
252 return Status;
253 }
254
255 /**
256 Install the FDT specified by its device path in text form.
257
258 @param[in] TextDevicePath Device path of the FDT to install in text form
259
260 @retval EFI_SUCCESS The FDT was installed.
261 @retval EFI_NOT_FOUND Failed to locate a protocol or a file.
262 @retval EFI_INVALID_PARAMETER Invalid device path.
263 @retval EFI_UNSUPPORTED Device path not supported.
264 @retval EFI_OUT_OF_RESOURCES An allocation failed.
265 **/
266 STATIC
267 EFI_STATUS
268 InstallFdt (
269 IN CONST CHAR16* TextDevicePath
270 )
271 {
272 EFI_STATUS Status;
273 EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
274 EFI_DEVICE_PATH *DevicePath;
275 EFI_PHYSICAL_ADDRESS FdtBlobBase;
276 UINTN FdtBlobSize;
277 UINTN NbPages;
278 EFI_PHYSICAL_ADDRESS RsFdtBlobBase;
279
280 Status = gBS->LocateProtocol (
281 &gEfiDevicePathFromTextProtocolGuid,
282 NULL,
283 (VOID **)&EfiDevicePathFromTextProtocol
284 );
285 if (EFI_ERROR (Status)) {
286 DEBUG ((EFI_D_ERROR, "InstallFdt() - Failed to locate EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL protocol\n"));
287 return Status;
288 }
289
290 DevicePath = (EFI_DEVICE_PATH*)EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (TextDevicePath);
291 if (DevicePath == NULL) {
292 return EFI_INVALID_PARAMETER;
293 }
294
295 //
296 // Load the FDT given its device path.
297 // This operation may fail if the device path is not supported.
298 //
299 FdtBlobBase = 0;
300 NbPages = 0;
301 Status = BdsLoadImage (DevicePath, AllocateAnyPages, &FdtBlobBase, &FdtBlobSize);
302 if (EFI_ERROR (Status)) {
303 goto Error;
304 }
305
306 // Check the FDT header is valid. We only make this check in DEBUG mode in
307 // case the FDT header change on production device and this ASSERT() becomes
308 // not valid.
309 ASSERT (fdt_check_header ((VOID*)(UINTN)FdtBlobBase) == 0);
310
311 //
312 // Ensure the Size of the Device Tree is smaller than the size of the read file
313 //
314 ASSERT ((UINTN)fdt_totalsize ((VOID*)(UINTN)FdtBlobBase) <= FdtBlobSize);
315
316 //
317 // Store the FDT as Runtime Service Data to prevent the Kernel from
318 // overwritting its data.
319 //
320 NbPages = EFI_SIZE_TO_PAGES (FdtBlobSize);
321 Status = gBS->AllocatePages (
322 AllocateAnyPages, EfiRuntimeServicesData,
323 NbPages, &RsFdtBlobBase
324 );
325 if (EFI_ERROR (Status)) {
326 goto Error;
327 }
328 CopyMem (
329 (VOID*)((UINTN)RsFdtBlobBase),
330 (VOID*)((UINTN)FdtBlobBase),
331 FdtBlobSize
332 );
333
334 //
335 // Install the FDT into the Configuration Table
336 //
337 Status = gBS->InstallConfigurationTable (
338 &gFdtTableGuid,
339 (VOID*)((UINTN)RsFdtBlobBase)
340 );
341 if (EFI_ERROR (Status)) {
342 gBS->FreePages (RsFdtBlobBase, NbPages);
343 }
344
345 Error :
346
347 if (FdtBlobBase != 0) {
348 gBS->FreePages (FdtBlobBase, NbPages);
349 }
350 FreePool (DevicePath);
351
352 return Status;
353 }
354
355 =======
356
357 /**
358 This is the shell command "setfdt" handler function. This function handles
359 the command when it is invoked in the shell.
360
361 @param[in] This The instance of the
362 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
363 @param[in] SystemTable The pointer to the UEFI system table.
364 @param[in] ShellParameters The parameters associated with the command.
365 @param[in] Shell The instance of the shell protocol used in the
366 context of processing this command.
367
368 @return SHELL_SUCCESS The operation was successful.
369 @return SHELL_ABORTED Operation aborted due to internal error.
370 @return SHELL_INVALID_PARAMETER The parameters of the command are not valid.
371 @return SHELL_INVALID_PARAMETER The EFI Shell file path is not valid.
372 @return SHELL_NOT_FOUND Failed to locate a protocol or a file.
373 @return SHELL_UNSUPPORTED Device path not supported.
374 @return SHELL_OUT_OF_RESOURCES A memory allocation failed.
375 @return SHELL_DEVICE_ERROR The "Fdt" variable could not be saved due to a hardware failure.
376 @return SHELL_ACCESS_DENIED The "Fdt" variable is read-only.
377 @return SHELL_ACCESS_DENIED The "Fdt" variable cannot be deleted.
378 @return SHELL_ACCESS_DENIED The "Fdt" variable could not be written due to security violation.
379
380 **/
381 STATIC
382 SHELL_STATUS
383 EFIAPI
384 ShellDynCmdSetFdtHandler (
385 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
386 IN EFI_SYSTEM_TABLE *SystemTable,
387 IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
388 IN EFI_SHELL_PROTOCOL *Shell
389 )
390 {
391 SHELL_STATUS ShellStatus;
392 EFI_STATUS Status;
393 LIST_ENTRY *ParamPackage;
394 BOOLEAN FilePath;
395 CONST CHAR16 *ValueStr;
396
397 ShellStatus = SHELL_SUCCESS;
398 ParamPackage = NULL;
399 FilePath = FALSE;
400
401 //
402 // Install the Shell and Shell Parameters Protocols on the driver
403 // image. This is necessary for the initialisation of the Shell
404 // Library to succeed in the next step.
405 //
406 Status = gBS->InstallMultipleProtocolInterfaces (
407 &gImageHandle,
408 &gEfiShellProtocolGuid, Shell,
409 &gEfiShellParametersProtocolGuid, ShellParameters,
410 NULL
411 );
412 if (EFI_ERROR (Status)) {
413 return SHELL_ABORTED;
414 }
415
416 //
417 // Initialise the Shell Library as we are going to use it.
418 // Assert that the return code is EFI_SUCCESS as it should.
419 // To anticipate any change is the codes returned by
420 // ShellInitialize(), leave in case of error.
421 //
422 Status = ShellInitialize ();
423 if (EFI_ERROR (Status)) {
424 ASSERT_EFI_ERROR (Status);
425 return SHELL_ABORTED;
426 }
427
428 Status = ShellCommandLineParse (ParamList, &ParamPackage, NULL, TRUE);
429 if (!EFI_ERROR (Status)) {
430 switch (ShellCommandLineGetCount (ParamPackage)) {
431 case 1:
432 //
433 // Case "setfdt -i"
434 //
435 if (!ShellCommandLineGetFlag (ParamPackage, L"-i")) {
436 Status = EFI_INVALID_PARAMETER;
437 }
438 break;
439
440 case 2:
441 //
442 // Case "setfdt file_path" or
443 // "setfdt -i file_path" or
444 // "setfdt file_path -i"
445 //
446 FilePath = TRUE;
447 break;
448
449 default:
450 Status = EFI_INVALID_PARAMETER;
451 }
452 }
453 if (EFI_ERROR (Status)) {
454 ShellStatus = EfiCodeToShellCode (Status);
455 ShellPrintHiiEx (
456 -1, -1, NULL,
457 STRING_TOKEN (STR_SETFDT_ERROR),
458 mFdtPlatformDxeHiiHandle,
459 Status
460 );
461 goto Error;
462 }
463
464 //
465 // Update the preferred device path for the FDT if asked for.
466 //
467 if (FilePath) {
468 ValueStr = ShellCommandLineGetRawValue (ParamPackage, 1);
469 ShellPrintHiiEx (
470 -1, -1, NULL,
471 STRING_TOKEN (STR_SETFDT_UPDATING),
472 mFdtPlatformDxeHiiHandle
473 );
474 ShellStatus = UpdateFdtTextDevicePath (Shell, ValueStr);
475 if (ShellStatus != SHELL_SUCCESS) {
476 goto Error;
477 }
478 }
479
480 //
481 // Run the FDT installation process if asked for.
482 //
483 if (ShellCommandLineGetFlag (ParamPackage, L"-i")) {
484 ShellPrintHiiEx (
485 -1, -1, NULL,
486 STRING_TOKEN (STR_SETFDT_INSTALLING),
487 mFdtPlatformDxeHiiHandle
488 );
489 Status = RunFdtInstallation ();
490 ShellStatus = EfiCodeToShellCode (Status);
491 if (!EFI_ERROR (Status)) {
492 ShellPrintHiiEx (
493 -1, -1, NULL,
494 STRING_TOKEN (STR_SETFDT_INSTALL_SUCCEEDED),
495 mFdtPlatformDxeHiiHandle
496 );
497 } else {
498 if (Status == EFI_INVALID_PARAMETER) {
499 ShellPrintHiiEx (
500 -1, -1, NULL,
501 STRING_TOKEN (STR_SETFDT_INVALID_DEVICE_PATH),
502 mFdtPlatformDxeHiiHandle
503 );
504 } else {
505 ShellPrintHiiEx (
506 -1, -1, NULL,
507 STRING_TOKEN (STR_SETFDT_ERROR),
508 mFdtPlatformDxeHiiHandle,
509 Status
510 );
511 }
512 }
513 }
514
515 Error:
516
517 gBS->UninstallMultipleProtocolInterfaces (
518 gImageHandle,
519 &gEfiShellProtocolGuid, Shell,
520 &gEfiShellParametersProtocolGuid, ShellParameters,
521 NULL
522 );
523 ShellCommandLineFreeVarList (ParamPackage);
524
525 return ShellStatus;
526 }
527
528 /**
529 This is the shell command "setfdt" help handler function. This
530 function returns the formatted help for the "setfdt" command.
531 The format matchs that in Appendix B of the revision 2.1 of the
532 UEFI Shell Specification.
533
534 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
535 @param[in] Language The pointer to the language string to use.
536
537 @return CHAR16* Pool allocated help string, must be freed by caller.
538 **/
539 STATIC
540 CHAR16*
541 EFIAPI
542 ShellDynCmdSetFdtGetHelp (
543 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
544 IN CONST CHAR8 *Language
545 )
546 {
547 //
548 // This allocates memory. The caller has to free the allocated memory.
549 //
550 return HiiGetString (
551 mFdtPlatformDxeHiiHandle,
552 STRING_TOKEN (STR_GET_HELP_SETFDT),
553 Language
554 );
555 }
556
557 /**
558 Update the text device path stored in the "Fdt" UEFI variable given
559 an EFI Shell file path or a text device path.
560
561 This function is a subroutine of the ShellDynCmdSetFdtHandler() function
562 to make its code easier to read.
563
564 @param[in] Shell The instance of the shell protocol used in the
565 context of processing the "setfdt" command.
566 @param[in] FilePath EFI Shell path or the device path to the FDT file.
567
568 @return SHELL_SUCCESS The text device path was succesfully updated.
569 @return SHELL_INVALID_PARAMETER The Shell file path is not valid.
570 @return SHELL_OUT_OF_RESOURCES A memory allocation failed.
571 @return SHELL_DEVICE_ERROR The "Fdt" variable could not be saved due to a hardware failure.
572 @return SHELL_ACCESS_DENIED The "Fdt" variable is read-only.
573 @return SHELL_ACCESS_DENIED The "Fdt" variable cannot be deleted.
574 @return SHELL_ACCESS_DENIED The "Fdt" variable could not be written due to security violation.
575 @return SHELL_NOT_FOUND Device path to text protocol not found.
576 @return SHELL_ABORTED Operation aborted.
577
578 **/
579 STATIC
580 SHELL_STATUS
581 UpdateFdtTextDevicePath (
582 IN EFI_SHELL_PROTOCOL *Shell,
583 IN CONST CHAR16 *FilePath
584 )
585 {
586 EFI_STATUS Status;
587 EFI_DEVICE_PATH *DevicePath;
588 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *EfiDevicePathToTextProtocol;
589 CHAR16 *TextDevicePath;
590 CHAR16 *FdtVariableValue;
591 EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol;
592 SHELL_STATUS ShellStatus;
593
594 ASSERT (FilePath != NULL);
595 TextDevicePath = NULL;
596 FdtVariableValue = NULL;
597
598 DevicePath = Shell->GetDevicePathFromFilePath (FilePath);
599 if (DevicePath != NULL) {
600 Status = gBS->LocateProtocol (
601 &gEfiDevicePathToTextProtocolGuid,
602 NULL,
603 (VOID **)&EfiDevicePathToTextProtocol
604 );
605 if (EFI_ERROR (Status)) {
606 goto Error;
607 }
608
609 TextDevicePath = EfiDevicePathToTextProtocol->ConvertDevicePathToText (
610 DevicePath,
611 FALSE,
612 FALSE
613 );
614 if (TextDevicePath == NULL) {
615 Status = EFI_OUT_OF_RESOURCES;
616 goto Error;
617 }
618 FdtVariableValue = TextDevicePath;
619 } else {
620 //
621 // Try to convert back the EFI Device Path String into a EFI device Path
622 // to ensure the format is valid
623 //
624 Status = gBS->LocateProtocol (
625 &gEfiDevicePathFromTextProtocolGuid,
626 NULL,
627 (VOID **)&EfiDevicePathFromTextProtocol
628 );
629 if (EFI_ERROR (Status)) {
630 goto Error;
631 }
632
633 DevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (
634 FilePath
635 );
636 if (DevicePath == NULL) {
637 Status = EFI_INVALID_PARAMETER;
638 goto Error;
639 }
640 FdtVariableValue = (CHAR16*)FilePath;
641 }
642
643 Status = gRT->SetVariable (
644 (CHAR16*)L"Fdt",
645 &gFdtVariableGuid,
646 EFI_VARIABLE_RUNTIME_ACCESS |
647 EFI_VARIABLE_NON_VOLATILE |
648 EFI_VARIABLE_BOOTSERVICE_ACCESS ,
649 StrSize (FdtVariableValue),
650 FdtVariableValue
651 );
652
653 Error:
654 ShellStatus = EfiCodeToShellCode (Status);
655 if (!EFI_ERROR (Status)) {
656 ShellPrintHiiEx (
657 -1, -1, NULL,
658 STRING_TOKEN (STR_SETFDT_UPDATE_SUCCEEDED),
659 mFdtPlatformDxeHiiHandle,
660 FdtVariableValue
661 );
662 } else {
663 if (Status == EFI_INVALID_PARAMETER) {
664 ShellPrintHiiEx (
665 -1, -1, NULL,
666 STRING_TOKEN (STR_SETFDT_INVALID_PATH),
667 mFdtPlatformDxeHiiHandle,
668 FilePath
669 );
670 } else {
671 ShellPrintHiiEx (
672 -1, -1, NULL,
673 STRING_TOKEN (STR_SETFDT_ERROR),
674 mFdtPlatformDxeHiiHandle,
675 Status
676 );
677 }
678 }
679
680 if (DevicePath != NULL) {
681 FreePool (DevicePath);
682 }
683 if (TextDevicePath != NULL) {
684 FreePool (TextDevicePath);
685 }
686
687 return ShellStatus;
688 }
689
690 /**
691 Transcode one of the EFI return code used by the model into an EFI Shell return code.
692
693 @param[in] Status EFI return code.
694
695 @return Transcoded EFI Shell return code.
696
697 **/
698 STATIC
699 SHELL_STATUS
700 EfiCodeToShellCode (
701 IN EFI_STATUS Status
702 )
703 {
704 SHELL_STATUS ShellStatus;
705
706 switch (Status) {
707 case EFI_SUCCESS :
708 ShellStatus = SHELL_SUCCESS;
709 break;
710
711 case EFI_INVALID_PARAMETER :
712 ShellStatus = SHELL_INVALID_PARAMETER;
713 break;
714
715 case EFI_UNSUPPORTED :
716 ShellStatus = SHELL_UNSUPPORTED;
717 break;
718
719 case EFI_DEVICE_ERROR :
720 ShellStatus = SHELL_DEVICE_ERROR;
721 break;
722
723 case EFI_WRITE_PROTECTED :
724 case EFI_SECURITY_VIOLATION :
725 ShellStatus = SHELL_ACCESS_DENIED;
726 break;
727
728 case EFI_OUT_OF_RESOURCES :
729 ShellStatus = SHELL_OUT_OF_RESOURCES;
730 break;
731
732 case EFI_NOT_FOUND :
733 ShellStatus = SHELL_NOT_FOUND;
734 break;
735
736 default :
737 ShellStatus = SHELL_ABORTED;
738 }
739
740 return ShellStatus;
741 }
742 >>>>>>> 4ac4fed... EmbeddedPkg/FdtPlatformDxe: Fix typo issue