]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Ebl/EfiDevice.c
EmbeddedPkg: Add EFIAPI to several Ebl functions
[mirror_edk2.git] / EmbeddedPkg / Ebl / EfiDevice.c
index 7633d669345c49207dce32cee2c77c4a56bfd412..ec9c331b70047bad00a60105eab2926eaf3a03ec 100644 (file)
@@ -1,10 +1,11 @@
 /** @file\r
   EBL commands for EFI and PI Devices\r
 \r
-  Copyright (c) 2007, Intel Corporation<BR>\r
-  Portions copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
+  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+  (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
 \r
-  All rights reserved. This program and the accompanying materials\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
@@ -31,13 +32,22 @@ EblPrintFsInfo (
   IN  EFI_OPEN_FILE   *File\r
   )\r
 {\r
+  CHAR16 *Str;\r
+\r
   if (File == NULL) {\r
     return;\r
   }\r
 \r
   AsciiPrint ("  %a: ", File->DeviceName);\r
   if (File->FsInfo != NULL) {\r
-    AsciiPrint ("%s: ", File->FsInfo->VolumeLabel);\r
+    for (Str = File->FsInfo->VolumeLabel; *Str != '\0'; Str++) {\r
+      if (*Str == ' ') {\r
+        // UI makes you enter _ for space, so make the printout match that\r
+        *Str = '_';\r
+      }\r
+      AsciiPrint ("%c", *Str);\r
+    }\r
+    AsciiPrint (":");\r
     if (File->FsInfo->ReadOnly) {\r
       AsciiPrint ("ReadOnly");\r
     }\r
@@ -81,29 +91,48 @@ EblPrintBlkIoInfo (
   )\r
 {\r
   UINT64                    DeviceSize;\r
-\r
+  UINTN                     Index;\r
+  UINTN                     Max;\r
+  EFI_OPEN_FILE             *FsFile;\r
 \r
   if (File == NULL) {\r
     return;\r
   }\r
 \r
   AsciiPrint ("  %a: ", File->DeviceName);\r
-  if (File->FsBlockIoMedia.RemovableMedia) {\r
-    AsciiPrint ("Removable ");\r
+\r
+  // print out name of file system, if any, on this block device\r
+  Max = EfiGetDeviceCounts (EfiOpenFileSystem);\r
+  if (Max != 0) {\r
+    for (Index = 0; Index < Max; Index++) {\r
+      FsFile = EfiDeviceOpenByType (EfiOpenFileSystem, Index);\r
+      if (FsFile != NULL) {\r
+        if (FsFile->EfiHandle == File->EfiHandle) {\r
+          AsciiPrint ("fs%d: ", Index);\r
+          EfiClose (FsFile);\r
+          break;\r
+        }\r
+        EfiClose (FsFile);\r
+      }\r
+    }\r
   }\r
-  if (!File->FsBlockIoMedia.MediaPresent) {\r
-    AsciiPrint ("No Media ");\r
+\r
+  // Print out useful Block IO media properties\r
+  if (File->FsBlockIoMedia->RemovableMedia) {\r
+    AsciiPrint ("Removable ");\r
   }\r
-  if (File->FsBlockIoMedia.LogicalPartition) {\r
-    AsciiPrint ("Partition ");\r
+  if (!File->FsBlockIoMedia->MediaPresent) {\r
+    AsciiPrint ("No Media\n");\r
+  } else {\r
+    if (File->FsBlockIoMedia->LogicalPartition) {\r
+      AsciiPrint ("Partition ");\r
+    }\r
+    DeviceSize = MultU64x32 (File->FsBlockIoMedia->LastBlock + 1, File->FsBlockIoMedia->BlockSize);\r
+    AsciiPrint ("Size = 0x%lX\n", DeviceSize);\r
   }\r
-  DeviceSize = MultU64x32 (File->FsBlockIoMedia.LastBlock + 1, File->FsBlockIoMedia.BlockSize);\r
-  AsciiPrint ("Size = 0x%lX\n", DeviceSize);\r
-\r
   EfiClose (File);\r
 }\r
 \r
-\r
  /**\r
   Print information about the Load File devices.\r
   If the device supports PXE dump out extra information\r
@@ -129,23 +158,23 @@ EblPrintLoadFileInfo (
 \r
   if (File->DevicePath != NULL) {\r
     // Try to print out the MAC address\r
-    for (DevicePathNode = File->DevicePath; \r
-        !IsDevicePathEnd (DevicePathNode); \r
+    for (DevicePathNode = File->DevicePath;\r
+        !IsDevicePathEnd (DevicePathNode);\r
         DevicePathNode = NextDevicePathNode (DevicePathNode)) {\r
-      \r
+\r
       if ((DevicePathType (DevicePathNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (DevicePathNode) == MSG_MAC_ADDR_DP)) {\r
         MacAddr = (MAC_ADDR_DEVICE_PATH *)DevicePathNode;\r
-        \r
+\r
         HwAddressSize = sizeof (EFI_MAC_ADDRESS);\r
         if (MacAddr->IfType == 0x01 || MacAddr->IfType == 0x00) {\r
           HwAddressSize = 6;\r
         }\r
-  \r
+\r
         AsciiPrint ("MAC ");\r
         for (Index = 0; Index < HwAddressSize; Index++) {\r
           AsciiPrint ("%02x", MacAddr->MacAddress.Addr[Index] & 0xff);\r
         }\r
-      }      \r
+      }\r
     }\r
   }\r
 \r
@@ -157,7 +186,7 @@ EblPrintLoadFileInfo (
 \r
 \r
 /**\r
-  Dump information about devices in the system. \r
+  Dump information about devices in the system.\r
 \r
   fv:       PI Firmware Volume\r
   fs:       EFI Simple File System\r
@@ -167,13 +196,14 @@ EblPrintLoadFileInfo (
   Argv[0] - "device"\r
 \r
   @param  Argc   Number of command arguments in Argv\r
-  @param  Argv   Array of strings that represent the parsed command line. \r
-                 Argv[0] is the comamnd name\r
+  @param  Argv   Array of strings that represent the parsed command line.\r
+                 Argv[0] is the command name\r
 \r
   @return EFI_SUCCESS\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 EblDeviceCmd (\r
   IN UINTN  Argc,\r
   IN CHAR8  **Argv\r
@@ -184,10 +214,11 @@ EblDeviceCmd (
   UINTN         Max;\r
 \r
   CurrentRow = 0;\r
-  \r
+\r
   // Need to call here to make sure Device Counts are valid\r
   EblUpdateDeviceLists ();\r
 \r
+  // Now we can print out the info...\r
   Max = EfiGetDeviceCounts (EfiOpenFirmwareVolume);\r
   if (Max != 0) {\r
     AsciiPrint ("Firmware Volume Devices:\n");\r
@@ -220,7 +251,7 @@ EblDeviceCmd (
       }\r
     }\r
   }\r
-  \r
+\r
   Max = EfiGetDeviceCounts (EfiOpenLoadFile);\r
   if (Max != 0) {\r
     AsciiPrint ("LoadFile Devices: (usually network)\n");\r
@@ -237,7 +268,7 @@ EblDeviceCmd (
 \r
 \r
 /**\r
-  Start an EFI image (PE32+ with EFI defined entry point). \r
+  Start an EFI image (PE32+ with EFI defined entry point).\r
 \r
   Argv[0] - "start"\r
   Argv[1] - device name and path\r
@@ -249,13 +280,14 @@ EblDeviceCmd (
   start LoadFile0:                    ; load an FV via a PXE boot\r
 \r
   @param  Argc   Number of command arguments in Argv\r
-  @param  Argv   Array of strings that represent the parsed command line. \r
-                 Argv[0] is the comamnd name\r
+  @param  Argv   Array of strings that represent the parsed command line.\r
+                 Argv[0] is the command name\r
 \r
   @return EFI_SUCCESS\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 EblStartCmd (\r
   IN UINTN  Argc,\r
   IN CHAR8  **Argv\r
@@ -279,7 +311,7 @@ EblStartCmd (
 \r
   File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);\r
   if (File == NULL) {\r
-    return EFI_INVALID_PARAMETER; \r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   DevicePath = File->DevicePath;\r
@@ -299,7 +331,7 @@ EblStartCmd (
 \r
     FreePool (Buffer);\r
   }\r
-  \r
+\r
   EfiClose (File);\r
 \r
   if (!EFI_ERROR (Status)) {\r
@@ -308,7 +340,7 @@ EblStartCmd (
       // We don't pass Argv[0] to the EFI Application (it's name) just the args\r
       Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&ImageInfo);\r
       ASSERT_EFI_ERROR (Status);\r
-      \r
+\r
       ImageInfo->LoadOptionsSize = (UINT32)AsciiStrSize (Argv[2]);\r
       ImageInfo->LoadOptions     = AllocatePool (ImageInfo->LoadOptionsSize);\r
       AsciiStrCpy (ImageInfo->LoadOptions, Argv[2]);\r
@@ -324,8 +356,8 @@ EblStartCmd (
 \r
 /**\r
   Load a Firmware Volume (FV) into memory from a device. This causes drivers in\r
-  the FV to be dispatched if the dependancies of the drivers are met.\r
-  \r
+  the FV to be dispatched if the dependencies of the drivers are met.\r
+\r
   Argv[0] - "loadfv"\r
   Argv[1] - device name and path\r
 \r
@@ -334,13 +366,14 @@ EblStartCmd (
   loadfv LoadFile0:      ; load an FV via a PXE boot\r
 \r
   @param  Argc   Number of command arguments in Argv\r
-  @param  Argv   Array of strings that represent the parsed command line. \r
-                 Argv[0] is the comamnd name\r
+  @param  Argv   Array of strings that represent the parsed command line.\r
+                 Argv[0] is the command name\r
 \r
   @return EFI_SUCCESS\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 EblLoadFvCmd (\r
   IN UINTN  Argc,\r
   IN CHAR8  **Argv\r
@@ -359,7 +392,7 @@ EblLoadFvCmd (
 \r
   File = EfiOpen (Argv[1], EFI_FILE_MODE_READ, 0);\r
   if (File == NULL) {\r
-    return EFI_INVALID_PARAMETER; \r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   if (File->Type == EfiOpenMemoryBuffer) {\r
@@ -372,29 +405,32 @@ EblLoadFvCmd (
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
-      \r
+\r
     Status = gDS->ProcessFirmwareVolume (FvStart, FvSize, &FvHandle);\r
-    FreePool (FvStart);\r
+    if (EFI_ERROR (Status)) {\r
+      FreePool (FvStart);\r
+    }\r
   }\r
   return Status;\r
 }\r
 \r
 \r
 /**\r
-  Perform an EFI connect to connect devices that follow the EFI driver model. \r
+  Perform an EFI connect to connect devices that follow the EFI driver model.\r
   If it is a PI system also call the dispatcher in case a new FV was made\r
-  availible by one of the connect EFI drivers (this is not a common case).\r
-  \r
+  available by one of the connect EFI drivers (this is not a common case).\r
+\r
   Argv[0] - "connect"\r
 \r
   @param  Argc   Number of command arguments in Argv\r
-  @param  Argv   Array of strings that represent the parsed command line. \r
-                 Argv[0] is the comamnd name\r
+  @param  Argv   Array of strings that represent the parsed command line.\r
+                 Argv[0] is the command name\r
 \r
   @return EFI_SUCCESS\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 EblConnectCmd (\r
   IN UINTN  Argc,\r
   IN CHAR8  **Argv\r
@@ -420,11 +456,11 @@ EblConnectCmd (
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
-      \r
+\r
       for (Index = 0; Index < HandleCount; Index++) {\r
         gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);\r
       }\r
-      \r
+\r
       //\r
       // Given we disconnect our console we should go and do a connect now\r
       //\r
@@ -506,17 +542,18 @@ CHAR8 *gMemMapType[] = {
 \r
 /**\r
   Dump out the EFI memory map\r
-  \r
+\r
   Argv[0] - "memmap"\r
 \r
   @param  Argc   Number of command arguments in Argv\r
-  @param  Argv   Array of strings that represent the parsed command line. \r
-                 Argv[0] is the comamnd name\r
+  @param  Argv   Array of strings that represent the parsed command line.\r
+                 Argv[0] is the command name\r
 \r
   @return EFI_SUCCESS\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 EblMemMapCmd (\r
   IN UINTN  Argc,\r
   IN CHAR8  **Argv\r
@@ -538,7 +575,7 @@ EblMemMapCmd (
   ZeroMem (PageCount, sizeof (PageCount));\r
 \r
   AsciiPrint ("EFI Memory Map\n");\r
-  \r
+\r
   // First call is to figure out how big the buffer needs to be\r
   MemMapSize = 0;\r
   MemMap     = NULL;\r
@@ -562,7 +599,7 @@ EblMemMapCmd (
           MemMap = NEXT_MEMORY_DESCRIPTOR (MemMap, DescriptorSize);\r
         }\r
       }\r
-        \r
+\r
       for (Index = 0, TotalMemory = 0; Index < EfiMaxMemoryType; Index++) {\r
         if (PageCount[Index] != 0) {\r
           AsciiPrint ("\n  %a %,7ld Pages (%,14ld)", gMemMapType[Index], PageCount[Index], LShiftU64 (PageCount[Index], 12));\r
@@ -597,35 +634,36 @@ EblMemMapCmd (
 \r
 \r
 /**\r
-  Load a file into memory and optionally jump to it. A load addres can be \r
+  Load a file into memory and optionally jump to it. A load address can be\r
   specified or automatically allocated. A quoted command line can optionally\r
-  be passed into the image. \r
+  be passed into the image.\r
 \r
   Argv[0] - "go"\r
   Argv[1] - Device Name:path for the file to load\r
   Argv[2] - Address to load to or '*' if the load address will be allocated\r
   Argv[3] - Optional Entry point to the image. Image will be called if present\r
-  Argv[4] - "" string that will be passed as Argc & Argv to EntryPoint. Needs \r
+  Argv[4] - "" string that will be passed as Argc & Argv to EntryPoint. Needs\r
             to include the command name\r
 \r
-  go fv1:\EblCmdX  0x10000  0x10010 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX \r
-    from FV1 to location 0x10000 and call the entry point at 0x10010 passing \r
+  go fv1:\EblCmdX  0x10000  0x10010 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX\r
+    from FV1 to location 0x10000 and call the entry point at 0x10010 passing\r
     in "EblCmdX Arg2 Arg3 Arg4" as the arguments.\r
 \r
-  go fv0:\EblCmdX  *  0x10 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX from FS0 \r
-    to location allocated by this comamnd and call the entry point at offset 0x10 \r
+  go fv0:\EblCmdX  *  0x10 "EblCmdX Arg2 Arg3 Arg4"; - load EblCmdX from FS0\r
+    to location allocated by this command and call the entry point at offset 0x10\r
     passing in "EblCmdX Arg2 Arg3 Arg4" as the arguments.\r
 \r
   go fv1:\EblCmdX  0x10000; Load EblCmdX to address 0x10000 and return\r
 \r
   @param  Argc   Number of command arguments in Argv\r
-  @param  Argv   Array of strings that represent the parsed command line. \r
-                 Argv[0] is the comamnd name\r
+  @param  Argv   Array of strings that represent the parsed command line.\r
+                 Argv[0] is the command name\r
 \r
   @return EFI_SUCCESS\r
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 EblGoCmd (\r
   IN UINTN  Argc,\r
   IN CHAR8  **Argv\r
@@ -638,7 +676,7 @@ EblGoCmd (
   EBL_COMMMAND                  EntryPoint;\r
   UINTN                         EntryPointArgc;\r
   CHAR8                         *EntryPointArgv[MAX_ARGS];\r
-  \r
+\r
 \r
   if (Argc <= 2) {\r
     // device name and laod address are required\r
@@ -655,8 +693,8 @@ EblGoCmd (
   if (Argv[2][0] == '*') {\r
     // * Means allocate the buffer\r
     Status = EfiReadAllocatePool (File, &Address, &Size);\r
-    \r
-    // EntryPoint is relatvie to the start of the image \r
+\r
+    // EntryPoint is relative to the start of the image\r
     EntryPoint = (EBL_COMMMAND)((UINTN)EntryPoint + (UINTN)Address);\r
 \r
   } else {\r
@@ -678,7 +716,7 @@ EblGoCmd (
         EntryPointArgc = 1;\r
         EntryPointArgv[0] = File->FileName;\r
       }\r
-      \r
+\r
       Status = EntryPoint (EntryPointArgc, EntryPointArgv);\r
     }\r
   }\r
@@ -690,6 +728,7 @@ EblGoCmd (
 #define FILE_COPY_CHUNK 0x20000\r
 \r
 EFI_STATUS\r
+EFIAPI\r
 EblFileCopyCmd (\r
   IN UINTN  Argc,\r
   IN CHAR8  **Argv\r
@@ -701,19 +740,64 @@ EblFileCopyCmd (
   VOID          *Buffer      = NULL;\r
   UINTN         Size;\r
   UINTN         Offset;\r
-  UINTN         Chunk = FILE_COPY_CHUNK;\r
-  \r
+  UINTN         Chunk        = FILE_COPY_CHUNK;\r
+  UINTN         FileNameLen;\r
+  CHAR8*        DestFileName;\r
+  CHAR8*        SrcFileName;\r
+  CHAR8*        SrcPtr;\r
+\r
   if (Argc < 3) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
+  DestFileName = Argv[2];\r
+  FileNameLen = AsciiStrLen (DestFileName);\r
+\r
+  // Check if the destination file name looks like a directory\r
+  if ((DestFileName[FileNameLen-1] == '\\') || (DestFileName[FileNameLen-1] == ':')) {\r
+    // Set the pointer after the source drive (eg: after fs1:)\r
+    SrcPtr = AsciiStrStr (Argv[1], ":");\r
+    if (SrcPtr == NULL) {\r
+      SrcPtr = Argv[1];\r
+    } else {\r
+      SrcPtr++;\r
+      if (*SrcPtr == '\\') {\r
+        SrcPtr++;\r
+      }\r
+    }\r
+\r
+    if (*SrcPtr == '\0') {\r
+      AsciiPrint("Source file incorrect.\n");\r
+    }\r
+\r
+    // Skip the Source Directories\r
+    while (1) {\r
+      SrcFileName = SrcPtr;\r
+      SrcPtr = AsciiStrStr (SrcPtr,"\\");\r
+      if (SrcPtr != NULL) {\r
+        SrcPtr++;\r
+      } else {\r
+        break;\r
+      }\r
+    }\r
+\r
+    if (*SrcFileName == '\0') {\r
+      AsciiPrint("Source file incorrect (Error 2).\n");\r
+    }\r
+\r
+    // Construct the destination filepath\r
+    DestFileName = (CHAR8*)AllocatePool (FileNameLen + AsciiStrLen (SrcFileName) + 1);\r
+    AsciiStrCpy (DestFileName, Argv[2]);\r
+    AsciiStrCat (DestFileName, SrcFileName);\r
+  }\r
+\r
   Source = EfiOpen(Argv[1], EFI_FILE_MODE_READ, 0);\r
   if (Source == NULL) {\r
     AsciiPrint("Source file open error.\n");\r
     return EFI_NOT_FOUND;\r
   }\r
-  \r
-  Destination = EfiOpen(Argv[2], EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);\r
+\r
+  Destination = EfiOpen(DestFileName, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);\r
   if (Destination == NULL) {\r
     AsciiPrint("Destination file open error.\n");\r
     return EFI_NOT_FOUND;\r
@@ -723,42 +807,43 @@ EblFileCopyCmd (
   if (Buffer == NULL) {\r
     goto Exit;\r
   }\r
-  \r
+\r
   Size = EfiTell(Source, NULL);\r
 \r
   for (Offset = 0; Offset + FILE_COPY_CHUNK <= Size; Offset += Chunk) {\r
     Chunk = FILE_COPY_CHUNK;\r
-    \r
+\r
     Status = EfiRead(Source, Buffer, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
-      AsciiPrint("Read file error\n");\r
+      AsciiPrint("Read file error %r\n", Status);\r
       goto Exit;\r
     }\r
 \r
     Status = EfiWrite(Destination, Buffer, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
-      AsciiPrint("Write file error\n");\r
+      AsciiPrint("Write file error %r\n", Status);\r
       goto Exit;\r
-    }    \r
+    }\r
   }\r
-  \r
+\r
   // Any left over?\r
   if (Offset < Size) {\r
     Chunk = Size - Offset;\r
-    \r
+\r
     Status = EfiRead(Source, Buffer, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
-      AsciiPrint("Read file error\n");\r
+      AsciiPrint("Read file error %r\n", Status);\r
       goto Exit;\r
     }\r
 \r
     Status = EfiWrite(Destination, Buffer, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
-      AsciiPrint("Write file error\n");\r
+      AsciiPrint("Write file error %r\n", Status);\r
       goto Exit;\r
-    }    \r
+    }\r
   }\r
 \r
+\r
 Exit:\r
   if (Source != NULL) {\r
     Status = EfiClose(Source);\r
@@ -766,22 +851,27 @@ Exit:
       AsciiPrint("Source close error %r\n", Status);\r
     }\r
   }\r
-  \r
   if (Destination != NULL) {\r
     Status = EfiClose(Destination);\r
     if (EFI_ERROR(Status)) {\r
       AsciiPrint("Destination close error %r\n", Status);\r
     }\r
+\r
+    // Case when we have concated the filename to the destination directory\r
+    if (DestFileName != Argv[2]) {\r
+      FreePool (DestFileName);\r
+    }\r
   }\r
-  \r
+\r
   if (Buffer != NULL) {\r
     FreePool(Buffer);\r
   }\r
-  \r
+\r
   return Status;\r
 }\r
 \r
 EFI_STATUS\r
+EFIAPI\r
 EblFileDiffCmd (\r
   IN UINTN  Argc,\r
   IN CHAR8  **Argv\r
@@ -796,17 +886,17 @@ EblFileDiffCmd (
   UINTN         Size2;\r
   UINTN         Offset;\r
   UINTN         Chunk   = FILE_COPY_CHUNK;\r
-  \r
+\r
   if (Argc != 3) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   File1 = EfiOpen(Argv[1], EFI_FILE_MODE_READ, 0);\r
   if (File1 == NULL) {\r
     AsciiPrint("File 1 open error.\n");\r
     return EFI_NOT_FOUND;\r
   }\r
-  \r
+\r
   File2 = EfiOpen(Argv[2], EFI_FILE_MODE_READ, 0);\r
   if (File2 == NULL) {\r
     AsciiPrint("File 2 open error.\n");\r
@@ -825,15 +915,15 @@ EblFileDiffCmd (
   if (Buffer1 == NULL) {\r
     goto Exit;\r
   }\r
-  \r
+\r
   Buffer2 = AllocatePool(FILE_COPY_CHUNK);\r
   if (Buffer2 == NULL) {\r
     goto Exit;\r
-  }  \r
+  }\r
 \r
   for (Offset = 0; Offset + FILE_COPY_CHUNK <= Size1; Offset += Chunk) {\r
     Chunk = FILE_COPY_CHUNK;\r
-    \r
+\r
     Status = EfiRead(File1, Buffer1, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
       AsciiPrint("File 1 read error\n");\r
@@ -845,17 +935,17 @@ EblFileDiffCmd (
       AsciiPrint("File 2 read error\n");\r
       goto Exit;\r
     }\r
-    \r
+\r
     if (CompareMem(Buffer1, Buffer2, Chunk) != 0) {\r
       AsciiPrint("Files differ.\n");\r
       goto Exit;\r
     };\r
   }\r
-  \r
+\r
   // Any left over?\r
   if (Offset < Size1) {\r
     Chunk = Size1 - Offset;\r
-    \r
+\r
     Status = EfiRead(File1, Buffer1, &Chunk);\r
     if (EFI_ERROR(Status)) {\r
       AsciiPrint("File 1 read error\n");\r
@@ -866,9 +956,9 @@ EblFileDiffCmd (
     if (EFI_ERROR(Status)) {\r
       AsciiPrint("File 2 read error\n");\r
       goto Exit;\r
-    }    \r
+    }\r
   }\r
-  \r
+\r
   if (CompareMem(Buffer1, Buffer2, Chunk) != 0) {\r
     AsciiPrint("Files differ.\n");\r
   } else {\r
@@ -882,22 +972,22 @@ Exit:
       AsciiPrint("File 1 close error %r\n", Status);\r
     }\r
   }\r
-  \r
+\r
   if (File2 != NULL) {\r
     Status = EfiClose(File2);\r
     if (EFI_ERROR(Status)) {\r
       AsciiPrint("File 2 close error %r\n", Status);\r
     }\r
   }\r
-  \r
+\r
   if (Buffer1 != NULL) {\r
     FreePool(Buffer1);\r
   }\r
-  \r
+\r
   if (Buffer2 != NULL) {\r
     FreePool(Buffer2);\r
   }\r
-  \r
+\r
   return Status;\r
 }\r
 \r
@@ -917,31 +1007,31 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdDeviceTemplate[] =
   },\r
   {\r
     "go",\r
-    " dev:path loadaddress entrypoint args; load to given address and jump in", \r
+    " dev:path loadaddress entrypoint args; load to given address and jump in",\r
     NULL,\r
     EblGoCmd\r
   },\r
   {\r
     "loadfv",\r
-    " devname; Load PI FV from device", \r
+    " devname; Load PI FV from device",\r
     NULL,\r
     EblLoadFvCmd\r
   },\r
   {\r
     "start",\r
-    " path; EFI Boot Device:filepath. fs1:\\EFI\\BOOT.EFI", \r
+    " path; EFI Boot Device:filepath. fs1:\\EFI\\BOOT.EFI",\r
     NULL,\r
     EblStartCmd\r
   },\r
   {\r
     "memmap",\r
-    "; dump EFI memory map", \r
+    "; dump EFI memory map",\r
     NULL,\r
     EblMemMapCmd\r
   },\r
   {\r
     "cp",\r
-    " file1 file2; copy file",\r
+    " file1 file2; copy file only.",\r
     NULL,\r
     EblFileCopyCmd\r
   },\r