Revision: 17300
http://sourceforge.net/p/edk2/code/17300
Author: oliviermartin
Date: 2015-05-05 15:24:17 +0000 (Tue, 05 May 2015)
Log Message:
-----------
EmbeddedPkg/FdtPlatformDxe: 'setfdt' command, add deletion of the UEFI variable
"Fdt"
Add deletion of the "Fdt" UEFI variable used to specify
a development FDT device path when the 'setfdt' command
is called with an empty string as file path.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <[email protected]>
Reviewed-by: Olivier Martin <[email protected]>
Modified Paths:
--------------
trunk/edk2/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c
Modified: trunk/edk2/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c
===================================================================
--- trunk/edk2/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c 2015-05-05
15:23:02 UTC (rev 17299)
+++ trunk/edk2/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.c 2015-05-05
15:24:17 UTC (rev 17300)
@@ -747,52 +747,55 @@
SHELL_STATUS ShellStatus;
ASSERT (FilePath != NULL);
+ DevicePath = NULL;
TextDevicePath = NULL;
FdtVariableValue = NULL;
- DevicePath = Shell->GetDevicePathFromFilePath (FilePath);
- if (DevicePath != NULL) {
- Status = gBS->LocateProtocol (
- &gEfiDevicePathToTextProtocolGuid,
- NULL,
- (VOID **)&EfiDevicePathToTextProtocol
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
+ if (*FilePath != L'\0') {
+ DevicePath = Shell->GetDevicePathFromFilePath (FilePath);
+ if (DevicePath != NULL) {
+ Status = gBS->LocateProtocol (
+ &gEfiDevicePathToTextProtocolGuid,
+ NULL,
+ (VOID **)&EfiDevicePathToTextProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ goto Error;
+ }
- TextDevicePath = EfiDevicePathToTextProtocol->ConvertDevicePathToText (
- DevicePath,
- FALSE,
- FALSE
+ TextDevicePath = EfiDevicePathToTextProtocol->ConvertDevicePathToText (
+ DevicePath,
+ FALSE,
+ FALSE
+ );
+ if (TextDevicePath == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Error;
+ }
+ FdtVariableValue = TextDevicePath;
+ } else {
+ //
+ // Try to convert back the EFI Device Path String into a EFI device Path
+ // to ensure the format is valid
+ //
+ Status = gBS->LocateProtocol (
+ &gEfiDevicePathFromTextProtocolGuid,
+ NULL,
+ (VOID **)&EfiDevicePathFromTextProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ goto Error;
+ }
+
+ DevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (
+ FilePath
);
- if (TextDevicePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
+ if (DevicePath == NULL) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Error;
+ }
+ FdtVariableValue = (CHAR16*)FilePath;
}
- FdtVariableValue = TextDevicePath;
- } else {
- //
- // Try to convert back the EFI Device Path String into a EFI device Path
- // to ensure the format is valid
- //
- Status = gBS->LocateProtocol (
- &gEfiDevicePathFromTextProtocolGuid,
- NULL,
- (VOID **)&EfiDevicePathFromTextProtocol
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- DevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath (
- FilePath
- );
- if (DevicePath == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Error;
- }
- FdtVariableValue = (CHAR16*)FilePath;
}
Status = gRT->SetVariable (
@@ -801,19 +804,29 @@
EFI_VARIABLE_RUNTIME_ACCESS |
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS ,
- StrSize (FdtVariableValue),
+ (FdtVariableValue != NULL) ?
+ StrSize (FdtVariableValue) : 0,
FdtVariableValue
);
Error:
ShellStatus = EfiCodeToShellCode (Status);
if (!EFI_ERROR (Status)) {
- ShellPrintHiiEx (
- -1, -1, NULL,
- STRING_TOKEN (STR_SETFDT_UPDATE_SUCCEEDED),
- mFdtPlatformDxeHiiHandle,
- FdtVariableValue
- );
+ if (FdtVariableValue != NULL) {
+ ShellPrintHiiEx (
+ -1, -1, NULL,
+ STRING_TOKEN (STR_SETFDT_UPDATE_SUCCEEDED),
+ mFdtPlatformDxeHiiHandle,
+ FdtVariableValue
+ );
+ } else {
+ ShellPrintHiiEx (
+ -1, -1, NULL,
+ STRING_TOKEN (STR_SETFDT_UPDATE_DELETED),
+ mFdtPlatformDxeHiiHandle,
+ FdtVariableValue
+ );
+ }
} else {
if (Status == EFI_INVALID_PARAMETER) {
ShellPrintHiiEx (
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits