public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org, afish@apple.com
Subject: Re: [PATCH] EmbeddedPkg Omap35xxPkg: remove EBL and associated libraries
Date: Fri, 24 Nov 2017 17:21:07 +0000	[thread overview]
Message-ID: <20171124172107.cfhnatabgwzof4x3@bivouac.eciton.net> (raw)
In-Reply-To: <20171115154553.24275-1-ard.biesheuvel@linaro.org>

On Wed, Nov 15, 2017 at 03:45:53PM +0000, Ard Biesheuvel wrote:
> 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.

Yes, please.
If someone in the future wants to use this seriously (instead of just
finding it easier to add commands to than the UEFI shell), we can
easily resurrect it.

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  BeagleBoardPkg/BeagleBoardPkg.dsc                                         |    3 -
>  EmbeddedPkg/Ebl/CmdTemplate.c                                             |   65 -
>  EmbeddedPkg/Ebl/Command.c                                                 |  925 ----------
>  EmbeddedPkg/Ebl/Dir.c                                                     |  357 ----
>  EmbeddedPkg/Ebl/Ebl.h                                                     |  210 ---
>  EmbeddedPkg/Ebl/Ebl.inf                                                   |  111 --
>  EmbeddedPkg/Ebl/EfiDevice.c                                               | 1060 ------------
>  EmbeddedPkg/Ebl/Hob.c                                                     |  234 ---
>  EmbeddedPkg/Ebl/HwDebug.c                                                 |  346 ----
>  EmbeddedPkg/Ebl/HwIoDebug.c                                               |  154 --
>  EmbeddedPkg/Ebl/Main.c                                                    |  677 --------
>  EmbeddedPkg/Ebl/Network.c                                                 |  106 --
>  EmbeddedPkg/Ebl/Script.c                                                  |  128 --
>  EmbeddedPkg/Ebl/Variable.c                                                |  221 ---
>  EmbeddedPkg/EblExternCmd/EntryPointGlue.c                                 |  154 --
>  EmbeddedPkg/EblExternCmd/Main.c                                           |   53 -
>  EmbeddedPkg/EmbeddedPkg.dec                                               |    6 -
>  EmbeddedPkg/EmbeddedPkg.dsc                                               |   10 -
>  EmbeddedPkg/EmbeddedPkg.fdf                                               |  141 --
>  EmbeddedPkg/Include/Library/EblAddExternalCommandLib.h                    |  122 --
>  EmbeddedPkg/Include/Library/EblCmdLib.h                                   |   51 -
>  EmbeddedPkg/Include/Library/EblNetworkLib.h                               |   68 -
>  EmbeddedPkg/Include/Protocol/EblAddCommand.h                              |  142 --
>  EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.c   |  155 --
>  EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf |   47 -
>  EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.c                         |   28 -
>  EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.inf                       |   43 -
>  EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c                         |  173 --
>  EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf                       |   34 -
>  EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c                               | 1784 --------------------
>  EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf                             |   64 -
>  Omap35xxPkg/Library/EblCmdLib/EblCmdLib.c                                 |   72 -
>  Omap35xxPkg/Library/EblCmdLib/EblCmdLib.inf                               |   48 -
>  Omap35xxPkg/Omap35xxPkg.dsc                                               |    1 -
>  34 files changed, 7793 deletions(-)
> 
> diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc
> index 30f6fd02e82f..b342672c3877 100644
> --- a/BeagleBoardPkg/BeagleBoardPkg.dsc
> +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc
> @@ -60,8 +60,6 @@ [LibraryClasses.common]
>    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 @@ [PcdsFeatureFlag.common]
>  [PcdsFixedAtBuild.common]
>    gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"Beagle Board"
>  
> -  gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"BeagleEdk2"
>    gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
>    gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
>    gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
> diff --git a/EmbeddedPkg/Ebl/CmdTemplate.c b/EmbeddedPkg/Ebl/CmdTemplate.c
> deleted file mode 100644
> index 2c291fcaea52..000000000000
> --- a/EmbeddedPkg/Ebl/CmdTemplate.c
> +++ /dev/null
> @@ -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));
> -}
> -
> diff --git a/EmbeddedPkg/Ebl/Command.c b/EmbeddedPkg/Ebl/Command.c
> deleted file mode 100644
> index 4bc1f4df0ca0..000000000000
> --- a/EmbeddedPkg/Ebl/Command.c
> +++ /dev/null
> @@ -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);
> -}
> -
> -
> diff --git a/EmbeddedPkg/Ebl/Dir.c b/EmbeddedPkg/Ebl/Dir.c
> deleted file mode 100644
> index a73c88d3aa2d..000000000000
> --- a/EmbeddedPkg/Ebl/Dir.c
> +++ /dev/null
> @@ -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));
> -  }
> -}
> -
> diff --git a/EmbeddedPkg/Ebl/Ebl.h b/EmbeddedPkg/Ebl/Ebl.h
> deleted file mode 100644
> index e028735d6b8a..000000000000
> --- a/EmbeddedPkg/Ebl/Ebl.h
> +++ /dev/null
> @@ -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
> -
> diff --git a/EmbeddedPkg/Ebl/Ebl.inf b/EmbeddedPkg/Ebl/Ebl.inf
> deleted file mode 100644
> index 91a82d9f8cf8..000000000000
> --- a/EmbeddedPkg/Ebl/Ebl.inf
> +++ /dev/null
> @@ -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
> -
> diff --git a/EmbeddedPkg/Ebl/EfiDevice.c b/EmbeddedPkg/Ebl/EfiDevice.c
> deleted file mode 100644
> index f6969e7b2b05..000000000000
> --- a/EmbeddedPkg/Ebl/EfiDevice.c
> +++ /dev/null
> @@ -1,1060 +0,0 @@
> -/** @file
> -  EBL commands for EFI and PI Devices
> -
> -  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"
> -
> -
> -EFI_DXE_SERVICES  *gDS = NULL;
> -
> -
> -/**
> -  Print information about the File System device.
> -
> -  @param  File  Open File for the device
> -
> -**/
> -VOID
> -EblPrintFsInfo (
> -  IN  EFI_OPEN_FILE   *File
> -  )
> -{
> -  CHAR16 *Str;
> -
> -  if (File == NULL) {
> -    return;
> -  }
> -
> -  AsciiPrint ("  %a: ", File->DeviceName);
> -  if (File->FsInfo != NULL) {
> -    for (Str = File->FsInfo->VolumeLabel; *Str != '\0'; Str++) {
> -      if (*Str == ' ') {
> -        // UI makes you enter _ for space, so make the printout match that
> -        *Str = '_';
> -      }
> -      AsciiPrint ("%c", *Str);
> -    }
> -    AsciiPrint (":");
> -    if (File->FsInfo->ReadOnly) {
> -      AsciiPrint ("ReadOnly");
> -    }
> -  }
> -
> -  AsciiPrint ("\n");
> -  EfiClose (File);
> -}
> -
> -
> -/**
> -  Print information about the FV devices.
> -
> -  @param  File  Open File for the device
> -
> -**/
> -VOID
> -EblPrintFvbInfo (
> -  IN  EFI_OPEN_FILE   *File
> -  )
> -{
> -  if (File == NULL) {
> -    return;
> -  }
> -
> -  AsciiPrint ("  %a: 0x%08lx - 0x%08lx : 0x%08x\n", File->DeviceName, File->FvStart, File->FvStart + File->FvSize - 1, File->FvSize);
> -  EfiClose (File);
> -}
> -
> -
> -/**
> -  Print information about the Blk IO devices.
> -  If the device supports PXE dump out extra information
> -
> -  @param  File  Open File for the device
> -
> -**/
> -VOID
> -EblPrintBlkIoInfo (
> -  IN  EFI_OPEN_FILE   *File
> -  )
> -{
> -  UINT64                    DeviceSize;
> -  UINTN                     Index;
> -  UINTN                     Max;
> -  EFI_OPEN_FILE             *FsFile;
> -
> -  if (File == NULL) {
> -    return;
> -  }
> -
> -  AsciiPrint ("  %a: ", File->DeviceName);
> -
> -  // print out name of file system, if any, on this block device
> -  Max = EfiGetDeviceCounts (EfiOpenFileSystem);
> -  if (Max != 0) {
> -    for (Index = 0; Index < Max; Index++) {
> -      FsFile = EfiDeviceOpenByType (EfiOpenFileSystem, Index);
> -      if (FsFile != NULL) {
> -        if (FsFile->EfiHandle == File->EfiHandle) {
> -          AsciiPrint ("fs%d: ", Index);
> -          EfiClose (FsFile);
> -          break;
> -        }
> -        EfiClose (FsFile);
> -      }
> -    }
> -  }
> -
> -  // Print out useful Block IO media properties
> -  if (File->FsBlockIoMedia->RemovableMedia) {
> -    AsciiPrint ("Removable ");
> -  }
> -  if (!File->FsBlockIoMedia->MediaPresent) {
> -    AsciiPrint ("No Media\n");
> -  } else {
> -    if (File->FsBlockIoMedia->LogicalPartition) {
> -      AsciiPrint ("Partition ");
> -    }
> -    DeviceSize = MultU64x32 (File->FsBlockIoMedia->LastBlock + 1, File->FsBlockIoMedia->BlockSize);
> -    AsciiPrint ("Size = 0x%lX\n", DeviceSize);
> -  }
> -  EfiClose (File);
> -}
> -
> - /**
> -  Print information about the Load File devices.
> -  If the device supports PXE dump out extra information
> -
> -  @param  File  Open File for the device
> -
> -**/
> -VOID
> -EblPrintLoadFileInfo (
> -  IN  EFI_OPEN_FILE   *File
> -  )
> -{
> -  EFI_DEVICE_PATH_PROTOCOL    *DevicePathNode;
> -  MAC_ADDR_DEVICE_PATH        *MacAddr;
> -  UINTN                       HwAddressSize;
> -  UINTN                       Index;
> -
> -  if (File == NULL) {
> -    return;
> -  }
> -
> -  AsciiPrint ("  %a: %a ", File->DeviceName, EblLoadFileBootTypeString (File->EfiHandle));
> -
> -  if (File->DevicePath != NULL) {
> -    // Try to print out the MAC address
> -    for (DevicePathNode = File->DevicePath;
> -        !IsDevicePathEnd (DevicePathNode);
> -        DevicePathNode = NextDevicePathNode (DevicePathNode)) {
> -
> -      if ((DevicePathType (DevicePathNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePathNode) == MSG_MAC_ADDR_DP)) {
> -        MacAddr = (MAC_ADDR_DEVICE_PATH *)DevicePathNode;
> -
> -        HwAddressSize = sizeof (EFI_MAC_ADDRESS);
> -        if (MacAddr->IfType == 0x01 || MacAddr->IfType == 0x00) {
> -          HwAddressSize = 6;
> -        }
> -
> -        AsciiPrint ("MAC ");
> -        for (Index = 0; Index < HwAddressSize; Index++) {
> -          AsciiPrint ("%02x", MacAddr->MacAddress.Addr[Index] & 0xff);
> -        }
> -      }
> -    }
> -  }
> -
> -  AsciiPrint ("\n");
> -  EfiClose (File);
> -  return;
> -}
> -
> -
> -
> -/**
> -  Dump information about devices in the system.
> -
> -  fv:       PI Firmware Volume
> -  fs:       EFI Simple File System
> -  blk:      EFI Block IO
> -  LoadFile: EFI Load File Protocol (commonly PXE network boot)
> -
> -  Argv[0] - "device"
> -
> -  @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
> -EblDeviceCmd (
> -  IN UINTN  Argc,
> -  IN CHAR8  **Argv
> -  )
> -{
> -  UINTN         Index;
> -  UINTN         CurrentRow;
> -  UINTN         Max;
> -
> -  CurrentRow = 0;
> -
> -  // Need to call here to make sure Device Counts are valid
> -  EblUpdateDeviceLists ();
> -
> -  // Now we can print out the info...
> -  Max = EfiGetDeviceCounts (EfiOpenFirmwareVolume);
> -  if (Max != 0) {
> -    AsciiPrint ("Firmware Volume Devices:\n");
> -    for (Index = 0; Index < Max; Index++) {
> -      EblPrintFvbInfo (EfiDeviceOpenByType (EfiOpenFirmwareVolume, Index));
> -      if (EblAnyKeyToContinueQtoQuit (&CurrentRow, TRUE)) {
> -        break;
> -      }
> -    }
> -  }
> -
> -  Max = EfiGetDeviceCounts (EfiOpenFileSystem);
> -  if (Max != 0) {
> -    AsciiPrint ("File System Devices:\n");
> -    for (Index = 0; Index < Max; Index++) {
> -      EblPrintFsInfo (EfiDeviceOpenByType (EfiOpenFileSystem, Index));
> -      if (EblAnyKeyToContinueQtoQuit (&CurrentRow, TRUE)) {
> -        break;
> -      }
> -    }
> -  }
> -
> -  Max = EfiGetDeviceCounts (EfiOpenBlockIo);
> -  if (Max != 0) {
> -    AsciiPrint ("Block IO Devices:\n");
> -    for (Index = 0; Index < Max; Index++) {
> -      EblPrintBlkIoInfo (EfiDeviceOpenByType (EfiOpenBlockIo, Index));
> -      if (EblAnyKeyToContinueQtoQuit (&CurrentRow, TRUE)) {
> -        break;
> -      }
> -    }
> -  }
> -
> -  Max = EfiGetDeviceCounts (EfiOpenLoadFile);
> -  if (Max != 0) {
> -    AsciiPrint ("LoadFile Devices: (usually network)\n");
> -    for (Index = 0; Index < Max; Index++) {
> -      EblPrintLoadFileInfo (EfiDeviceOpenByType (EfiOpenLoadFile, Index));
> -      if (EblAnyKeyToContinueQtoQuit (&CurrentRow, TRUE)) {
> -        break;
> -      }
> -    }
> -  }
> -
> -  return EFI_SUCCESS;
> -}
> -
> -
> -/**
> -  Start an EFI image (PE32+ with EFI defined entry point).
> -
> -  Argv[0] - "start"
> -  Argv[1] - device name and path
> -  Argv[2] - "" string to pass into image being started
> -
> -  start fs1:\Temp\Fv.Fv "arg to pass" ; load an FV from the disk and pass the
> -                                      ; ascii string arg to pass to the image
> -  start fv0:\FV                       ; load an FV from an FV (not common)
> -  start LoadFile0:                    ; load an FV via a PXE boot
> -
> -  @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
> -EblStartCmd (
> -  IN UINTN  Argc,
> -  IN CHAR8  **Argv
> -  )
> -{
> -  EFI_STATUS                  Status;
> -  EFI_OPEN_FILE               *File;
> -  EFI_DEVICE_PATH_PROTOCOL    *DevicePath;
> -  EFI_HANDLE                  ImageHandle;
> -  UINTN                       ExitDataSize;
> -  CHAR16                      *ExitData;
> -  VOID                        *Buffer;
> -  UINTN                       BufferSize;
> -  EFI_LOADED_IMAGE_PROTOCOL   *ImageInfo;
> -
> -  ImageHandle = NULL;
> -
> -  if (Argc < 2) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);
> -  if (File == NULL) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  DevicePath = File->DevicePath;
> -  if (DevicePath != NULL) {
> -    // check for device path form: blk, fv, fs, and loadfile
> -    Status = gBS->LoadImage (FALSE, gImageHandle, DevicePath, NULL, 0, &ImageHandle);
> -  } else {
> -    // Check for buffer form: A0x12345678:0x1234 syntax.
> -    // Means load using buffer starting at 0x12345678 of size 0x1234.
> -
> -    Status = EfiReadAllocatePool (File, &Buffer, &BufferSize);
> -    if (EFI_ERROR (Status)) {
> -      EfiClose (File);
> -      return Status;
> -    }
> -    Status = gBS->LoadImage (FALSE, gImageHandle, DevicePath, Buffer, BufferSize, &ImageHandle);
> -
> -    FreePool (Buffer);
> -  }
> -
> -  EfiClose (File);
> -
> -  if (!EFI_ERROR (Status)) {
> -    if (Argc >= 3) {
> -      // Argv[2] is a "" string that we pass directly to the EFI application without the ""
> -      // We don't pass Argv[0] to the EFI Application (it's name) just the args
> -      Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&ImageInfo);
> -      ASSERT_EFI_ERROR (Status);
> -
> -      ImageInfo->LoadOptionsSize = (UINT32)AsciiStrSize (Argv[2]);
> -      ImageInfo->LoadOptions     = AllocatePool (ImageInfo->LoadOptionsSize);
> -      AsciiStrCpyS (ImageInfo->LoadOptions, ImageInfo->LoadOptionsSize, Argv[2]);
> -    }
> -
> -    // Transfer control to the EFI image we loaded with LoadImage()
> -    Status = gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData);
> -  }
> -
> -  return Status;
> -}
> -
> -
> -/**
> -  Load a Firmware Volume (FV) into memory from a device. This causes drivers in
> -  the FV to be dispatched if the dependencies of the drivers are met.
> -
> -  Argv[0] - "loadfv"
> -  Argv[1] - device name and path
> -
> -  loadfv fs1:\Temp\Fv.Fv ; load an FV from the disk
> -  loadfv fv0:\FV         ; load an FV from an FV (not common)
> -  loadfv LoadFile0:      ; load an FV via a PXE boot
> -
> -  @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
> -EblLoadFvCmd (
> -  IN UINTN  Argc,
> -  IN CHAR8  **Argv
> -  )
> -{
> -  EFI_STATUS                        Status;
> -  EFI_OPEN_FILE                     *File;
> -  VOID                              *FvStart;
> -  UINTN                             FvSize;
> -  EFI_HANDLE                        FvHandle;
> -
> -
> -  if (Argc < 2) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);
> -  if (File == NULL) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  if (File->Type == EfiOpenMemoryBuffer) {
> -    // If it is a address just use it.
> -    Status = gDS->ProcessFirmwareVolume (File->Buffer, File->Size, &FvHandle);
> -  } else {
> -    // If it is a file read it into memory and use it
> -    Status = EfiReadAllocatePool (File, &FvStart, &FvSize);
> -    EfiClose (File);
> -    if (EFI_ERROR (Status)) {
> -      return Status;
> -    }
> -
> -    Status = gDS->ProcessFirmwareVolume (FvStart, FvSize, &FvHandle);
> -    if (EFI_ERROR (Status)) {
> -      FreePool (FvStart);
> -    }
> -  }
> -  return Status;
> -}
> -
> -
> -/**
> -  Perform an EFI connect to connect devices that follow the EFI driver model.
> -  If it is a PI system also call the dispatcher in case a new FV was made
> -  available by one of the connect EFI drivers (this is not a common case).
> -
> -  Argv[0] - "connect"
> -
> -  @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
> -EblConnectCmd (
> -  IN UINTN  Argc,
> -  IN CHAR8  **Argv
> -  )
> -{
> -  EFI_STATUS    Status;
> -  UINTN         HandleCount;
> -  EFI_HANDLE    *HandleBuffer;
> -  UINTN         Index;
> -  BOOLEAN       Dispatch;
> -  EFI_OPEN_FILE *File;
> -
> -
> -  if (Argc > 1) {
> -    if ((*Argv[1] == 'd') || (*Argv[1] == 'D')) {
> -      Status = gBS->LocateHandleBuffer (
> -                      AllHandles,
> -                      NULL,
> -                      NULL,
> -                      &HandleCount,
> -                      &HandleBuffer
> -                      );
> -      if (EFI_ERROR (Status)) {
> -        return Status;
> -      }
> -
> -      for (Index = 0; Index < HandleCount; Index++) {
> -        gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
> -      }
> -
> -      //
> -      // Given we disconnect our console we should go and do a connect now
> -      //
> -    } else {
> -      File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);
> -      if (File != NULL) {
> -        AsciiPrint ("Connecting %a\n", Argv[1]);
> -        gBS->ConnectController (File->EfiHandle, NULL, NULL, TRUE);
> -        EfiClose (File);
> -        return EFI_SUCCESS;
> -      }
> -    }
> -  }
> -
> -  Dispatch = FALSE;
> -  do {
> -    Status = gBS->LocateHandleBuffer (
> -                    AllHandles,
> -                    NULL,
> -                    NULL,
> -                    &HandleCount,
> -                    &HandleBuffer
> -                    );
> -    if (EFI_ERROR (Status)) {
> -      return Status;
> -    }
> -
> -    for (Index = 0; Index < HandleCount; Index++) {
> -      gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
> -    }
> -
> -    FreePool (HandleBuffer);
> -
> -    //
> -    // Check to see if it's possible to dispatch an more DXE drivers.
> -    // The BdsLibConnectAllEfi () may have made new DXE drivers show up.
> -    // If anything is Dispatched Status == EFI_SUCCESS and we will try
> -    // the connect again.
> -    //
> -    if (gDS == NULL) {
> -      Status = EFI_NOT_FOUND;
> -    } else {
> -      Status = gDS->Dispatch ();
> -      if (!EFI_ERROR (Status)) {
> -        Dispatch = TRUE;
> -      }
> -    }
> -
> -  } while (!EFI_ERROR (Status));
> -
> -  if (Dispatch) {
> -    AsciiPrint ("Connected and dispatched\n");
> -  } else {
> -    AsciiPrint ("Connect\n");
> -  }
> -
> -  return EFI_SUCCESS;
> -}
> -
> -
> -
> -CHAR8 *gMemMapType[] = {
> -  "reserved  ",
> -  "LoaderCode",
> -  "LoaderData",
> -  "BS_code   ",
> -  "BS_data   ",
> -  "RT_code   ",
> -  "RT_data   ",
> -  "available ",
> -  "Unusable  ",
> -  "ACPI_recl ",
> -  "ACPI_NVS  ",
> -  "MemMapIO  ",
> -  "MemPortIO ",
> -  "PAL_code  "
> -};
> -
> -
> -/**
> -  Dump out the EFI memory map
> -
> -  Argv[0] - "memmap"
> -
> -  @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
> -EblMemMapCmd (
> -  IN UINTN  Argc,
> -  IN CHAR8  **Argv
> -  )
> -{
> -  EFI_STATUS            Status;
> -  EFI_MEMORY_DESCRIPTOR *MemMap;
> -  EFI_MEMORY_DESCRIPTOR *OrigMemMap;
> -  UINTN                 MemMapSize;
> -  UINTN                 MapKey;
> -  UINTN                 DescriptorSize;
> -  UINT32                DescriptorVersion;
> -  UINT64                PageCount[EfiMaxMemoryType];
> -  UINTN                 Index;
> -  UINT64                EntrySize;
> -  UINTN                 CurrentRow;
> -  UINT64                TotalMemory;
> -
> -  ZeroMem (PageCount, sizeof (PageCount));
> -
> -  AsciiPrint ("EFI Memory Map\n");
> -
> -  // First call is to figure out how big the buffer needs to be
> -  MemMapSize = 0;
> -  MemMap     = NULL;
> -  Status = gBS->GetMemoryMap (&MemMapSize, MemMap, &MapKey, &DescriptorSize, &DescriptorVersion);
> -  if (Status == EFI_BUFFER_TOO_SMALL) {
> -    // In case the AllocatPool changes the memory map we added in some extra descriptors
> -    MemMapSize += (DescriptorSize * 0x100);
> -    OrigMemMap = MemMap = AllocatePool (MemMapSize);
> -    if (OrigMemMap != NULL) {
> -      // 2nd time we get the data
> -      Status = gBS->GetMemoryMap (&MemMapSize, MemMap, &MapKey, &DescriptorSize, &DescriptorVersion);
> -      if (!EFI_ERROR (Status)) {
> -        for (Index = 0, CurrentRow = 0; Index < MemMapSize/DescriptorSize; Index++) {
> -          EntrySize = LShiftU64 (MemMap->NumberOfPages, 12);
> -          AsciiPrint ("\n%a %016lx - %016lx: # %08lx %016lx", gMemMapType[MemMap->Type % EfiMaxMemoryType], MemMap->PhysicalStart, MemMap->PhysicalStart + EntrySize -1, MemMap->NumberOfPages, MemMap->Attribute);
> -          if (EblAnyKeyToContinueQtoQuit (&CurrentRow, TRUE)) {
> -            break;
> -          }
> -
> -          PageCount[MemMap->Type % EfiMaxMemoryType] += MemMap->NumberOfPages;
> -          MemMap = NEXT_MEMORY_DESCRIPTOR (MemMap, DescriptorSize);
> -        }
> -      }
> -
> -      for (Index = 0, TotalMemory = 0; Index < EfiMaxMemoryType; Index++) {
> -        if (PageCount[Index] != 0) {
> -          AsciiPrint ("\n  %a %,7ld Pages (%,14ld)", gMemMapType[Index], PageCount[Index], LShiftU64 (PageCount[Index], 12));
> -          if (Index == EfiLoaderCode ||
> -              Index == EfiLoaderData ||
> -              Index == EfiBootServicesCode ||
> -              Index == EfiBootServicesData ||
> -              Index == EfiRuntimeServicesCode ||
> -              Index == EfiRuntimeServicesData ||
> -              Index == EfiConventionalMemory ||
> -              Index == EfiACPIReclaimMemory ||
> -              Index == EfiACPIMemoryNVS ||
> -              Index == EfiPalCode
> -          ) {
> -            // Count total memory
> -            TotalMemory += PageCount[Index];
> -          }
> -        }
> -      }
> -
> -      AsciiPrint ("\nTotal Memory: %,ld MB (%,ld bytes)\n", RShiftU64 (TotalMemory, 8), LShiftU64 (TotalMemory, 12));
> -
> -      FreePool (OrigMemMap);
> -
> -    }
> -  }
> -
> -  return EFI_SUCCESS;
> -}
> -
> -
> -
> -
> -/**
> -  Load a file into memory and optionally jump to it. A load address can be
> -  specified or automatically allocated. A quoted command line can optionally
> -  be passed into the image.
> -
> -  Argv[0] - "go"
> -  Argv[1] - Device Name:path for the file to load
> -  Argv[2] - Address to load to or '*' if the load address will be allocated
> -  Argv[3] - Optional Entry point to the image. Image will be called if present
> -  Argv[4] - "" string that will be passed as Argc & Argv to EntryPoint. Needs
> -            to include the command name
> -
> -  go fv1:\EblCmdX  0x10000  0x10010 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX
> -    from FV1 to location 0x10000 and call the entry point at 0x10010 passing
> -    in "EblCmdX Arg2 Arg3 Arg4" as the arguments.
> -
> -  go fv0:\EblCmdX  *  0x10 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX from FS0
> -    to location allocated by this command and call the entry point at offset 0x10
> -    passing in "EblCmdX Arg2 Arg3 Arg4" as the arguments.
> -
> -  go fv1:\EblCmdX  0x10000; Load EblCmdX to address 0x10000 and return
> -
> -  @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
> -EblGoCmd (
> -  IN UINTN  Argc,
> -  IN CHAR8  **Argv
> -  )
> -{
> -  EFI_STATUS                    Status;
> -  EFI_OPEN_FILE                 *File;
> -  VOID                          *Address;
> -  UINTN                         Size;
> -  EBL_COMMMAND                  EntryPoint;
> -  UINTN                         EntryPointArgc;
> -  CHAR8                         *EntryPointArgv[MAX_ARGS];
> -
> -
> -  if (Argc <= 2) {
> -    // device name and laod address are 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;
> -  }
> -
> -  EntryPoint  = (EBL_COMMMAND)((Argc > 3) ? (UINTN)AsciiStrHexToUintn (Argv[3]) : (UINTN)NULL);
> -  if (Argv[2][0] == '*') {
> -    // * Means allocate the buffer
> -    Status = EfiReadAllocatePool (File, &Address, &Size);
> -
> -    // EntryPoint is relative to the start of the image
> -    EntryPoint = (EBL_COMMMAND)((UINTN)EntryPoint + (UINTN)Address);
> -
> -  } else {
> -    Address = (VOID *)AsciiStrHexToUintn (Argv[2]);
> -    Size = File->Size;
> -
> -    // File->Size for LoadFile is lazy so we need to use the tell to figure it out
> -    EfiTell (File, NULL);
> -    Status = EfiRead (File, Address, &Size);
> -  }
> -
> -  if (!EFI_ERROR (Status)) {
> -    AsciiPrint ("Loaded %,d bytes to 0x%08x\n", Size, Address);
> -
> -    if (Argc > 3) {
> -      if (Argc > 4) {
> -        ParseArguments (Argv[4], &EntryPointArgc, EntryPointArgv);
> -      } else {
> -        EntryPointArgc = 1;
> -        EntryPointArgv[0] = File->FileName;
> -      }
> -
> -      Status = EntryPoint (EntryPointArgc, EntryPointArgv);
> -    }
> -  }
> -
> -  EfiClose (File);
> -  return Status;
> -}
> -
> -#define FILE_COPY_CHUNK 0x20000
> -
> -EFI_STATUS
> -EFIAPI
> -EblFileCopyCmd (
> -  IN UINTN  Argc,
> -  IN CHAR8  **Argv
> -  )
> -{
> -  EFI_OPEN_FILE *Source      = NULL;
> -  EFI_OPEN_FILE *Destination = NULL;
> -  EFI_STATUS    Status       = EFI_SUCCESS;
> -  VOID          *Buffer      = NULL;
> -  UINTN         Size;
> -  UINTN         Offset;
> -  UINTN         Chunk        = FILE_COPY_CHUNK;
> -  UINTN         FileNameLen, DestFileNameLen;
> -  CHAR8*        DestFileName;
> -  CHAR8*        SrcFileName;
> -  CHAR8*        SrcPtr;
> -
> -  if (Argc < 3) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  DestFileName = Argv[2];
> -  FileNameLen = AsciiStrLen (DestFileName);
> -
> -  // Check if the destination file name looks like a directory
> -  if ((DestFileName[FileNameLen-1] == '\\') || (DestFileName[FileNameLen-1] == ':')) {
> -    // Set the pointer after the source drive (eg: after fs1:)
> -    SrcPtr = AsciiStrStr (Argv[1], ":");
> -    if (SrcPtr == NULL) {
> -      SrcPtr = Argv[1];
> -    } else {
> -      SrcPtr++;
> -      if (*SrcPtr == '\\') {
> -        SrcPtr++;
> -      }
> -    }
> -
> -    if (*SrcPtr == '\0') {
> -      AsciiPrint("Source file incorrect.\n");
> -    }
> -
> -    // Skip the Source Directories
> -    while (1) {
> -      SrcFileName = SrcPtr;
> -      SrcPtr = AsciiStrStr (SrcPtr,"\\");
> -      if (SrcPtr != NULL) {
> -        SrcPtr++;
> -      } else {
> -        break;
> -      }
> -    }
> -
> -    if (*SrcFileName == '\0') {
> -      AsciiPrint("Source file incorrect (Error 2).\n");
> -    }
> -
> -    // Construct the destination filepath
> -    DestFileNameLen = FileNameLen + AsciiStrLen (SrcFileName) + 1;
> -    DestFileName = (CHAR8*)AllocatePool (DestFileNameLen);
> -    AsciiStrCpyS (DestFileName, DestFileNameLen, Argv[2]);
> -    AsciiStrCatS (DestFileName, DestFileNameLen, SrcFileName);
> -  }
> -
> -  Source = EfiOpen(Argv[1], EFI_FILE_MODE_READ, 0);
> -  if (Source == NULL) {
> -    AsciiPrint("Source file open error.\n");
> -    return EFI_NOT_FOUND;
> -  }
> -
> -  Destination = EfiOpen(DestFileName, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
> -  if (Destination == NULL) {
> -    AsciiPrint("Destination file open error.\n");
> -    return EFI_NOT_FOUND;
> -  }
> -
> -  Buffer = AllocatePool(FILE_COPY_CHUNK);
> -  if (Buffer == NULL) {
> -    goto Exit;
> -  }
> -
> -  Size = EfiTell(Source, NULL);
> -
> -  for (Offset = 0; Offset + FILE_COPY_CHUNK <= Size; Offset += Chunk) {
> -    Chunk = FILE_COPY_CHUNK;
> -
> -    Status = EfiRead(Source, Buffer, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Read file error %r\n", Status);
> -      goto Exit;
> -    }
> -
> -    Status = EfiWrite(Destination, Buffer, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Write file error %r\n", Status);
> -      goto Exit;
> -    }
> -  }
> -
> -  // Any left over?
> -  if (Offset < Size) {
> -    Chunk = Size - Offset;
> -
> -    Status = EfiRead(Source, Buffer, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Read file error %r\n", Status);
> -      goto Exit;
> -    }
> -
> -    Status = EfiWrite(Destination, Buffer, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Write file error %r\n", Status);
> -      goto Exit;
> -    }
> -  }
> -
> -
> -Exit:
> -  if (Source != NULL) {
> -    Status = EfiClose(Source);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Source close error %r\n", Status);
> -    }
> -  }
> -  if (Destination != NULL) {
> -    Status = EfiClose(Destination);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Destination close error %r\n", Status);
> -    }
> -
> -    // Case when we have concated the filename to the destination directory
> -    if (DestFileName != Argv[2]) {
> -      FreePool (DestFileName);
> -    }
> -  }
> -
> -  if (Buffer != NULL) {
> -    FreePool(Buffer);
> -  }
> -
> -  return Status;
> -}
> -
> -EFI_STATUS
> -EFIAPI
> -EblFileDiffCmd (
> -  IN UINTN  Argc,
> -  IN CHAR8  **Argv
> -  )
> -{
> -  EFI_OPEN_FILE *File1   = NULL;
> -  EFI_OPEN_FILE *File2   = NULL;
> -  EFI_STATUS    Status   = EFI_SUCCESS;
> -  VOID          *Buffer1 = NULL;
> -  VOID          *Buffer2 = NULL;
> -  UINTN         Size1;
> -  UINTN         Size2;
> -  UINTN         Offset;
> -  UINTN         Chunk   = FILE_COPY_CHUNK;
> -
> -  if (Argc != 3) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  File1 = EfiOpen(Argv[1], EFI_FILE_MODE_READ, 0);
> -  if (File1 == NULL) {
> -    AsciiPrint("File 1 open error.\n");
> -    return EFI_NOT_FOUND;
> -  }
> -
> -  File2 = EfiOpen(Argv[2], EFI_FILE_MODE_READ, 0);
> -  if (File2 == NULL) {
> -    AsciiPrint("File 2 open error.\n");
> -    return EFI_NOT_FOUND;
> -  }
> -
> -  Size1 = EfiTell(File1, NULL);
> -  Size2 = EfiTell(File2, NULL);
> -
> -  if (Size1 != Size2) {
> -    AsciiPrint("Files differ.\n");
> -    goto Exit;
> -  }
> -
> -  Buffer1 = AllocatePool(FILE_COPY_CHUNK);
> -  if (Buffer1 == NULL) {
> -    goto Exit;
> -  }
> -
> -  Buffer2 = AllocatePool(FILE_COPY_CHUNK);
> -  if (Buffer2 == NULL) {
> -    goto Exit;
> -  }
> -
> -  for (Offset = 0; Offset + FILE_COPY_CHUNK <= Size1; Offset += Chunk) {
> -    Chunk = FILE_COPY_CHUNK;
> -
> -    Status = EfiRead(File1, Buffer1, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("File 1 read error\n");
> -      goto Exit;
> -    }
> -
> -    Status = EfiRead(File2, Buffer2, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("File 2 read error\n");
> -      goto Exit;
> -    }
> -
> -    if (CompareMem(Buffer1, Buffer2, Chunk) != 0) {
> -      AsciiPrint("Files differ.\n");
> -      goto Exit;
> -    };
> -  }
> -
> -  // Any left over?
> -  if (Offset < Size1) {
> -    Chunk = Size1 - Offset;
> -
> -    Status = EfiRead(File1, Buffer1, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("File 1 read error\n");
> -      goto Exit;
> -    }
> -
> -    Status = EfiRead(File2, Buffer2, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("File 2 read error\n");
> -      goto Exit;
> -    }
> -  }
> -
> -  if (CompareMem(Buffer1, Buffer2, Chunk) != 0) {
> -    AsciiPrint("Files differ.\n");
> -  } else {
> -    AsciiPrint("Files are identical.\n");
> -  }
> -
> -Exit:
> -  if (File1 != NULL) {
> -    Status = EfiClose(File1);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("File 1 close error %r\n", Status);
> -    }
> -  }
> -
> -  if (File2 != NULL) {
> -    Status = EfiClose(File2);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("File 2 close error %r\n", Status);
> -    }
> -  }
> -
> -  if (Buffer1 != NULL) {
> -    FreePool(Buffer1);
> -  }
> -
> -  if (Buffer2 != NULL) {
> -    FreePool(Buffer2);
> -  }
> -
> -  return Status;
> -}
> -
> -GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdDeviceTemplate[] =
> -{
> -  {
> -    "connect",
> -    "[d]; Connect all EFI devices. d means disconnect",
> -    NULL,
> -    EblConnectCmd
> -  },
> -  {
> -    "device",
> -    "; Show information about boot devices",
> -    NULL,
> -    EblDeviceCmd
> -  },
> -  {
> -    "go",
> -    " dev:path loadaddress entrypoint args; load to given address and jump in",
> -    NULL,
> -    EblGoCmd
> -  },
> -  {
> -    "loadfv",
> -    " devname; Load PI FV from device",
> -    NULL,
> -    EblLoadFvCmd
> -  },
> -  {
> -    "start",
> -    " path; EFI Boot Device:filepath. fs1:\\EFI\\BOOT.EFI",
> -    NULL,
> -    EblStartCmd
> -  },
> -  {
> -    "memmap",
> -    "; dump EFI memory map",
> -    NULL,
> -    EblMemMapCmd
> -  },
> -  {
> -    "cp",
> -    " file1 file2; copy file only.",
> -    NULL,
> -    EblFileCopyCmd
> -  },
> -  {
> -    "diff",
> -    " file1 file2; compare files",
> -    NULL,
> -    EblFileDiffCmd
> -  }
> -};
> -
> -
> -/**
> -  Initialize the commands in this in this file
> -**/
> -
> -VOID
> -EblInitializeDeviceCmd (
> -  VOID
> -  )
> -{
> -  EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (VOID **) &gDS);
> -  EblAddCommands (mCmdDeviceTemplate, sizeof (mCmdDeviceTemplate)/sizeof (EBL_COMMAND_TABLE));
> -}
> -
> diff --git a/EmbeddedPkg/Ebl/Hob.c b/EmbeddedPkg/Ebl/Hob.c
> deleted file mode 100644
> index edc0a744f47f..000000000000
> --- a/EmbeddedPkg/Ebl/Hob.c
> +++ /dev/null
> @@ -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));
> -  }
> -}
> -
> diff --git a/EmbeddedPkg/Ebl/HwDebug.c b/EmbeddedPkg/Ebl/HwDebug.c
> deleted file mode 100644
> index a62ccdc9c521..000000000000
> --- a/EmbeddedPkg/Ebl/HwDebug.c
> +++ /dev/null
> @@ -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));
> -  }
> -}
> -
> diff --git a/EmbeddedPkg/Ebl/HwIoDebug.c b/EmbeddedPkg/Ebl/HwIoDebug.c
> deleted file mode 100644
> index 6c99e7af0e60..000000000000
> --- a/EmbeddedPkg/Ebl/HwIoDebug.c
> +++ /dev/null
> @@ -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));
> -  }
> -}
> -
> diff --git a/EmbeddedPkg/Ebl/Main.c b/EmbeddedPkg/Ebl/Main.c
> deleted file mode 100644
> index 62f559fccfe8..000000000000
> --- a/EmbeddedPkg/Ebl/Main.c
> +++ /dev/null
> @@ -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 ();
> -    }
> -  }
> -}
> -
> -
> diff --git a/EmbeddedPkg/Ebl/Network.c b/EmbeddedPkg/Ebl/Network.c
> deleted file mode 100644
> index f2562e60b0db..000000000000
> --- a/EmbeddedPkg/Ebl/Network.c
> +++ /dev/null
> @@ -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));
> -}
> -
> diff --git a/EmbeddedPkg/Ebl/Script.c b/EmbeddedPkg/Ebl/Script.c
> deleted file mode 100644
> index 73360cb24840..000000000000
> --- a/EmbeddedPkg/Ebl/Script.c
> +++ /dev/null
> @@ -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));
> -  }
> -}
> -
> diff --git a/EmbeddedPkg/Ebl/Variable.c b/EmbeddedPkg/Ebl/Variable.c
> deleted file mode 100644
> index 92464a6b7133..000000000000
> --- a/EmbeddedPkg/Ebl/Variable.c
> +++ /dev/null
> @@ -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));
> -}
> diff --git a/EmbeddedPkg/EblExternCmd/EntryPointGlue.c b/EmbeddedPkg/EblExternCmd/EntryPointGlue.c
> deleted file mode 100644
> index d0e549bdc189..000000000000
> --- a/EmbeddedPkg/EblExternCmd/EntryPointGlue.c
> +++ /dev/null
> @@ -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);
> -}
> -
> -
> diff --git a/EmbeddedPkg/EblExternCmd/Main.c b/EmbeddedPkg/EblExternCmd/Main.c
> deleted file mode 100644
> index dbfe336899c7..000000000000
> --- a/EmbeddedPkg/EblExternCmd/Main.c
> +++ /dev/null
> @@ -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;
> -}
> -
> diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
> index af9b221f4f07..adcf65be93b3 100644
> --- a/EmbeddedPkg/EmbeddedPkg.dec
> +++ b/EmbeddedPkg/EmbeddedPkg.dec
> @@ -36,13 +36,9 @@ [Includes.common]
>    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 @@ [Protocols.common]
>    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 @@ [PcdsFixedAtBuild.common]
>    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
> diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
> index d7ee6a3018bf..8338715d6e46 100644
> --- a/EmbeddedPkg/EmbeddedPkg.dsc
> +++ b/EmbeddedPkg/EmbeddedPkg.dsc
> @@ -59,7 +59,6 @@ [LibraryClasses.common]
>    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
>  
> @@ -93,9 +92,6 @@ [LibraryClasses.common]
>    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
> @@ -240,9 +236,6 @@ [BuildOptions]
>  #
>  ################################################################################
>  [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
> @@ -254,8 +247,6 @@ [Components.common]
>    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
> @@ -274,7 +265,6 @@ [Components.common]
>    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
> diff --git a/EmbeddedPkg/EmbeddedPkg.fdf b/EmbeddedPkg/EmbeddedPkg.fdf
> deleted file mode 100644
> index c84a5193efc4..000000000000
> --- a/EmbeddedPkg/EmbeddedPkg.fdf
> +++ /dev/null
> @@ -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
> -  }
> diff --git a/EmbeddedPkg/Include/Library/EblAddExternalCommandLib.h b/EmbeddedPkg/Include/Library/EblAddExternalCommandLib.h
> deleted file mode 100644
> index 65aeddddddad..000000000000
> --- a/EmbeddedPkg/Include/Library/EblAddExternalCommandLib.h
> +++ /dev/null
> @@ -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
> -
> diff --git a/EmbeddedPkg/Include/Library/EblCmdLib.h b/EmbeddedPkg/Include/Library/EblCmdLib.h
> deleted file mode 100644
> index 2a8a66c016c4..000000000000
> --- a/EmbeddedPkg/Include/Library/EblCmdLib.h
> +++ /dev/null
> @@ -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
> -
> diff --git a/EmbeddedPkg/Include/Library/EblNetworkLib.h b/EmbeddedPkg/Include/Library/EblNetworkLib.h
> deleted file mode 100644
> index 66dc6ac30502..000000000000
> --- a/EmbeddedPkg/Include/Library/EblNetworkLib.h
> +++ /dev/null
> @@ -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
> -
> diff --git a/EmbeddedPkg/Include/Protocol/EblAddCommand.h b/EmbeddedPkg/Include/Protocol/EblAddCommand.h
> deleted file mode 100644
> index 4a9f494c5d93..000000000000
> --- a/EmbeddedPkg/Include/Protocol/EblAddCommand.h
> +++ /dev/null
> @@ -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
> -
> -
> diff --git a/EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.c b/EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.c
> deleted file mode 100644
> index 3b9f1846d3cf..000000000000
> --- a/EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.c
> +++ /dev/null
> @@ -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;
> -}
> -
> diff --git a/EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf b/EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
> deleted file mode 100644
> index 335386a8c800..000000000000
> --- a/EmbeddedPkg/Library/EblAddExternalCommandLib/EblAddExternalCommandLib.inf
> +++ /dev/null
> @@ -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]
> diff --git a/EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.c b/EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.c
> deleted file mode 100644
> index 6cde5f95ab88..000000000000
> --- a/EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.c
> +++ /dev/null
> @@ -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;
> -}
> diff --git a/EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.inf b/EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.inf
> deleted file mode 100644
> index c7935ae37e3e..000000000000
> --- a/EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.inf
> +++ /dev/null
> @@ -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]
> diff --git a/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c b/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c
> deleted file mode 100644
> index 1c945cd33b5a..000000000000
> --- a/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.c
> +++ /dev/null
> @@ -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;
> -}
> -
> diff --git a/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf b/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
> deleted file mode 100644
> index c9b2d31dc437..000000000000
> --- a/EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
> +++ /dev/null
> @@ -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
> diff --git a/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c b/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c
> deleted file mode 100644
> index 8c38d22f1eb1..000000000000
> --- a/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c
> +++ /dev/null
> @@ -1,1784 +0,0 @@
> -/** @file
> -File IO routines inspired by Streams with an EFI flavor
> -
> -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.
> -
> -Basic support for opening files on different device types. The device string
> -is in the form of DevType:Path. Current DevType is required as there is no
> -current mounted device concept of current working directory concept implement
> -by this library.
> -
> -Device names are case insensitive and only check the leading characters for
> -unique matches. Thus the following are all the same:
> -LoadFile0:
> -l0:
> -L0:
> -Lo0:
> -
> -Supported Device Names:
> -A0x1234:0x12 - A memory buffer starting at address 0x1234 for 0x12 bytes
> -l1:          - EFI LoadFile device one.
> -B0:          - EFI BlockIo zero.
> -fs3:         - EFI Simple File System device 3
> -Fv2:         - EFI Firmware VOlume device 2
> -10.0.1.102:  - TFTP service IP followed by the file name
> -**/
> -
> -#include <PiDxe.h>
> -#include <Protocol/BlockIo.h>
> -#include <Protocol/DiskIo.h>
> -#include <Protocol/SimpleFileSystem.h>
> -#include <Protocol/FirmwareVolume2.h>
> -#include <Protocol/LoadFile.h>
> -#include <Protocol/FirmwareVolumeBlock.h>
> -
> -#include <Guid/FileInfo.h>
> -#include <Guid/ZeroGuid.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/PcdLib.h>
> -#include <Library/EblNetworkLib.h>
> -
> -
> -CHAR8 *gCwd = NULL;
> -
> -#define EFI_OPEN_FILE_GUARD_HEADER  0x4B4D4641
> -#define EFI_OPEN_FILE_GUARD_FOOTER  0x444D5A56
> -
> -// Need to defend against this overflowing
> -#define MAX_CMD_LINE  0x200
> -
> -typedef struct {
> -  UINT32            Header;
> -  EFI_OPEN_FILE     File;
> -  UINT32            Footer;
> -} EFI_OPEN_FILE_GUARD;
> -
> -
> -// globals to store current open device info
> -EFI_HANDLE            *mBlkIo = NULL;
> -UINTN                 mBlkIoCount = 0;
> -
> -EFI_HANDLE            *mFs = NULL;
> -UINTN                 mFsCount = 0;
> -// mFsInfo[] array entries must match mFs[] handles
> -EFI_FILE_SYSTEM_INFO  **mFsInfo = NULL;
> -
> -EFI_HANDLE            *mFv = NULL;
> -UINTN                 mFvCount = 0;
> -EFI_HANDLE            *mLoadFile = NULL;
> -UINTN                 mLoadFileCount = 0;
> -
> -
> -
> -/**
> -Internal worker function to validate a File handle.
> -
> -@param  File    Open File Handle
> -
> -@return TRUE    File is valid
> -@return FALSE   File is not valid
> -
> -
> -**/
> -BOOLEAN
> -FileHandleValid (
> -  IN EFI_OPEN_FILE  *File
> -  )
> -{
> -  EFI_OPEN_FILE_GUARD  *GuardFile;
> -
> -  // Look right before and after file structure for the correct signatures
> -  GuardFile = BASE_CR (File, EFI_OPEN_FILE_GUARD, File);
> -  if ((GuardFile->Header != EFI_OPEN_FILE_GUARD_HEADER) ||
> -    (GuardFile->Footer != EFI_OPEN_FILE_GUARD_FOOTER) ) {
> -      return FALSE;
> -    }
> -
> -    return TRUE;
> -}
> -
> -/**
> -Internal worker function. If Buffer is not NULL free it.
> -
> -@param  Buffer    Buffer to FreePool()
> -
> -**/
> -VOID
> -EblFreePool (
> -  IN  VOID  *Buffer
> -  )
> -{
> -  if (Buffer != NULL) {
> -    FreePool (Buffer);
> -  }
> -}
> -
> -/**
> -Update Device List Global Variables
> -
> -**/
> -VOID
> -EblUpdateDeviceLists (
> -  VOID
> -  )
> -{
> -  EFI_STATUS                        Status;
> -  UINTN                             Size;
> -  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL   *Fs;
> -  EFI_FILE_HANDLE                   Root;
> -  UINTN                             Index;
> -
> -  if (mBlkIo != NULL) {
> -    FreePool (mBlkIo);
> -  }
> -  gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &mBlkIoCount, &mBlkIo);
> -
> -
> -
> -  if (mFv != NULL) {
> -    FreePool (mFv);
> -  }
> -  gBS->LocateHandleBuffer (ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, NULL, &mFvCount, &mFv);
> -
> -  if (mLoadFile != NULL) {
> -    FreePool (mLoadFile);
> -  }
> -  gBS->LocateHandleBuffer (ByProtocol, &gEfiLoadFileProtocolGuid, NULL, &mLoadFileCount, &mLoadFile);
> -
> -  if (mFs != NULL) {
> -    FreePool (mFs);
> -  }
> -
> -  if (&mFsInfo[0] != NULL) {
> -    // Need to Free the mFsInfo prior to recalculating mFsCount so don't move this code
> -    for (Index = 0; Index < mFsCount; Index++) {
> -      if (mFsInfo[Index] != NULL) {
> -        FreePool (mFsInfo[Index]);
> -      }
> -    }
> -    FreePool (mFsInfo);
> -  }
> -
> -  gBS->LocateHandleBuffer (ByProtocol, &gEfiSimpleFileSystemProtocolGuid, NULL, &mFsCount, &mFs);
> -
> -
> -  mFsInfo = AllocateZeroPool (mFsCount * sizeof (EFI_FILE_SYSTEM_INFO *));
> -  if (mFsInfo == NULL) {
> -    // If we can't do this then we can't support file system entries
> -    mFsCount = 0;
> -  } else {
> -    // Loop through all the file system structures and cache the file system info data
> -    for (Index =0; Index < mFsCount; Index++) {
> -      Status = gBS->HandleProtocol (mFs[Index], &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Fs);
> -      if (!EFI_ERROR (Status)) {
> -        Status = Fs->OpenVolume (Fs, &Root);
> -        if (!EFI_ERROR (Status)) {
> -          // Get information about the volume
> -          Size = 0;
> -          Status = Root->GetInfo (Root, &gEfiFileSystemInfoGuid, &Size, mFsInfo[Index]);
> -          if (Status == EFI_BUFFER_TOO_SMALL) {
> -            mFsInfo[Index] = AllocatePool (Size);
> -            Status = Root->GetInfo (Root, &gEfiFileSystemInfoGuid, &Size, mFsInfo[Index]);
> -          }
> -
> -          Root->Close (Root);
> -        }
> -      }
> -    }
> -  }
> -}
> -
> -
> -/**
> -PathName is in the form <device name>:<path> for example fs1:\ or ROOT:\.
> -Return TRUE if the <devce name> prefix of PathName matches a file system
> -Volume Name. MatchIndex is the array  index in mFsInfo[] of the match,
> -and it can be used with mFs[] to find the handle that needs to be opened
> -
> -@param  PathName      PathName to check
> -@param  FileStart     Index of the first character of the <path>
> -@param  MatchIndex    Index in mFsInfo[] that matches
> -
> -@return TRUE      PathName matches a Volume Label and MatchIndex is valid
> -@return FALSE     PathName does not match a Volume Label MatchIndex undefined
> -
> -**/
> -BOOLEAN
> -EblMatchVolumeName (
> -  IN  CHAR8   *PathName,
> -  IN  UINTN   FileStart,
> -  OUT UINTN   *MatchIndex
> -  )
> -{
> -  UINTN   Index;
> -  UINTN   Compare;
> -  UINTN   VolStrLen;
> -  BOOLEAN Match;
> -
> -  for (Index =0; Index < mFsCount; Index++) {
> -    if (mFsInfo[Index] == NULL) {
> -      // FsInfo is not valid so skip it
> -      continue;
> -    }
> -    VolStrLen = StrLen (mFsInfo[Index]->VolumeLabel);
> -    for (Compare = 0, Match = TRUE; Compare < (FileStart - 1); Compare++) {
> -      if (Compare > VolStrLen) {
> -        Match = FALSE;
> -        break;
> -      }
> -      if (PathName[Compare] != (CHAR8)mFsInfo[Index]->VolumeLabel[Compare]) {
> -        // If the VolumeLabel has a space allow a _ to match with it in addition to ' '
> -        if (!((PathName[Compare] == '_') && (mFsInfo[Index]->VolumeLabel[Compare] == L' '))) {
> -          Match = FALSE;
> -          break;
> -        }
> -      }
> -    }
> -    if (Match) {
> -      *MatchIndex = Index;
> -      return TRUE;
> -    }
> -  }
> -
> -  return FALSE;
> -}
> -
> -
> -/**
> -Return the number of devices of the current type active in the system
> -
> -@param  Type      Device type to check
> -
> -@return 0         Invalid type
> -
> -**/
> -UINTN
> -EfiGetDeviceCounts (
> -  IN  EFI_OPEN_FILE_TYPE     DeviceType
> -  )
> -{
> -  switch (DeviceType) {
> -  case EfiOpenLoadFile:
> -    return mLoadFileCount;
> -  case EfiOpenFirmwareVolume:
> -    return mFvCount;
> -  case EfiOpenFileSystem:
> -    return mFsCount;
> -  case EfiOpenBlockIo:
> -    return mBlkIoCount;
> -  default:
> -    return 0;
> -  }
> -}
> -
> -EFI_STATUS
> -ConvertIpStringToEfiIp (
> -  IN  CHAR8           *PathName,
> -  OUT EFI_IP_ADDRESS  *ServerIp
> -  )
> -{
> -  CHAR8     *Str;
> -
> -  Str = PathName;
> -  ServerIp->v4.Addr[0] = (UINT8)AsciiStrDecimalToUintn (Str);
> -
> -  Str = AsciiStrStr (Str, ".");
> -  if (Str == NULL) {
> -    return EFI_DEVICE_ERROR;
> -  }
> -
> -  ServerIp->v4.Addr[1] = (UINT8)AsciiStrDecimalToUintn (++Str);
> -
> -  Str = AsciiStrStr (Str, ".");
> -  if (Str == NULL) {
> -    return EFI_DEVICE_ERROR;
> -  }
> -
> -  ServerIp->v4.Addr[2] = (UINT8)AsciiStrDecimalToUintn (++Str);
> -
> -  Str = AsciiStrStr (Str, ".");
> -  if (Str == NULL) {
> -    return EFI_DEVICE_ERROR;
> -  }
> -
> -  ServerIp->v4.Addr[3] = (UINT8)AsciiStrDecimalToUintn (++Str);
> -
> -  return EFI_SUCCESS;
> -}
> -
> -
> -/**
> -Internal work function to extract a device number from a string skipping
> -text. Easy way to extract numbers from strings like blk7:.
> -
> -@param  Str   String to extract device number form
> -
> -@return -1    Device string is not valid
> -@return       Device #
> -
> -**/
> -UINTN
> -EblConvertDevStringToNumber (
> -  IN  CHAR8   *Str
> -  )
> -{
> -  UINTN   Max;
> -  UINTN   Index;
> -
> -
> -  // Find the first digit
> -  Max = AsciiStrLen (Str);
> -  for  (Index = 0; !((*Str >= '0') && (*Str <= '9')) && (Index < Max); Index++) {
> -    Str++;
> -  }
> -  if (Index == Max) {
> -    return (UINTN)-1;
> -  }
> -
> -  return AsciiStrDecimalToUintn (Str);
> -}
> -
> -
> -/**
> -Internal work function to fill in EFI_OPEN_FILE information for the Fs and BlkIo
> -
> -@param  File        Open file handle
> -@param  FileName    Name of file after device stripped off
> -
> -
> -**/
> -EFI_STATUS
> -EblFileDevicePath (
> -  IN OUT EFI_OPEN_FILE  *File,
> -  IN  CHAR8             *FileName,
> -  IN  CONST UINT64      OpenMode
> -  )
> -{
> -  EFI_STATUS                        Status;
> -  UINTN                             Size;
> -  FILEPATH_DEVICE_PATH              *FilePath;
> -  EFI_DEVICE_PATH_PROTOCOL          *FileDevicePath;
> -  CHAR16                            UnicodeFileName[MAX_PATHNAME];
> -  EFI_BLOCK_IO_PROTOCOL             *BlkIo;
> -  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL   *Fs;
> -  EFI_FILE_HANDLE                   Root;
> -
> -
> -  if ( *FileName != 0 ) {
> -    AsciiStrToUnicodeStrS (FileName, UnicodeFileName,
> -      ARRAY_SIZE (UnicodeFileName));
> -  } else {
> -    AsciiStrToUnicodeStrS ("\\", UnicodeFileName, ARRAY_SIZE (UnicodeFileName));
> -  }
> -
> -  Size = StrSize (UnicodeFileName);
> -  FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + sizeof (EFI_DEVICE_PATH_PROTOCOL));
> -  if (FileDevicePath != NULL) {
> -    FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
> -    FilePath->Header.Type    = MEDIA_DEVICE_PATH;
> -    FilePath->Header.SubType = MEDIA_FILEPATH_DP;
> -    CopyMem (&FilePath->PathName, UnicodeFileName, Size);
> -    SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
> -    SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
> -
> -    if (File->EfiHandle != NULL) {
> -      File->DevicePath = DevicePathFromHandle (File->EfiHandle);
> -    }
> -
> -    File->DevicePath = AppendDevicePath (File->DevicePath, FileDevicePath);
> -    FreePool (FileDevicePath);
> -  }
> -
> -  Status = gBS->HandleProtocol (File->EfiHandle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo);
> -  if (!EFI_ERROR (Status)) {
> -    File->FsBlockIoMedia = BlkIo->Media;
> -    File->FsBlockIo = BlkIo;
> -
> -    // If we are not opening the device this will get over written with file info
> -    File->MaxPosition = MultU64x32 (BlkIo->Media->LastBlock + 1, BlkIo->Media->BlockSize);
> -  }
> -
> -  if (File->Type == EfiOpenFileSystem) {
> -    Status = gBS->HandleProtocol (File->EfiHandle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Fs);
> -    if (!EFI_ERROR (Status)) {
> -      Status = Fs->OpenVolume (Fs, &Root);
> -      if (!EFI_ERROR (Status)) {
> -        // Get information about the volume
> -        Size = 0;
> -        Status = Root->GetInfo (Root, &gEfiFileSystemInfoGuid, &Size, File->FsInfo);
> -        if (Status == EFI_BUFFER_TOO_SMALL) {
> -          File->FsInfo = AllocatePool (Size);
> -          Status = Root->GetInfo (Root, &gEfiFileSystemInfoGuid, &Size, File->FsInfo);
> -        }
> -
> -        // Get information about the file
> -        Status = Root->Open (Root, &File->FsFileHandle, UnicodeFileName, OpenMode, 0);
> -        if (!EFI_ERROR (Status)) {
> -          Size = 0;
> -          Status = File->FsFileHandle->GetInfo (File->FsFileHandle, &gEfiFileInfoGuid, &Size, NULL);
> -          if (Status == EFI_BUFFER_TOO_SMALL) {
> -            File->FsFileInfo = AllocatePool (Size);
> -            Status = File->FsFileHandle->GetInfo (File->FsFileHandle, &gEfiFileInfoGuid, &Size, File->FsFileInfo);
> -            if (!EFI_ERROR (Status)) {
> -              File->Size = (UINTN)File->FsFileInfo->FileSize;
> -              File->MaxPosition = (UINT64)File->Size;
> -            }
> -          }
> -        }
> -
> -        Root->Close (Root);
> -      }
> -    }
> -  } else if (File->Type == EfiOpenBlockIo) {
> -    File->Size = (UINTN)File->MaxPosition;
> -  }
> -
> -  return Status;
> -}
> -
> -#define ToUpper(a)  ((((a) >= 'a') && ((a) <= 'z')) ? ((a) - 'a' + 'A') : (a))
> -
> -EFI_STATUS
> -CompareGuidToString (
> -  IN  EFI_GUID    *Guid,
> -  IN  CHAR8       *String
> -  )
> -{
> -  CHAR8       AsciiGuid[64];
> -  CHAR8       *StringPtr;
> -  CHAR8       *GuidPtr;
> -
> -  AsciiSPrint (AsciiGuid, sizeof(AsciiGuid), "%g", Guid);
> -
> -  StringPtr = String;
> -  GuidPtr   = AsciiGuid;
> -
> -  while ((*StringPtr != '\0') && (*GuidPtr != '\0')) {
> -    // Skip dashes
> -    if (*StringPtr == '-') {
> -      StringPtr++;
> -      continue;
> -    }
> -
> -    if (*GuidPtr == '-') {
> -      GuidPtr++;
> -      continue;
> -    }
> -
> -    if (ToUpper(*StringPtr) != ToUpper(*GuidPtr)) {
> -      return EFI_NOT_FOUND;
> -    }
> -
> -    StringPtr++;
> -    GuidPtr++;
> -  }
> -
> -  return EFI_SUCCESS;
> -}
> -
> -
> -/**
> -Internal work function to fill in EFI_OPEN_FILE information for the FV
> -
> -@param  File        Open file handle
> -@param  FileName    Name of file after device stripped off
> -
> -
> -**/
> -EFI_STATUS
> -EblFvFileDevicePath (
> -  IN OUT EFI_OPEN_FILE  *File,
> -  IN  CHAR8             *FileName,
> -  IN  CONST UINT64      OpenMode
> -  )
> -{
> -  EFI_STATUS                          Status;
> -  EFI_STATUS                          GetNextFileStatus;
> -  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH   DevicePathNode;
> -  EFI_DEVICE_PATH_PROTOCOL            *DevicePath;
> -  UINTN                               Key;
> -  UINT32                              AuthenticationStatus;
> -  CHAR8                               AsciiSection[MAX_PATHNAME];
> -  VOID                                *Section;
> -  UINTN                               SectionSize;
> -  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *Fvb;
> -  EFI_LBA                             Lba;
> -  UINTN                               BlockSize;
> -  UINTN                               NumberOfBlocks;
> -  EFI_FIRMWARE_VOLUME_HEADER          *FvHeader = NULL;
> -  UINTN                               Index;
> -
> -
> -  Status = gBS->HandleProtocol (File->EfiHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&File->Fv);
> -  if (EFI_ERROR (Status)) {
> -    return Status;
> -  }
> -
> -  // Get FVB Info about the handle
> -  Status = gBS->HandleProtocol (File->EfiHandle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);
> -  if (!EFI_ERROR (Status)) {
> -    Status = Fvb->GetPhysicalAddress (Fvb, &File->FvStart);
> -    if (!EFI_ERROR (Status)) {
> -      FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)File->FvStart;
> -      File->FvHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_HEADER);
> -      for (Index = 0; FvHeader->BlockMap[Index].Length !=0; Index++) {
> -        File->FvHeaderSize += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
> -      }
> -
> -      for (Lba = 0, File->FvSize = 0, NumberOfBlocks = 0; ; File->FvSize += (BlockSize * NumberOfBlocks), Lba += NumberOfBlocks) {
> -        Status = Fvb->GetBlockSize (Fvb, Lba, &BlockSize, &NumberOfBlocks);
> -        if (EFI_ERROR (Status)) {
> -          break;
> -        }
> -      }
> -    }
> -  }
> -
> -
> -  DevicePath = DevicePathFromHandle (File->EfiHandle);
> -
> -  if (*FileName == '\0') {
> -    File->DevicePath = DuplicateDevicePath (DevicePath);
> -    File->Size = File->FvSize;
> -    File->MaxPosition = File->Size;
> -  } else {
> -    Key = 0;
> -    do {
> -      File->FvType = EFI_FV_FILETYPE_ALL;
> -      GetNextFileStatus = File->Fv->GetNextFile (
> -        File->Fv,
> -        &Key,
> -        &File->FvType,
> -        &File->FvNameGuid,
> -        &File->FvAttributes,
> -        &File->Size
> -        );
> -      if (!EFI_ERROR (GetNextFileStatus)) {
> -        // Compare GUID first
> -        Status = CompareGuidToString (&File->FvNameGuid, FileName);
> -        if (!EFI_ERROR(Status)) {
> -          break;
> -        }
> -
> -        Section = NULL;
> -        Status = File->Fv->ReadSection (
> -          File->Fv,
> -          &File->FvNameGuid,
> -          EFI_SECTION_USER_INTERFACE,
> -          0,
> -          &Section,
> -          &SectionSize,
> -          &AuthenticationStatus
> -          );
> -        if (!EFI_ERROR (Status)) {
> -          UnicodeStrToAsciiStrS (Section, AsciiSection, MAX_PATHNAME);
> -          if (AsciiStriCmp (FileName, AsciiSection) == 0) {
> -            FreePool (Section);
> -            break;
> -          }
> -          FreePool (Section);
> -        }
> -      }
> -    } while (!EFI_ERROR (GetNextFileStatus));
> -
> -    if (EFI_ERROR (GetNextFileStatus)) {
> -      return GetNextFileStatus;
> -    }
> -
> -    if (OpenMode != EFI_SECTION_ALL) {
> -      // Calculate the size of the section we are targeting
> -      Section = NULL;
> -      File->Size = 0;
> -      Status = File->Fv->ReadSection (
> -        File->Fv,
> -        &File->FvNameGuid,
> -        (EFI_SECTION_TYPE)OpenMode,
> -        0,
> -        &Section,
> -        &File->Size,
> -        &AuthenticationStatus
> -        );
> -      if (EFI_ERROR (Status)) {
> -        return Status;
> -      }
> -    }
> -
> -    File->MaxPosition = File->Size;
> -    EfiInitializeFwVolDevicepathNode (&DevicePathNode, &File->FvNameGuid);
> -    File->DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&DevicePathNode);
> -  }
> -
> -
> -  // FVB not required if FV was soft loaded...
> -  return EFI_SUCCESS;
> -}
> -
> -
> -
> -
> -/**
> -Open a device named by PathName. The PathName includes a device name and
> -path separated by a :. See file header for more details on the PathName
> -syntax. There is no checking to prevent a file from being opened more than
> -one type.
> -
> -SectionType is only used to open an FV. Each file in an FV contains multiple
> -sections and only the SectionType section is opened.
> -
> -For any file that is opened with EfiOpen() must be closed with EfiClose().
> -
> -@param  PathName    Path to parse to open
> -@param  OpenMode    Same as EFI_FILE.Open()
> -@param  SectionType Section in FV to open.
> -
> -@return NULL  Open failed
> -@return Valid EFI_OPEN_FILE handle
> -
> -**/
> -EFI_OPEN_FILE *
> -EfiOpen (
> -  IN        CHAR8               *PathName,
> -  IN  CONST UINT64              OpenMode,
> -  IN  CONST EFI_SECTION_TYPE    SectionType
> -  )
> -{
> -  EFI_STATUS                Status;
> -  EFI_OPEN_FILE             *File;
> -  EFI_OPEN_FILE             FileData;
> -  UINTN                     StrLen;
> -  UINTN                     FileStart;
> -  UINTN                     DevNumber = 0;
> -  EFI_OPEN_FILE_GUARD       *GuardFile;
> -  BOOLEAN                   VolumeNameMatch;
> -  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
> -  UINTN                     Size;
> -  EFI_IP_ADDRESS            Ip;
> -  CHAR8                     *CwdPlusPathName;
> -  UINTN                     Index;
> -  EFI_SECTION_TYPE          ModifiedSectionType;
> -  UINTN                     AsciiLength;
> -
> -  EblUpdateDeviceLists ();
> -
> -  File = &FileData;
> -  ZeroMem (File, sizeof (EFI_OPEN_FILE));
> -
> -  StrLen = AsciiStrSize (PathName);
> -  if (StrLen <= 1) {
> -    // Smallest valid path is 1 char and a null
> -    return NULL;
> -  }
> -
> -  for (FileStart = 0; FileStart < StrLen; FileStart++) {
> -    if (PathName[FileStart] == ':') {
> -      FileStart++;
> -      break;
> -    }
> -  }
> -
> -  //
> -  // Matching volume name has precedence over handle based names
> -  //
> -  VolumeNameMatch = EblMatchVolumeName (PathName, FileStart, &DevNumber);
> -  if (!VolumeNameMatch) {
> -    if (FileStart == StrLen) {
> -      // No Volume name or device name, so try Current Working Directory
> -      if (gCwd == NULL) {
> -        // No CWD
> -        return NULL;
> -      }
> -
> -      // We could add a current working directory concept
> -      AsciiLength = AsciiStrSize (gCwd) + AsciiStrSize (PathName);
> -      CwdPlusPathName = AllocatePool (AsciiLength);
> -      if (CwdPlusPathName == NULL) {
> -        return NULL;
> -      }
> -
> -      if ((PathName[0] == '/') || (PathName[0] == '\\')) {
> -        // PathName starts in / so this means we go to the root of the device in the CWD.
> -        CwdPlusPathName[0] = '\0';
> -        for (FileStart = 0; gCwd[FileStart] != '\0'; FileStart++) {
> -          CwdPlusPathName[FileStart] = gCwd[FileStart];
> -          if (gCwd[FileStart] == ':') {
> -            FileStart++;
> -            CwdPlusPathName[FileStart] = '\0';
> -            break;
> -          }
> -        }
> -      } else {
> -        AsciiStrCpyS (CwdPlusPathName, AsciiLength, gCwd);
> -        StrLen = AsciiStrLen (gCwd);
> -        if ((*PathName != '/') && (*PathName != '\\') && (gCwd[StrLen-1] != '/') && (gCwd[StrLen-1] != '\\')) {
> -          AsciiStrCatS (CwdPlusPathName, AsciiLength, "\\");
> -        }
> -      }
> -
> -      AsciiStrCatS (CwdPlusPathName, AsciiLength, PathName);
> -      if (AsciiStrStr (CwdPlusPathName, ":") == NULL) {
> -        // Extra error check to make sure we don't recurse and blow stack
> -        return NULL;
> -      }
> -
> -      File = EfiOpen (CwdPlusPathName, OpenMode, SectionType);
> -      FreePool (CwdPlusPathName);
> -      return File;
> -    }
> -
> -    DevNumber = EblConvertDevStringToNumber ((CHAR8 *)PathName);
> -  }
> -
> -  File->DeviceName = AllocatePool (StrLen);
> -  AsciiStrCpyS (File->DeviceName, StrLen, PathName);
> -  File->DeviceName[FileStart - 1] = '\0';
> -  File->FileName = &File->DeviceName[FileStart];
> -  if (File->FileName[0] == '\0') {
> -    // if it is just a file name use / as root
> -    File->FileName = "\\";
> -  }
> -
> -  //
> -  // Use best match algorithm on the dev names so we only need to look at the
> -  // first few charters to match the full device name. Short name forms are
> -  // legal from the caller.
> -  //
> -  Status = EFI_SUCCESS;
> -  if (*PathName == 'f' || *PathName == 'F' || VolumeNameMatch) {
> -    if (PathName[1] == 's' || PathName[1] == 'S' || VolumeNameMatch) {
> -      if (DevNumber >= mFsCount) {
> -        goto ErrorExit;
> -      }
> -      File->Type = EfiOpenFileSystem;
> -      File->EfiHandle = mFs[DevNumber];
> -      Status = EblFileDevicePath (File, &PathName[FileStart], OpenMode);
> -
> -    } else if (PathName[1] == 'v' || PathName[1] == 'V') {
> -      if (DevNumber >= mFvCount) {
> -        goto ErrorExit;
> -      }
> -      File->Type = EfiOpenFirmwareVolume;
> -      File->EfiHandle = mFv[DevNumber];
> -
> -      if ((PathName[FileStart] == '/') || (PathName[FileStart] == '\\')) {
> -        // Skip leading / as its not really needed for the FV since no directories are supported
> -        FileStart++;
> -      }
> -
> -      // Check for 2nd :
> -      ModifiedSectionType = SectionType;
> -      for (Index = FileStart; PathName[Index] != '\0'; Index++) {
> -        if (PathName[Index] == ':') {
> -          // Support fv0:\DxeCore:0x10
> -          // This means open the PE32 Section of the file
> -          ModifiedSectionType = (EFI_SECTION_TYPE)AsciiStrHexToUintn (&PathName[Index + 1]);
> -          PathName[Index] = '\0';
> -        }
> -      }
> -      File->FvSectionType = ModifiedSectionType;
> -      Status = EblFvFileDevicePath (File, &PathName[FileStart], ModifiedSectionType);
> -    }
> -  } else if ((*PathName == 'A') || (*PathName == 'a')) {
> -    // Handle a:0x10000000:0x1234 address form a:ADDRESS:SIZE
> -    File->Type = EfiOpenMemoryBuffer;
> -    // 1st colon is at PathName[FileStart - 1]
> -    File->Buffer = (VOID *)AsciiStrHexToUintn (&PathName[FileStart]);
> -
> -    // Find 2nd colon
> -    while ((PathName[FileStart] != ':') && (PathName[FileStart] != '\0')) {
> -      FileStart++;
> -    }
> -
> -    // If we ran out of string, there's no extra data
> -    if (PathName[FileStart] == '\0') {
> -      File->Size = 0;
> -    } else {
> -      File->Size = AsciiStrHexToUintn (&PathName[FileStart + 1]);
> -    }
> -
> -    // if there's no number after the second colon, default
> -    // the end of memory
> -    if (File->Size == 0) {
> -      File->Size =  (UINTN)(0 - (UINTN)File->Buffer);
> -    }
> -
> -    File->MaxPosition = File->Size;
> -    File->BaseOffset = (UINTN)File->Buffer;
> -
> -  } else if (*PathName== 'l' || *PathName == 'L') {
> -    if (DevNumber >= mLoadFileCount) {
> -      goto ErrorExit;
> -    }
> -    File->Type = EfiOpenLoadFile;
> -    File->EfiHandle = mLoadFile[DevNumber];
> -
> -    Status = gBS->HandleProtocol (File->EfiHandle, &gEfiLoadFileProtocolGuid, (VOID **)&File->LoadFile);
> -    if (EFI_ERROR (Status)) {
> -      goto ErrorExit;
> -    }
> -
> -    Status = gBS->HandleProtocol (File->EfiHandle, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath);
> -    if (EFI_ERROR (Status)) {
> -      goto ErrorExit;
> -    }
> -    File->DevicePath = DuplicateDevicePath (DevicePath);
> -
> -  } else if (*PathName == 'b' || *PathName == 'B') {
> -    // Handle b#:0x10000000:0x1234 address form b#:ADDRESS:SIZE
> -    if (DevNumber >= mBlkIoCount) {
> -      goto ErrorExit;
> -    }
> -    File->Type = EfiOpenBlockIo;
> -    File->EfiHandle = mBlkIo[DevNumber];
> -    EblFileDevicePath (File, "", OpenMode);
> -
> -    // 1st colon is at PathName[FileStart - 1]
> -    File->DiskOffset = AsciiStrHexToUintn (&PathName[FileStart]);
> -
> -    // Find 2nd colon
> -    while ((PathName[FileStart] != ':') && (PathName[FileStart] != '\0')) {
> -      FileStart++;
> -    }
> -
> -    // If we ran out of string, there's no extra data
> -    if (PathName[FileStart] == '\0') {
> -      Size = 0;
> -    } else {
> -      Size = AsciiStrHexToUintn (&PathName[FileStart + 1]);
> -    }
> -
> -    // if a zero size is passed in (or the size is left out entirely),
> -    // go to the end of the device.
> -    if (Size == 0) {
> -      File->Size = File->Size - File->DiskOffset;
> -    } else {
> -      File->Size = Size;
> -    }
> -
> -    File->MaxPosition = File->Size;
> -    File->BaseOffset = File->DiskOffset;
> -  } else if ((*PathName) >= '0' && (*PathName <= '9')) {
> -
> -    // Get current IP address
> -    Status = EblGetCurrentIpAddress (&Ip);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Device IP Address is not configured.\n");
> -      goto ErrorExit;
> -    }
> -
> -
> -    // Parse X.X.X.X:Filename, only support IPv4 TFTP for now...
> -    File->Type = EfiOpenTftp;
> -    File->IsDirty = FALSE;
> -    File->IsBufferValid = FALSE;
> -
> -    Status = ConvertIpStringToEfiIp (PathName, &File->ServerIp);
> -  }
> -
> -  if (EFI_ERROR (Status)) {
> -    goto ErrorExit;
> -  }
> -
> -  GuardFile = (EFI_OPEN_FILE_GUARD *)AllocateZeroPool (sizeof (EFI_OPEN_FILE_GUARD));
> -  if (GuardFile == NULL) {
> -    goto ErrorExit;
> -  }
> -
> -  GuardFile->Header = EFI_OPEN_FILE_GUARD_HEADER;
> -  CopyMem (&(GuardFile->File), &FileData, sizeof (EFI_OPEN_FILE));
> -  GuardFile->Footer = EFI_OPEN_FILE_GUARD_FOOTER;
> -
> -  return &(GuardFile->File);
> -
> -ErrorExit:
> -  FreePool (File->DeviceName);
> -  return NULL;
> -}
> -
> -#define FILE_COPY_CHUNK 0x01000000
> -
> -EFI_STATUS
> -EfiCopyFile (
> -  IN        CHAR8               *DestinationFile,
> -  IN        CHAR8               *SourceFile
> -  )
> -{
> -  EFI_OPEN_FILE *Source      = NULL;
> -  EFI_OPEN_FILE *Destination = NULL;
> -  EFI_STATUS    Status       = EFI_SUCCESS;
> -  VOID          *Buffer      = NULL;
> -  UINTN         Size;
> -  UINTN         Offset;
> -  UINTN         Chunk = FILE_COPY_CHUNK;
> -
> -  Source = EfiOpen (SourceFile, EFI_FILE_MODE_READ, 0);
> -  if (Source == NULL) {
> -    AsciiPrint("Source file open error.\n");
> -    Status = EFI_NOT_FOUND;
> -    goto Exit;
> -  }
> -
> -  Destination = EfiOpen (DestinationFile, EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
> -  if (Destination == NULL) {
> -    AsciiPrint("Destination file open error.\n");
> -    Status = EFI_NOT_FOUND;
> -    goto Exit;
> -  }
> -
> -  Buffer = AllocatePool(FILE_COPY_CHUNK);
> -  if (Buffer == NULL) {
> -    Status = EFI_OUT_OF_RESOURCES;
> -    goto Exit;
> -  }
> -
> -  Size = EfiTell(Source, NULL);
> -
> -  for (Offset = 0; Offset + FILE_COPY_CHUNK <= Size; Offset += Chunk) {
> -    Chunk = FILE_COPY_CHUNK;
> -
> -    Status = EfiRead(Source, Buffer, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Read file error %r\n", Status);
> -      goto Exit;
> -    }
> -
> -    Status = EfiWrite(Destination, Buffer, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Write file error %r\n", Status);
> -      goto Exit;
> -    }
> -  }
> -
> -  // Any left over?
> -  if (Offset < Size) {
> -    Chunk = Size - Offset;
> -
> -    Status = EfiRead(Source, Buffer, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Read file error\n");
> -      goto Exit;
> -    }
> -
> -    Status = EfiWrite(Destination, Buffer, &Chunk);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Write file error\n");
> -      goto Exit;
> -    }
> -  }
> -
> -Exit:
> -  if (Source != NULL) {
> -    Status = EfiClose(Source);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Source close error");
> -    }
> -  }
> -
> -  if (Destination != NULL) {
> -    Status = EfiClose(Destination);
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("Destination close error");
> -    }
> -  }
> -
> -  if (Buffer != NULL) {
> -    FreePool(Buffer);
> -  }
> -
> -  return Status;
> -}
> -
> -/**
> -Use DeviceType and Index to form a valid PathName and try and open it.
> -
> -@param  DeviceType  Device type to open
> -@param  Index       Device Index to use. Zero relative.
> -
> -@return NULL  Open failed
> -@return Valid EFI_OPEN_FILE handle
> -
> -**/
> -EFI_OPEN_FILE  *
> -EfiDeviceOpenByType (
> -  IN  EFI_OPEN_FILE_TYPE    DeviceType,
> -  IN  UINTN                 Index
> -  )
> -{
> -  CHAR8   *DevStr;
> -  CHAR8   Path[MAX_CMD_LINE];
> -
> -  switch (DeviceType) {
> -  case EfiOpenLoadFile:
> -    DevStr = "loadfile%d:";
> -    break;
> -  case EfiOpenFirmwareVolume:
> -    DevStr = "fv%d:";
> -    break;
> -  case EfiOpenFileSystem:
> -    DevStr = "fs%d:";
> -    break;
> -  case EfiOpenBlockIo:
> -    DevStr = "blk%d:";
> -    break;
> -  case EfiOpenMemoryBuffer:
> -    DevStr = "a%d:";
> -    break;
> -  default:
> -    return NULL;
> -  }
> -
> -  AsciiSPrint (Path, MAX_PATHNAME, DevStr, Index);
> -
> -  return EfiOpen (Path, EFI_FILE_MODE_READ, 0);
> -}
> -
> -
> -/**
> -Close a file handle opened by EfiOpen() and free all resources allocated by
> -EfiOpen().
> -
> -@param  Stream    Open File Handle
> -
> -@return EFI_INVALID_PARAMETER  Stream is not an Open File
> -@return EFI_SUCCESS            Steam closed
> -
> -**/
> -EFI_STATUS
> -EfiClose (
> -  IN  EFI_OPEN_FILE     *File
> -  )
> -{
> -  EFI_STATUS          Status;
> -  UINT64              TftpBufferSize;
> -
> -  if (!FileHandleValid (File)) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  //Write the buffer contents to TFTP file.
> -  if ((File->Type == EfiOpenTftp) && (File->IsDirty)) {
> -
> -    TftpBufferSize = File->Size;
> -    Status = EblMtftp (
> -      EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,
> -      File->Buffer,
> -      TRUE,
> -      &TftpBufferSize,
> -      NULL,
> -      &File->ServerIp,
> -      (UINT8 *)File->FileName,
> -      NULL,
> -      FALSE
> -      );
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("TFTP error during APPLE_NSP_TFTP_WRITE_FILE: %r\n", Status);
> -      return Status;
> -    }
> -  }
> -
> -  if ((File->Type == EfiOpenLoadFile) ||
> -    ((File->Type == EfiOpenTftp) && (File->IsBufferValid == TRUE)) ||
> -    ((File->Type == EfiOpenFirmwareVolume) && (File->IsBufferValid == TRUE))) {
> -    EblFreePool(File->Buffer);
> -  }
> -
> -  EblFreePool (File->DevicePath);
> -  EblFreePool (File->DeviceName);
> -  EblFreePool (File->FsFileInfo);
> -  EblFreePool (File->FsInfo);
> -
> -  if (File->FsFileHandle != NULL) {
> -    File->FsFileHandle->Close (File->FsFileHandle);
> -  }
> -
> -  // Need to free File and it's Guard structures
> -  EblFreePool (BASE_CR (File, EFI_OPEN_FILE_GUARD, File));
> -  return EFI_SUCCESS;
> -}
> -
> -
> -/**
> -Return the size of the file represented by Stream. Also return the current
> -Seek position. Opening a file will enable a valid file size to be returned.
> -LoadFile is an exception as a load file size is set to zero.
> -
> -@param  Stream    Open File Handle
> -
> -@return 0         Stream is not an Open File or a valid LoadFile handle
> -
> -**/
> -UINTN
> -EfiTell (
> -  IN  EFI_OPEN_FILE     *File,
> -  OUT EFI_LBA           *CurrentPosition    OPTIONAL
> -  )
> -{
> -  EFI_STATUS Status;
> -  UINT64     BufferSize = 0;
> -
> -  if (!FileHandleValid (File)) {
> -    return 0;
> -  }
> -
> -  if (CurrentPosition != NULL) {
> -    *CurrentPosition = File->CurrentPosition;
> -  }
> -
> -  if (File->Type == EfiOpenLoadFile) {
> -    // Figure out the File->Size
> -    File->Buffer = NULL;
> -    File->Size   = 0;
> -    Status = File->LoadFile->LoadFile (File->LoadFile, File->DevicePath, FALSE, &File->Size, File->Buffer);
> -    if (Status != EFI_BUFFER_TOO_SMALL) {
> -      return 0;
> -    }
> -
> -    File->MaxPosition = (UINT64)File->Size;
> -  } else if (File->Type == EfiOpenTftp) {
> -
> -    Status = EblMtftp (
> -      EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
> -      NULL,
> -      FALSE,
> -      &BufferSize,
> -      NULL,
> -      &File->ServerIp,
> -      (UINT8 *)File->FileName,
> -      NULL,
> -      TRUE
> -      );
> -    if (EFI_ERROR(Status)) {
> -      AsciiPrint("TFTP error during APPLE_NSP_TFTP_GET_FILE_SIZE: %r\n", Status);
> -      return 0;
> -    }
> -
> -    File->Size        = (UINTN)BufferSize;
> -    File->MaxPosition = File->Size;
> -  }
> -
> -  return File->Size;
> -}
> -
> -
> -/**
> -Seek to the Offset location in the file. LoadFile and FV device types do
> -not support EfiSeek(). It is not possible to grow the file size using
> -EfiSeek().
> -
> -SeekType defines how use Offset to calculate the new file position:
> -EfiSeekStart  : Position = Offset
> -EfiSeekCurrent: Position is Offset bytes from the current position
> -EfiSeekEnd    : Only supported if Offset is zero to seek to end of file.
> -
> -@param  Stream    Open File Handle
> -@param  Offset    Offset to seek too.
> -@param  SeekType  Type of seek to perform
> -
> -
> -@return EFI_INVALID_PARAMETER  Stream is not an Open File
> -@return EFI_UNSUPPORTED        LoadFile and FV do not support Seek
> -@return EFI_NOT_FOUND          Seek past the end of the file.
> -@return EFI_SUCCESS            Steam closed
> -
> -**/
> -EFI_STATUS
> -EfiSeek (
> -  IN  EFI_OPEN_FILE     *File,
> -  IN  EFI_LBA           Offset,
> -  IN  EFI_SEEK_TYPE     SeekType
> -  )
> -{
> -  EFI_STATUS    Status;
> -  UINT64        CurrentPosition;
> -
> -  if (!FileHandleValid (File)) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  if (File->Type == EfiOpenLoadFile) {
> -    // LoadFile does not support Seek
> -    return EFI_UNSUPPORTED;
> -  }
> -
> -  CurrentPosition = File->CurrentPosition;
> -  switch (SeekType) {
> -  case EfiSeekStart:
> -    if (Offset > File->MaxPosition) {
> -      return EFI_NOT_FOUND;
> -    }
> -    CurrentPosition = Offset;
> -    break;
> -
> -  case EfiSeekCurrent:
> -    if ((File->CurrentPosition + Offset) > File->MaxPosition) {
> -      return EFI_NOT_FOUND;
> -    }
> -    CurrentPosition += Offset;
> -    break;
> -
> -  case EfiSeekEnd:
> -    if (Offset != 0) {
> -      // We don't support growing file size via seeking past end of file
> -      return EFI_UNSUPPORTED;
> -    }
> -    CurrentPosition = File->MaxPosition;
> -    break;
> -
> -  default:
> -    return EFI_NOT_FOUND;
> -  }
> -
> -  Status = EFI_SUCCESS;
> -  if (File->FsFileHandle != NULL) {
> -    Status = File->FsFileHandle->SetPosition (File->FsFileHandle, CurrentPosition);
> -  }
> -
> -  if (!EFI_ERROR (Status)) {
> -    File->CurrentPosition = CurrentPosition;
> -  }
> -
> -  return Status;
> -}
> -
> -EFI_STATUS
> -CacheTftpFile (
> -  IN OUT  EFI_OPEN_FILE *File
> -  )
> -{
> -  EFI_STATUS          Status;
> -  UINT64              TftpBufferSize;
> -
> -  if (File->IsBufferValid) {
> -    return EFI_SUCCESS;
> -  }
> -
> -  // Make sure the file size is set.
> -  EfiTell (File, NULL);
> -
> -  //Allocate a buffer to hold the whole file.
> -  File->Buffer = AllocatePool(File->Size);
> -  if (File->Buffer == NULL) {
> -    return EFI_OUT_OF_RESOURCES;
> -  }
> -
> -  TftpBufferSize = File->Size;
> -
> -  Status = EblMtftp (
> -    EFI_PXE_BASE_CODE_TFTP_READ_FILE,
> -    File->Buffer,
> -    FALSE,
> -    &TftpBufferSize,
> -    NULL,
> -    &File->ServerIp,
> -    (UINT8 *)File->FileName,
> -    NULL,
> -    FALSE);
> -  if (EFI_ERROR(Status)) {
> -    AsciiPrint("TFTP error during APPLE_NSP_TFTP_READ_FILE: %r\n", Status);
> -    FreePool(File->Buffer);
> -    return Status;
> -  }
> -
> -  // Set the buffer valid flag.
> -  File->IsBufferValid = TRUE;
> -
> -  return Status;
> -}
> -
> -/**
> -Read BufferSize bytes from the current location in the file. For load file,
> -FV, and TFTP case you must read the entire file.
> -
> -@param  Stream      Open File Handle
> -@param  Buffer      Caller allocated buffer.
> -@param  BufferSize  Size of buffer in bytes.
> -
> -
> -@return EFI_SUCCESS           Stream is not an Open File
> -@return EFI_END_OF_FILE Tried to read past the end of the file
> -@return EFI_INVALID_PARAMETER Stream is not an open file handle
> -@return EFI_BUFFER_TOO_SMALL  Buffer is not big enough to do the read
> -@return "other"               Error returned from device read
> -
> -**/
> -EFI_STATUS
> -EfiRead (
> -  IN  EFI_OPEN_FILE       *File,
> -  OUT VOID                *Buffer,
> -  OUT UINTN               *BufferSize
> -  )
> -{
> -  EFI_STATUS            Status;
> -  UINT32                AuthenticationStatus;
> -  EFI_DISK_IO_PROTOCOL  *DiskIo;
> -
> -  if (!FileHandleValid (File)) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  // Don't read past the end of the file.
> -  if ((File->CurrentPosition + *BufferSize) > File->MaxPosition) {
> -    return EFI_END_OF_FILE;
> -  }
> -
> -  switch (File->Type) {
> -  case EfiOpenLoadFile:
> -    // Figure out the File->Size
> -    EfiTell (File, NULL);
> -
> -    Status = File->LoadFile->LoadFile (File->LoadFile, File->DevicePath, FALSE, BufferSize, Buffer);
> -    break;
> -
> -  case EfiOpenFirmwareVolume:
> -    if (CompareGuid (&File->FvNameGuid, &gZeroGuid)) {
> -      // This is the entire FV device, so treat like a memory buffer
> -      CopyMem (Buffer, (VOID *)(UINTN)(File->FvStart + File->CurrentPosition), *BufferSize);
> -      File->CurrentPosition += *BufferSize;
> -      Status = EFI_SUCCESS;
> -    } else {
> -      if (File->Buffer == NULL) {
> -        if (File->FvSectionType == EFI_SECTION_ALL) {
> -          Status = File->Fv->ReadFile (
> -            File->Fv,
> -            &File->FvNameGuid,
> -            (VOID **)&File->Buffer,
> -            &File->Size,
> -            &File->FvType,
> -            &File->FvAttributes,
> -            &AuthenticationStatus
> -            );
> -        } else {
> -          Status = File->Fv->ReadSection (
> -            File->Fv,
> -            &File->FvNameGuid,
> -            File->FvSectionType,
> -            0,
> -            (VOID **)&File->Buffer,
> -            &File->Size,
> -            &AuthenticationStatus
> -            );
> -        }
> -        if (EFI_ERROR (Status)) {
> -          return Status;
> -        }
> -        File->IsBufferValid = TRUE;
> -      }
> -      // Operate on the cached buffer so Seek will work
> -      CopyMem (Buffer, File->Buffer + File->CurrentPosition, *BufferSize);
> -      File->CurrentPosition += *BufferSize;
> -      Status = EFI_SUCCESS;
> -    }
> -    break;
> -
> -  case EfiOpenMemoryBuffer:
> -    CopyMem (Buffer, File->Buffer + File->CurrentPosition, *BufferSize);
> -    File->CurrentPosition += *BufferSize;
> -    Status = EFI_SUCCESS;
> -    break;
> -
> -  case EfiOpenFileSystem:
> -    Status = File->FsFileHandle->Read (File->FsFileHandle, BufferSize, Buffer);
> -    File->CurrentPosition += *BufferSize;
> -    break;
> -
> -  case EfiOpenBlockIo:
> -    Status = gBS->HandleProtocol(File->EfiHandle, &gEfiDiskIoProtocolGuid, (VOID **)&DiskIo);
> -    if (!EFI_ERROR(Status)) {
> -      Status = DiskIo->ReadDisk(DiskIo, File->FsBlockIoMedia->MediaId, File->DiskOffset + File->CurrentPosition, *BufferSize, Buffer);
> -    }
> -    File->CurrentPosition += *BufferSize;
> -    break;
> -
> -  case EfiOpenTftp:
> -    // Cache the file if it hasn't been cached yet.
> -    if (File->IsBufferValid == FALSE) {
> -      Status = CacheTftpFile (File);
> -      if (EFI_ERROR (Status)) {
> -        return Status;
> -      }
> -    }
> -
> -    // Copy out the requested data
> -    CopyMem (Buffer, File->Buffer + File->CurrentPosition, *BufferSize);
> -    File->CurrentPosition += *BufferSize;
> -
> -    Status = EFI_SUCCESS;
> -    break;
> -
> -  default:
> -    return EFI_INVALID_PARAMETER;
> -  };
> -
> -  return Status;
> -}
> -
> -
> -/**
> -Read the entire file into a buffer. This routine allocates the buffer and
> -returns it to the user full of the read data.
> -
> -This is very useful for load file where it's hard to know how big the buffer
> -must be.
> -
> -@param  Stream      Open File Handle
> -@param  Buffer      Pointer to buffer to return.
> -@param  BufferSize  Pointer to Size of buffer return..
> -
> -
> -@return EFI_SUCCESS           Stream is not an Open File
> -@return EFI_END_OF_FILE       Tried to read past the end of the file
> -@return EFI_INVALID_PARAMETER Stream is not an open file handle
> -@return EFI_BUFFER_TOO_SMALL  Buffer is not big enough to do the read
> -@return "other"               Error returned from device read
> -
> -**/
> -EFI_STATUS
> -EfiReadAllocatePool (
> -  IN  EFI_OPEN_FILE     *File,
> -  OUT VOID              **Buffer,
> -  OUT UINTN             *BufferSize
> -  )
> -{
> -  if (!FileHandleValid (File)) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  // Loadfile defers file size determination on Open so use tell to find it
> -  EfiTell (File, NULL);
> -
> -  *BufferSize = File->Size;
> -  *Buffer = AllocatePool (*BufferSize);
> -  if (*Buffer == NULL) {
> -    return EFI_NOT_FOUND;
> -  }
> -
> -  return EfiRead (File, *Buffer, BufferSize);
> -}
> -
> -
> -/**
> -Write data back to the file. For TFTP case you must write the entire file.
> -
> -@param  Stream      Open File Handle
> -@param  Buffer      Pointer to buffer to return.
> -@param  BufferSize  Pointer to Size of buffer return..
> -
> -
> -@return EFI_SUCCESS           Stream is not an Open File
> -@return EFI_END_OF_FILE       Tried to read past the end of the file
> -@return EFI_INVALID_PARAMETER Stream is not an open file handle
> -@return EFI_BUFFER_TOO_SMALL  Buffer is not big enough to do the read
> -@return "other"               Error returned from device write
> -
> -**/
> -EFI_STATUS
> -EfiWrite (
> -  IN  EFI_OPEN_FILE   *File,
> -  OUT VOID            *Buffer,
> -  OUT UINTN           *BufferSize
> -  )
> -{
> -  EFI_STATUS              Status;
> -  EFI_FV_WRITE_FILE_DATA  FileData;
> -  EFI_DISK_IO_PROTOCOL    *DiskIo;
> -
> -  if (!FileHandleValid (File)) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  switch (File->Type) {
> -  case EfiOpenMemoryBuffer:
> -    if ((File->CurrentPosition + *BufferSize) > File->MaxPosition) {
> -      return EFI_END_OF_FILE;
> -    }
> -
> -    CopyMem (File->Buffer + File->CurrentPosition, Buffer, *BufferSize);
> -    File->CurrentPosition += *BufferSize;
> -    Status = EFI_SUCCESS;
> -
> -  case EfiOpenLoadFile:
> -    // LoadFile device is read only be definition
> -    Status = EFI_UNSUPPORTED;
> -
> -  case EfiOpenFirmwareVolume:
> -    if (File->FvSectionType != EFI_SECTION_ALL) {
> -      // Writes not support to a specific section. You have to update entire file
> -      return EFI_UNSUPPORTED;
> -    }
> -
> -    FileData.NameGuid       = &(File->FvNameGuid);
> -    FileData.Type           = File->FvType;
> -    FileData.FileAttributes = File->FvAttributes;
> -    FileData.Buffer         = Buffer;
> -    FileData.BufferSize     = (UINT32)*BufferSize;
> -    Status = File->Fv->WriteFile (File->Fv, 1, EFI_FV_UNRELIABLE_WRITE, &FileData);
> -    break;
> -
> -  case EfiOpenFileSystem:
> -    Status = File->FsFileHandle->Write (File->FsFileHandle, BufferSize, Buffer);
> -    File->CurrentPosition += *BufferSize;
> -    break;
> -
> -  case EfiOpenBlockIo:
> -    if ((File->CurrentPosition + *BufferSize) > File->MaxPosition) {
> -      return EFI_END_OF_FILE;
> -    }
> -
> -    Status = gBS->HandleProtocol (File->EfiHandle, &gEfiDiskIoProtocolGuid, (VOID **)&DiskIo);
> -    if (!EFI_ERROR(Status)) {
> -      Status = DiskIo->WriteDisk (DiskIo, File->FsBlockIoMedia->MediaId, File->DiskOffset + File->CurrentPosition, *BufferSize, Buffer);
> -    }
> -    File->CurrentPosition += *BufferSize;
> -    break;
> -
> -  case EfiOpenTftp:
> -    // Cache the file if it hasn't been cached yet.
> -    if (File->IsBufferValid == FALSE) {
> -      Status = CacheTftpFile(File);
> -      if (EFI_ERROR(Status)) {
> -        return Status;
> -      }
> -    }
> -
> -    // Don't overwrite the buffer
> -    if ((File->CurrentPosition + *BufferSize) > File->MaxPosition) {
> -      UINT8 *TempBuffer;
> -
> -      TempBuffer = File->Buffer;
> -
> -      File->Buffer = AllocatePool ((UINTN)(File->CurrentPosition + *BufferSize));
> -      if (File->Buffer == NULL) {
> -        return EFI_OUT_OF_RESOURCES;
> -      }
> -
> -      CopyMem (File->Buffer, TempBuffer, File->Size);
> -
> -      FreePool (TempBuffer);
> -
> -      File->Size = (UINTN)(File->CurrentPosition + *BufferSize);
> -      File->MaxPosition = (UINT64)File->Size;
> -    }
> -
> -    // Copy in the requested data
> -    CopyMem (File->Buffer + File->CurrentPosition, Buffer, *BufferSize);
> -    File->CurrentPosition += *BufferSize;
> -
> -    // Mark the file dirty
> -    File->IsDirty = TRUE;
> -
> -    Status = EFI_SUCCESS;
> -    break;
> -
> -  default:
> -    Status = EFI_INVALID_PARAMETER;
> -  };
> -
> -  return Status;
> -}
> -
> -
> -/**
> -Given Cwd expand Path to remove .. and replace them with real
> -directory names.
> -
> -@param  Cwd     Current Working Directory
> -@param  Path    Path to expand
> -
> -@return NULL     Cwd or Path are not valid
> -@return 'other'  Path with .. expanded
> -
> -**/
> -CHAR8 *
> -ExpandPath (
> -  IN CHAR8    *Cwd,
> -  IN CHAR8    *Path
> -  )
> -{
> -  CHAR8   *NewPath;
> -  CHAR8   *Work, *Start, *End;
> -  UINTN   StrLen, AllocLen;
> -  INTN    i;
> -
> -  if (Cwd == NULL || Path == NULL) {
> -    return NULL;
> -  }
> -
> -  StrLen = AsciiStrSize (Cwd);
> -  if (StrLen <= 2) {
> -    // Smallest valid path is 1 char and a null
> -    return NULL;
> -  }
> -
> -  StrLen = AsciiStrSize (Path);
> -  AllocLen = AsciiStrSize (Cwd) + StrLen + 1;
> -  NewPath = AllocatePool (AllocLen);
> -  if (NewPath == NULL) {
> -    return NULL;
> -  }
> -  AsciiStrCpyS (NewPath, AllocLen, Cwd);
> -
> -  End = Path + StrLen;
> -  for (Start = Path ;;) {
> -    Work = AsciiStrStr (Start, "..") ;
> -    if (Work == NULL) {
> -      // Remaining part of Path contains no more ..
> -      break;
> -    }
> -
> -    // append path prior to ..
> -    AsciiStrnCatS (NewPath, AllocLen, Start, Work - Start);
> -    StrLen = AsciiStrLen (NewPath);
> -    for (i = StrLen; i >= 0; i--) {
> -      if (NewPath[i] == ':') {
> -        // too many ..
> -        return NULL;
> -      }
> -      if (NewPath[i] == '/' || NewPath[i] == '\\') {
> -        if ((i > 0) && (NewPath[i-1] == ':')) {
> -          // leave the / before a :
> -          NewPath[i+1] = '\0';
> -        } else {
> -          // replace / will Null to remove trailing file/dir reference
> -          NewPath[i] = '\0';
> -        }
> -        break;
> -      }
> -    }
> -
> -    Start = Work + 3;
> -  }
> -
> -  // Handle the path that remains after the ..
> -  AsciiStrnCatS (NewPath, AllocLen, Start, End - Start);
> -
> -  return NewPath;
> -}
> -
> -
> -/**
> -Set the Current Working Directory (CWD). If a call is made to EfiOpen () and
> -the path does not contain a device name, The CWD is prepended to the path.
> -
> -@param  Cwd     Current Working Directory to set
> -
> -
> -@return EFI_SUCCESS           CWD is set
> -@return EFI_INVALID_PARAMETER Cwd is not a valid device:path
> -
> -**/
> -EFI_STATUS
> -EfiSetCwd (
> -  IN  CHAR8   *Cwd
> -  )
> -{
> -  EFI_OPEN_FILE *File;
> -  UINTN         Len, AllocLen;
> -  CHAR8         *Path;
> -
> -  if (Cwd == NULL) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  if (AsciiStrCmp (Cwd, ".") == 0) {
> -    // cd . is a no-op
> -    return EFI_SUCCESS;
> -  }
> -
> -  Path = Cwd;
> -  if (AsciiStrStr (Cwd, "..") != NULL) {
> -    if (gCwd == NULL) {
> -      // no parent
> -      return EFI_SUCCESS;
> -    }
> -
> -    Len = AsciiStrLen (gCwd);
> -    if ((gCwd[Len-2] == ':') && ((gCwd[Len-1] == '/') || (gCwd[Len-1] == '\\'))) {
> -      // parent is device so nothing to do
> -      return EFI_SUCCESS;
> -    }
> -
> -    // Expand .. in Cwd, given we know current working directory
> -    Path = ExpandPath (gCwd, Cwd);
> -    if (Path == NULL) {
> -      return EFI_NOT_FOUND;
> -    }
> -  }
> -
> -  File = EfiOpen (Path, EFI_FILE_MODE_READ, 0);
> -  if (File == NULL) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  if (gCwd != NULL) {
> -    FreePool (gCwd);
> -  }
> -
> -  // Use the info returned from EfiOpen as it can add in CWD if needed. So Cwd could be
> -  // relative to the current gCwd or not.
> -  AllocLen = AsciiStrSize (File->DeviceName) + AsciiStrSize (File->FileName) + 10;
> -  gCwd = AllocatePool (AllocLen);
> -  if (gCwd == NULL) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  AsciiStrCpyS (gCwd, AllocLen, File->DeviceName);
> -  if (File->FileName == NULL) {
> -    AsciiStrCatS (gCwd, AllocLen, ":\\");
> -  } else {
> -    AsciiStrCatS (gCwd, AllocLen, ":");
> -    AsciiStrCatS (gCwd, AllocLen, File->FileName);
> -  }
> -
> -
> -  EfiClose (File);
> -  if (Path != Cwd) {
> -    FreePool (Path);
> -  }
> -  return EFI_SUCCESS;
> -}
> -
> -
> -/**
> -Set the Current Working Directory (CWD). If a call is made to EfiOpen () and
> -the path does not contain a device name, The CWD is prepended to the path.
> -The CWD buffer is only valid until a new call is made to EfiSetCwd(). After
> -a call to EfiSetCwd() it is not legal to use the pointer returned by
> -this function.
> -
> -@param  Cwd     Current Working Directory
> -
> -
> -@return ""      No CWD set
> -@return 'other' Returns buffer that contains CWD.
> -
> -**/
> -CHAR8 *
> -EfiGetCwd (
> -  VOID
> -  )
> -{
> -  if (gCwd == NULL) {
> -    return "";
> -  }
> -  return gCwd;
> -}
> -
> -
> diff --git a/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf b/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
> deleted file mode 100644
> index b8cb255268a5..000000000000
> --- a/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
> +++ /dev/null
> @@ -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
> diff --git a/Omap35xxPkg/Library/EblCmdLib/EblCmdLib.c b/Omap35xxPkg/Library/EblCmdLib/EblCmdLib.c
> deleted file mode 100644
> index 47161755de84..000000000000
> --- a/Omap35xxPkg/Library/EblCmdLib/EblCmdLib.c
> +++ /dev/null
> @@ -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;
> -}
> diff --git a/Omap35xxPkg/Library/EblCmdLib/EblCmdLib.inf b/Omap35xxPkg/Library/EblCmdLib/EblCmdLib.inf
> deleted file mode 100644
> index dd7a13cf6629..000000000000
> --- a/Omap35xxPkg/Library/EblCmdLib/EblCmdLib.inf
> +++ /dev/null
> @@ -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]
> diff --git a/Omap35xxPkg/Omap35xxPkg.dsc b/Omap35xxPkg/Omap35xxPkg.dsc
> index c5d9746104e6..f150d544ab16 100644
> --- a/Omap35xxPkg/Omap35xxPkg.dsc
> +++ b/Omap35xxPkg/Omap35xxPkg.dsc
> @@ -180,7 +180,6 @@ [Components.common]
>  
>    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
> -- 
> 2.11.0
> 


  reply	other threads:[~2017-11-24 17:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 15:45 [PATCH] EmbeddedPkg Omap35xxPkg: remove EBL and associated libraries Ard Biesheuvel
2017-11-24 17:21 ` Leif Lindholm [this message]
2017-11-26 11:16   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171124172107.cfhnatabgwzof4x3@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox