EmbeddedPkg Omap35xxPkg: remove EBL and associated libraries

EBL is a deprecated, small memory footprint alternative for the
UEFI Shell that is no longer in use by any platforms in EDK2 or
in edk2-platforms. To avoid confusion, let's remove it from the
tree.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
Ard Biesheuvel 2017-11-15 15:36:07 +00:00
parent d780544d3d
commit 5604d269ab
34 changed files with 0 additions and 7793 deletions

View File

@ -60,8 +60,6 @@
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
# These libraries are used by the dynamic EFI Shell commands
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
@ -265,7 +263,6 @@
[PcdsFixedAtBuild.common]
gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"Beagle Board"
gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"BeagleEdk2"
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000

View File

@ -1,65 +0,0 @@
/** @file
%CommandName% for EBL (Embedded Boot Loader)
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
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.
Module Name: CmdTemplate.c
Search/Replace %CommandName% with the name of your new command
**/
#include "Ebl.h"
/**
Fill Me In
Argv[0] - "%CommandName%"
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
Ebl%CommandName%Cmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
return EFI_SUCCESS;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmd%CommandName%Template[] =
{
{
"%CommandName%",
" [show args] ; explain args and command",
NULL,
Ebl%CommandName%Cmd
}
};
/**
Initialize the commands in this file
**/
VOID
EblInitialize%CommandName%Cmd (
VOID
)
{
EblAddCommands (mCmd%CommandName%Template, sizeof (mCmd%CommandName%Template)/sizeof (EBL_COMMAND_TABLE));
}

View File

@ -1,925 +0,0 @@
/** @file
Basic commands and command processing infrastructure for EBL
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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 <Protocol/DiskIo.h>
#include <Protocol/BlockIo.h>
UINTN mCmdTableMaxIndex = EBL_MAX_COMMAND_COUNT;
UINTN mCmdTableNextFreeIndex = 0;
EBL_COMMAND_TABLE *mCmdTable[EBL_MAX_COMMAND_COUNT];
/**
Converts a lowercase Ascii character to upper one
If Chr is lowercase Ascii character, then converts it to upper one.
If Value >= 0xA0, then ASSERT().
If (Value & 0x0F) >= 0x0A, then ASSERT().
@param chr one Ascii character
@return The uppercase value of Ascii character
**/
STATIC
CHAR8
AsciiToUpper (
IN CHAR8 Chr
)
{
return (UINT8) ((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);
}
/**
Case insensitive comparison of two Null-terminated Unicode strings with maximum
lengths, and returns the difference between the first mismatched Unicode
characters.
This function compares the Null-terminated Unicode string FirstString to the
Null-terminated Unicode string SecondString. At most, Length Unicode
characters will be compared. If Length is 0, then 0 is returned. If
FirstString is identical to SecondString, then 0 is returned. Otherwise, the
value returned is the first mismatched Unicode character in SecondString
subtracted from the first mismatched Unicode character in FirstString.
@param FirstString Pointer to a Null-terminated ASCII string.
@param SecondString Pointer to a Null-terminated ASCII string.
@param Length Max length to compare.
@retval 0 FirstString is identical to SecondString using case insensitive
comparisons.
@retval !=0 FirstString is not identical to SecondString using case
insensitive comparisons.
**/
INTN
EFIAPI
AsciiStrniCmp (
IN CONST CHAR8 *FirstString,
IN CONST CHAR8 *SecondString,
IN UINTN Length
)
{
if (Length == 0) {
return 0;
}
while ((AsciiToUpper (*FirstString) != '\0') &&
(AsciiToUpper (*FirstString) == AsciiToUpper (*SecondString)) &&
(Length > 1)) {
FirstString++;
SecondString++;
Length--;
}
return AsciiToUpper (*FirstString) - AsciiToUpper (*SecondString);
}
/**
Add a command to the mCmdTable. If there is no free space in the command
table ASSERT. The mCmdTable is maintained in alphabetical order and the
new entry is inserted into its sorted position.
@param Entry Command Entry to add to the CmdTable
**/
VOID
EFIAPI
EblAddCommand (
IN const EBL_COMMAND_TABLE *Entry
)
{
UINTN Count;
if (mCmdTableNextFreeIndex == EBL_MAX_COMMAND_COUNT) {
//
// Ran out of space to store commands. Increase EBL_MAX_COMMAND_COUNT
//
ASSERT (FALSE);
return;
}
//
// Add command and Insertion sort array in the process
//
mCmdTable[mCmdTableNextFreeIndex] = (EBL_COMMAND_TABLE *)Entry;
if (mCmdTableNextFreeIndex != 0) {
for (Count = mCmdTableNextFreeIndex; Count > 0; Count--) {
if (AsciiStriCmp (mCmdTable[Count - 1]->Name, Entry->Name) <= 0) {
break;
}
mCmdTable[Count] = mCmdTable[Count - 1];
}
mCmdTable[Count] = (EBL_COMMAND_TABLE *)Entry;
}
mCmdTableNextFreeIndex++;
}
/**
Add an set of commands to the command table. Most commonly used on static
array of commands.
@param EntryArray Pointer to array of command entries
@param ArrayCount Number of command entries to add
**/
VOID
EFIAPI
EblAddCommands (
IN const EBL_COMMAND_TABLE *EntryArray,
IN UINTN ArrayCount
)
{
UINTN Index;
for (Index = 0; Index < ArrayCount; Index++) {
EblAddCommand (&EntryArray[Index]);
}
}
EBL_ADD_COMMAND_PROTOCOL gEblAddCommand = {
EblAddCommand,
EblAddCommands,
EblGetCharKey,
EblAnyKeyToContinueQtoQuit
};
/**
Return the best matching command for the passed in command name. The match
does not have to be exact, it just needs to be unique. This enables commands
to be shortened to the smallest set of starting characters that is unique.
@param CommandName Name of command to search for
@return NULL CommandName did not match or was not unique
Other Pointer to EBL_COMMAND_TABLE entry for CommandName
**/
EBL_COMMAND_TABLE *
EblGetCommand (
IN CHAR8 *CommandName
)
{
UINTN Index;
UINTN BestMatchCount;
UINTN Length;
EBL_COMMAND_TABLE *Match;
CHAR8 *Str;
Length = AsciiStrLen (CommandName);
Str = AsciiStrStr (CommandName, ".");
if (Str != NULL) {
// If the command includes a trailing . command extension skip it for the match.
// Example: hexdump.4
Length = (UINTN)(Str - CommandName);
}
for (Index = 0, BestMatchCount = 0, Match = NULL; Index < mCmdTableNextFreeIndex; Index++) {
if (AsciiStriCmp (mCmdTable[Index]->Name, CommandName) == 0) {
// match a command exactly
return mCmdTable[Index];
}
if (AsciiStrniCmp (CommandName, mCmdTable[Index]->Name, Length) == 0) {
// partial match, so keep looking to make sure there is only one partial match
BestMatchCount++;
Match = mCmdTable[Index];
}
}
if (BestMatchCount == 1) {
return Match;
}
//
// We had no matches or too many matches
//
return NULL;
}
UINTN
CountNewLines (
IN CHAR8 *Str
)
{
UINTN Count;
if (Str == NULL) {
return 0;
}
for (Count = 0; *Str != '\0'; Str++) {
if (Str[Count] == '\n') {
Count++;
}
}
return Count;
}
/**
List out help information on all the commands or print extended information
about a specific passed in command.
Argv[0] - "help"
Argv[1] - Command to display help about
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblHelpCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
UINTN Index;
CHAR8 *Ptr;
UINTN CurrentRow = 0;
if (Argc == 1) {
// Print all the commands
AsciiPrint ("Embedded Boot Loader (EBL) commands (help command for more info):\n");
CurrentRow++;
for (Index = 0; Index < mCmdTableNextFreeIndex; Index++) {
EblSetTextColor (EFI_YELLOW);
AsciiPrint (" %a", mCmdTable[Index]->Name);
EblSetTextColor (0);
AsciiPrint ("%a\n", mCmdTable[Index]->HelpSummary);
// Handle multi line help summaries
CurrentRow += CountNewLines (mCmdTable[Index]->HelpSummary);
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
break;
}
}
} else if (Argv[1] != NULL) {
// Print specific help
for (Index = 0, CurrentRow = 0; Index < mCmdTableNextFreeIndex; Index++) {
if (AsciiStriCmp (Argv[1], mCmdTable[Index]->Name) == 0) {
Ptr = (mCmdTable[Index]->Help == NULL) ? mCmdTable[Index]->HelpSummary : mCmdTable[Index]->Help;
AsciiPrint ("%a%a\n", Argv[1], Ptr);
// Handle multi line help summaries
CurrentRow += CountNewLines (Ptr);
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
break;
}
}
}
}
return EFI_SUCCESS;
}
/**
Exit the EBL. If the command processor sees EFI_ABORTED return status it will
exit the EBL.
Argv[0] - "exit"
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_ABORTED
**/
EFI_STATUS
EFIAPI
EblExitCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status;
UINTN MemoryMapSize;
EFI_MEMORY_DESCRIPTOR *MemoryMap;
UINTN MapKey;
UINTN DescriptorSize;
UINT32 DescriptorVersion;
UINTN Pages;
if (Argc > 1) {
if (AsciiStriCmp (Argv[1], "efi") != 0) {
return EFI_ABORTED;
}
} else if (Argc == 1) {
return EFI_ABORTED;
}
MemoryMap = NULL;
MemoryMapSize = 0;
do {
Status = gBS->GetMemoryMap (
&MemoryMapSize,
MemoryMap,
&MapKey,
&DescriptorSize,
&DescriptorVersion
);
if (Status == EFI_BUFFER_TOO_SMALL) {
Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1;
MemoryMap = AllocatePages (Pages);
//
// Get System MemoryMap
//
Status = gBS->GetMemoryMap (
&MemoryMapSize,
MemoryMap,
&MapKey,
&DescriptorSize,
&DescriptorVersion
);
// Don't do anything between the GetMemoryMap() and ExitBootServices()
if (!EFI_ERROR (Status)) {
Status = gBS->ExitBootServices (gImageHandle, MapKey);
if (EFI_ERROR (Status)) {
FreePages (MemoryMap, Pages);
MemoryMap = NULL;
MemoryMapSize = 0;
}
}
}
} while (EFI_ERROR (Status));
//
// At this point it is very dangerous to do things EFI as most of EFI is now gone.
// This command is useful if you are working with a debugger as it will shutdown
// DMA and other things that could break a soft resets.
//
CpuDeadLoop ();
// Should never get here, but makes the compiler happy
return EFI_ABORTED;
}
/**
Update the screen by decrementing the timeout value.
This AsciiPrint has to match the AsciiPrint in
EblPauseCmd.
@param ElaspedTime Current timeout value remaining
**/
VOID
EFIAPI
EblPauseCallback (
IN UINTN ElapsedTime
)
{
AsciiPrint ("\b\b\b\b\b\b\b\b\b\b\b\b \b\b%3d seconds", ElapsedTime);
}
/**
Pause until a key is pressed and abort the remaining commands on the command
line. If no key is pressed continue processing the command line. This command
allows the user to stop an operation from happening and return control to the
command prompt.
Argv[0] - "pause"
Argv[1] - timeout value is decimal seconds
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS Timeout expired with no input
@return EFI_TIMEOUT Stop processing other commands on the same command line
**/
EFI_STATUS
EFIAPI
EblPauseCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status;
UINTN Delay;
EFI_INPUT_KEY Key;
Delay = (Argc == 1)? 10 : AsciiStrDecimalToUintn (Argv[1]);
AsciiPrint ("Hit any key to break. You have %3d seconds", Delay);
Status = EblGetCharKey (&Key, Delay, EblPauseCallback);
AsciiPrint ("\n");
// If we timeout then the pause succeeded thus return success
// If we get a key return timeout to stop other command on this cmd line
return (Status == EFI_SUCCESS) ? EFI_TIMEOUT : EFI_SUCCESS;;
}
/**
On a debug build issue a software breakpoint to enter the debugger
Argv[0] - "break"
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblBreakPointCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
CpuBreakpoint ();
return EFI_SUCCESS;
}
/**
Reset the system. If no Argument do a Cold reset. If argument use that reset type
(W)arm = Warm Reset
(S)hutdown = Shutdown Reset
Argv[0] - "reset"
Argv[1] - warm or shutdown reset type
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblResetCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_RESET_TYPE ResetType;
ResetType = EfiResetCold;
if (Argc > 1) {
switch (*Argv[1]) {
case 'W':
case 'w':
ResetType = EfiResetWarm;
break;
case 'S':
case 's':
ResetType = EfiResetShutdown;
}
}
gRT->ResetSystem (ResetType, EFI_SUCCESS, 0, NULL);
return EFI_SUCCESS;
}
/**
Toggle page break global. This turns on and off prompting to Quit or hit any
key to continue when a command is about to scroll the screen with its output
Argv[0] - "page"
Argv[1] - on or off
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblPageCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
if (Argc <= 1) {
// toggle setting
gPageBreak = (gPageBreak) ? FALSE : TRUE;
} else {
// use argv to set the value
if ((Argv[1][0] == 'o') || (Argv[1][0] == 'O')) {
if ((Argv[1][1] == 'n') || (Argv[1][1] == 'N')) {
gPageBreak = TRUE;
} else if ((Argv[1][1] == 'f') || (Argv[1][1] == 'F')) {
gPageBreak = FALSE;
} else {
return EFI_INVALID_PARAMETER;
}
}
}
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
EblSleepCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
UINTN Delay;
Delay = (Argc == 1)? 10 : AsciiStrDecimalToUintn (Argv[1]);
gBS->Stall (Delay * 1000000);
return EFI_SUCCESS;
}
CHAR8
ConvertToTextLine (
IN CHAR8 Character
)
{
if (Character < ' ' || Character > '~') {
return '.';
} else {
return Character;
}
}
UINTN
GetBytes (
IN UINT8 *Address,
IN UINTN Bytes
)
{
UINTN Result = 0;
if (Bytes >= 1) {
Result = *Address++;
}
if (Bytes >= 2) {
Result = (Result << 8) + *Address++;
}
if (Bytes >= 3) {
Result = (Result << 8) + *Address++;
}
return Result;
}
CHAR8 mBlanks[] = " ";
EFI_STATUS
OutputData (
IN UINT8 *Address,
IN UINTN Length,
IN UINTN Width,
IN UINTN Offset
)
{
UINT8 *EndAddress;
UINTN Line;
CHAR8 TextLine[0x11];
UINTN CurrentRow = 0;
UINTN Bytes;
UINTN Spaces = 0;
CHAR8 Blanks[80];
AsciiStrCpyS (Blanks, sizeof Blanks, mBlanks);
for (EndAddress = Address + Length; Address < EndAddress; Offset += Line) {
AsciiPrint ("%08x: ", Offset);
for (Line = 0; (Line < 0x10) && (Address < EndAddress);) {
Bytes = EndAddress - Address;
switch (Width) {
case 4:
if (Bytes >= 4) {
AsciiPrint ("%08x ", *((UINT32 *)Address));
TextLine[Line++] = ConvertToTextLine(*Address++);
TextLine[Line++] = ConvertToTextLine(*Address++);
TextLine[Line++] = ConvertToTextLine(*Address++);
TextLine[Line++] = ConvertToTextLine(*Address++);
} else {
AsciiPrint ("%08x ", GetBytes(Address, Bytes));
Address += Bytes;
Line += Bytes;
}
break;
case 2:
if (Bytes >= 2) {
AsciiPrint ("%04x ", *((UINT16 *)Address));
TextLine[Line++] = ConvertToTextLine(*Address++);
TextLine[Line++] = ConvertToTextLine(*Address++);
} else {
AsciiPrint ("%04x ", GetBytes(Address, Bytes));
Address += Bytes;
Line += Bytes;
}
break;
case 1:
AsciiPrint ("%02x ", *((UINT8 *)Address));
TextLine[Line++] = ConvertToTextLine(*Address++);
break;
default:
AsciiPrint ("Width must be 1, 2, or 4!\n");
return EFI_INVALID_PARAMETER;
}
}
// Pad spaces
if (Line < 0x10) {
switch (Width) {
case 4:
Spaces = 9 * ((0x10 - Line)/4);
break;
case 2:
Spaces = 5 * ((0x10 - Line)/2);
break;
case 1:
Spaces = 3 * (0x10 - Line);
break;
}
Blanks[Spaces] = '\0';
AsciiPrint(Blanks);
Blanks[Spaces] = ' ';
}
TextLine[Line] = 0;
AsciiPrint ("|%a|\n", TextLine);
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
return EFI_END_OF_FILE;
}
}
if (Length % Width != 0) {
AsciiPrint ("%08x\n", Offset);
}
return EFI_SUCCESS;
}
/**
See if command contains .# where # is a number. Return # as the Width
or 1 as the default Width for commands.
Example hexdump.4 returns a width of 4.
@param Argv Argv[0] is the command name
@return Width of command
**/
UINTN
WidthFromCommandName (
IN CHAR8 *Argv,
IN UINTN Default
)
{
CHAR8 *Str;
UINTN Width;
//Hexdump.2 HexDump.4 mean use a different width
Str = AsciiStrStr (Argv, ".");
if (Str != NULL) {
Width = AsciiStrDecimalToUintn (Str + 1);
if (Width == 0) {
Width = Default;
}
} else {
// Default answer
return Default;
}
return Width;
}
#define HEXDUMP_CHUNK 1024
/**
Toggle page break global. This turns on and off prompting to Quit or hit any
key to continue when a command is about to scroll the screen with its output
Argv[0] - "hexdump"[.#] # is optional 1,2, or 4 for width
Argv[1] - Device or File to dump.
Argv[2] - Optional offset to start dumping
Argv[3] - Optional number of bytes to dump
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblHexdumpCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_OPEN_FILE *File;
VOID *Location;
UINTN Size;
UINTN Width;
UINTN Offset = 0;
EFI_STATUS Status;
UINTN Chunk = HEXDUMP_CHUNK;
if ((Argc < 2) || (Argc > 4)) {
return EFI_INVALID_PARAMETER;
}
Width = WidthFromCommandName (Argv[0], 1);
if ((Width != 1) && (Width != 2) && (Width != 4)) {
return EFI_INVALID_PARAMETER;
}
File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);
if (File == NULL) {
return EFI_NOT_FOUND;
}
Location = AllocatePool (Chunk);
Size = (Argc > 3) ? AsciiStrHexToUintn (Argv[3]) : EfiTell (File, NULL);
Offset = 0;
if (Argc > 2) {
Offset = AsciiStrHexToUintn (Argv[2]);
if (Offset > 0) {
// Make sure size includes the part of the file we have skipped
Size += Offset;
}
}
Status = EfiSeek (File, Offset, EfiSeekStart);
if (EFI_ERROR (Status)) {
goto Exit;
}
for (; Offset + HEXDUMP_CHUNK <= Size; Offset += Chunk) {
Chunk = HEXDUMP_CHUNK;
Status = EfiRead (File, Location, &Chunk);
if (EFI_ERROR(Status)) {
AsciiPrint ("Error reading file content\n");
goto Exit;
}
Status = OutputData (Location, Chunk, Width, File->BaseOffset + Offset);
if (EFI_ERROR(Status)) {
if (Status == EFI_END_OF_FILE) {
Status = EFI_SUCCESS;
}
goto Exit;
}
}
// Any left over?
if (Offset < Size) {
Chunk = Size - Offset;
Status = EfiRead (File, Location, &Chunk);
if (EFI_ERROR(Status)) {
AsciiPrint ("Error reading file content\n");
goto Exit;
}
Status = OutputData (Location, Chunk, Width, File->BaseOffset + Offset);
if (EFI_ERROR(Status)) {
if (Status == EFI_END_OF_FILE) {
Status = EFI_SUCCESS;
}
goto Exit;
}
}
Exit:
EfiClose (File);
FreePool (Location);
return EFI_SUCCESS;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdTemplate[] =
{
{
"reset",
" [type]; Reset system. type = [warm] [shutdown] default is cold reset",
NULL,
EblResetCmd
},
{
"exit",
"; Exit EBL",
NULL,
EblExitCmd
},
{
"help",
" [cmd]; Help on cmd or a list of all commands if cmd is ommited",
NULL,
EblHelpCmd
},
{
"break",
"; Generate debugging breakpoint",
NULL,
EblBreakPointCmd
},
{
"page",
" [on|off]]; toggle promting on command output larger than screen",
NULL,
EblPageCmd
},
{
"pause",
" [sec]; Pause for sec[10] seconds. ",
NULL,
EblPauseCmd
},
{
"sleep",
" [sec]; Sleep for sec[10] seconds. ",
NULL,
EblSleepCmd
},
{
"hexdump",
"[.{1|2|4}] filename [Offset] [Size]; dump a file as hex .width",
NULL,
EblHexdumpCmd
}
};
EFI_HANDLE gExternalCmdHandle = NULL;
/**
Initialize the commands in this in this file
**/
VOID
EblInitializeCmdTable (
VOID
)
{
EblAddCommands (mCmdTemplate, sizeof (mCmdTemplate)/sizeof (EBL_COMMAND_TABLE));
gBS->InstallProtocolInterface (
&gExternalCmdHandle,
&gEfiEblAddCommandProtocolGuid,
EFI_NATIVE_INTERFACE,
&gEblAddCommand
);
}
VOID
EblShutdownExternalCmdTable (
VOID
)
{
gBS->UninstallProtocolInterface (gExternalCmdHandle, &gEfiEblAddCommandProtocolGuid, &gEblAddCommand);
}

View File

@ -1,357 +0,0 @@
/** @file
Dir for EBL (Embedded Boot Loader)
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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.
Module Name: CmdTemplate.c
Search/Replace Dir with the name of your new command
**/
#include "Ebl.h"
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 *gFvFileType[] = {
"All",
"Bin",
"section",
"SEC",
"PeiCore",
"DxeCore",
"PEIM",
"Driver",
"Combo",
"App",
"NULL",
"FV"
};
/**
Perform a dir on a device. The device must support Simple File System Protocol
or the FV protocol.
Argv[0] - "dir"
Argv[1] - Device Name:path. Path is optional
Argv[2] - Optional filename to match on. A leading * means match substring
Argv[3] - Optional FV file type
dir fs1:\efi ; perform a dir on fs1: device in the efi directory
dir fs1:\efi *.efi; perform a dir on fs1: device in the efi directory but
only print out files that contain the string *.efi
dir fv1:\ ; perform a dir on fv1: device in the efi directory
NOTE: fv devices do not contain subdirs
dir fv1:\ * PEIM ; will match all files of type PEIM
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblDirCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status;
EFI_OPEN_FILE *File;
EFI_FILE_INFO *DirInfo;
UINTN ReadSize;
UINTN CurrentRow;
CHAR16 *MatchSubString;
EFI_STATUS GetNextFileStatus;
UINTN Key;
EFI_FV_FILETYPE SearchType;
EFI_FV_FILETYPE Type;
EFI_FV_FILE_ATTRIBUTES Attributes;
UINTN Size;
EFI_GUID NameGuid;
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
UINT32 AuthenticationStatus;
VOID *Section;
UINTN SectionSize;
EFI_FV_FILETYPE Index;
UINTN Length;
UINTN BestMatchCount;
CHAR16 UnicodeFileName[MAX_CMD_LINE];
CHAR8 *Path;
CHAR8 *TypeStr;
UINTN TotalSize;
if (Argc <= 1) {
Path = EfiGetCwd ();
if (Path == NULL) {
return EFI_SUCCESS;
}
} else {
Path = Argv[1];
}
File = EfiOpen (Path, EFI_FILE_MODE_READ, 0);
if (File == NULL) {
return EFI_SUCCESS;
}
if (File->Type == EfiOpenFirmwareVolume) {
// FV Dir
SearchType = EFI_FV_FILETYPE_ALL;
UnicodeFileName[0] = '\0';
MatchSubString = &UnicodeFileName[0];
if (Argc > 2) {
AsciiStrToUnicodeStrS (Argv[2], UnicodeFileName,
ARRAY_SIZE (UnicodeFileName));
if (UnicodeFileName[0] == '*') {
// Handle *Name substring matching
MatchSubString = &UnicodeFileName[1];
}
// Handle file type matchs
if (Argc > 3) {
// match a specific file type, always last argument
Length = AsciiStrLen (Argv[3]);
for (Index = 1, BestMatchCount = 0; Index < sizeof (gFvFileType)/sizeof (CHAR8 *); Index++) {
if (AsciiStriCmp (gFvFileType[Index], Argv[3]) == 0) {
// exact match
SearchType = Index;
break;
}
if (AsciiStrniCmp (Argv[3], gFvFileType[Index], Length) == 0) {
// partial match, so keep looking to make sure there is only one partial match
BestMatchCount++;
SearchType = Index;
}
}
if (BestMatchCount > 1) {
SearchType = EFI_FV_FILETYPE_ALL;
}
}
}
TotalSize = 0;
Fv = File->Fv;
Key = 0;
CurrentRow = 0;
do {
Type = SearchType;
GetNextFileStatus = Fv->GetNextFile (
Fv,
&Key,
&Type,
&NameGuid,
&Attributes,
&Size
);
if (!EFI_ERROR (GetNextFileStatus)) {
TotalSize += Size;
// Calculate size of entire file
Section = NULL;
Size = 0;
Status = Fv->ReadFile (
Fv,
&NameGuid,
Section,
&Size,
&Type,
&Attributes,
&AuthenticationStatus
);
if (!((Status == EFI_BUFFER_TOO_SMALL) || !EFI_ERROR (Status))) {
// EFI_SUCCESS or EFI_BUFFER_TOO_SMALL mean size is valid
Size = 0;
}
TypeStr = (Type <= EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) ? gFvFileType[Type] : "UNKNOWN";
// read the UI seciton to do a name match.
Section = NULL;
Status = Fv->ReadSection (
Fv,
&NameGuid,
EFI_SECTION_USER_INTERFACE,
0,
&Section,
&SectionSize,
&AuthenticationStatus
);
if (!EFI_ERROR (Status)) {
if (StrStr (Section, MatchSubString) != NULL) {
AsciiPrint ("%,9d %7a %g %s\n", Size, TypeStr, &NameGuid, Section);
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
break;
}
}
FreePool (Section);
} else {
if (*MatchSubString == '\0') {
AsciiPrint ("%,9d %7a %g\n", Size, TypeStr, &NameGuid);
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
break;
}
}
}
}
} while (!EFI_ERROR (GetNextFileStatus));
if (SearchType == EFI_FV_FILETYPE_ALL) {
AsciiPrint ("%,20d bytes in files %,d bytes free\n", TotalSize, File->FvSize - File->FvHeaderSize - TotalSize);
}
} else if ((File->Type == EfiOpenFileSystem) || (File->Type == EfiOpenBlockIo)) {
// Simple File System DIR
if (File->FsFileInfo == NULL) {
return EFI_SUCCESS;
}
if (!(File->FsFileInfo->Attribute & EFI_FILE_DIRECTORY)) {
return EFI_SUCCESS;
}
// Handle *Name substring matching
MatchSubString = NULL;
UnicodeFileName[0] = '\0';
if (Argc > 2) {
AsciiStrToUnicodeStrS (Argv[2], UnicodeFileName, MAX_CMD_LINE);
if (UnicodeFileName[0] == '*') {
MatchSubString = &UnicodeFileName[1];
}
}
File->FsFileHandle->SetPosition (File->FsFileHandle, 0);
for (CurrentRow = 0;;) {
// First read gets the size
DirInfo = NULL;
ReadSize = 0;
Status = File->FsFileHandle->Read (File->FsFileHandle, &ReadSize, DirInfo);
if (Status == EFI_BUFFER_TOO_SMALL) {
// Allocate the buffer for the real read
DirInfo = AllocatePool (ReadSize);
if (DirInfo == NULL) {
goto Done;
}
// Read the data
Status = File->FsFileHandle->Read (File->FsFileHandle, &ReadSize, DirInfo);
if ((EFI_ERROR (Status)) || (ReadSize == 0)) {
break;
}
} else {
break;
}
if (MatchSubString != NULL) {
if (StrStr (&DirInfo->FileName[0], MatchSubString) == NULL) {
// does not match *name argument, so skip
continue;
}
} else if (UnicodeFileName[0] != '\0') {
// is not an exact match for name argument, so skip
if (StrCmp (&DirInfo->FileName[0], UnicodeFileName) != 0) {
continue;
}
}
if (DirInfo->Attribute & EFI_FILE_DIRECTORY) {
AsciiPrint (" <DIR> %s\n", &DirInfo->FileName[0]);
} else {
AsciiPrint ("%,14ld %s\n", DirInfo->FileSize, &DirInfo->FileName[0]);
}
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
break;
}
FreePool (DirInfo);
}
Done:
if (DirInfo != NULL) {
FreePool (DirInfo);
}
}
EfiClose (File);
return EFI_SUCCESS;
}
/**
Change the Current Working Directory
Argv[0] - "cd"
Argv[1] - Device Name:path. Path is optional
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblCdCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
if (Argc <= 1) {
return EFI_SUCCESS;
}
return EfiSetCwd (Argv[1]);
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdDirTemplate[] =
{
{
"dir",
" dirdev [*match]; directory listing of dirdev. opt match a substring",
NULL,
EblDirCmd
},
{
"cd",
" device - set the current working directory",
NULL,
EblCdCmd
}
};
/**
Initialize the commands in this in this file
**/
VOID
EblInitializeDirCmd (
VOID
)
{
if (FeaturePcdGet (PcdEmbeddedDirCmd)) {
EblAddCommands (mCmdDirTemplate, sizeof (mCmdDirTemplate)/sizeof (EBL_COMMAND_TABLE));
}
}

View File

@ -1,210 +0,0 @@
/** @file
Include file for basic command line parser for EBL (Embedded Boot Loader)
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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.
**/
#ifndef __EBL_H__
#define __EBL_H__
#include <PiDxe.h>
#include <Protocol/BlockIo.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/LoadFile.h>
#include <Protocol/FirmwareVolumeBlock.h>
#include <Protocol/PxeBaseCode.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/EblAddCommand.h>
#include <Protocol/PciIo.h>
#include <Protocol/DevicePath.h>
#include <Guid/FileInfo.h>
#include <Guid/DxeServices.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/MemoryAllocationHob.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PrintLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/DebugLib.h>
#include <Library/EfiFileLib.h>
#include <Library/HobLib.h>
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/EblCmdLib.h>
#include <Library/DevicePathLib.h>
#include <Library/UefiLib.h>
#include <Library/EblNetworkLib.h>
#include <Library/TimerLib.h>
#include <IndustryStandard/Pci.h>
//
// Prompt for the command line
//
#define CMD_SEPARATOR ';'
#define EBL_MAX_COMMAND_COUNT 0x100
#define MAX_CMD_HISTORY 16
#define MAX_CMD_LINE 256
#define MAX_ARGS 32
#define EBL_CR 0x0a
#define EBL_LF 0x0d
#define EFI_SET_TIMER_TO_SECOND 10000000
EBL_COMMAND_TABLE *
EblGetCommand (
IN CHAR8 *CommandName
);
EFI_STATUS
EblPathToDevice (
IN CHAR8 *Path,
OUT EFI_HANDLE *DeviceHandle,
OUT EFI_DEVICE_PATH_PROTOCOL **PathDevicePath,
OUT VOID **Buffer,
OUT UINTN *BufferSize
);
BOOLEAN
EFIAPI
EblAnyKeyToContinueQtoQuit (
IN UINTN *CurrentRow,
IN BOOLEAN PrefixNewline
);
VOID
EblUpdateDeviceLists (
VOID
);
VOID
EblInitializeCmdTable (
VOID
);
VOID
EblShutdownExternalCmdTable (
VOID
);
VOID
EblSetTextColor (
UINTN Attribute
);
EFI_STATUS
EFIAPI
EblGetCharKey (
IN OUT EFI_INPUT_KEY *Key,
IN UINTN TimoutInSec,
IN EBL_GET_CHAR_CALL_BACK CallBack OPTIONAL
);
// BugBug: Move me to a library
INTN
EFIAPI
AsciiStrniCmp (
IN CONST CHAR8 *FirstString,
IN CONST CHAR8 *SecondString,
IN UINTN Length
);
VOID
EblInitializeDeviceCmd (
VOID
);
VOID
EblInitializemdHwDebugCmds (
VOID
);
VOID
EblInitializeDirCmd (
VOID
);
VOID
EblInitializeHobCmd (
VOID
);
VOID
EblInitializemdHwIoDebugCmds (
VOID
);
VOID
EblInitializeScriptCmd (
VOID
);
VOID
EblInitializeNetworkCmd (
VOID
);
VOID
EblInitializeVariableCmds (
VOID
);
CHAR8 *
ParseArguments (
IN CHAR8 *CmdLine,
OUT UINTN *Argc,
OUT CHAR8 **Argv
);
EFI_STATUS
ProcessCmdLine (
IN CHAR8 *CmdLine,
IN UINTN MaxCmdLineSize
);
EFI_STATUS
OutputData (
IN UINT8 *Address,
IN UINTN Length,
IN UINTN Width,
IN UINTN Offset
);
UINTN
WidthFromCommandName (
IN CHAR8 *Argv,
IN UINTN Default
);
extern UINTN gScreenColumns;
extern UINTN gScreenRows;
extern BOOLEAN gPageBreak;
extern CHAR8 *gMemMapType[];
#endif

View File

@ -1,111 +0,0 @@
#/** @file
# EBL Applicaiton
#
# This is a shell application that will display Hello World.
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
# 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.
#
#
#**/
################################################################################
#
# Defines Section - statements that will be processed to create a Makefile.
#
################################################################################
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = Ebl
FILE_GUID = 3CEF354A-3B7A-4519-AD70-72A134698311
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = 1.0
ENTRY_POINT = EdkBootLoaderEntry
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
Main.c
Command.c
EfiDevice.c
HwDebug.c
HwIoDebug.c
Dir.c
Hob.c
Script.c
Ebl.h
Network.c
Variable.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
DebugLib
UefiLib
UefiApplicationEntryPoint
UefiBootServicesTableLib
UefiRuntimeServicesTableLib
BaseMemoryLib
MemoryAllocationLib
DevicePathLib
IoLib
PrintLib
PcdLib
EfiFileLib
HobLib
BaseLib
EblCmdLib
EblNetworkLib
[LibraryClasses.ARM]
SemihostLib
[Protocols.common]
gEfiFirmwareVolume2ProtocolGuid
gEfiFirmwareVolumeBlockProtocolGuid
gEfiBlockIoProtocolGuid
gEfiSimpleFileSystemProtocolGuid
gEfiLoadFileProtocolGuid
gEfiLoadedImageProtocolGuid
gEfiPxeBaseCodeProtocolGuid
gEfiEblAddCommandProtocolGuid
gEfiDiskIoProtocolGuid
gEfiPciIoProtocolGuid
gEfiSimpleNetworkProtocolGuid
[Guids.common]
gEfiDxeServicesTableGuid
gEfiFileInfoGuid
gEfiHobMemoryAllocModuleGuid
gEfiMemoryTypeInformationGuid
[FeaturePcd.common]
gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot
gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd
gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd
gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd
gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable
gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd
gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd
gEmbeddedTokenSpaceGuid.PcdEmbeddedProbeRemovable
[FixedPcd.common]
gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand
gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor
gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize
gEmbeddedTokenSpaceGuid.PcdEmbeddedShellCharacterEcho
gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt

File diff suppressed because it is too large Load Diff

View File

@ -1,234 +0,0 @@
/** @file
Hob command for EBL (Embedded Boot Loader)
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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.
Module Name: Hob.c
Search/Replace Dir with the name of your new command
Boot Mode:
==========
BOOT_WITH_FULL_CONFIGURATION 0x00
BOOT_WITH_MINIMAL_CONFIGURATION 0x01
BOOT_ASSUMING_NO_CONFIGURATION_CHANGES 0x02
BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS 0x03
BOOT_WITH_DEFAULT_SETTINGS 0x04
BOOT_ON_S4_RESUME 0x05
BOOT_ON_S5_RESUME 0x06
BOOT_ON_S2_RESUME 0x10
BOOT_ON_S3_RESUME 0x11
BOOT_ON_FLASH_UPDATE 0x12
BOOT_IN_RECOVERY_MODE 0x20
BOOT_IN_RECOVERY_MODE_MASK 0x40
BOOT_SPECIAL_MASK 0x80
Mem Alloc HOB Type:
===================
typedef enum {
EfiReservedMemoryType = 0x00
EfiLoaderCode = 0x01
EfiLoaderData = 0x02
EfiBootServicesCode = 0x03
EfiBootServicesData = 0x04
EfiRuntimeServicesCode = 0x05
EfiRuntimeServicesData = 0x06
EfiConventionalMemory = 0x07
EfiUnusableMemory = 0x08
EfiACPIReclaimMemory = 0x09
EfiACPIMemoryNVS = 0x0a
EfiMemoryMappedIO = 0x0b
EfiMemoryMappedIOPortSpace = 0x0c
EfiPalCode = 0x0d
EfiMaxMemoryType = 0x0e
} EFI_MEMORY_TYPE;
Resource Hob Tye:
=================
EFI_RESOURCE_SYSTEM_MEMORY 0
EFI_RESOURCE_MEMORY_MAPPED_IO 1
EFI_RESOURCE_IO 2
EFI_RESOURCE_FIRMWARE_DEVICE 3
EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 4
EFI_RESOURCE_MEMORY_RESERVED 5
EFI_RESOURCE_IO_RESERVED 6
EFI_RESOURCE_MAX_MEMORY_TYPE 7
Resource Hob Attribute (last thing printed):
============================================
EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001
EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002
EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004
EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008
EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010
EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020
EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040
EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080
EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100
EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200
EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400
EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800
EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000
EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000
EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000
EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000
EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000
EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000
**/
#include "Ebl.h"
// BugBug: Autogen does not allow this to be included currently
//#include <EdkModulePkg/Include/EdkDxe.h>
GLOBAL_REMOVE_IF_UNREFERENCED char *mHobResourceType[] = {
"Memory ",
"MMIO ",
"IO ",
"Firmware ",
"MMIO Port ",
"Reserved ",
"IO Reserved",
"Illegal "
};
/**
Dump out the HOBs in the system. HOBs are defined in the PI specification
and they are used to hand off information from PEI to DXE.
Argv[0] - "hob"
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblHobCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
UINTN CurrentRow;
EFI_PEI_HOB_POINTERS Hob;
EFI_MEMORY_TYPE_INFORMATION *EfiMemoryTypeInformation;
UINTN Index;
CurrentRow = 0;
for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
if (Hob.Header->HobType == EFI_HOB_TYPE_HANDOFF) {
AsciiPrint ("PHIT HOB Ver %x Boot Mode %02x Top %lx Bottom %lx\n",
Hob.HandoffInformationTable->Version,
Hob.HandoffInformationTable->BootMode,
Hob.HandoffInformationTable->EfiMemoryTop,
Hob.HandoffInformationTable->EfiMemoryBottom
);
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
return EFI_SUCCESS;
}
AsciiPrint (" Free Top %lx Free Bottom %lx End Of HOB %lx\n",
Hob.HandoffInformationTable->EfiFreeMemoryTop,
Hob.HandoffInformationTable->EfiFreeMemoryBottom,
Hob.HandoffInformationTable->EfiEndOfHobList
);
} else if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
// mod(%) on array index is just to prevent buffer overrun
AsciiPrint ("Mem Alloc HOB %a %g %08lx:%lx\n",
(Hob.MemoryAllocation->AllocDescriptor.MemoryType < EfiMaxMemoryType) ? gMemMapType[Hob.MemoryAllocation->AllocDescriptor.MemoryType] : "ILLEGAL TYPE",
&Hob.MemoryAllocation->AllocDescriptor.Name,
Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress,
Hob.MemoryAllocation->AllocDescriptor.MemoryLength
);
if (CompareGuid (&gEfiHobMemoryAllocModuleGuid, &Hob.MemoryAllocation->AllocDescriptor.Name)) {
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
return EFI_SUCCESS;
}
AsciiPrint (" Module Name %g EntryPoint %lx\n", &Hob.MemoryAllocationModule->ModuleName, Hob.MemoryAllocationModule->EntryPoint);
}
} else if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
AsciiPrint ("Resource HOB %a %g %08lx:%lx\n Attributes: %08x\n",
(Hob.ResourceDescriptor->ResourceType < EFI_RESOURCE_MAX_MEMORY_TYPE) ? mHobResourceType[Hob.ResourceDescriptor->ResourceType] : mHobResourceType[EFI_RESOURCE_MAX_MEMORY_TYPE],
&Hob.ResourceDescriptor->Owner,
Hob.ResourceDescriptor->PhysicalStart,
Hob.ResourceDescriptor->ResourceLength,
Hob.ResourceDescriptor->ResourceAttribute
);
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
return EFI_SUCCESS;
}
} else if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) {
AsciiPrint ("GUID HOB %g\n", &Hob.Guid->Name);
if (CompareGuid (&gEfiMemoryTypeInformationGuid, &Hob.Guid->Name)) {
EfiMemoryTypeInformation = GET_GUID_HOB_DATA (Hob.Guid);
for (Index = 0; Index < (GET_GUID_HOB_DATA_SIZE (Hob.Guid)/sizeof (EFI_MEMORY_TYPE_INFORMATION)); Index++, EfiMemoryTypeInformation++) {
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
return EFI_SUCCESS;
}
AsciiPrint (" %a 0x%08x\n",
(EfiMemoryTypeInformation->Type < EfiMaxMemoryType) ? gMemMapType[EfiMemoryTypeInformation->Type] : "END ",
EfiMemoryTypeInformation->NumberOfPages
);
}
}
} else if (Hob.Header->HobType == EFI_HOB_TYPE_FV) {
AsciiPrint ("FV HOB %08lx:%08lx\n", Hob.FirmwareVolume->BaseAddress, Hob.FirmwareVolume->Length);
} else if (Hob.Header->HobType == EFI_HOB_TYPE_CPU) {
AsciiPrint ("CPU HOB: Mem %x IO %x\n", Hob.Cpu->SizeOfMemorySpace, Hob.Cpu->SizeOfIoSpace);
} else if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_POOL) {
AsciiPrint ("Mem Pool HOB:\n");
/* Not in PI
} else if (Hob.Header->HobType == EFI_HOB_TYPE_CV) {
AsciiPrint ("CV HOB: %08lx:%08lx\n", Hob.CapsuleVolume->BaseAddress, Hob.CapsuleVolume->Length);
*/
}
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
break;
}
}
return EFI_SUCCESS;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdHobTemplate[] =
{
{
"hob",
"; dump HOBs",
NULL,
EblHobCmd
}
};
/**
Initialize the commands in this in this file
**/
VOID
EblInitializeHobCmd (
VOID
)
{
if (FeaturePcdGet (PcdEmbeddedHobCmd)) {
EblAddCommands (mCmdHobTemplate, sizeof (mCmdHobTemplate)/sizeof (EBL_COMMAND_TABLE));
}
}

View File

@ -1,346 +0,0 @@
/** @file
Basic command line parser for EBL (Embedded Boot Loader)
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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.
Module Name: HwDebug.c
Commands useful for debugging hardware.
**/
#include "Ebl.h"
/**
Dump memory
Argv[0] - "md"[.#] # is optional width 1, 2, 4, or 8. Default 1
Argv[1] - Hex Address to dump
Argv[2] - Number of hex bytes to dump (0x20 is default)
md.4 0x123445678 50 ; Dump 0x50 4 byte quantities starting at 0x123445678
md 0x123445678 40 ; Dump 0x40 1 byte quantities starting at 0x123445678
md 0x123445678 ; Dump 0x20 1 byte quantities starting at 0x123445678
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblMdCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
STATIC UINT8 *Address = NULL;
STATIC UINTN Length = 0x20;
STATIC UINTN Width;
Width = WidthFromCommandName (Argv[0], 1);
switch (Argc) {
case 3:
Length = AsciiStrHexToUintn(Argv[2]);
case 2:
Address = (UINT8 *)AsciiStrHexToUintn (Argv[1]);
default:
break;
}
OutputData (Address, Length, Width, (UINTN)Address);
Address += Length;
return EFI_SUCCESS;
}
/**
Fill Memory with data
Argv[0] - "mfill"[.#] # is optional width 1, 2, 4, or 8. Default 4
Argv[1] - Hex Address to fill
Argv[2] - Data to write (0x00 is default)
Argv[3] - Number of units to dump.
mf.1 0x123445678 aa 100 ; Start at 0x123445678 and write aa (1 byte) to the next 100 bytes
mf.4 0x123445678 aa 100 ; Start at 0x123445678 and write aa (4 byte) to the next 400 bytes
mf 0x123445678 aa ; Start at 0x123445678 and write aa (4 byte) to the next 1 byte
mf 0x123445678 ; Start at 0x123445678 and write 00 (4 byte) to the next 1 byte
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblMfillCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
UINTN Address;
UINTN EndAddress;
UINT32 Data;
UINTN Length;
UINTN Width;
if (Argc < 2) {
return EFI_INVALID_PARAMETER;
}
Width = WidthFromCommandName (Argv[0], 4);
Address = AsciiStrHexToUintn (Argv[1]);
Data = (Argc > 2) ? (UINT32)AsciiStrHexToUintn (Argv[2]) : 0;
Length = (Argc > 3) ? AsciiStrHexToUintn (Argv[3]) : 1;
for (EndAddress = Address + (Length * Width); Address < EndAddress; Address += Width) {
if (Width == 4) {
MmioWrite32 (Address, Data);
} else if (Width == 2) {
MmioWrite16 (Address, (UINT16)Data);
} else {
MmioWrite8 (Address, (UINT8)Data);
}
}
return EFI_SUCCESS;
}
//
// Strings for PCI Class code [2]
//
CHAR8 *gPciDevClass[] = {
"Old Device ",
"Mass storage ",
"Network ",
"Display ",
"Multimedia ",
"Memory controller ",
"Bridge device ",
"simple communications ",
"base system peripherals",
"Input devices ",
"Docking stations ",
"Processors ",
"serial bus ",
};
CHAR8 *gPciSerialClassCodes[] = {
"Mass storage ",
"Firewire ",
"ACCESS bus ",
"SSA ",
"USB "
};
/**
PCI Dump
Argv[0] - "pci"
Argv[1] - bus
Argv[2] - dev
Argv[3] - func
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblPciCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *Pci;
UINTN HandleCount;
EFI_HANDLE *HandleBuffer;
UINTN Seg;
UINTN Bus;
UINTN Dev;
UINTN Func;
UINTN BusArg;
UINTN DevArg;
UINTN FuncArg;
UINTN Index;
UINTN Count;
PCI_TYPE_GENERIC PciHeader;
PCI_TYPE_GENERIC *Header;
PCI_BRIDGE_CONTROL_REGISTER *Bridge;
PCI_DEVICE_HEADER_TYPE_REGION *Device;
PCI_DEVICE_INDEPENDENT_REGION *Hdr;
CHAR8 *Str;
UINTN ThisBus;
BusArg = (Argc > 1) ? AsciiStrDecimalToUintn (Argv[1]) : 0;
DevArg = (Argc > 2) ? AsciiStrDecimalToUintn (Argv[2]) : 0;
FuncArg = (Argc > 3) ? AsciiStrDecimalToUintn (Argv[3]) : 0;
Header = &PciHeader;
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPciIoProtocolGuid, NULL, &HandleCount, &HandleBuffer);
if (EFI_ERROR (Status)) {
AsciiPrint ("No PCI devices found in the system\n");
return EFI_SUCCESS;
}
if (Argc == 1) {
// Dump all PCI devices
AsciiPrint ("BusDevFun VendorId DeviceId Device Class Sub-Class\n");
AsciiPrint ("_____________________________________________________________");
for (ThisBus = 0; ThisBus <= PCI_MAX_BUS; ThisBus++) {
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID **)&Pci);
if (!EFI_ERROR (Status)) {
Pci->GetLocation (Pci, &Seg, &Bus, &Dev, &Func);
if (ThisBus != Bus) {
continue;
}
AsciiPrint ("\n%03d.%02d.%02d", Bus, Dev, Func);
Status = Pci->Pci.Read (Pci, EfiPciIoWidthUint32, 0, sizeof (PciHeader)/sizeof (UINT32), &PciHeader);
if (!EFI_ERROR (Status)) {
Hdr = &PciHeader.Bridge.Hdr;
if (Hdr->ClassCode[2] < sizeof (gPciDevClass)/sizeof (VOID *)) {
Str = gPciDevClass[Hdr->ClassCode[2]];
if (Hdr->ClassCode[2] == PCI_CLASS_SERIAL) {
if (Hdr->ClassCode[1] < sizeof (gPciSerialClassCodes)/sizeof (VOID *)) {
// print out Firewire or USB inplace of Serial Bus controllers
Str = gPciSerialClassCodes[Hdr->ClassCode[1]];
}
}
} else {
Str = "Unknown device ";
}
AsciiPrint (" 0x%04x 0x%04x %a 0x%02x", Hdr->VendorId, Hdr->DeviceId, Str, Hdr->ClassCode[1]);
}
if (Seg != 0) {
// Only print Segment if it is non zero. If you only have one PCI segment it is
// redundent to print it out
AsciiPrint (" Seg:%d", Seg);
}
}
}
}
AsciiPrint ("\n");
} else {
// Dump specific PCI device
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID **)&Pci);
if (!EFI_ERROR (Status)) {
Pci->GetLocation (Pci, &Seg, &Bus, &Dev, &Func);
if ((Bus == BusArg) && (Dev == DevArg) && (Func == FuncArg)) {
// Only print Segment if it is non zero. If you only have one PCI segment it is
// redundant to print it out
if (Seg != 0) {
AsciiPrint ("Seg:%d ", Seg);
}
AsciiPrint ("Bus:%d Dev:%d Func:%d ", Bus, Dev, Func);
Status = Pci->Pci.Read (Pci, EfiPciIoWidthUint32, 0, sizeof (PciHeader)/sizeof (UINT32), Header);
if (!EFI_ERROR (Status)) {
Hdr = &PciHeader.Bridge.Hdr;
if (IS_PCI_BRIDGE (&PciHeader.Bridge)) {
Bridge = &PciHeader.Bridge.Bridge;
AsciiPrint (
"PCI Bridge. Bus Primary %d Secondary %d Subordinate %d\n",
Bridge->PrimaryBus, Bridge->SecondaryBus, Bridge->SubordinateBus
);
AsciiPrint (" Bar 0: 0x%08x Bar 1: 0x%08x\n", Bridge->Bar[0], Bridge->Bar[1]);
} else {
Device = &PciHeader.Device.Device;
AsciiPrint (
"VendorId: 0x%04x DeviceId: 0x%04x SubSusVendorId: 0x%04x SubSysDeviceId: 0x%04x\n",
Hdr->VendorId, Hdr->DeviceId, Device->SubsystemVendorID, Device->SubsystemID
);
AsciiPrint (" Class Code: 0x%02x 0x%02x 0x%02x\n", Hdr->ClassCode[2], Hdr->ClassCode[1], Hdr->ClassCode[0]);
for (Count = 0; Count < 6; Count++) {
AsciiPrint (" Bar %d: 0x%08x\n", Count, Device->Bar[Count]);
}
}
}
AsciiPrint ("\n");
break;
}
}
}
}
FreePool (HandleBuffer);
return EFI_SUCCESS;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdPciDebugTemplate[] = {
{
"pci",
" [bus] [dev] [func]; Dump PCI",
NULL,
EblPciCmd
}
};
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdHwDebugTemplate[] =
{
{
"md",
"[.{1|2|4}] [Addr] [Len] [1|2|4]; Memory Dump from Addr Len bytes",
NULL,
EblMdCmd
},
{
"mfill",
"[.{1|2|4}] Addr Len [data]; Memory Fill Addr Len*(1|2|4) bytes of data(0)",
NULL,
EblMfillCmd
},
};
/**
Initialize the commands in this in this file
**/
VOID
EblInitializemdHwDebugCmds (
VOID
)
{
if (FeaturePcdGet (PcdEmbeddedHwDebugCmd)) {
EblAddCommands (mCmdHwDebugTemplate, sizeof (mCmdHwDebugTemplate)/sizeof (EBL_COMMAND_TABLE));
}
if (FeaturePcdGet (PcdEmbeddedPciDebugCmd)) {
EblAddCommands (mCmdPciDebugTemplate, sizeof (mCmdPciDebugTemplate)/sizeof (EBL_COMMAND_TABLE));
}
}

View File

@ -1,154 +0,0 @@
/** @file
Hardware IO based debug commands
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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.
Commands useful for debugging hardware. IO commands separated out as not all
processor architectures support the IO command.
**/
#include "Ebl.h"
/**
Read from IO space
Argv[0] - "ioread"[.#] # is optional width 1, 2, or 4. Default 1
Argv[1] - Hex IO address
ior.4 0x3f8 ;Do a 32-bit IO Read from 0x3f8
ior 0x3f8 ;Do a 8-bit IO Read from 0x3f8
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblIoReadCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
UINTN Width;
UINTN Port;
UINTN Data;
if (Argc < 2) {
return EFI_INVALID_PARAMETER;
}
Port = AsciiStrHexToUintn (Argv[1]);
Width = WidthFromCommandName (Argv[0], 1);
if (Width == 1) {
Data = IoRead8 (Port);
} else if (Width == 2) {
Data = IoRead16 (Port);
} else if (Width == 4) {
Data = IoRead32 (Port);
} else {
return EFI_INVALID_PARAMETER;
}
AsciiPrint ("0x%04x = 0x%x", Port, Data);
return EFI_SUCCESS;
}
/**
Write to IO space
Argv[0] - "iowrite"[.#] # is optional width 1, 2, or 4. Default 1
Argv[1] - Hex IO address
Argv[2] - Hex data to write
iow.4 0x3f8 af ;Do a 32-bit IO write of af to 0x3f8
iow 0x3f8 af ;Do an 8-bit IO write of af to 0x3f8
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblIoWriteCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
UINTN Width;
UINTN Port;
UINTN Data;
if (Argc < 3) {
return EFI_INVALID_PARAMETER;
}
Port = AsciiStrHexToUintn (Argv[1]);
Data = AsciiStrHexToUintn (Argv[2]);
Width = WidthFromCommandName (Argv[0], 1);
if (Width == 1) {
IoWrite8 (Port, (UINT8)Data);
} else if (Width == 2) {
IoWrite16 (Port, (UINT16)Data);
} else if (Width == 4) {
IoWrite32 (Port, (UINT32)Data);
} else {
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdHwIoDebugTemplate[] =
{
{
"ioread",
"[.{1|2|4}] Port ; IO read of width byte(s) from Port",
NULL,
EblIoReadCmd
},
{
"iowrite",
"[.{1|2|4}] Port Data ; IO write Data of width byte(s) to Port",
NULL,
EblIoWriteCmd
}
};
/**
Initialize the commands in this in this file
**/
VOID
EblInitializemdHwIoDebugCmds (
VOID
)
{
if (FeaturePcdGet (PcdEmbeddedIoEnable)) {
EblAddCommands (mCmdHwIoDebugTemplate, sizeof (mCmdHwIoDebugTemplate)/sizeof (EBL_COMMAND_TABLE));
}
}

View File

@ -1,677 +0,0 @@
/** @file
Basic command line parser for EBL (Embedded Boot Loader)
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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"
// Globals for command history processing
INTN mCmdHistoryEnd = -1;
INTN mCmdHistoryStart = -1;
INTN mCmdHistoryCurrent = -1;
CHAR8 mCmdHistory[MAX_CMD_HISTORY][MAX_CMD_LINE];
CHAR8 *mCmdBlank = "";
// Globals to remember current screen geometry
UINTN gScreenColumns;
UINTN gScreenRows;
// Global to turn on/off breaking commands with prompts before they scroll the screen
BOOLEAN gPageBreak = TRUE;
VOID
RingBufferIncrement (
IN INTN *Value
)
{
*Value = *Value + 1;
if (*Value >= MAX_CMD_HISTORY) {
*Value = 0;
}
}
VOID
RingBufferDecrement (
IN INTN *Value
)
{
*Value = *Value - 1;
if (*Value < 0) {
*Value = MAX_CMD_HISTORY - 1;
}
}
/**
Save this command in the circular history buffer. Older commands are
overwritten with newer commands.
@param Cmd Command line to archive the history of.
@return None
**/
VOID
SetCmdHistory (
IN CHAR8 *Cmd
)
{
// Don't bother adding empty commands to the list
if (AsciiStrLen(Cmd) != 0) {
// First entry
if (mCmdHistoryStart == -1) {
mCmdHistoryStart = 0;
mCmdHistoryEnd = 0;
} else {
// Record the new command at the next index
RingBufferIncrement(&mCmdHistoryStart);
// If the next index runs into the end index, shuffle end back by one
if (mCmdHistoryStart == mCmdHistoryEnd) {
RingBufferIncrement(&mCmdHistoryEnd);
}
}
// Copy the new command line into the ring buffer
AsciiStrnCpyS (&mCmdHistory[mCmdHistoryStart][0], MAX_CMD_LINE, Cmd, MAX_CMD_LINE);
}
// Reset the command history for the next up arrow press
mCmdHistoryCurrent = mCmdHistoryStart;
}
/**
Retreave data from the Command History buffer. Direction maps into up arrow
an down arrow on the command line
@param Direction Command forward or back
@return The Command history based on the Direction
**/
CHAR8 *
GetCmdHistory (
IN UINT16 Direction
)
{
CHAR8 *HistoricalCommand = NULL;
// No history yet?
if (mCmdHistoryCurrent == -1) {
HistoricalCommand = mCmdBlank;
goto Exit;
}
if (Direction == SCAN_UP) {
HistoricalCommand = &mCmdHistory[mCmdHistoryCurrent][0];
// if we just echoed the last command, hang out there, don't wrap around
if (mCmdHistoryCurrent == mCmdHistoryEnd) {
goto Exit;
}
// otherwise, back up by one
RingBufferDecrement(&mCmdHistoryCurrent);
} else if (Direction == SCAN_DOWN) {
// if we last echoed the start command, put a blank prompt out
if (mCmdHistoryCurrent == mCmdHistoryStart) {
HistoricalCommand = mCmdBlank;
goto Exit;
}
// otherwise increment the current pointer and return that command
RingBufferIncrement(&mCmdHistoryCurrent);
RingBufferIncrement(&mCmdHistoryCurrent);
HistoricalCommand = &mCmdHistory[mCmdHistoryCurrent][0];
RingBufferDecrement(&mCmdHistoryCurrent);
}
Exit:
return HistoricalCommand;
}
/**
Parse the CmdLine and break it up into Argc (arg count) and Argv (array of
pointers to each argument). The Cmd buffer is altered and separators are
converted to string terminators. This allows Argv to point into CmdLine.
A CmdLine can support multiple commands. The next command in the command line
is returned if it exists.
@param CmdLine String to parse for a set of commands
@param Argc Returns the number of arguments in the CmdLine current command
@param Argv Argc pointers to each string in CmdLine
@return Next Command in the command line or NULL if non exists
**/
CHAR8 *
ParseArguments (
IN CHAR8 *CmdLine,
OUT UINTN *Argc,
OUT CHAR8 **Argv
)
{
UINTN Arg;
CHAR8 *Char;
BOOLEAN LookingForArg;
BOOLEAN InQuote;
*Argc = 0;
if (AsciiStrLen (CmdLine) == 0) {
return NULL;
}
// Walk a single command line. A CMD_SEPARATOR allows multiple commands on a single line
InQuote = FALSE;
LookingForArg = TRUE;
for (Char = CmdLine, Arg = 0; *Char != '\0'; Char++) {
if (!InQuote && *Char == CMD_SEPARATOR) {
break;
}
// Perform any text conversion here
if (*Char == '\t') {
// TAB to space
*Char = ' ';
}
if (LookingForArg) {
// Look for the beginning of an Argv[] entry
if (*Char == '"') {
Argv[Arg++] = ++Char;
LookingForArg = FALSE;
InQuote = TRUE;
} else if (*Char != ' ') {
Argv[Arg++] = Char;
LookingForArg = FALSE;
}
} else {
// Looking for the terminator of an Argv[] entry
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;
}
}
}
*Argc = Arg;
if (*Char == CMD_SEPARATOR) {
// Replace the command delimiter with null and return pointer to next command line
*Char = '\0';
return ++Char;
}
return NULL;
}
/**
Return a keypress or optionally timeout if a timeout value was passed in.
An optional callback function is called every second when waiting for a
timeout.
@param Key EFI Key information returned
@param TimeoutInSec Number of seconds to wait to timeout
@param CallBack Callback called every second during the timeout wait
@return EFI_SUCCESS Key was returned
@return EFI_TIMEOUT If the TimoutInSec expired
**/
EFI_STATUS
EFIAPI
EblGetCharKey (
IN OUT EFI_INPUT_KEY *Key,
IN UINTN TimeoutInSec,
IN EBL_GET_CHAR_CALL_BACK CallBack OPTIONAL
)
{
EFI_STATUS Status;
UINTN WaitCount;
UINTN WaitIndex;
EFI_EVENT WaitList[2];
WaitCount = 1;
WaitList[0] = gST->ConIn->WaitForKey;
if (TimeoutInSec != 0) {
// Create a time event for 1 sec duration if we have a timeout
gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &WaitList[1]);
gBS->SetTimer (WaitList[1], TimerPeriodic, EFI_SET_TIMER_TO_SECOND);
WaitCount++;
}
for (;;) {
Status = gBS->WaitForEvent (WaitCount, WaitList, &WaitIndex);
ASSERT_EFI_ERROR (Status);
switch (WaitIndex) {
case 0:
// Key event signaled
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
if (!EFI_ERROR (Status)) {
if (WaitCount == 2) {
gBS->CloseEvent (WaitList[1]);
}
return EFI_SUCCESS;
}
break;
case 1:
// Periodic 1 sec timer signaled
TimeoutInSec--;
if (CallBack != NULL) {
// Call the users callback function if registered
CallBack (TimeoutInSec);
}
if (TimeoutInSec == 0) {
gBS->CloseEvent (WaitList[1]);
return EFI_TIMEOUT;
}
break;
default:
ASSERT (FALSE);
}
}
}
/**
This routine is used prevent command output data from scrolling off the end
of the screen. The global gPageBreak is used to turn on or off this feature.
If the CurrentRow is near the end of the screen pause and print out a prompt
If the use hits Q to quit return TRUE else for any other key return FALSE.
PrefixNewline is used to figure out if a newline is needed before the prompt
string. This depends on the last print done before calling this function.
CurrentRow is updated by one on a call or set back to zero if a prompt is
needed.
@param CurrentRow Used to figure out if its the end of the page and updated
@param PrefixNewline Did previous print issue a newline
@return TRUE if Q was hit to quit, FALSE in all other cases.
**/
BOOLEAN
EFIAPI
EblAnyKeyToContinueQtoQuit (
IN UINTN *CurrentRow,
IN BOOLEAN PrefixNewline
)
{
EFI_INPUT_KEY InputKey;
if (!gPageBreak) {
// global disable for this feature
return FALSE;
}
if (*CurrentRow >= (gScreenRows - 2)) {
if (PrefixNewline) {
AsciiPrint ("\n");
}
AsciiPrint ("Any key to continue (Q to quit): ");
EblGetCharKey (&InputKey, 0, NULL);
AsciiPrint ("\n");
// Time to promt to stop the screen. We have to leave space for the prompt string
*CurrentRow = 0;
if (InputKey.UnicodeChar == 'Q' || InputKey.UnicodeChar == 'q') {
return TRUE;
}
} else {
*CurrentRow += 1;
}
return FALSE;
}
/**
Set the text color of the EFI Console. If a zero is passed in reset to
default text/background color.
@param Attribute For text and background color
**/
VOID
EblSetTextColor (
UINTN Attribute
)
{
if (Attribute == 0) {
// Set the text color back to default
Attribute = (UINTN)PcdGet32 (PcdEmbeddedDefaultTextColor);
}
gST->ConOut->SetAttribute (gST->ConOut, Attribute);
}
/**
Collect the keyboard input for a cmd line. Carriage Return, New Line, or ESC
terminates the command line. You can edit the command line via left arrow,
delete and backspace and they all back up and erase the command line.
No edit of command line is possible without deletion at this time!
The up arrow and down arrow fill Cmd with information from the history
buffer.
@param Cmd Command line to return
@param CmdMaxSize Maximum size of Cmd
@return The Status of EblGetCharKey()
**/
EFI_STATUS
GetCmd (
IN OUT CHAR8 *Cmd,
IN UINTN CmdMaxSize
)
{
EFI_STATUS Status;
UINTN Index;
UINTN Index2;
CHAR8 Char;
CHAR8 *History;
EFI_INPUT_KEY Key;
for (Index = 0; Index < CmdMaxSize - 1;) {
Status = EblGetCharKey (&Key, 0, NULL);
if (EFI_ERROR (Status)) {
Cmd[Index] = '\0';
AsciiPrint ("\n");
return Status;
}
Char = (CHAR8)Key.UnicodeChar;
if ((Char == '\n') || (Char == '\r') || (Char == 0x7f)) {
Cmd[Index] = '\0';
if (FixedPcdGetBool(PcdEmbeddedShellCharacterEcho) == TRUE) {
AsciiPrint ("\n\r");
}
return EFI_SUCCESS;
} else if ((Char == '\b') || (Key.ScanCode == SCAN_LEFT) || (Key.ScanCode == SCAN_DELETE)){
if (Index != 0) {
Index--;
//
// Update the display
//
AsciiPrint ("\b \b");
}
} else if ((Key.ScanCode == SCAN_UP) || Key.ScanCode == SCAN_DOWN) {
History = GetCmdHistory (Key.ScanCode);
//
// Clear display line
//
for (Index2 = 0; Index2 < Index; Index2++) {
AsciiPrint ("\b \b");
}
AsciiPrint (History);
Index = AsciiStrLen (History);
AsciiStrnCpyS (Cmd, CmdMaxSize, History, CmdMaxSize);
} else {
Cmd[Index++] = Char;
if (FixedPcdGetBool(PcdEmbeddedShellCharacterEcho) == TRUE) {
AsciiPrint ("%c", Char);
}
}
}
return EFI_SUCCESS;
}
/**
Print the boot up banner for the EBL.
**/
VOID
EblPrintStartupBanner (
VOID
)
{
AsciiPrint ("Embedded Boot Loader (");
EblSetTextColor (EFI_YELLOW);
AsciiPrint ("EBL");
EblSetTextColor (0);
AsciiPrint (") prototype. Built at %a on %a\n",__TIME__, __DATE__);
AsciiPrint ("THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN 'AS IS' BASIS,\nWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\n");
AsciiPrint ("Please send feedback to edk2-devel@lists.sourceforge.net\n");
}
/**
Send null requests to all removable media block IO devices so the a media add/remove/change
can be detected in real before we execute a command.
This is mainly due to the fact that the FAT driver does not do this today so you can get stale
dir commands after an SD Card has been removed.
**/
VOID
EblProbeRemovableMedia (
VOID
)
{
UINTN Index;
UINTN Max;
EFI_OPEN_FILE *File;
//
// Probe for media insertion/removal in removable media devices
//
Max = EfiGetDeviceCounts (EfiOpenBlockIo);
if (Max != 0) {
for (Index = 0; Index < Max; Index++) {
File = EfiDeviceOpenByType (EfiOpenBlockIo, Index);
if (File != NULL) {
if (File->FsBlockIoMedia->RemovableMedia) {
// Probe to see if media is present (or not) or media changed
// this causes the ReinstallProtocolInterface() to fire in the
// block io driver to update the system about media change events
File->FsBlockIo->ReadBlocks (File->FsBlockIo, File->FsBlockIo->Media->MediaId, (EFI_LBA)0, 0, NULL);
}
EfiClose (File);
}
}
}
}
/**
Print the prompt for the EBL.
**/
VOID
EblPrompt (
VOID
)
{
EblSetTextColor (EFI_YELLOW);
AsciiPrint ("%a %a",(CHAR8 *)PcdGetPtr (PcdEmbeddedPrompt), EfiGetCwd ());
EblSetTextColor (0);
AsciiPrint ("%a", ">");
}
/**
Parse a command line and execute the commands. The ; separator allows
multiple commands for each command line. Stop processing if one of the
commands returns an error.
@param CmdLine Command Line to process.
@param MaxCmdLineSize MaxSize of the Command line
@return EFI status of the Command
**/
EFI_STATUS
ProcessCmdLine (
IN CHAR8 *CmdLine,
IN UINTN MaxCmdLineSize
)
{
EFI_STATUS Status;
EBL_COMMAND_TABLE *Cmd;
CHAR8 *Ptr;
UINTN Argc;
CHAR8 *Argv[MAX_ARGS];
// Parse the command line. The loop processes commands separated by ;
for (Ptr = CmdLine, Status = EFI_SUCCESS; Ptr != NULL;) {
Ptr = ParseArguments (Ptr, &Argc, Argv);
if (Argc != 0) {
Cmd = EblGetCommand (Argv[0]);
if (Cmd != NULL) {
// Execute the Command!
Status = Cmd->Command (Argc, Argv);
if (Status == EFI_ABORTED) {
// exit command so lets exit
break;
} else if (Status == EFI_TIMEOUT) {
// pause command got input so don't process any more cmd on this cmd line
break;
} else if (EFI_ERROR (Status)) {
AsciiPrint ("%a returned %r error\n", Cmd->Name, Status);
// if any command fails stop processing CmdLine
break;
}
} else {
AsciiPrint ("The command '%a' is not supported.\n", Argv[0]);
}
}
}
return Status;
}
/**
Embedded Boot Loader (EBL) - A simple EFI command line application for embedded
devices. PcdEmbeddedAutomaticBootCommand is a complied in command line that
gets executed automatically. The ; separator allows multiple commands
for each command line.
@param ImageHandle EFI ImageHandle for this application.
@param SystemTable EFI system table
@return EFI status of the application
**/
EFI_STATUS
EFIAPI
EdkBootLoaderEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
CHAR8 CmdLine[MAX_CMD_LINE];
CHAR16 *CommandLineVariable = NULL;
CHAR16 *CommandLineVariableName = L"default-cmdline";
UINTN CommandLineVariableSize = 0;
EFI_GUID VendorGuid;
// Initialize tables of commands
EblInitializeCmdTable ();
EblInitializeDeviceCmd ();
EblInitializemdHwDebugCmds ();
EblInitializemdHwIoDebugCmds ();
EblInitializeDirCmd ();
EblInitializeHobCmd ();
EblInitializeScriptCmd ();
EblInitializeExternalCmd ();
EblInitializeNetworkCmd();
EblInitializeVariableCmds ();
if (gST->ConOut == NULL) {
DEBUG((EFI_D_ERROR,"Error: No Console Output\n"));
return EFI_NOT_READY;
}
// Disable the 5 minute EFI watchdog time so we don't get automatically reset
gBS->SetWatchdogTimer (0, 0, 0, NULL);
if (FeaturePcdGet (PcdEmbeddedMacBoot)) {
// A MAC will boot in graphics mode, so turn it back to text here
// This protocol was removed from edk2. It is only an edk thing. We need to make our own copy.
// DisableQuietBoot ();
// Enable the biggest output screen size possible
gST->ConOut->SetMode (gST->ConOut, (UINTN)gST->ConOut->Mode->MaxMode - 1);
}
// Save current screen mode
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &gScreenColumns, &gScreenRows);
EblPrintStartupBanner ();
// Parse command line and handle commands separated by ;
// The loop prints the prompt gets user input and saves history
// Look for a variable with a default command line, otherwise use the Pcd
ZeroMem(&VendorGuid, sizeof(EFI_GUID));
Status = gRT->GetVariable(CommandLineVariableName, &VendorGuid, NULL, &CommandLineVariableSize, CommandLineVariable);
if (Status == EFI_BUFFER_TOO_SMALL) {
CommandLineVariable = AllocatePool(CommandLineVariableSize);
Status = gRT->GetVariable(CommandLineVariableName, &VendorGuid, NULL, &CommandLineVariableSize, CommandLineVariable);
if (!EFI_ERROR(Status)) {
UnicodeStrToAsciiStrS (CommandLineVariable, CmdLine, MAX_CMD_LINE);
}
FreePool(CommandLineVariable);
}
if (EFI_ERROR(Status)) {
AsciiStrCpyS (CmdLine, MAX_CMD_LINE, (CHAR8 *)PcdGetPtr (PcdEmbeddedAutomaticBootCommand));
}
for (;;) {
Status = ProcessCmdLine (CmdLine, MAX_CMD_LINE);
if (Status == EFI_ABORTED) {
// if a command returns EFI_ABORTED then exit the EBL
EblShutdownExternalCmdTable ();
return EFI_SUCCESS;
}
// get the command line from the user
EblPrompt ();
GetCmd (CmdLine, MAX_CMD_LINE);
SetCmdHistory (CmdLine);
if (FeaturePcdGet (PcdEmbeddedProbeRemovable)) {
// Probe removable media devices to see if media has been inserted or removed.
EblProbeRemovableMedia ();
}
}
}

View File

@ -1,106 +0,0 @@
/** @file
EBL commands for Network Devices
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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"
EFI_STATUS
ParseIp (
IN CHAR8 *String,
OUT EFI_IP_ADDRESS *Address
)
{
Address->v4.Addr[0] = (UINT8)AsciiStrDecimalToUintn (String);
String = AsciiStrStr(String, ".") + 1;
Address->v4.Addr[1] = (UINT8)AsciiStrDecimalToUintn (String);
String = AsciiStrStr(String, ".") + 1;
Address->v4.Addr[2] = (UINT8)AsciiStrDecimalToUintn (String);
String = AsciiStrStr(String, ".") + 1;
Address->v4.Addr[3] = (UINT8)AsciiStrDecimalToUintn (String);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
EblIpCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status = EFI_INVALID_PARAMETER;
EFI_MAC_ADDRESS Mac;
EFI_IP_ADDRESS Ip;
if (Argc == 1) {
// Get current IP/MAC
// Get current MAC address
Status = EblGetCurrentMacAddress (&Mac);
if (EFI_ERROR (Status)) {
goto Exit;
}
AsciiPrint ("MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\n", Mac.Addr[0], Mac.Addr[1], Mac.Addr[2], Mac.Addr[3], Mac.Addr[4], Mac.Addr[5]);
// Get current IP address
Status = EblGetCurrentIpAddress (&Ip);
if (EFI_ERROR(Status)) {
AsciiPrint("IP Address is not configured.\n");
Status = EFI_SUCCESS;
goto Exit;
}
AsciiPrint("IP Address: %d.%d.%d.%d\n", Ip.v4.Addr[0], Ip.v4.Addr[1],Ip.v4.Addr[2], Ip.v4.Addr[3]);
} else if ((Argv[1][0] == 'r') && (Argc == 2)) {
// Get new address via dhcp
Status = EblPerformDHCP (TRUE);
} else if ((Argv[1][0] == 's') && (Argc == 3)) {
// Set static IP
Status = ParseIp (Argv[2], &Ip);
if (EFI_ERROR (Status)) {
goto Exit;
}
Status = EblSetStationIp (&Ip, NULL);
}
Exit:
return Status;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdNetworkTemplate[] =
{
{
"ip",
" ; print current ip address\n\r [r]; request DHCP address\n\r [s] ipaddr; set static IP address",
NULL,
EblIpCmd
}
};
/**
Initialize the commands in this in this file
**/
VOID
EblInitializeNetworkCmd (
VOID
)
{
EblAddCommands (mCmdNetworkTemplate, sizeof (mCmdNetworkTemplate)/sizeof (EBL_COMMAND_TABLE));
}

View File

@ -1,128 +0,0 @@
/** @file
Script command allows the execution of commands from a text file
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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.
Module Name: EfiDevice.c
**/
#include "Ebl.h"
/**
Execute the passed in file like a series of commands. The ; can be used on
a single line to indicate multiple commands per line. The Ascii text file
can contain any number of lines. The following line termination forms are
supported:
LF : Unix, Mac OS X*, BeOS
CR+LF: MS-DOS*, Microsoft Windows*
CR : Commodore, Apple II, and really Mac OS
LF+CR: for simplicity and completeness
Argv[0] - "script"
Argv[1] - Device Name:path for the file to load
script fv1:\script.txt
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
EblScriptCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status;
EFI_OPEN_FILE *File;
VOID *Address;
UINTN Size;
CHAR8 *Ptr;
CHAR8 *ScanPtr;
UINTN CmdLineSize;
if (Argc < 2) {
// file name required
return EFI_SUCCESS;
}
File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);
if (File == NULL) {
AsciiPrint (" %a is not a valid path\n", Argv[1]);
return EFI_SUCCESS;
}
Status = EfiReadAllocatePool (File, &Address, &Size);
if (!EFI_ERROR (Status)) {
// Loop through each line in the text file
for (Ptr = (CHAR8 *)Address; (Ptr < (((CHAR8 *)Address) + Size)) && !EFI_ERROR (Status); Ptr += CmdLineSize) {
for (CmdLineSize = 0, ScanPtr = Ptr; ; CmdLineSize++, ScanPtr++) {
// look for the end of the line
if ((*ScanPtr == EBL_CR) || (*ScanPtr == EBL_LF)) {
// convert to NULL as this is what input routine would do
*ScanPtr = 0;
if ((*(ScanPtr + 1) == EBL_CR) || (*(ScanPtr + 1) == EBL_LF)) {
// if its a set get the 2nd EOL char
CmdLineSize++;
*(ScanPtr + 1) = 0;
}
CmdLineSize++;
break;
}
}
Status = ProcessCmdLine (Ptr, CmdLineSize);
}
FreePool (Address);
}
EfiClose (File);
return Status;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mScriptTemplate[] = {
{
"script",
" device:path; load an ascii file and execute it like commands",
NULL,
EblScriptCmd
}
};
/**
Initialize the commands in this in this file
**/
VOID
EblInitializeScriptCmd (
VOID
)
{
if (FeaturePcdGet (PcdEmbeddedScriptCmd)) {
EblAddCommands (mScriptTemplate, sizeof (mScriptTemplate)/sizeof (EBL_COMMAND_TABLE));
}
}

View File

@ -1,221 +0,0 @@
/** @file
*
* Copyright (c) 2011, ARM Limited. All rights reserved.
* (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
*
* 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
EFIAPI
EblGetCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status = EFI_INVALID_PARAMETER;
UINTN Size;
VOID* Value;
CHAR8* AsciiVariableName = NULL;
CHAR16* VariableName;
UINTN VariableNameLen;
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 {
VariableNameLen = AsciiStrLen (AsciiVariableName) + 1;
VariableName = AllocatePool (VariableNameLen * sizeof (CHAR16));
AsciiStrToUnicodeStrS (AsciiVariableName, VariableName, VariableNameLen);
}
// 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 '%s' 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
EFIAPI
EblSetCmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
EFI_STATUS Status = EFI_INVALID_PARAMETER;
CHAR8* AsciiVariableSetting = NULL;
CHAR8* AsciiVariableName;
CHAR8* AsciiValue;
UINT32 AsciiValueLength;
CHAR16* VariableName;
UINTN VariableNameLen;
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) {
//
// There is no value. It means this variable will be deleted
//
// Convert VariableName into Unicode
VariableNameLen = AsciiStrLen (AsciiVariableSetting) + 1;
VariableName = AllocatePool (VariableNameLen * sizeof (CHAR16));
AsciiStrToUnicodeStrS (AsciiVariableSetting, VariableName, VariableNameLen);
Status = gRT->SetVariable (
VariableName,
&gEfiGlobalVariableGuid,
( !Volatile ? EFI_VARIABLE_NON_VOLATILE : 0) |
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
0,
NULL
);
if (!EFI_ERROR(Status)) {
AsciiPrint("Variable '%s' deleted\n",VariableName);
} else {
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
VariableNameLen = AsciiStrLen (AsciiVariableName) + 1;
VariableName = AllocatePool (VariableNameLen * sizeof (CHAR16));
AsciiStrToUnicodeStrS (AsciiVariableName, VariableName, VariableNameLen);
Status = gRT->SetVariable (
VariableName,
&gEfiGlobalVariableGuid,
( !Volatile ? EFI_VARIABLE_NON_VOLATILE : 0) |
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
AsciiStrLen (AsciiValue)+1,
AsciiValue
);
if (!EFI_ERROR(Status)) {
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));
}

View File

@ -1,154 +0,0 @@
/** @file
Glue code that contains the EFI entry point and converts it to an EBL
ASCII Argc, Argv sytle entry point
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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"
#define CMD_SEPARATOR ';'
#define MAX_ARGS 32
EFI_STATUS
EblMain (
IN UINTN Argc,
IN CHAR8 **Argv
);
///
/// EdkExternCmdEntry() & ParseArguments() convert the standard EFI entry point
/// into Argc, Argv form that calls EblMain().
///
/**
Parse the CmdLine and break it up into Argc (arg count) and Argv (array of
pointers to each argument). The Cmd buffer is altered and separators are
converted to string terminators. This allows Argv to point into CmdLine.
A CmdLine can support multiple commands. The next command in the command line
is returned if it exists.
@param CmdLine String to parse for a set of commands
@param CmdLineSize Size of CmdLine in bytes
@param Argc Returns the number of arguments in the CmdLine current command
@param Argv Argc pointers to each string in CmdLine
@return Next Command in the command line or NULL if non exists
**/
VOID
ParseArguments (
IN CHAR8 *CmdLine,
IN UINTN CmdLineSize,
OUT UINTN *Argc,
OUT CHAR8 **Argv
)
{
UINTN Arg;
CHAR8 *Char;
BOOLEAN LookingForArg;
BOOLEAN InQuote;
UINTN Index;
*Argc = 0;
if ((CmdLineSize == 0) || (AsciiStrLen (CmdLine) == 0)) {
// basic error checking failed on the arguments
return;
}
// Walk a single command line. A CMD_SEPARATOR allows multiple commands on a single line
InQuote = FALSE;
LookingForArg = TRUE;
for (Char = CmdLine, Arg = 0, Index = 0; *Char != '\0' && *Char != CMD_SEPARATOR; Char++, Index++) {
// Perform any text conversion here
if (*Char == '\t') {
// TAB to space
*Char = ' ';
}
if (LookingForArg) {
// Look for the beginning of an Argv[] entry
if (*Char == '"') {
Argv[Arg++] = ++Char;
LookingForArg = FALSE;
InQuote = TRUE;
} else if (*Char != ' ') {
Argv[Arg++] = Char;
LookingForArg = FALSE;
}
} else {
// Looking for the terminator of an Argv[] entry
if ((InQuote && (*Char == '"')) || (!InQuote && (*Char == ' '))) {
*Char = '\0';
LookingForArg = TRUE;
}
}
if ((Arg >= MAX_ARGS) || (Index > CmdLineSize)) {
// Error check buffer and exit since it does not look valid
break;
}
}
*Argc = Arg;
if (*Char == CMD_SEPARATOR) {
// Replace the command delimiter with null
*Char = '\0';
}
return;
}
/**
Embedded Boot Loader (EBL) - A simple EFI command line application for embedded
devices. PcdEmbeddedAutomaticBootCommand is a complied in command line that
gets executed automatically. The ; separator allows multiple commands
for each command line.
@param ImageHandle EFI ImageHandle for this application.
@param SystemTable EFI system table
@return EFI status of the application
**/
EFI_STATUS
EFIAPI
EdkExternCmdEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
UINTN Argc;
CHAR8 *Argv[MAX_ARGS];
Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&ImageInfo);
if (EFI_ERROR (Status)) {
Argc = 0;
} else {
// Looks like valid commands were passed in.
ParseArguments (ImageInfo->LoadOptions, ImageInfo->LoadOptionsSize, &Argc, Argv);
}
return EblMain (Argc, Argv);
}

View File

@ -1,53 +0,0 @@
/** @file
Example of an external EBL command. It's loaded via EBL start command.
Argc and Argv are passed in via "" of the EBL command line.
Start fs0:\EdkExternCmd.efi "Argv[0] Argv[1] 2"
will launch this command with
Argv[0] = "Argv[0]"
Argv[1] = "Argv[2]"
Argv[2] = "3"
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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"
/**
Entry point with Argc, Argv. Put your code here.
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EblMain (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
UINTN Index;
AsciiPrint ("Hello World\n");
for (Index = 0; Index < Argc; Index++) {
AsciiPrint ("Argv[%d] = %a\n", Index, Argv[Index]);
}
return EFI_SUCCESS;
}

View File

@ -36,13 +36,9 @@
Include # Root include for the package
[LibraryClasses.common]
EfiFileLib|Include/Library/EfiFileLib.h
PrePiLib|Include/Library/PrePiLib.h
RealTimeClockLib|Include/Library/RealTimeClockLib.h
EfiResetSystemLib|Include/Library/EfiResetSystemLib.h
EblCmdLib|Include/Library/EblCmdLib.h
EblAddExternalCommandLib|Include/Library/EblAddExternalCommandLib.h
EblNetworkLib|Include/Library/EblNetworkLib.h
GdbSerialLib|Include/Library/GdbSerialLib.h
DebugAgentTimerLib|Include/Library/DebugAgentTimerLib.h
NorFlashInfoLib|Include/Library/NorFlashInfoLib.h
@ -75,7 +71,6 @@
gHardwareInterruptProtocolGuid = { 0x2890B3EA, 0x053D, 0x1643, { 0xAD, 0x0C, 0xD6, 0x48, 0x08, 0xDA, 0x3F, 0xF1 } }
gHardwareInterrupt2ProtocolGuid = { 0x32898322, 0x2da1, 0x474a, { 0xba, 0xaa, 0xf3, 0xf7, 0xcf, 0x56, 0x94, 0x70 } }
gEfiDebugSupportPeriodicCallbackProtocolGuid = { 0x9546e07c, 0x2cbb, 0x4c88, { 0x98, 0x6c, 0xcd, 0x34, 0x10, 0x86, 0xf0, 0x44 } }
gEfiEblAddCommandProtocolGuid = { 0xaeda2428, 0x9a22, 0x4637, { 0x9b, 0x21, 0x54, 0x5e, 0x28, 0xfb, 0xb8, 0x29 } }
gEmbeddedDeviceGuid = { 0xbf4b9d10, 0x13ec, 0x43dd, { 0x88, 0x80, 0xe9, 0xb, 0x71, 0x8f, 0x27, 0xde } }
gEmbeddedExternalDeviceProtocolGuid = { 0x735F8C64, 0xD696, 0x44D0, { 0xBD, 0xF2, 0x44, 0x7F, 0xD0, 0x5A, 0x54, 0x06 }}
gEmbeddedGpioProtocolGuid = { 0x17a0a3d7, 0xc0a5, 0x4635, { 0xbb, 0xd5, 0x07, 0x21, 0x87, 0xdf, 0xe2, 0xee }}
@ -115,7 +110,6 @@
gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|L""|VOID*|0x00000007
gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07|UINT32|0x00000008
gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000|UINT32|0x00000009
gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"Ebl"|VOID*|0x00000034
gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0|UINT32|0x0000000b
gEmbeddedTokenSpaceGuid.PcdPrePiStackSize|131072|UINT32|0x0000000c

View File

@ -59,7 +59,6 @@
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
ReportStatusCodeLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
@ -94,9 +93,6 @@
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
EblCmdLib|EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.inf
EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
@ -241,9 +237,6 @@
#
################################################################################
[Components.common]
EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.inf
EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
EmbeddedPkg/Library/GdbSerialDebugPortLib/GdbSerialDebugPortLib.inf
EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.inf
EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
@ -255,8 +248,6 @@
EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf
EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf
EmbeddedPkg/Ebl/Ebl.inf
#### EmbeddedPkg/EblExternCmd/EblExternCmd.inf
EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf
EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
@ -275,7 +266,6 @@
EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf
EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
EmbeddedPkg/Library/FdtLib/FdtLib.inf
EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.inf
EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf

View File

@ -1,141 +0,0 @@
# This is Ebl FDF file
#
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
#
# 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.
#
################################################################################
#
# FV Section
#
# [FV] section is used to define what components or modules are placed within a flash
# device file. This section also defines order the components and modules are positioned
# within the image. The [FV] section consists of define statements, set statements and
# module statements.
#
################################################################################
[FV.FvLoad]
FvAlignment = 16 #FV alignment and FV attributes setting.
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
STICKY_WRITE = TRUE
LOCK_CAP = TRUE
LOCK_STATUS = TRUE
WRITE_DISABLED_CAP = TRUE
WRITE_ENABLED_CAP = TRUE
WRITE_STATUS = TRUE
WRITE_LOCK_CAP = TRUE
WRITE_LOCK_STATUS = TRUE
READ_DISABLED_CAP = TRUE
READ_ENABLED_CAP = TRUE
READ_STATUS = TRUE
READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
################################################################################
#
# The INF statements point to module INF files, which will be placed into this FV image.
# Parsing tools will scan the INF file to determine the type of component or module.
# The component or module type is used to reference the standard rules
# defined elsewhere in the FDF file.
#
# The format for INF statements is:
# INF $(PathAndInfFileName)
#
################################################################################
INF EmbeddedPkg/Ebl/Ebl.inf
################################################################################
#
# Rules are use with the [FV] section's module INF type to define
# how an FFS file is created for a given INF file. The following Rule are the default
# rules for the different module type. User can add the customized rules to define the
# content of the FFS file.
#
################################################################################
############################################################################
# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
############################################################################
#
#[Rule.Common.DXE_DRIVER]
# FILE DRIVER = $(NAMED_GUID) {
# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
# COMPRESS PI_STD {
# GUIDED {
# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
# UI STRING="$(MODULE_NAME)" Optional
# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
# }
# }
# }
#
############################################################################
[Rule.Common.SEC]
FILE SEC = $(NAMED_GUID) {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
}
[Rule.Common.PEI_CORE]
FILE PEI_CORE = $(NAMED_GUID) {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING ="$(MODULE_NAME)" Optional
}
[Rule.Common.PEIM]
FILE PEIM = $(NAMED_GUID) {
PEI_DEPEX PEI_DEPEX Optional $(MODULE_NAME).depex
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.PEIM.TIANOCOMPRESSED]
FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
PEI_DEPEX PEI_DEPEX Optional $(MODULE_NAME).depex
GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING="$(MODULE_NAME)" Optional
}
}
[Rule.Common.DXE_CORE]
FILE DXE_CORE = $(NAMED_GUID) {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.UEFI_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.DXE_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.DXE_RUNTIME_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING="$(MODULE_NAME)" Optional
}
[Rule.Common.UEFI_APPLICATION]
FILE APPLICATION = $(NAMED_GUID) {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING="$(MODULE_NAME)" Optional
}

View File

@ -1,122 +0,0 @@
/** @file
Include file for basic command line parser for EBL (Embedded Boot Loader)
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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.
**/
#ifndef __EBL_ADD_EXTERNAL_COMMAND_LIB_H__
#define __EBL_ADD_EXTERNAL_COMMAND_LIB_H__
#include <PiDxe.h>
#include <Protocol/EblAddCommand.h>
EFI_STATUS
EFIAPI
EblAddExternalCommands (
IN const EBL_COMMAND_TABLE *EntryArray,
IN UINTN ArrayCount
);
/**
Return a keypress or optionally timeout if a timeout value was passed in.
An optional callback function is called every second when waiting for a
timeout.
@param Key EFI Key information returned
@param TimeoutInSec Number of seconds to wait to timeout
@param CallBack Callback called every second during the timeout wait
@return EFI_SUCCESS Key was returned
@return EFI_TIMEOUT If the TimoutInSec expired
**/
EFI_STATUS
EFIAPI
EblGetCharKey (
IN OUT EFI_INPUT_KEY *Key,
IN UINTN TimeoutInSec,
IN EBL_GET_CHAR_CALL_BACK CallBack OPTIONAL
);
/**
This routine is used prevent command output data from scrolling off the end
of the screen. The global gPageBreak is used to turn on or off this feature.
If the CurrentRow is near the end of the screen pause and print out a prompt
If the use hits Q to quit return TRUE else for any other key return FALSE.
PrefixNewline is used to figure out if a newline is needed before the prompt
string. This depends on the last print done before calling this function.
CurrentRow is updated by one on a call or set back to zero if a prompt is
needed.
@param CurrentRow Used to figure out if its the end of the page and updated
@param PrefixNewline Did previous print issue a newline
@return TRUE if Q was hit to quit, FALSE in all other cases.
**/
BOOLEAN
EFIAPI
EblAnyKeyToContinueQtoQuit (
IN UINTN *CurrentRow,
IN BOOLEAN PrefixNewline
);
#endif

View File

@ -1,51 +0,0 @@
/** @file
Include file for basic command line parser for EBL (Embedded Boot Loader)
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
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.
**/
#ifndef __EBL_LIB_H__
#define __EBL_LIB_H__
#include <PiDxe.h>
#include <Protocol/EblAddCommand.h>
VOID
EFIAPI
EblAddCommand (
IN const EBL_COMMAND_TABLE *Entry
);
VOID
EFIAPI
EblAddCommands (
IN const EBL_COMMAND_TABLE *EntryArray,
IN UINTN ArrayCount
);
//
// LIbrary constructor called directly from Ebl Code.
// This module calls EblAddCommand () or EblAddCommands () to register new commands
//
VOID
EblInitializeExternalCmd (
VOID
);
#endif

View File

@ -1,68 +0,0 @@
/** @file
Abstractions for Ebl network accesses.
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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.
**/
#ifndef __EBL_NETWORK_LIB_H__
#define __EBL_NETWORK_LIB_H__
#include <Protocol/PxeBaseCode.h>
EFI_STATUS
EFIAPI
EblGetCurrentIpAddress (
IN OUT EFI_IP_ADDRESS *Ip
);
EFI_STATUS
EFIAPI
EblGetCurrentMacAddress (
IN OUT EFI_MAC_ADDRESS *Mac
);
CHAR8 *
EFIAPI
EblLoadFileBootTypeString (
IN EFI_HANDLE Handle
);
EFI_STATUS
EFIAPI
EblPerformDHCP (
IN BOOLEAN SortOffers
);
EFI_STATUS
EFIAPI
EblSetStationIp (
IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL
IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL
);
EFI_STATUS
EFIAPI
EblMtftp (
IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
IN OUT VOID *BufferPtr OPTIONAL,
IN BOOLEAN Overwrite,
IN OUT UINT64 *BufferSize,
IN UINTN *BlockSize OPTIONAL,
IN EFI_IP_ADDRESS *ServerIp,
IN UINT8 *Filename OPTIONAL,
IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL,
IN BOOLEAN DontUseBuffer
);
#endif

View File

@ -1,142 +0,0 @@
/** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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.
**/
#ifndef __EBL_ADD_COMMAND_H__
#define __EBL_ADD_COMMAND_H__
//
// Protocol GUID
//
// AEDA2428-9A22-4637-9B21-545E28FBB829
#define EBL_ADD_COMMAND_PROTOCOL_GUID \
{ 0xaeda2428, 0x9a22, 0x4637, { 0x9b, 0x21, 0x54, 0x5e, 0x28, 0xfb, 0xb8, 0x29 } }
typedef struct _EBL_ADD_COMMAND_PROTOCOL EBL_ADD_COMMAND_PROTOCOL;
typedef
EFI_STATUS
(EFIAPI *EBL_COMMMAND) (
IN UINTN Argc,
IN CHAR8 **Argv
);
typedef struct {
CHAR8 *Name;
CHAR8 *HelpSummary;
CHAR8 *Help;
EBL_COMMMAND Command;
} EBL_COMMAND_TABLE;
/**
Add a single command table entry.
@param EntryArray Pointer EBL_COMMAND_TABLE of the command that is being added
**/
typedef
VOID
(EFIAPI *EBL_ADD_COMMAND) (
IN const EBL_COMMAND_TABLE *Entry
);
/**
Add a multiple command table entry.
@param EntryArray Pointer EBL_COMMAND_TABLE of the commands that are being added
@param ArrayCount Number of commands in the EntryArray.
**/
typedef
VOID
(EFIAPI *EBL_ADD_COMMANDS) (
IN const EBL_COMMAND_TABLE *EntryArray,
IN UINTN ArrayCount
);
typedef
VOID
(EFIAPI *EBL_GET_CHAR_CALL_BACK) (
IN UINTN ElapsedTime
);
/**
Return a keypress or optionally timeout if a timeout value was passed in.
An optional callback function is called every second when waiting for a
timeout.
@param Key EFI Key information returned
@param TimeoutInSec Number of seconds to wait to timeout
@param CallBack Callback called every second during the timeout wait
@return EFI_SUCCESS Key was returned
@return EFI_TIMEOUT If the TimoutInSec expired
**/
typedef
EFI_STATUS
(EFIAPI *EBL_GET_CHAR_KEY) (
IN OUT EFI_INPUT_KEY *Key,
IN UINTN TimeoutInSec,
IN EBL_GET_CHAR_CALL_BACK CallBack OPTIONAL
);
/**
This routine is used prevent command output data from scrolling off the end
of the screen. The global gPageBreak is used to turn on or off this feature.
If the CurrentRow is near the end of the screen pause and print out a prompt
If the use hits Q to quit return TRUE else for any other key return FALSE.
PrefixNewline is used to figure out if a newline is needed before the prompt
string. This depends on the last print done before calling this function.
CurrentRow is updated by one on a call or set back to zero if a prompt is
needed.
@param CurrentRow Used to figure out if its the end of the page and updated
@param PrefixNewline Did previous print issue a newline
@return TRUE if Q was hit to quit, FALSE in all other cases.
**/
typedef
BOOLEAN
(EFIAPI *EBL_ANY_KEY_CONTINUE_Q_QUIT) (
IN UINTN *CurrentRow,
IN BOOLEAN PrefixNewline
);
struct _EBL_ADD_COMMAND_PROTOCOL {
EBL_ADD_COMMAND AddCommand;
EBL_ADD_COMMANDS AddCommands;
// Commands to reuse EBL infrastructure
EBL_GET_CHAR_KEY EblGetCharKey;
EBL_ANY_KEY_CONTINUE_Q_QUIT EblAnyKeyToContinueQtoQuit;
};
extern EFI_GUID gEfiEblAddCommandProtocolGuid;
#endif

View File

@ -1,155 +0,0 @@
/** @file
Add external EblCmd Lib
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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 <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/EblAddExternalCommandLib.h>
#include <Protocol/EblAddCommand.h>
STATIC BOOLEAN gInstalledCommand = FALSE;
STATIC EFI_EVENT mEblCommandRegistration = NULL;
STATIC const EBL_COMMAND_TABLE *mAddExternalCmdLibTemplate = NULL;
STATIC UINTN mAddExternalCmdLibTemplateSize = 0;
EBL_ADD_COMMAND_PROTOCOL *gEblExternalCommand = NULL;
/**
Return a keypress or optionally timeout if a timeout value was passed in.
An optional callback function is called every second when waiting for a
timeout.
@param Key EFI Key information returned
@param TimeoutInSec Number of seconds to wait to timeout
@param CallBack Callback called every second during the timeout wait
@return EFI_SUCCESS Key was returned
@return EFI_TIMEOUT If the TimoutInSec expired
**/
EFI_STATUS
EFIAPI
EblGetCharKey (
IN OUT EFI_INPUT_KEY *Key,
IN UINTN TimeoutInSec,
IN EBL_GET_CHAR_CALL_BACK CallBack OPTIONAL
)
{
if (gEblExternalCommand != NULL) {
return gEblExternalCommand->EblGetCharKey (Key, TimeoutInSec, CallBack);
}
return EFI_TIMEOUT;
}
/**
This routine is used prevent command output data from scrolling off the end
of the screen. The global gPageBreak is used to turn on or off this feature.
If the CurrentRow is near the end of the screen pause and print out a prompt
If the use hits Q to quit return TRUE else for any other key return FALSE.
PrefixNewline is used to figure out if a newline is needed before the prompt
string. This depends on the last print done before calling this function.
CurrentRow is updated by one on a call or set back to zero if a prompt is
needed.
@param CurrentRow Used to figure out if its the end of the page and updated
@param PrefixNewline Did previous print issue a newline
@return TRUE if Q was hit to quit, FALSE in all other cases.
**/
BOOLEAN
EFIAPI
EblAnyKeyToContinueQtoQuit (
IN UINTN *CurrentRow,
IN BOOLEAN PrefixNewline
)
{
if (gEblExternalCommand != NULL) {
return gEblExternalCommand->EblAnyKeyToContinueQtoQuit (CurrentRow, PrefixNewline);
}
return FALSE;
}
/**
Update mFvbEntry. Add new entry, or update existing entry if Fvb protocol is
reinstalled.
@param Event The Event that is being processed
@param Context Event Context
**/
VOID
EFIAPI
EblAddCommandNotificationEvent (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
if (!gInstalledCommand) {
Status = gBS->LocateProtocol (&gEfiEblAddCommandProtocolGuid, NULL, (VOID **)&gEblExternalCommand);
if (!EFI_ERROR (Status)) {
gEblExternalCommand->AddCommands (mAddExternalCmdLibTemplate, mAddExternalCmdLibTemplateSize);
gInstalledCommand = TRUE;
}
}
}
/**
The user Entry Point for the driver. The user code starts with this function
as the real entry point for the image goes into a library that calls this
function.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval other Some error occurs when executing this entry point.
**/
EFI_STATUS
EFIAPI
EblAddExternalCommands (
IN const EBL_COMMAND_TABLE *EntryArray,
IN UINTN ArrayCount
)
{
if (mAddExternalCmdLibTemplate != NULL) {
return EFI_ALREADY_STARTED;
}
mAddExternalCmdLibTemplate = EntryArray;
mAddExternalCmdLibTemplateSize = ArrayCount;
EfiCreateProtocolNotifyEvent (
&gEfiEblAddCommandProtocolGuid,
TPL_CALLBACK,
EblAddCommandNotificationEvent,
NULL,
&mEblCommandRegistration
);
return EFI_SUCCESS;
}

View File

@ -1,47 +0,0 @@
#/** @file
# Component description file for the entry point to a EFIDXE Drivers
#
# Library to abstract Framework extensions that conflict with UEFI 2.0 Specification
# Copyright (c) 2007 - 2007, Intel Corporation. All rights reserved.<BR>
#
# 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.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = EblAddExternalCommandLib
FILE_GUID = 9195D970-C6F7-484E-8013-5B03C89C3B81
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = EblAddExternalCommandLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
EblAddExternalCommandLib.c
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
UefiBootServicesTableLib
UefiLib
EblAddExternalCommandLib
[Protocols]
gEfiEblAddCommandProtocolGuid
[Guids]

View File

@ -1,28 +0,0 @@
/** @file
Null EblCmdLib
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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 <PiDxe.h>
#include <Library/EblCmdLib.h>
VOID
EblInitializeExternalCmd (
VOID
)
{
return;
}

View File

@ -1,43 +0,0 @@
#/** @file
# Component description file for the entry point to a EFIDXE Drivers
#
# Library to abstract Framework extensions that conflict with UEFI 2.0 Specification
# Copyright (c) 2007 - 2007, Intel Corporation. All rights reserved.<BR>
#
# 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.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = EblCmdLibNull
FILE_GUID = 3513C4E2-06D6-4921-9C2B-E938777BA79E
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = EfiCmdLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
EblCmdLibNull.c
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
[Protocols]
[Guids]

View File

@ -1,173 +0,0 @@
/** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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 <Uefi.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/PxeBaseCode.h>
BOOLEAN gUseIpv6 = FALSE;
EFI_STATUS
EFIAPI
EblGetCurrentIpAddress (
IN OUT EFI_IP_ADDRESS *Ip
)
{
EFI_STATUS Status;
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
if (EFI_ERROR(Status)) {
return Status;
}
Status = Pxe->Start (Pxe, gUseIpv6);
if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
return Status;
}
CopyMem (Ip, &Pxe->Mode->StationIp, sizeof (EFI_IP_ADDRESS));
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
EblGetCurrentMacAddress (
IN OUT EFI_MAC_ADDRESS *Mac
)
{
EFI_STATUS Status;
EFI_SIMPLE_NETWORK_PROTOCOL *SimpleNet;
Status = gBS->LocateProtocol (&gEfiSimpleNetworkProtocolGuid, NULL, (VOID **)&SimpleNet);
if (EFI_ERROR(Status)) {
return Status;
}
CopyMem (Mac, SimpleNet->Mode->CurrentAddress.Addr, sizeof (EFI_MAC_ADDRESS));
return Status;
}
CHAR8 *
EFIAPI
EblLoadFileBootTypeString (
IN EFI_HANDLE Handle
)
{
EFI_STATUS Status;
VOID *NullPtr;
Status = gBS->HandleProtocol (Handle, &gEfiPxeBaseCodeProtocolGuid, &NullPtr);
if (!EFI_ERROR (Status)) {
return "EFI PXE Network Boot";
}
return "";
}
EFI_STATUS
EFIAPI
EblPerformDHCP (
IN BOOLEAN SortOffers
)
{
EFI_STATUS Status;
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
if (EFI_ERROR(Status)) {
return Status;
}
Status = Pxe->Start (Pxe, gUseIpv6);
if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
return Status;
}
Status = Pxe->Dhcp(Pxe, TRUE);
return Status;
}
EFI_STATUS
EFIAPI
EblSetStationIp (
IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL
IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL
)
{
EFI_STATUS Status;
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
if (EFI_ERROR(Status)) {
return Status;
}
Status = Pxe->Start (Pxe, gUseIpv6);
if (EFI_ERROR(Status) && (Status != EFI_ALREADY_STARTED)) {
return Status;
}
Status = Pxe->SetStationIp (Pxe, NewStationIp, NewSubnetMask);
return Status;
}
EFI_STATUS
EFIAPI
EblMtftp (
IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
IN OUT VOID *BufferPtr OPTIONAL,
IN BOOLEAN Overwrite,
IN OUT UINT64 *BufferSize,
IN UINTN *BlockSize OPTIONAL,
IN EFI_IP_ADDRESS *ServerIp,
IN UINT8 *Filename OPTIONAL,
IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL,
IN BOOLEAN DontUseBuffer
)
{
EFI_STATUS Status;
EFI_PXE_BASE_CODE_PROTOCOL *Pxe;
Status = gBS->LocateProtocol (&gEfiPxeBaseCodeProtocolGuid, NULL, (VOID **)&Pxe);
if (EFI_ERROR(Status)) {
return Status;
}
Status = Pxe->Mtftp (
Pxe,
Operation,
BufferPtr,
Overwrite,
BufferSize,
BlockSize,
ServerIp,
Filename,
Info,
DontUseBuffer
);
return Status;
}

View File

@ -1,34 +0,0 @@
#/** @file
#
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
# 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.
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = EblNetworkLib
FILE_GUID = D885869A-7869-47DB-9429-DE03C318BCFD
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = EblNetworkLib|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
[sources.common]
EblNetworkLib.c
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
[Protocols]
gEfiSimpleNetworkProtocolGuid
gEfiPxeBaseCodeProtocolGuid
[Depex]
TRUE

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +0,0 @@
#/** @file
# Component description file for the entry point to a EFIDXE Drivers
#
# Library to abstract Framework extensions that conflict with UEFI 2.0 Specification
# Copyright (c) 2007 - 2007, Intel Corporation. All rights reserved.<BR>
#
# 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.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = EfiFileLib
FILE_GUID = d8c640db-73ba-48f5-a7ed-8e93c6012491
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = EfiFileLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
EfiFileLib.c
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
[LibraryClasses]
BaseLib
MemoryAllocationLib
DevicePathLib
PrintLib
BaseMemoryLib
UefiLib
UefiBootServicesTableLib
UefiRuntimeServicesTableLib
DebugLib
EblNetworkLib
[Protocols]
gEfiBlockIoProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiDiskIoProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiSimpleFileSystemProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiLoadFileProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
[Guids]
gEfiFileInfoGuid
gEfiFileSystemInfoGuid
gZeroGuid

View File

@ -1,72 +0,0 @@
/** @file
Add custom commands for BeagleBoard development.
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
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 <PiDxe.h>
#include <Library/ArmLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/EblCmdLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiLib.h>
#include <Library/PcdLib.h>
#include <Library/EfiFileLib.h>
//PcdEmbeddedFdBaseAddress
/**
Fill Me In
Argv[0] - "%CommandName%"
@param Argc Number of command arguments in Argv
@param Argv Array of strings that represent the parsed command line.
Argv[0] is the command name
@return EFI_SUCCESS
**/
EFI_STATUS
EblEdk2Cmd (
IN UINTN Argc,
IN CHAR8 **Argv
)
{
return EFI_SUCCESS;
}
GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =
{
{
"edk2",
" filename ; Load FD into memory and boot from it",
NULL,
EblEdk2Cmd
}
};
VOID
EblInitializeExternalCmd (
VOID
)
{
EblAddCommands (mLibCmdTemplate, sizeof (mLibCmdTemplate)/sizeof (EBL_COMMAND_TABLE));
return;
}

View File

@ -1,48 +0,0 @@
#/** @file
# Component description file for the entry point to a EFIDXE Drivers
#
# Library to abstract Framework extensions that conflict with UEFI 2.0 Specification
# Copyright (c) 2007 - 2007, Intel Corporation. All rights reserved.<BR>
#
# 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.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = BeagleBoardEblCmdLib
FILE_GUID = ea62bdc3-1063-425f-8851-98cb47f213a8
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = EblCmdLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
EblCmdLib.c
[Packages]
MdePkg/MdePkg.dec
EmbeddedPkg/EmbeddedPkg.dec
ArmPkg/ArmPkg.dec
[LibraryClasses]
BaseLib
DebugLib
[Protocols]
[Guids]
[Pcd]

View File

@ -180,7 +180,6 @@
Omap35xxPkg/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.inf
Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.inf
Omap35xxPkg/Library/EblCmdLib/EblCmdLib.inf
Omap35xxPkg/Library/GdbSerialLib/GdbSerialLib.inf
Omap35xxPkg/Library/RealTimeClockLib/RealTimeClockLib.inf
Omap35xxPkg/Library/SerialPortLib/SerialPortLib.inf