diff options
Diffstat (limited to 'EmbeddedPkg')
-rw-r--r-- | EmbeddedPkg/Ebl/Ebl.h | 5 | ||||
-rw-r--r-- | EmbeddedPkg/Ebl/Ebl.inf | 1 | ||||
-rw-r--r-- | EmbeddedPkg/Ebl/Main.c | 10 | ||||
-rw-r--r-- | EmbeddedPkg/Ebl/Variable.c | 192 | ||||
-rw-r--r-- | EmbeddedPkg/EmbeddedPkg.dec | 7 | ||||
-rw-r--r-- | EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c | 4 | ||||
-rwxr-xr-x | EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S | 15 |
7 files changed, 218 insertions, 16 deletions
diff --git a/EmbeddedPkg/Ebl/Ebl.h b/EmbeddedPkg/Ebl/Ebl.h index 04f75d0f76..5c322e5e97 100644 --- a/EmbeddedPkg/Ebl/Ebl.h +++ b/EmbeddedPkg/Ebl/Ebl.h @@ -165,6 +165,11 @@ EblInitializeNetworkCmd ( VOID ); +VOID +EblInitializeVariableCmds ( + VOID + ); + CHAR8 * ParseArguments ( IN CHAR8 *CmdLine, diff --git a/EmbeddedPkg/Ebl/Ebl.inf b/EmbeddedPkg/Ebl/Ebl.inf index 44bab64b07..7c302337a5 100644 --- a/EmbeddedPkg/Ebl/Ebl.inf +++ b/EmbeddedPkg/Ebl/Ebl.inf @@ -43,6 +43,7 @@ Script.c
Ebl.h
Network.c
+ Variable.c
[Packages]
MdePkg/MdePkg.dec
diff --git a/EmbeddedPkg/Ebl/Main.c b/EmbeddedPkg/Ebl/Main.c index 98097e4be1..8f6f4ea9e1 100644 --- a/EmbeddedPkg/Ebl/Main.c +++ b/EmbeddedPkg/Ebl/Main.c @@ -187,7 +187,7 @@ ParseArguments ( break;
}
- // Perform any text coversion here
+ // Perform any text conversion here
if (*Char == '\t') {
// TAB to space
*Char = ' ';
@@ -205,9 +205,14 @@ ParseArguments ( }
} else {
// Looking for the terminator of an Argv[] entry
- if ((InQuote && (*Char == '"')) || (!InQuote && (*Char == ' '))) {
+ if (!InQuote && (*Char == ' ')) {
*Char = '\0';
LookingForArg = TRUE;
+ } else if (!InQuote && (*Char == '"') && (*(Char-1) != '\\')) {
+ InQuote = TRUE;
+ } else if (InQuote && (*Char == '"') && (*(Char-1) != '\\')) {
+ *Char = '\0';
+ InQuote = FALSE;
}
}
}
@@ -597,6 +602,7 @@ EdkBootLoaderEntry ( EblInitializeScriptCmd ();
EblInitializeExternalCmd ();
EblInitializeNetworkCmd();
+ EblInitializeVariableCmds ();
// Disable the 5 minute EFI watchdog time so we don't get automatically reset
gBS->SetWatchdogTimer (0, 0, 0, NULL);
diff --git a/EmbeddedPkg/Ebl/Variable.c b/EmbeddedPkg/Ebl/Variable.c new file mode 100644 index 0000000000..330a143375 --- /dev/null +++ b/EmbeddedPkg/Ebl/Variable.c @@ -0,0 +1,192 @@ +/** @file +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ +
+#include "Ebl.h"
+ +#include <Guid/GlobalVariable.h> +
+EFI_STATUS
+EblGetCmd (
+ IN UINTN Argc,
+ IN CHAR8 **Argv
+ )
+{
+ EFI_STATUS Status = EFI_INVALID_PARAMETER;
+ UINTN Size; + VOID* Value; + CHAR8* AsciiVariableName = NULL; + CHAR16* VariableName; + UINT32 Index; + + if (Argc == 1) { + AsciiPrint("Variable name is missing.\n"); + return Status; + } + + for (Index = 1; Index < Argc; Index++) { + if (Argv[Index][0] == '-') { + AsciiPrint("Warning: '%a' not recognized.\n",Argv[Index]); + } else { + AsciiVariableName = Argv[Index]; + } + } + + if (AsciiVariableName == NULL) { + AsciiPrint("Variable name is missing.\n"); + return Status; + } else { + VariableName = AllocatePool((AsciiStrLen (AsciiVariableName) + 1) * sizeof (CHAR16)); + AsciiStrToUnicodeStr (AsciiVariableName,VariableName); + } + + // Try to get the variable size. + Value = NULL; + Size = 0; + Status = gRT->GetVariable (VariableName, &gEfiGlobalVariableGuid, NULL, &Size, Value); + if (Status == EFI_NOT_FOUND) { + AsciiPrint("Variable name '%a' not found.\n",VariableName); + } else if (Status == EFI_BUFFER_TOO_SMALL) { + // Get the environment variable value + Value = AllocatePool (Size); + if (Value == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Status = gRT->GetVariable ((CHAR16 *)VariableName, &gEfiGlobalVariableGuid, NULL, &Size, Value); + if (EFI_ERROR (Status)) { + AsciiPrint("Error: '%r'\n",Status); + } else { + AsciiPrint("%a=%a\n",AsciiVariableName,Value); + } + FreePool(Value); + } else { + AsciiPrint("Error: '%r'\n",Status); + }
+
+ FreePool(VariableName);
+ return Status;
+}
+
+EFI_STATUS
+EblSetCmd (
+ IN UINTN Argc,
+ IN CHAR8 **Argv
+ )
+{
+ EFI_STATUS Status = EFI_INVALID_PARAMETER;
+ CHAR8* AsciiVariableSetting = NULL; + CHAR8* AsciiVariableName; + CHAR8* AsciiValue; + UINT32 AsciiValueLength; + CHAR16* VariableName; + UINT32 Index;
+ UINT32 EscapedQuotes = 0;
+ BOOLEAN Volatile = FALSE;
+
+ if (Argc == 1) { + AsciiPrint("Variable name is missing.\n"); + return Status; + } + + for (Index = 1; Index < Argc; Index++) { + if (AsciiStrCmp(Argv[Index],"-v") == 0) { + Volatile = 0; + } else if (Argv[Index][0] == '-') { + AsciiPrint("Warning: '%a' not recognized.\n",Argv[Index]); + } else { + AsciiVariableSetting = Argv[Index]; + } + } + + if (AsciiVariableSetting == NULL) { + AsciiPrint("Variable name is missing.\n"); + return Status; + } + + // Check if it is a valid variable setting + AsciiValue = AsciiStrStr (AsciiVariableSetting,"=");
+ if (AsciiValue == NULL) { + AsciiPrint("Variable setting is incorrect. It should be VariableName=Value\n"); + return Status; + }
+
+ AsciiValue[0] = '\0';
+ AsciiVariableName = AsciiVariableSetting;
+ AsciiValue++;
+
+ // Clean AsciiValue from quote
+ if (AsciiValue[0] == '"') {
+ AsciiValue++;
+ }
+ AsciiValueLength = AsciiStrLen (AsciiValue);
+ if ((AsciiValue[AsciiValueLength-2] != '\\') && (AsciiValue[AsciiValueLength-1] == '"')) {
+ AsciiValue[AsciiValueLength-1] = '\0';
+ }
+
+ // Clean AsciiValue from escaped quotes
+ for (Index = 0; Index < AsciiValueLength; Index++) {
+ if ((Index > 0) && (AsciiValue[Index-1] == '\\') && (AsciiValue[Index] == '"')) {
+ EscapedQuotes++;
+ }
+ AsciiValue[Index-EscapedQuotes] = AsciiValue[Index];
+ }
+ // Fill the end of the value with '\0'
+ for (Index = 0; Index < EscapedQuotes; Index++) {
+ AsciiValue[AsciiValueLength-1-Index] = '\0';
+ }
+
+ // Convert VariableName into Unicode
+ VariableName = AllocatePool((AsciiStrLen (AsciiVariableName) + 1) * sizeof (CHAR16)); + AsciiStrToUnicodeStr (AsciiVariableName,VariableName);
+
+ Status = gRT->SetVariable ( + VariableName, + &gEfiGlobalVariableGuid, + ( !Volatile ? EFI_VARIABLE_NON_VOLATILE : 0) | + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + AsciiStrLen (AsciiValue)+1, + AsciiValue + );
+
+ AsciiPrint("'%a'='%a'\n",AsciiVariableName,AsciiValue);
+
+ return Status;
+}
+
+GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdVariableTemplate[] =
+{
+ {
+ "get",
+ " ; get UEFI variable\n\r [v]; verbose",
+ NULL,
+ EblGetCmd
+ },
+ {
+ "set",
+ " ; set UEFI variable\n\r [v]; create volatile variable",
+ NULL,
+ EblSetCmd
+ }
+};
+
+/**
+ Initialize the commands in this in this file
+**/
+VOID
+EblInitializeVariableCmds (
+ VOID
+ )
+{
+ EblAddCommands (mCmdVariableTemplate, sizeof (mCmdVariableTemplate)/sizeof (EBL_COMMAND_TABLE));
+}
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index ca83ad93e4..714242fc6e 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -65,11 +65,11 @@ gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE|BOOLEAN|0x00000005
gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE|BOOLEAN|0x00000006
gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|FALSE|BOOLEAN|0x00000041
- gEmbeddedTokenSpaceGuid.PcdEmbeddedProbeRemovable|TRUE|BOOLEAN|0x00000050
+ gEmbeddedTokenSpaceGuid.PcdEmbeddedProbeRemovable|TRUE|BOOLEAN|0x00000052
gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|FALSE|BOOLEAN|0x0000001b
gEmbeddedTokenSpaceGuid.PcdCacheEnable|FALSE|BOOLEAN|0x00000042
- gEmbeddedTokenSpaceGuid.PcdGdbSerial|FALSE|BOOLEAN|0x00000051
+ gEmbeddedTokenSpaceGuid.PcdGdbSerial|FALSE|BOOLEAN|0x00000053
[PcdsFixedAtBuild.common]
@@ -94,6 +94,9 @@ gEmbeddedTokenSpaceGuid.PcdFlashFvMainOffset|0x0|UINT32|0x00000044
gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize|0x0|UINT32|0x00000045
+ gEmbeddedTokenSpaceGuid.PcdFlashFvSecBase|0x0|UINT32|0x00000050
+ gEmbeddedTokenSpaceGuid.PcdFlashFvSecSize|0x0|UINT32|0x00000051
+
# Used to help reduce fragmentation in the EFI memory map
# EFI Pages (4K) are the units used
diff --git a/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c b/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c index c5fdb34ad1..0edd5d018d 100644 --- a/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c +++ b/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c @@ -45,7 +45,7 @@ EblGetCurrentIpAddress ( CopyMem (Ip, &Pxe->Mode->StationIp, sizeof (EFI_IP_ADDRESS)); - return Status; + return EFI_SUCCESS; } @@ -63,7 +63,7 @@ EblGetCurrentMacAddress ( return Status; } - CopyMem (SimpleNet->Mode->CurrentAddress.Addr, Mac, sizeof (EFI_MAC_ADDRESS)); + CopyMem (Mac, SimpleNet->Mode->CurrentAddress.Addr, sizeof (EFI_MAC_ADDRESS)); return Status; } diff --git a/EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S b/EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S index 2682581ea9..f8c4e296ca 100755 --- a/EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S +++ b/EmbeddedPkg/Library/GdbDebugAgent/Arm/ExceptionSupport.ARMv6.S @@ -50,16 +50,11 @@ This is the stack constructed by the exception handler (low address to high addr */ -.globl ASM_PFX(ExceptionHandlersStart) -INTERWORK_FUNC(ExceptionHandlersStart) -.globl ASM_PFX(ExceptionHandlersEnd) -INTERWORK_FUNC(ExceptionHandlersEnd) -.globl ASM_PFX(CommonExceptionEntry) -INTERWORK_FUNC(CommonExceptionEntry) -.globl ASM_PFX(AsmCommonExceptionEntry) -INTERWORK_FUNC(AsmCommonExceptionEntry) -.globl ASM_PFX(GdbExceptionHandler) -INTERWORK_FUNC(GdbExceptionHandler) +GCC_ASM_EXPORT(ExceptionHandlersStart) +GCC_ASM_EXPORT(ExceptionHandlersEnd) +GCC_ASM_EXPORT(CommonExceptionEntry) +GCC_ASM_EXPORT(AsmCommonExceptionEntry) +GCC_ASM_EXPORT(GdbExceptionHandler) .text .align 3 |