2009-12-06 02:57:05 +01:00
|
|
|
/** @file
|
|
|
|
Basic commands and command processing infrastructure for EBL
|
|
|
|
|
2010-04-29 14:40:51 +02:00
|
|
|
Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
|
|
|
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
2015-10-29 13:59:06 +01:00
|
|
|
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
|
2009-12-06 02:57:05 +01:00
|
|
|
|
2010-04-29 14:40:51 +02:00
|
|
|
This program and the accompanying materials
|
2009-12-06 02:57:05 +01:00
|
|
|
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
|
|
|
|
|
2014-08-19 15:29:52 +02:00
|
|
|
@return The uppercase value of Ascii character
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
STATIC
|
|
|
|
CHAR8
|
|
|
|
AsciiToUpper (
|
|
|
|
IN CHAR8 Chr
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return (UINT8) ((Chr >= 'a' && Chr <= 'z') ? Chr - ('a' - 'A') : Chr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-08-08 20:29:14 +02:00
|
|
|
Case insensitive comparison of two Null-terminated Unicode strings with maximum
|
2009-12-06 02:57:05 +01:00
|
|
|
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.
|
2014-08-19 15:29:52 +02:00
|
|
|
|
|
|
|
@param FirstString Pointer to a Null-terminated ASCII string.
|
2009-12-06 02:57:05 +01:00
|
|
|
@param SecondString Pointer to a Null-terminated ASCII string.
|
|
|
|
@param Length Max length to compare.
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
@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--;
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
return AsciiToUpper (*FirstString) - AsciiToUpper (*SecondString);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2014-08-19 15:29:52 +02:00
|
|
|
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
|
2011-08-08 20:29:14 +02:00
|
|
|
new entry is inserted into its sorted position.
|
2009-12-06 02:57:05 +01:00
|
|
|
|
2011-08-08 20:29:14 +02:00
|
|
|
@param Entry Command Entry to add to the CmdTable
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
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;
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
mCmdTable[Count] = mCmdTable[Count - 1];
|
|
|
|
}
|
|
|
|
mCmdTable[Count] = (EBL_COMMAND_TABLE *)Entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
mCmdTableNextFreeIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2014-08-19 15:29:52 +02:00
|
|
|
Add an set of commands to the command table. Most commonly used on static
|
2009-12-06 02:57:05 +01:00
|
|
|
array of commands.
|
|
|
|
|
|
|
|
@param EntryArray Pointer to array of command entries
|
2011-08-08 20:29:14 +02:00
|
|
|
@param ArrayCount Number of command entries to add
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2014-08-19 15:29:52 +02:00
|
|
|
Return the best matching command for the passed in command name. The match
|
2011-08-08 20:29:14 +02:00
|
|
|
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.
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
@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;
|
2010-02-11 00:48:46 +01:00
|
|
|
CHAR8 *Str;
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
Length = AsciiStrLen (CommandName);
|
2010-02-11 00:48:46 +01:00
|
|
|
Str = AsciiStrStr (CommandName, ".");
|
|
|
|
if (Str != NULL) {
|
|
|
|
// If the command includes a trailing . command extension skip it for the match.
|
|
|
|
// Example: hexdump.4
|
2014-08-19 15:29:52 +02:00
|
|
|
Length = (UINTN)(Str - CommandName);
|
2010-02-11 00:48:46 +01:00
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-12 21:13:55 +01:00
|
|
|
UINTN
|
|
|
|
CountNewLines (
|
|
|
|
IN CHAR8 *Str
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINTN Count;
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-12 21:13:55 +01:00
|
|
|
if (Str == NULL) {
|
|
|
|
return 0;
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-12 21:13:55 +01:00
|
|
|
for (Count = 0; *Str != '\0'; Str++) {
|
|
|
|
if (Str[Count] == '\n') {
|
|
|
|
Count++;
|
|
|
|
}
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-12 21:13:55 +01:00
|
|
|
return Count;
|
|
|
|
}
|
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
/**
|
2014-08-19 15:29:52 +02:00
|
|
|
List out help information on all the commands or print extended information
|
2009-12-06 02:57:05 +01:00
|
|
|
about a specific passed in command.
|
|
|
|
|
|
|
|
Argv[0] - "help"
|
|
|
|
Argv[1] - Command to display help about
|
|
|
|
|
|
|
|
@param Argc Number of command arguments in Argv
|
2014-08-19 15:29:52 +02:00
|
|
|
@param Argv Array of strings that represent the parsed command line.
|
2011-08-08 20:29:14 +02:00
|
|
|
Argv[0] is the command name
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
@return EFI_SUCCESS
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
2015-10-29 13:59:06 +01:00
|
|
|
EFIAPI
|
2009-12-06 02:57:05 +01:00
|
|
|
EblHelpCmd (
|
|
|
|
IN UINTN Argc,
|
|
|
|
IN CHAR8 **Argv
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINTN Index;
|
|
|
|
CHAR8 *Ptr;
|
2010-02-12 21:13:55 +01:00
|
|
|
UINTN CurrentRow = 0;
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
if (Argc == 1) {
|
|
|
|
// Print all the commands
|
|
|
|
AsciiPrint ("Embedded Boot Loader (EBL) commands (help command for more info):\n");
|
2010-02-12 21:13:55 +01:00
|
|
|
CurrentRow++;
|
2009-12-06 02:57:05 +01:00
|
|
|
for (Index = 0; Index < mCmdTableNextFreeIndex; Index++) {
|
|
|
|
EblSetTextColor (EFI_YELLOW);
|
|
|
|
AsciiPrint (" %a", mCmdTable[Index]->Name);
|
|
|
|
EblSetTextColor (0);
|
|
|
|
AsciiPrint ("%a\n", mCmdTable[Index]->HelpSummary);
|
2010-02-12 21:13:55 +01:00
|
|
|
// Handle multi line help summaries
|
|
|
|
CurrentRow += CountNewLines (mCmdTable[Index]->HelpSummary);
|
|
|
|
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
|
|
|
break;
|
|
|
|
}
|
2009-12-06 02:57:05 +01:00
|
|
|
}
|
|
|
|
} else if (Argv[1] != NULL) {
|
2014-08-19 15:29:52 +02:00
|
|
|
// Print specific help
|
2009-12-06 02:57:05 +01:00
|
|
|
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);
|
2010-02-12 21:13:55 +01:00
|
|
|
// Handle multi line help summaries
|
|
|
|
CurrentRow += CountNewLines (Ptr);
|
2009-12-06 02:57:05 +01:00
|
|
|
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-08-08 20:29:14 +02:00
|
|
|
Exit the EBL. If the command processor sees EFI_ABORTED return status it will
|
2009-12-06 02:57:05 +01:00
|
|
|
exit the EBL.
|
|
|
|
|
|
|
|
Argv[0] - "exit"
|
|
|
|
|
|
|
|
@param Argc Number of command arguments in Argv
|
2014-08-19 15:29:52 +02:00
|
|
|
@param Argv Array of strings that represent the parsed command line.
|
2011-08-08 20:29:14 +02:00
|
|
|
Argv[0] is the command name
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
@return EFI_ABORTED
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
2015-10-29 13:59:06 +01:00
|
|
|
EFIAPI
|
2009-12-06 02:57:05 +01:00
|
|
|
EblExitCmd (
|
|
|
|
IN UINTN Argc,
|
|
|
|
IN CHAR8 **Argv
|
|
|
|
)
|
|
|
|
{
|
2010-02-07 23:04:03 +01:00
|
|
|
EFI_STATUS Status;
|
|
|
|
UINTN MemoryMapSize;
|
|
|
|
EFI_MEMORY_DESCRIPTOR *MemoryMap;
|
|
|
|
UINTN MapKey;
|
|
|
|
UINTN DescriptorSize;
|
|
|
|
UINT32 DescriptorVersion;
|
|
|
|
UINTN Pages;
|
2009-12-06 02:57:05 +01:00
|
|
|
|
2014-08-19 15:29:52 +02:00
|
|
|
if (Argc > 1) {
|
2009-12-06 02:57:05 +01:00
|
|
|
if (AsciiStriCmp (Argv[1], "efi") != 0) {
|
|
|
|
return EFI_ABORTED;
|
|
|
|
}
|
|
|
|
} else if (Argc == 1) {
|
|
|
|
return EFI_ABORTED;
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-07 23:04:03 +01:00
|
|
|
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);
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-07 23:04:03 +01:00
|
|
|
//
|
|
|
|
// 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));
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// 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.
|
2014-08-19 15:29:52 +02:00
|
|
|
//
|
2009-12-06 02:57:05 +01:00
|
|
|
CpuDeadLoop ();
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
// Should never get here, but makes the compiler happy
|
|
|
|
return EFI_ABORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Update the screen by decrementing the timeout value.
|
2014-08-19 15:29:52 +02:00
|
|
|
This AsciiPrint has to match the AsciiPrint in
|
|
|
|
EblPauseCmd.
|
2009-12-06 02:57:05 +01:00
|
|
|
|
2011-08-08 20:29:14 +02:00
|
|
|
@param ElaspedTime Current timeout value remaining
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
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
|
2014-08-19 15:29:52 +02:00
|
|
|
@param Argv Array of strings that represent the parsed command line.
|
2011-08-08 20:29:14 +02:00
|
|
|
Argv[0] is the command name
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
@return EFI_SUCCESS Timeout expired with no input
|
2011-08-08 20:29:14 +02:00
|
|
|
@return EFI_TIMEOUT Stop processing other commands on the same command line
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
2015-10-29 13:59:06 +01:00
|
|
|
EFIAPI
|
2009-12-06 02:57:05 +01:00
|
|
|
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");
|
|
|
|
|
2011-08-08 20:29:14 +02:00
|
|
|
// 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
|
2009-12-06 02:57:05 +01:00
|
|
|
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
|
2014-08-19 15:29:52 +02:00
|
|
|
@param Argv Array of strings that represent the parsed command line.
|
2011-08-08 20:29:14 +02:00
|
|
|
Argv[0] is the command name
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
@return EFI_SUCCESS
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
2015-10-29 13:59:06 +01:00
|
|
|
EFIAPI
|
2009-12-06 02:57:05 +01:00
|
|
|
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
|
2014-08-19 15:29:52 +02:00
|
|
|
@param Argv Array of strings that represent the parsed command line.
|
2011-08-08 20:29:14 +02:00
|
|
|
Argv[0] is the command name
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
@return EFI_SUCCESS
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
2015-10-29 13:59:06 +01:00
|
|
|
EFIAPI
|
2009-12-06 02:57:05 +01:00
|
|
|
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;
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
}
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
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
|
2014-08-19 15:29:52 +02:00
|
|
|
@param Argv Array of strings that represent the parsed command line.
|
2011-08-08 20:29:14 +02:00
|
|
|
Argv[0] is the command name
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
@return EFI_SUCCESS
|
|
|
|
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
2015-10-29 13:59:06 +01:00
|
|
|
EFIAPI
|
2009-12-06 02:57:05 +01:00
|
|
|
EblPageCmd (
|
|
|
|
IN UINTN Argc,
|
|
|
|
IN CHAR8 **Argv
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (Argc <= 1) {
|
2014-08-19 15:29:52 +02:00
|
|
|
// toggle setting
|
2009-12-06 02:57:05 +01:00
|
|
|
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
|
2015-10-29 13:59:06 +01:00
|
|
|
EFIAPI
|
2009-12-06 02:57:05 +01:00
|
|
|
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
|
|
|
|
)
|
|
|
|
{
|
2010-02-10 21:04:08 +01:00
|
|
|
if (Character < ' ' || Character > '~') {
|
2009-12-06 02:57:05 +01:00
|
|
|
return '.';
|
2010-02-10 21:04:08 +01:00
|
|
|
} else {
|
2009-12-06 02:57:05 +01:00
|
|
|
return Character;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UINTN
|
|
|
|
GetBytes (
|
|
|
|
IN UINT8 *Address,
|
|
|
|
IN UINTN Bytes
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINTN Result = 0;
|
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
if (Bytes >= 1) {
|
2009-12-06 02:57:05 +01:00
|
|
|
Result = *Address++;
|
2010-02-10 21:04:08 +01:00
|
|
|
}
|
|
|
|
if (Bytes >= 2) {
|
2009-12-06 02:57:05 +01:00
|
|
|
Result = (Result << 8) + *Address++;
|
2014-08-19 15:29:52 +02:00
|
|
|
}
|
2010-02-10 21:04:08 +01:00
|
|
|
if (Bytes >= 3) {
|
2009-12-06 02:57:05 +01:00
|
|
|
Result = (Result << 8) + *Address++;
|
2010-02-10 21:04:08 +01:00
|
|
|
}
|
2009-12-06 02:57:05 +01:00
|
|
|
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];
|
|
|
|
|
|
|
|
AsciiStrCpy (Blanks, mBlanks);
|
2010-02-10 21:04:08 +01:00
|
|
|
for (EndAddress = Address + Length; Address < EndAddress; Offset += Line) {
|
2009-12-06 02:57:05 +01:00
|
|
|
AsciiPrint ("%08x: ", Offset);
|
2010-02-10 21:04:08 +01:00
|
|
|
for (Line = 0; (Line < 0x10) && (Address < EndAddress);) {
|
2009-12-06 02:57:05 +01:00
|
|
|
Bytes = EndAddress - Address;
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
switch (Width) {
|
2009-12-06 02:57:05 +01:00
|
|
|
case 4:
|
2010-02-10 21:04:08 +01:00
|
|
|
if (Bytes >= 4) {
|
2009-12-06 02:57:05 +01:00
|
|
|
AsciiPrint ("%08x ", *((UINT32 *)Address));
|
|
|
|
TextLine[Line++] = ConvertToTextLine(*Address++);
|
|
|
|
TextLine[Line++] = ConvertToTextLine(*Address++);
|
|
|
|
TextLine[Line++] = ConvertToTextLine(*Address++);
|
|
|
|
TextLine[Line++] = ConvertToTextLine(*Address++);
|
2010-02-10 21:04:08 +01:00
|
|
|
} else {
|
2009-12-06 02:57:05 +01:00
|
|
|
AsciiPrint ("%08x ", GetBytes(Address, Bytes));
|
|
|
|
Address += Bytes;
|
|
|
|
Line += Bytes;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2010-02-10 21:04:08 +01:00
|
|
|
if (Bytes >= 2) {
|
2009-12-06 02:57:05 +01:00
|
|
|
AsciiPrint ("%04x ", *((UINT16 *)Address));
|
|
|
|
TextLine[Line++] = ConvertToTextLine(*Address++);
|
|
|
|
TextLine[Line++] = ConvertToTextLine(*Address++);
|
2010-02-10 21:04:08 +01:00
|
|
|
} else {
|
2009-12-06 02:57:05 +01:00
|
|
|
AsciiPrint ("%04x ", GetBytes(Address, Bytes));
|
|
|
|
Address += Bytes;
|
|
|
|
Line += Bytes;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
AsciiPrint ("%02x ", *((UINT8 *)Address));
|
|
|
|
TextLine[Line++] = ConvertToTextLine(*Address++);
|
|
|
|
break;
|
|
|
|
|
ARM Packages: Replace tabs by spaces for indentation
Replace tabs by spaces for indentation to comply to EDK2 coding standards.
Done in files with extension ".S", ".c", ".h", ".asm", ".dsc", ".inc", "*.inf",
"*.dec" or ".fdf" and located in ArmPkg, ArmPlatformPkg, EmbeddedPkg,
BeagleBoardPkg or Omap35xxPkg.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15901 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-26 12:14:17 +02:00
|
|
|
default:
|
|
|
|
AsciiPrint ("Width must be 1, 2, or 4!\n");
|
|
|
|
return EFI_INVALID_PARAMETER;
|
2009-12-06 02:57:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Pad spaces
|
2010-02-10 21:04:08 +01:00
|
|
|
if (Line < 0x10) {
|
|
|
|
switch (Width) {
|
2009-12-06 02:57:05 +01:00
|
|
|
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);
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
Blanks[Spaces] = ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
TextLine[Line] = 0;
|
|
|
|
AsciiPrint ("|%a|\n", TextLine);
|
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {
|
2009-12-06 02:57:05 +01:00
|
|
|
return EFI_END_OF_FILE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
if (Length % Width != 0) {
|
2009-12-06 02:57:05 +01:00
|
|
|
AsciiPrint ("%08x\n", Offset);
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-02-11 00:48:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
See if command contains .# where # is a number. Return # as the Width
|
2014-08-19 15:29:52 +02:00
|
|
|
or 1 as the default Width for commands.
|
|
|
|
|
2010-02-11 00:48:46 +01:00
|
|
|
Example hexdump.4 returns a width of 4.
|
|
|
|
|
2011-08-08 20:29:14 +02:00
|
|
|
@param Argv Argv[0] is the command name
|
2010-02-11 00:48:46 +01:00
|
|
|
|
|
|
|
@return Width of command
|
|
|
|
|
|
|
|
**/
|
|
|
|
UINTN
|
|
|
|
WidthFromCommandName (
|
|
|
|
IN CHAR8 *Argv,
|
|
|
|
IN UINTN Default
|
|
|
|
)
|
|
|
|
{
|
|
|
|
CHAR8 *Str;
|
|
|
|
UINTN Width;
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-11 00:48:46 +01:00
|
|
|
//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;
|
|
|
|
}
|
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
#define HEXDUMP_CHUNK 1024
|
|
|
|
|
2010-02-11 00:48:46 +01:00
|
|
|
/**
|
|
|
|
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
|
|
|
|
|
2014-08-19 15:29:52 +02:00
|
|
|
Argv[0] - "hexdump"[.#] # is optional 1,2, or 4 for width
|
|
|
|
Argv[1] - Device or File to dump.
|
2010-02-11 00:48:46 +01:00
|
|
|
Argv[2] - Optional offset to start dumping
|
|
|
|
Argv[3] - Optional number of bytes to dump
|
|
|
|
|
|
|
|
@param Argc Number of command arguments in Argv
|
2014-08-19 15:29:52 +02:00
|
|
|
@param Argv Array of strings that represent the parsed command line.
|
2011-08-08 20:29:14 +02:00
|
|
|
Argv[0] is the command name
|
2010-02-11 00:48:46 +01:00
|
|
|
|
|
|
|
@return EFI_SUCCESS
|
|
|
|
|
|
|
|
**/
|
2009-12-06 02:57:05 +01:00
|
|
|
EFI_STATUS
|
2015-10-29 13:59:06 +01:00
|
|
|
EFIAPI
|
2009-12-06 02:57:05 +01:00
|
|
|
EblHexdumpCmd (
|
|
|
|
IN UINTN Argc,
|
|
|
|
IN CHAR8 **Argv
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_OPEN_FILE *File;
|
|
|
|
VOID *Location;
|
|
|
|
UINTN Size;
|
2010-02-11 00:48:46 +01:00
|
|
|
UINTN Width;
|
2009-12-06 02:57:05 +01:00
|
|
|
UINTN Offset = 0;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
UINTN Chunk = HEXDUMP_CHUNK;
|
|
|
|
|
2010-02-11 00:48:46 +01:00
|
|
|
if ((Argc < 2) || (Argc > 4)) {
|
2009-12-06 02:57:05 +01:00
|
|
|
return EFI_INVALID_PARAMETER;
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-11 00:48:46 +01:00
|
|
|
Width = WidthFromCommandName (Argv[0], 1);
|
2010-02-10 21:04:08 +01:00
|
|
|
if ((Width != 1) && (Width != 2) && (Width != 4)) {
|
2009-12-06 02:57:05 +01:00
|
|
|
return EFI_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);
|
|
|
|
if (File == NULL) {
|
2009-12-06 02:57:05 +01:00
|
|
|
return EFI_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
Location = AllocatePool (Chunk);
|
2010-02-11 00:48:46 +01:00
|
|
|
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;
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
}
|
2009-12-06 02:57:05 +01:00
|
|
|
|
2010-02-11 00:48:46 +01:00
|
|
|
Status = EfiSeek (File, Offset, EfiSeekStart);
|
|
|
|
if (EFI_ERROR (Status)) {
|
|
|
|
goto Exit;
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2010-02-11 00:48:46 +01:00
|
|
|
for (; Offset + HEXDUMP_CHUNK <= Size; Offset += Chunk) {
|
2009-12-06 02:57:05 +01:00
|
|
|
Chunk = HEXDUMP_CHUNK;
|
2010-02-10 21:04:08 +01:00
|
|
|
Status = EfiRead (File, Location, &Chunk);
|
2010-02-11 00:48:46 +01:00
|
|
|
if (EFI_ERROR(Status)) {
|
2009-12-06 02:57:05 +01:00
|
|
|
AsciiPrint ("Error reading file content\n");
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
Status = OutputData (Location, Chunk, Width, File->BaseOffset + Offset);
|
|
|
|
if (EFI_ERROR(Status)) {
|
2009-12-06 02:57:05 +01:00
|
|
|
if (Status == EFI_END_OF_FILE) {
|
|
|
|
Status = EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
}
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
// Any left over?
|
2010-02-10 21:04:08 +01:00
|
|
|
if (Offset < Size) {
|
2009-12-06 02:57:05 +01:00
|
|
|
Chunk = Size - Offset;
|
2010-02-10 21:04:08 +01:00
|
|
|
Status = EfiRead (File, Location, &Chunk);
|
|
|
|
if (EFI_ERROR(Status)) {
|
2009-12-06 02:57:05 +01:00
|
|
|
AsciiPrint ("Error reading file content\n");
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
Status = OutputData (Location, Chunk, Width, File->BaseOffset + Offset);
|
|
|
|
if (EFI_ERROR(Status)) {
|
2009-12-06 02:57:05 +01:00
|
|
|
if (Status == EFI_END_OF_FILE) {
|
|
|
|
Status = EFI_SUCCESS;
|
|
|
|
}
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
2010-02-10 21:04:08 +01:00
|
|
|
EfiClose (File);
|
2009-12-06 02:57:05 +01:00
|
|
|
|
2010-02-10 21:04:08 +01:00
|
|
|
FreePool (Location);
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
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",
|
2010-02-12 21:13:55 +01:00
|
|
|
"[.{1|2|4}] filename [Offset] [Size]; dump a file as hex .width",
|
2009-12-06 02:57:05 +01:00
|
|
|
NULL,
|
|
|
|
EblHexdumpCmd
|
2010-02-10 21:04:08 +01:00
|
|
|
}
|
2009-12-06 02:57:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
EFI_HANDLE gExternalCmdHandle = NULL;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Initialize the commands in this in this file
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EblInitializeCmdTable (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
|
|
|
|
EblAddCommands (mCmdTemplate, sizeof (mCmdTemplate)/sizeof (EBL_COMMAND_TABLE));
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
gBS->InstallProtocolInterface (
|
|
|
|
&gExternalCmdHandle,
|
|
|
|
&gEfiEblAddCommandProtocolGuid,
|
|
|
|
EFI_NATIVE_INTERFACE,
|
|
|
|
&gEblAddCommand
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
|
|
|
EblShutdownExternalCmdTable (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
gBS->UninstallProtocolInterface (gExternalCmdHandle, &gEfiEblAddCommandProtocolGuid, &gEblAddCommand);
|
|
|
|
}
|
|
|
|
|
|
|
|
|