diff options
author | Ronald Cron <Ronald.Cron@arm.com> | 2015-05-05 15:23:02 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@Edk2> | 2015-05-05 15:23:02 +0000 |
commit | 4589ffaa85551193ef541fc31dc436281005f0d5 (patch) | |
tree | 768ec2fd3b47c2451d647ac1aa1dfa5d86ecef59 /EmbeddedPkg | |
parent | cd66c5a2f1cf3042c3de83f00f592ac5fa4cf593 (diff) | |
download | edk2-platforms-4589ffaa85551193ef541fc31dc436281005f0d5.tar.xz |
ArmPlatformPkg/FdtPlatformDxe: 'setfdt' command, add display of FDT device paths.
Add the display of the device paths that the FDT installation
process goes through when the 'setfdt' EFI Shell command is
called without any parameter.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17299 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmbeddedPkg')
-rw-r--r-- | EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c | 112 |
1 files changed, 110 insertions, 2 deletions
diff --git a/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c b/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c index 8702765c6a..b5ae8c0bb5 100644 --- a/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c +++ b/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c @@ -50,6 +50,10 @@ STATIC CHAR16* EFIAPI ShellDynCmdSetFdtGetHelp ( IN CONST CHAR8 *Language
);
+STATIC VOID DisplayFdtDevicePaths (
+ VOID
+ );
+
STATIC SHELL_STATUS UpdateFdtTextDevicePath (
IN EFI_SHELL_PROTOCOL *Shell,
IN CONST CHAR16 *FilePath
@@ -478,10 +482,10 @@ ShellDynCmdSetFdtHandler ( switch (ShellCommandLineGetCount (ParamPackage)) {
case 1:
//
- // Case "setfdt -i"
+ // Case "setfdt" or "setfdt -i"
//
if (!ShellCommandLineGetFlag (ParamPackage, L"-i")) {
- Status = EFI_INVALID_PARAMETER;
+ DisplayFdtDevicePaths ();
}
break;
@@ -557,6 +561,7 @@ ShellDynCmdSetFdtHandler ( Status
);
}
+ DisplayFdtDevicePaths ();
}
}
@@ -602,6 +607,109 @@ ShellDynCmdSetFdtGetHelp ( }
/**
+ Display FDT device paths.
+
+ Display in text form the device paths used to install the FDT from the
+ highest to the lowest priority.
+
+**/
+STATIC
+VOID
+DisplayFdtDevicePaths (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINTN DataSize;
+ CHAR16 *TextDevicePath;
+ CHAR16 *TextDevicePaths;
+ CHAR16 *TextDevicePathSeparator;
+
+ ShellPrintHiiEx (
+ -1, -1, NULL,
+ STRING_TOKEN (STR_SETFDT_DEVICE_PATH_LIST),
+ mFdtPlatformDxeHiiHandle
+ );
+
+ if (FeaturePcdGet (PcdOverridePlatformFdt)) {
+ DataSize = 0;
+ Status = gRT->GetVariable (
+ L"Fdt",
+ &gFdtVariableGuid,
+ NULL,
+ &DataSize,
+ NULL
+ );
+
+ //
+ // Keep going only if the "Fdt" variable is defined.
+ //
+
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ TextDevicePath = AllocatePool (DataSize);
+ if (TextDevicePath == NULL) {
+ return;
+ }
+
+ Status = gRT->GetVariable (
+ L"Fdt",
+ &gFdtVariableGuid,
+ NULL,
+ &DataSize,
+ TextDevicePath
+ );
+ if (!EFI_ERROR (Status)) {
+ ShellPrintHiiEx (
+ -1, -1, NULL,
+ STRING_TOKEN (STR_SETFDT_DEVICE_PATH),
+ mFdtPlatformDxeHiiHandle,
+ TextDevicePath
+ );
+ }
+
+ FreePool (TextDevicePath);
+ }
+ }
+
+ //
+ // Loop over the device path list provided by "PcdFdtDevicePaths". The device
+ // paths are in text form and separated by a semi-colon.
+ //
+
+ TextDevicePaths = AllocateCopyPool (
+ StrSize ((CHAR16*)PcdGetPtr (PcdFdtDevicePaths)),
+ (CHAR16*)PcdGetPtr (PcdFdtDevicePaths)
+ );
+ if (TextDevicePaths == NULL) {
+ return;
+ }
+
+ for (TextDevicePath = TextDevicePaths;
+ *TextDevicePath != L'\0' ; ) {
+ TextDevicePathSeparator = StrStr (TextDevicePath, L";");
+
+ if (TextDevicePathSeparator != NULL) {
+ *TextDevicePathSeparator = L'\0';
+ }
+
+ ShellPrintHiiEx (
+ -1, -1, NULL,
+ STRING_TOKEN (STR_SETFDT_DEVICE_PATH),
+ mFdtPlatformDxeHiiHandle,
+ TextDevicePath
+ );
+
+ if (TextDevicePathSeparator == NULL) {
+ break;
+ }
+ TextDevicePath = TextDevicePathSeparator + 1;
+ }
+
+ FreePool (TextDevicePaths);
+
+}
+
+/**
Update the text device path stored in the "Fdt" UEFI variable given
an EFI Shell file path or a text device path.
|