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
This commit is contained in:
Ronald Cron 2015-05-05 15:23:02 +00:00 committed by oliviermartin
parent cd66c5a2f1
commit 4589ffaa85
1 changed files with 110 additions and 2 deletions

View File

@ -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 ();
}
}
@ -601,6 +606,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.