]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/GenFv/GenFvInternalLib.c
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / C / GenFv / GenFvInternalLib.c
index 6a34b6f553649f2a110a8e0ec5ff978025863e5a..6a874f4e944fd56f6f286f1b91bfbaa78b8b6b02 100644 (file)
@@ -4,13 +4,13 @@ This file contains the internal functions required to generate a Firmware Volume
 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
 Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
 Portions Copyright (c) 2016 HP Development Company, L.P.<BR>\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
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -53,56 +53,56 @@ EFI_GUID  mDefaultCapsuleGuid                 = {0x3B6686BD, 0x0D76, 0x4030, { 0
 EFI_GUID  mEfiFfsSectionAlignmentPaddingGuid  = EFI_FFS_SECTION_ALIGNMENT_PADDING_GUID;\r
 \r
 CHAR8      *mFvbAttributeName[] = {\r
-  EFI_FVB2_READ_DISABLED_CAP_STRING, \r
-  EFI_FVB2_READ_ENABLED_CAP_STRING,  \r
-  EFI_FVB2_READ_STATUS_STRING,       \r
+  EFI_FVB2_READ_DISABLED_CAP_STRING,\r
+  EFI_FVB2_READ_ENABLED_CAP_STRING,\r
+  EFI_FVB2_READ_STATUS_STRING,\r
   EFI_FVB2_WRITE_DISABLED_CAP_STRING,\r
-  EFI_FVB2_WRITE_ENABLED_CAP_STRING, \r
-  EFI_FVB2_WRITE_STATUS_STRING,      \r
-  EFI_FVB2_LOCK_CAP_STRING,          \r
-  EFI_FVB2_LOCK_STATUS_STRING,       \r
+  EFI_FVB2_WRITE_ENABLED_CAP_STRING,\r
+  EFI_FVB2_WRITE_STATUS_STRING,\r
+  EFI_FVB2_LOCK_CAP_STRING,\r
+  EFI_FVB2_LOCK_STATUS_STRING,\r
   NULL,\r
-  EFI_FVB2_STICKY_WRITE_STRING,      \r
-  EFI_FVB2_MEMORY_MAPPED_STRING,     \r
-  EFI_FVB2_ERASE_POLARITY_STRING,    \r
-  EFI_FVB2_READ_LOCK_CAP_STRING,     \r
-  EFI_FVB2_READ_LOCK_STATUS_STRING,  \r
-  EFI_FVB2_WRITE_LOCK_CAP_STRING,    \r
-  EFI_FVB2_WRITE_LOCK_STATUS_STRING \r
+  EFI_FVB2_STICKY_WRITE_STRING,\r
+  EFI_FVB2_MEMORY_MAPPED_STRING,\r
+  EFI_FVB2_ERASE_POLARITY_STRING,\r
+  EFI_FVB2_READ_LOCK_CAP_STRING,\r
+  EFI_FVB2_READ_LOCK_STATUS_STRING,\r
+  EFI_FVB2_WRITE_LOCK_CAP_STRING,\r
+  EFI_FVB2_WRITE_LOCK_STATUS_STRING\r
 };\r
 \r
 CHAR8      *mFvbAlignmentName[] = {\r
-  EFI_FVB2_ALIGNMENT_1_STRING,   \r
-  EFI_FVB2_ALIGNMENT_2_STRING,   \r
-  EFI_FVB2_ALIGNMENT_4_STRING,   \r
-  EFI_FVB2_ALIGNMENT_8_STRING,   \r
-  EFI_FVB2_ALIGNMENT_16_STRING,  \r
-  EFI_FVB2_ALIGNMENT_32_STRING,  \r
-  EFI_FVB2_ALIGNMENT_64_STRING,  \r
-  EFI_FVB2_ALIGNMENT_128_STRING, \r
-  EFI_FVB2_ALIGNMENT_256_STRING, \r
-  EFI_FVB2_ALIGNMENT_512_STRING, \r
-  EFI_FVB2_ALIGNMENT_1K_STRING,  \r
-  EFI_FVB2_ALIGNMENT_2K_STRING,  \r
-  EFI_FVB2_ALIGNMENT_4K_STRING,  \r
-  EFI_FVB2_ALIGNMENT_8K_STRING,  \r
-  EFI_FVB2_ALIGNMENT_16K_STRING, \r
-  EFI_FVB2_ALIGNMENT_32K_STRING, \r
-  EFI_FVB2_ALIGNMENT_64K_STRING, \r
+  EFI_FVB2_ALIGNMENT_1_STRING,\r
+  EFI_FVB2_ALIGNMENT_2_STRING,\r
+  EFI_FVB2_ALIGNMENT_4_STRING,\r
+  EFI_FVB2_ALIGNMENT_8_STRING,\r
+  EFI_FVB2_ALIGNMENT_16_STRING,\r
+  EFI_FVB2_ALIGNMENT_32_STRING,\r
+  EFI_FVB2_ALIGNMENT_64_STRING,\r
+  EFI_FVB2_ALIGNMENT_128_STRING,\r
+  EFI_FVB2_ALIGNMENT_256_STRING,\r
+  EFI_FVB2_ALIGNMENT_512_STRING,\r
+  EFI_FVB2_ALIGNMENT_1K_STRING,\r
+  EFI_FVB2_ALIGNMENT_2K_STRING,\r
+  EFI_FVB2_ALIGNMENT_4K_STRING,\r
+  EFI_FVB2_ALIGNMENT_8K_STRING,\r
+  EFI_FVB2_ALIGNMENT_16K_STRING,\r
+  EFI_FVB2_ALIGNMENT_32K_STRING,\r
+  EFI_FVB2_ALIGNMENT_64K_STRING,\r
   EFI_FVB2_ALIGNMENT_128K_STRING,\r
   EFI_FVB2_ALIGNMENT_256K_STRING,\r
   EFI_FVB2_ALIGNMENT_512K_STRING,\r
-  EFI_FVB2_ALIGNMENT_1M_STRING,  \r
-  EFI_FVB2_ALIGNMENT_2M_STRING,  \r
-  EFI_FVB2_ALIGNMENT_4M_STRING,  \r
-  EFI_FVB2_ALIGNMENT_8M_STRING,  \r
-  EFI_FVB2_ALIGNMENT_16M_STRING, \r
-  EFI_FVB2_ALIGNMENT_32M_STRING, \r
-  EFI_FVB2_ALIGNMENT_64M_STRING, \r
+  EFI_FVB2_ALIGNMENT_1M_STRING,\r
+  EFI_FVB2_ALIGNMENT_2M_STRING,\r
+  EFI_FVB2_ALIGNMENT_4M_STRING,\r
+  EFI_FVB2_ALIGNMENT_8M_STRING,\r
+  EFI_FVB2_ALIGNMENT_16M_STRING,\r
+  EFI_FVB2_ALIGNMENT_32M_STRING,\r
+  EFI_FVB2_ALIGNMENT_64M_STRING,\r
   EFI_FVB2_ALIGNMENT_128M_STRING,\r
   EFI_FVB2_ALIGNMENT_256M_STRING,\r
   EFI_FVB2_ALIGNMENT_512M_STRING,\r
-  EFI_FVB2_ALIGNMENT_1G_STRING,  \r
+  EFI_FVB2_ALIGNMENT_1G_STRING,\r
   EFI_FVB2_ALIGNMENT_2G_STRING\r
 };\r
 \r
@@ -258,7 +258,7 @@ Returns:
     //\r
     strcpy (FvInfo->FvName, Value);\r
   }\r
-  \r
+\r
   //\r
   // Read Fv Attribute\r
   //\r
@@ -409,7 +409,7 @@ UpdateFfsFileState (
 Routine Description:\r
 \r
   This function changes the FFS file attributes based on the erase polarity\r
-  of the FV. Update the reserved bits of State to EFI_FVB2_ERASE_POLARITY. \r
+  of the FV. Update the reserved bits of State to EFI_FVB2_ERASE_POLARITY.\r
 \r
 Arguments:\r
 \r
@@ -586,7 +586,7 @@ Arguments:
                   The current offset must be valid.\r
   DataAlignment   The data alignment of the next FFS file.\r
   FvEnd           End of the empty data in FvImage.\r
-  ExtHeader       PI FvExtHeader Optional \r
+  ExtHeader       PI FvExtHeader Optional\r
 \r
 Returns:\r
 \r
@@ -723,12 +723,12 @@ Returns:
     }\r
     memcpy ((UINT8 *)PadFile + CurFfsHeaderSize, ExtHeader, ExtHeader->ExtHeaderSize);\r
     ((EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage)->ExtHeaderOffset = (UINT16) ((UINTN) ((UINT8 *)PadFile + CurFfsHeaderSize) - (UINTN) FvImage->FileImage);\r
-         //\r
-         // Make next file start at QWord Boundry\r
-         //\r
-         while (((UINTN) FvImage->CurrentFilePointer & (EFI_FFS_FILE_HEADER_ALIGNMENT - 1)) != 0) {\r
-           FvImage->CurrentFilePointer++;\r
-         }\r
+    //\r
+    // Make next file start at QWord Boundry\r
+    //\r
+    while (((UINTN) FvImage->CurrentFilePointer & (EFI_FFS_FILE_HEADER_ALIGNMENT - 1)) != 0) {\r
+      FvImage->CurrentFilePointer++;\r
+    }\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -766,7 +766,7 @@ EFI_STATUS
 WriteMapFile (\r
   IN OUT FILE                  *FvMapFile,\r
   IN     CHAR8                 *FileName,\r
-  IN     EFI_FFS_FILE_HEADER   *FfsFile, \r
+  IN     EFI_FFS_FILE_HEADER   *FfsFile,\r
   IN     EFI_PHYSICAL_ADDRESS  ImageBaseAddress,\r
   IN     PE_COFF_LOADER_IMAGE_CONTEXT *pImageContext\r
   )\r
@@ -817,19 +817,19 @@ Returns:
   //\r
   FunctionType = 0;\r
   //\r
-  // Print FileGuid to string buffer. \r
+  // Print FileGuid to string buffer.\r
   //\r
   PrintGuidToBuffer (&FfsFile->Name, (UINT8 *)FileGuidName, MAX_LINE_LEN, TRUE);\r
-  \r
+\r
   //\r
-  // Construct Map file Name \r
+  // Construct Map file Name\r
   //\r
   if (strlen (FileName) >= MAX_LONG_FILE_PATH) {\r
     return EFI_ABORTED;\r
   }\r
   strncpy (PeMapFileName, FileName, MAX_LONG_FILE_PATH - 1);\r
   PeMapFileName[MAX_LONG_FILE_PATH - 1] = 0;\r
-  \r
+\r
   //\r
   // Change '\\' to '/', unified path format.\r
   //\r
@@ -840,10 +840,10 @@ Returns:
     }\r
     Cptr ++;\r
   }\r
-  \r
+\r
   //\r
   // Get Map file\r
-  // \r
+  //\r
   Cptr = PeMapFileName + strlen (PeMapFileName);\r
   while ((*Cptr != '.') && (Cptr >= PeMapFileName)) {\r
     Cptr --;\r
@@ -864,30 +864,30 @@ Returns:
   while ((*Cptr != FILE_SEP_CHAR) && (Cptr >= PeMapFileName)) {\r
     Cptr --;\r
   }\r
-       *Cptr2 = '\0';\r
+  *Cptr2 = '\0';\r
   if (strlen (Cptr + 1) >= MAX_LINE_LEN) {\r
     return EFI_ABORTED;\r
   }\r
   strncpy (KeyWord, Cptr + 1, MAX_LINE_LEN - 1);\r
   KeyWord[MAX_LINE_LEN - 1] = 0;\r
-       *Cptr2 = '.';\r
+  *Cptr2 = '.';\r
 \r
   //\r
   // AddressOfEntryPoint and Offset in Image\r
   //\r
   if (!pImageContext->IsTeImage) {\r
-       ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINT8 *) pImageContext->Handle + pImageContext->PeCoffHeaderOffset);\r
-       AddressOfEntryPoint = ImgHdr->Pe32.OptionalHeader.AddressOfEntryPoint;\r
-       Offset = 0;\r
+    ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINT8 *) pImageContext->Handle + pImageContext->PeCoffHeaderOffset);\r
+    AddressOfEntryPoint = ImgHdr->Pe32.OptionalHeader.AddressOfEntryPoint;\r
+    Offset = 0;\r
     SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (\r
                        (UINT8 *) ImgHdr +\r
-                       sizeof (UINT32) + \r
-                       sizeof (EFI_IMAGE_FILE_HEADER) +  \r
+                       sizeof (UINT32) +\r
+                       sizeof (EFI_IMAGE_FILE_HEADER) +\r
                        ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader\r
                        );\r
     Index = ImgHdr->Pe32.FileHeader.NumberOfSections;\r
   } else {\r
-       TEImageHeader = (EFI_TE_IMAGE_HEADER *) pImageContext->Handle;\r
+    TEImageHeader = (EFI_TE_IMAGE_HEADER *) pImageContext->Handle;\r
     AddressOfEntryPoint = TEImageHeader->AddressOfEntryPoint;\r
     Offset = TEImageHeader->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER);\r
     SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (TEImageHeader + 1);\r
@@ -907,31 +907,31 @@ Returns:
 \r
   if (FfsFile->Type != EFI_FV_FILETYPE_SECURITY_CORE && pImageContext->Machine == EFI_IMAGE_MACHINE_IA64) {\r
     //\r
-    // Process IPF PLABEL to get the real address after the image has been rebased. \r
+    // Process IPF PLABEL to get the real address after the image has been rebased.\r
     // PLABEL structure is got by AddressOfEntryPoint offset to ImageBuffer stored in pImageContext->Handle.\r
     //\r
     fprintf (FvMapFile, "EntryPoint=0x%010llx", (unsigned long long) (*(UINT64 *)((UINTN) pImageContext->Handle + (UINTN) AddressOfEntryPoint)));\r
   } else {\r
     fprintf (FvMapFile, "EntryPoint=0x%010llx", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));\r
   }\r
-  fprintf (FvMapFile, ")\n"); \r
-  \r
+  fprintf (FvMapFile, ")\n");\r
+\r
   fprintf (FvMapFile, "(GUID=%s", FileGuidName);\r
   TextVirtualAddress = 0;\r
   DataVirtualAddress = 0;\r
   for (; Index > 0; Index --, SectionHeader ++) {\r
     if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) {\r
-               TextVirtualAddress = SectionHeader->VirtualAddress;\r
-       } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {\r
-         DataVirtualAddress = SectionHeader->VirtualAddress;\r
-       } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".sdata") == 0) {\r
-         DataVirtualAddress = SectionHeader->VirtualAddress;\r
-       }\r
+      TextVirtualAddress = SectionHeader->VirtualAddress;\r
+    } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {\r
+      DataVirtualAddress = SectionHeader->VirtualAddress;\r
+    } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".sdata") == 0) {\r
+      DataVirtualAddress = SectionHeader->VirtualAddress;\r
+    }\r
   }\r
   fprintf (FvMapFile, " .textbaseaddress=0x%010llx", (unsigned long long) (ImageBaseAddress + TextVirtualAddress));\r
   fprintf (FvMapFile, " .databaseaddress=0x%010llx", (unsigned long long) (ImageBaseAddress + DataVirtualAddress));\r
   fprintf (FvMapFile, ")\n\n");\r
-   \r
+\r
   //\r
   // Open PeMapFile\r
   //\r
@@ -941,7 +941,7 @@ Returns:
     return EFI_ABORTED;\r
   }\r
   VerboseMsg ("The map file is %s", PeMapFileName);\r
-  \r
+\r
   //\r
   // Output Functions information into Fv Map file\r
   //\r
@@ -956,7 +956,7 @@ Returns:
     }\r
     //\r
     // By Address and Static keyword\r
-    //  \r
+    //\r
     if (FunctionType == 0) {\r
       sscanf (Line, "%s", KeyWord);\r
       if (stricmp (KeyWord, "Address") == 0) {\r
@@ -1001,7 +1001,7 @@ Returns:
   //\r
   fprintf (FvMapFile, "\n\n");\r
   fclose (PeMapFile);\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -1196,7 +1196,7 @@ Returns:
   EFI_STATUS            Status;\r
   UINTN                 Index1;\r
   UINT8                 FileGuidString[PRINTED_GUID_BUFFER_SIZE];\r
-  \r
+\r
   Index1 = 0;\r
   //\r
   // Verify input parameters.\r
@@ -1236,7 +1236,7 @@ Returns:
   // Done with the file, from this point on we will just use the buffer read.\r
   //\r
   fclose (NewFile);\r
-  \r
+\r
   //\r
   // Verify read successful\r
   //\r
@@ -1245,20 +1245,20 @@ Returns:
     Error (NULL, 0, 0004, "Error reading file", FvInfo->FvFiles[Index]);\r
     return EFI_ABORTED;\r
   }\r
-  \r
+\r
   //\r
   // For None PI Ffs file, directly add them into FvImage.\r
   //\r
   if (!FvInfo->IsPiFvImage) {\r
     memcpy (FvImage->CurrentFilePointer, FileBuffer, FileSize);\r
     if (FvInfo->SizeofFvFiles[Index] > FileSize) {\r
-       FvImage->CurrentFilePointer += FvInfo->SizeofFvFiles[Index];\r
+      FvImage->CurrentFilePointer += FvInfo->SizeofFvFiles[Index];\r
     } else {\r
-       FvImage->CurrentFilePointer += FileSize;\r
+      FvImage->CurrentFilePointer += FileSize;\r
     }\r
     goto Done;\r
   }\r
-  \r
+\r
   //\r
   // Verify Ffs file\r
   //\r
@@ -1303,7 +1303,7 @@ Returns:
   // Check if alignment is required\r
   //\r
   ReadFfsAlignment ((EFI_FFS_FILE_HEADER *) FileBuffer, &CurrentFileAlignment);\r
-  \r
+\r
   //\r
   // Find the largest alignment of all the FFS files in the FV\r
   //\r
@@ -1328,20 +1328,20 @@ Returns:
         return EFI_ABORTED;\r
       }\r
       //\r
-      // Rebase the PE or TE image in FileBuffer of FFS file for XIP \r
+      // Rebase the PE or TE image in FileBuffer of FFS file for XIP\r
       // Rebase for the debug genfvmap tool\r
       //\r
       Status = FfsRebase (FvInfo, FvInfo->FvFiles[Index], (EFI_FFS_FILE_HEADER *) FileBuffer, (UINTN) *VtfFileImage - (UINTN) FvImage->FileImage, FvMapFile);\r
       if (EFI_ERROR (Status)) {\r
         Error (NULL, 0, 3000, "Invalid", "Could not rebase %s.", FvInfo->FvFiles[Index]);\r
         return Status;\r
-      }          \r
+      }\r
       //\r
       // copy VTF File\r
       //\r
       memcpy (*VtfFileImage, FileBuffer, FileSize);\r
-      \r
-      PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE); \r
+\r
+      PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE);\r
       fprintf (FvReportFile, "0x%08X %s\n", (unsigned)(UINTN) (((UINT8 *)*VtfFileImage) - (UINTN)FvImage->FileImage), FileGuidString);\r
 \r
       free (FileBuffer);\r
@@ -1374,19 +1374,19 @@ Returns:
   //\r
   if ((UINTN) (FvImage->CurrentFilePointer + FileSize) <= (UINTN) (*VtfFileImage)) {\r
     //\r
-    // Rebase the PE or TE image in FileBuffer of FFS file for XIP. \r
+    // Rebase the PE or TE image in FileBuffer of FFS file for XIP.\r
     // Rebase Bs and Rt drivers for the debug genfvmap tool.\r
     //\r
     Status = FfsRebase (FvInfo, FvInfo->FvFiles[Index], (EFI_FFS_FILE_HEADER *) FileBuffer, (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage, FvMapFile);\r
-       if (EFI_ERROR (Status)) {\r
-         Error (NULL, 0, 3000, "Invalid", "Could not rebase %s.", FvInfo->FvFiles[Index]);\r
-         return Status;\r
-       }               \r
+  if (EFI_ERROR (Status)) {\r
+    Error (NULL, 0, 3000, "Invalid", "Could not rebase %s.", FvInfo->FvFiles[Index]);\r
+    return Status;\r
+  }\r
     //\r
     // Copy the file\r
     //\r
     memcpy (FvImage->CurrentFilePointer, FileBuffer, FileSize);\r
-    PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE); \r
+    PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE);\r
     fprintf (FvReportFile, "0x%08X %s\n", (unsigned) (FvImage->CurrentFilePointer - FvImage->FileImage), FileGuidString);\r
     FvImage->CurrentFilePointer += FileSize;\r
   } else {\r
@@ -1401,7 +1401,7 @@ Returns:
     FvImage->CurrentFilePointer++;\r
   }\r
 \r
-Done: \r
+Done:\r
   //\r
   // Free allocated memory.\r
   //\r
@@ -1458,7 +1458,7 @@ Returns:
   PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;\r
 \r
   //\r
-  // write PadFile FFS header with PadType, don't need to set PAD file guid in its header. \r
+  // write PadFile FFS header with PadType, don't need to set PAD file guid in its header.\r
   //\r
   PadFile->Type       = EFI_FV_FILETYPE_FFS_PAD;\r
   PadFile->Attributes = 0;\r
@@ -1629,7 +1629,7 @@ Returns:
   if (EFI_ERROR (Status)) {\r
     Error (NULL, 0, 3000, "Invalid", "could not get the PE32 entry point for the SEC core.");\r
     return EFI_ABORTED;\r
-  }  \r
+  }\r
 \r
   if (\r
        Vtf0Detected &&\r
@@ -1650,7 +1650,7 @@ Returns:
   SecCorePhysicalAddress = FvInfo->BaseAddress;\r
   SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + SecHeaderSize - (UINTN) FvImage->FileImage;\r
   SecCorePhysicalAddress += EntryPoint;\r
-  DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress); \r
+  DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress);\r
 \r
   //\r
   // Find the PEI Core\r
@@ -1758,18 +1758,18 @@ Returns:
     // Write lower 32 bits of physical address for Pei Core entry\r
     //\r
     *Ia32ResetAddressPtr = (UINT32) PeiCorePhysicalAddress;\r
-    \r
+\r
     //\r
     // Write SecCore Entry point relative address into the jmp instruction in reset vector.\r
-    // \r
+    //\r
     Ia32ResetAddressPtr  = (UINT32 *) ((UINTN) FvImage->Eof - IA32_SEC_CORE_ENTRY_OFFSET);\r
-    \r
+\r
     Ia32SecEntryOffset   = (INT32) (SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2));\r
     if (Ia32SecEntryOffset <= -65536) {\r
       Error (NULL, 0, 3000, "Invalid", "The SEC EXE file size is too large, it must be less than 64K.");\r
       return STATUS_ERROR;\r
     }\r
-    \r
+\r
     *(UINT16 *) Ia32ResetAddressPtr = (UINT16) Ia32SecEntryOffset;\r
 \r
     //\r
@@ -1819,9 +1819,9 @@ Returns:
     //\r
     WordPointer   = (UINT16 *) (BytePointer + SIZEOF_STARTUP_DATA_ARRAY - 2);\r
     *WordPointer  = (UINT16) (0x10000 - (UINT32) CheckSum);\r
-    \r
+\r
     //\r
-    // IpiVector at the 4k aligned address in the top 2 blocks in the PEI FV. \r
+    // IpiVector at the 4k aligned address in the top 2 blocks in the PEI FV.\r
     //\r
     IpiVector  = (UINT32) (FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer));\r
     DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", (unsigned) IpiVector);\r
@@ -2120,15 +2120,15 @@ UpdateArmResetVectorIfNeeded (
 /*++\r
 \r
 Routine Description:\r
-  This parses the FV looking for SEC and patches that address into the \r
+  This parses the FV looking for SEC and patches that address into the\r
   beginning of the FV header.\r
 \r
   For ARM32 the reset vector is at 0x00000000 or 0xFFFF0000.\r
   For AArch64 the reset vector is at 0x00000000.\r
 \r
-  This would commonly map to the first entry in the ROM. \r
+  This would commonly map to the first entry in the ROM.\r
   ARM32 Exceptions:\r
-  Reset            +0    \r
+  Reset            +0\r
   Undefined        +4\r
   SWI              +8\r
   Prefetch Abort   +12\r
@@ -2138,15 +2138,15 @@ Routine Description:
 \r
   We support two schemes on ARM.\r
   1) Beginning of the FV is the reset vector\r
-  2) Reset vector is data bytes FDF file and that code branches to reset vector \r
+  2) Reset vector is data bytes FDF file and that code branches to reset vector\r
     in the beginning of the FV (fixed size offset).\r
 \r
   Need to have the jump for the reset vector at location zero.\r
   We also need to store the address or PEI (if it exists).\r
-  We stub out a return from interrupt in case the debugger \r
+  We stub out a return from interrupt in case the debugger\r
    is using SWI (not done for AArch64, not enough space in struct).\r
-  The optional entry to the common exception handler is \r
-   to support full featured exception handling from ROM and is currently \r
+  The optional entry to the common exception handler is\r
+   to support full featured exception handling from ROM and is currently\r
     not support by this tool.\r
 \r
 Arguments:\r
@@ -2243,7 +2243,7 @@ Returns:
     // 1 - PEI Entry Point\r
     // 2 - movs pc,lr for a SWI handler\r
     // 3 - Place holder for Common Exception Handler\r
-    UINT32                      ResetVector[4]; \r
+    UINT32                      ResetVector[4];\r
 \r
     memset(ResetVector, 0, sizeof (ResetVector));\r
 \r
@@ -2356,8 +2356,8 @@ GetPe32Info (
 \r
 Routine Description:\r
 \r
-  Retrieves the PE32 entry point offset and machine type from PE image or TeImage.  \r
-  See EfiImage.h for machine types.  The entry point offset is from the beginning \r
+  Retrieves the PE32 entry point offset and machine type from PE image or TeImage.\r
+  See EfiImage.h for machine types.  The entry point offset is from the beginning\r
   of the PE32 buffer passed in.\r
 \r
 Arguments:\r
@@ -2399,13 +2399,13 @@ Returns:
     *BaseOfCode   = TeHeader->BaseOfCode + sizeof (EFI_TE_IMAGE_HEADER) - TeHeader->StrippedSize;\r
     *MachineType  = TeHeader->Machine;\r
   } else {\r
-  \r
+\r
     //\r
-    // Then check whether \r
+    // Then check whether\r
     // First is the DOS header\r
     //\r
     DosHeader = (EFI_IMAGE_DOS_HEADER *) Pe32;\r
-  \r
+\r
     //\r
     // Verify DOS header is expected\r
     //\r
@@ -2417,7 +2417,7 @@ Returns:
     // Immediately following is the NT header.\r
     //\r
     ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN) Pe32 + DosHeader->e_lfanew);\r
-  \r
+\r
     //\r
     // Verify NT header is expected\r
     //\r
@@ -2436,7 +2436,7 @@ Returns:
   //\r
   // Verify machine type is supported\r
   //\r
-  if ((*MachineType != EFI_IMAGE_MACHINE_IA32) && (*MachineType != EFI_IMAGE_MACHINE_IA64) && (*MachineType != EFI_IMAGE_MACHINE_X64) && (*MachineType != EFI_IMAGE_MACHINE_EBC) && \r
+  if ((*MachineType != EFI_IMAGE_MACHINE_IA32) && (*MachineType != EFI_IMAGE_MACHINE_IA64) && (*MachineType != EFI_IMAGE_MACHINE_X64) && (*MachineType != EFI_IMAGE_MACHINE_EBC) &&\r
       (*MachineType != EFI_IMAGE_MACHINE_ARMT) && (*MachineType != EFI_IMAGE_MACHINE_AARCH64)) {\r
     Error (NULL, 0, 3000, "Invalid", "Unrecognized machine type in the PE32 file.");\r
     return EFI_UNSUPPORTED;\r
@@ -2506,7 +2506,7 @@ Returns:
     InfMemoryFile.FileImage           = InfFileImage;\r
     InfMemoryFile.CurrentFilePointer  = InfFileImage;\r
     InfMemoryFile.Eof                 = InfFileImage + InfFileSize;\r
-  \r
+\r
     //\r
     // Parse the FV inf file for header information\r
     //\r
@@ -2528,17 +2528,17 @@ Returns:
     Error (NULL, 0, 1001, "Missing option", "Output file name");\r
     return EFI_ABORTED;\r
   }\r
-  \r
+\r
   if (mFvDataInfo.FvBlocks[0].Length == 0) {\r
     Error (NULL, 0, 1001, "Missing required argument", "Block Size");\r
     return EFI_ABORTED;\r
   }\r
-  \r
+\r
   //\r
   // Debug message Fv File System Guid\r
   //\r
   if (mFvDataInfo.FvFileSystemGuidSet) {\r
-    DebugMsg (NULL, 0, 9, "FV File System Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \r
+    DebugMsg (NULL, 0, 9, "FV File System Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",\r
                   (unsigned) mFvDataInfo.FvFileSystemGuid.Data1,\r
                   mFvDataInfo.FvFileSystemGuid.Data2,\r
                   mFvDataInfo.FvFileSystemGuid.Data3,\r
@@ -2611,7 +2611,7 @@ Returns:
   // Debug message Fv Name Guid\r
   //\r
   if (mFvDataInfo.FvNameGuidSet) {\r
-      DebugMsg (NULL, 0, 9, "FV Name Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \r
+      DebugMsg (NULL, 0, 9, "FV Name Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",\r
                   (unsigned) mFvDataInfo.FvNameGuid.Data1,\r
                   mFvDataInfo.FvNameGuid.Data2,\r
                   mFvDataInfo.FvNameGuid.Data3,\r
@@ -2695,7 +2695,7 @@ Returns:
     goto Finish;\r
   }\r
   VerboseMsg ("the generated FV image size is %u bytes", (unsigned) mFvDataInfo.Size);\r
-  \r
+\r
   //\r
   // support fv image and empty fv image\r
   //\r
@@ -2716,7 +2716,7 @@ Returns:
   //\r
   if (mFvDataInfo.FvAttributes == 0) {\r
     //\r
-    // Set Default Fv Attribute \r
+    // Set Default Fv Attribute\r
     //\r
     mFvDataInfo.FvAttributes = FV_DEFAULT_ATTRIBUTE;\r
   }\r
@@ -2747,7 +2747,7 @@ Returns:
   FvHeader->Revision        = EFI_FVH_REVISION;\r
   FvHeader->ExtHeaderOffset = 0;\r
   FvHeader->Reserved[0]     = 0;\r
-  \r
+\r
   //\r
   // Copy firmware block map\r
   //\r
@@ -2802,7 +2802,7 @@ Returns:
     Status = EFI_ABORTED;\r
     goto Finish;\r
   }\r
-  \r
+\r
   //\r
   // Open FvReport file\r
   //\r
@@ -2883,7 +2883,7 @@ Returns:
     if (!mArm) {\r
       //\r
       // Update reset vector (SALE_ENTRY for IPF)\r
-      // Now for IA32 and IA64 platform, the fv which has bsf file must have the \r
+      // Now for IA32 and IA64 platform, the fv which has bsf file must have the\r
       // EndAddress of 0xFFFFFFFF (unless the section was rebased).\r
       // Thus, only this type fv needs to update the  reset vector.\r
       // If the PEI Core is found, the VTF file will probably get\r
@@ -2892,29 +2892,29 @@ Returns:
       if (mFvDataInfo.ForceRebase == 1 ||\r
           (mFvDataInfo.BaseAddress + mFvDataInfo.Size) == FV_IMAGES_TOP_ADDRESS) {\r
         Status = UpdateResetVector (&FvImageMemoryFile, &mFvDataInfo, VtfFileImage);\r
-        if (EFI_ERROR(Status)) {                                               \r
+        if (EFI_ERROR(Status)) {\r
           Error (NULL, 0, 3000, "Invalid", "Could not update the reset vector.");\r
-          goto Finish;                                              \r
+          goto Finish;\r
         }\r
         DebugMsg (NULL, 0, 9, "Update Reset vector in VTF file", NULL);\r
       }\r
     }\r
-  } \r
+  }\r
 \r
   if (mArm) {\r
     Status = UpdateArmResetVectorIfNeeded (&FvImageMemoryFile, &mFvDataInfo);\r
-    if (EFI_ERROR (Status)) {                                               \r
+    if (EFI_ERROR (Status)) {\r
       Error (NULL, 0, 3000, "Invalid", "Could not update the reset vector.");\r
-      goto Finish;                                              \r
-    }  \r
-    \r
+      goto Finish;\r
+    }\r
+\r
     //\r
     // Update Checksum for FvHeader\r
     //\r
     FvHeader->Checksum = 0;\r
     FvHeader->Checksum = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));\r
   }\r
-  \r
+\r
   //\r
   // Update FV Alignment attribute to the largest alignment of all the FFS files in the FV\r
   //\r
@@ -2937,7 +2937,7 @@ Returns:
     FvHeader->Checksum      = CalculateChecksum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));\r
   }\r
 \r
-WriteFile: \r
+WriteFile:\r
   //\r
   // Write fv file\r
   //\r
@@ -2970,12 +2970,12 @@ Finish:
   if (FvReportName != NULL) {\r
     free (FvReportName);\r
   }\r
-  \r
+\r
   if (FvFile != NULL) {\r
     fflush (FvFile);\r
     fclose (FvFile);\r
   }\r
-  \r
+\r
   if (FvMapFile != NULL) {\r
     fflush (FvMapFile);\r
     fclose (FvMapFile);\r
@@ -3084,7 +3084,7 @@ Returns:
   UINT32              FfsHeaderSize;\r
   EFI_FFS_FILE_HEADER FfsHeader;\r
   UINTN               VtfFileSize;\r
-  \r
+\r
   FvExtendHeaderSize = 0;\r
   VtfFileSize = 0;\r
   fpin  = NULL;\r
@@ -3097,19 +3097,19 @@ Returns:
   for (Index = 0; FvInfoPtr->FvBlocks[Index].NumBlocks > 0 && FvInfoPtr->FvBlocks[Index].Length > 0; Index++) {\r
     FvInfoPtr->Size += FvInfoPtr->FvBlocks[Index].NumBlocks * FvInfoPtr->FvBlocks[Index].Length;\r
   }\r
-  \r
+\r
   //\r
   // Calculate the required sizes for all FFS files.\r
   //\r
   CurrentOffset = sizeof (EFI_FIRMWARE_VOLUME_HEADER);\r
-  \r
+\r
   for (Index = 1;; Index ++) {\r
     CurrentOffset += sizeof (EFI_FV_BLOCK_MAP_ENTRY);\r
     if (FvInfoPtr->FvBlocks[Index].NumBlocks == 0 || FvInfoPtr->FvBlocks[Index].Length == 0) {\r
       break;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Calculate PI extension header\r
   //\r
@@ -3164,7 +3164,7 @@ Returns:
     // close file\r
     //\r
     fclose (fpin);\r
-    \r
+\r
     if (FvInfoPtr->IsPiFvImage) {\r
         //\r
         // Check whether this ffs file is vtf file\r
@@ -3183,7 +3183,7 @@ Returns:
       }\r
 \r
       //\r
-      // Get the alignment of FFS file \r
+      // Get the alignment of FFS file\r
       //\r
       ReadFfsAlignment (&FfsHeader, &FfsAlignment);\r
       FfsAlignment = 1 << FfsAlignment;\r
@@ -3197,28 +3197,28 @@ Returns:
         CurrentOffset = (CurrentOffset + FfsHeaderSize + sizeof(EFI_FFS_FILE_HEADER) + FfsAlignment - 1) & ~(FfsAlignment - 1);\r
         CurrentOffset -= FfsHeaderSize;\r
       }\r
-         }\r
+    }\r
 \r
     //\r
     // Add ffs file size\r
     //\r
     if (FvInfoPtr->SizeofFvFiles[Index] > FfsFileSize) {\r
-       CurrentOffset += FvInfoPtr->SizeofFvFiles[Index];\r
+      CurrentOffset += FvInfoPtr->SizeofFvFiles[Index];\r
     } else {\r
-       CurrentOffset += FfsFileSize;\r
+      CurrentOffset += FfsFileSize;\r
     }\r
-       \r
+\r
     //\r
     // Make next ffs file start at QWord Boundry\r
     //\r
     if (FvInfoPtr->IsPiFvImage) {\r
-       CurrentOffset = (CurrentOffset + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1);\r
+      CurrentOffset = (CurrentOffset + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1);\r
     }\r
   }\r
   CurrentOffset += VtfFileSize;\r
   DebugMsg (NULL, 0, 9, "FvImage size", "The calculated fv image size is 0x%x and the current set fv image size is 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);\r
-  \r
-  if (FvInfoPtr->Size == 0) { \r
+\r
+  if (FvInfoPtr->Size == 0) {\r
     //\r
     // Update FvInfo data\r
     //\r
@@ -3233,7 +3233,7 @@ Returns:
     Error (NULL, 0, 3000, "Invalid", "the required fv image size 0x%x exceeds the set fv image size 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   //\r
   // Set Fv Size Information\r
   //\r
@@ -3288,7 +3288,7 @@ Returns:
 \r
 EFI_STATUS\r
 GetChildFvFromFfs (\r
-  IN      FV_INFO               *FvInfo, \r
+  IN      FV_INFO               *FvInfo,\r
   IN      EFI_FFS_FILE_HEADER   *FfsFile,\r
   IN      UINTN                 XipOffset\r
   )\r
@@ -3319,7 +3319,7 @@ Returns:
 \r
   for (Index = 1;; Index++) {\r
     //\r
-    // Find FV section \r
+    // Find FV section\r
     //\r
     Status = GetSectionByType (FfsFile, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, Index, &SubFvSection);\r
     if (EFI_ERROR (Status)) {\r
@@ -3361,9 +3361,9 @@ Returns:
 }\r
 \r
 EFI_STATUS\r
-FfsRebase ( \r
-  IN OUT  FV_INFO               *FvInfo, \r
-  IN      CHAR8                 *FileName,           \r
+FfsRebase (\r
+  IN OUT  FV_INFO               *FvInfo,\r
+  IN      CHAR8                 *FileName,\r
   IN OUT  EFI_FFS_FILE_HEADER   *FfsFile,\r
   IN      UINTN                 XipOffset,\r
   IN      FILE                  *FvMapFile\r
@@ -3376,7 +3376,7 @@ Routine Description:
   rebase any PE32 sections found in the file using the base address.\r
 \r
 Arguments:\r
-  \r
+\r
   FvInfo            A pointer to FV_INFO struture.\r
   FileName          Ffs File PathName\r
   FfsFile           A pointer to Ffs file image.\r
@@ -3395,7 +3395,7 @@ Returns:
 {\r
   EFI_STATUS                            Status;\r
   PE_COFF_LOADER_IMAGE_CONTEXT          ImageContext;\r
-  PE_COFF_LOADER_IMAGE_CONTEXT          OrigImageContext;  \r
+  PE_COFF_LOADER_IMAGE_CONTEXT          OrigImageContext;\r
   EFI_PHYSICAL_ADDRESS                  XipBase;\r
   EFI_PHYSICAL_ADDRESS                  NewPe32BaseAddress;\r
   UINTN                                 Index;\r
@@ -3414,7 +3414,7 @@ Returns:
   UINT32                                FfsHeaderSize;\r
   UINT32                                CurSecHdrSize;\r
 \r
-  Index              = 0;  \r
+  Index              = 0;\r
   MemoryImagePointer = NULL;\r
   TEImageHeader      = NULL;\r
   ImgHdr             = NULL;\r
@@ -3429,7 +3429,7 @@ Returns:
   if ((FvInfo->BaseAddress == 0) && (FvInfo->ForceRebase == -1)) {\r
     return EFI_SUCCESS;\r
   }\r
-  \r
+\r
   //\r
   // If ForceRebase Flag specified to FALSE, will always not take rebase action.\r
   //\r
@@ -3475,7 +3475,7 @@ Returns:
     // Init Value\r
     //\r
     NewPe32BaseAddress = 0;\r
-    \r
+\r
     //\r
     // Find Pe Image\r
     //\r
@@ -3506,7 +3506,7 @@ Returns:
     // Keep Image Context for PE image in FV\r
     //\r
     memcpy (&OrigImageContext, &ImageContext, sizeof (ImageContext));\r
-    \r
+\r
     //\r
     // Get File PdbPointer\r
     //\r
@@ -3536,11 +3536,11 @@ Returns:
           return EFI_ABORTED;\r
         }\r
         //\r
-        // PeImage has no reloc section. It will try to get reloc data from the original EFI image. \r
+        // PeImage has no reloc section. It will try to get reloc data from the original EFI image.\r
         //\r
         if (ImageContext.RelocationsStripped) {\r
           //\r
-          // Construct the original efi file Name \r
+          // Construct the original efi file Name\r
           //\r
           if (strlen (FileName) >= MAX_LONG_FILE_PATH) {\r
             Error (NULL, 0, 2000, "Invalid", "The file name %s is too long.", FileName);\r
@@ -3622,7 +3622,7 @@ Returns:
         //\r
         return EFI_SUCCESS;\r
     }\r
-    \r
+\r
     //\r
     // Relocation doesn't exist\r
     //\r
@@ -3644,14 +3644,14 @@ Returns:
     }\r
     memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);\r
     ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((UINTN) ImageContext.SectionAlignment - 1));\r
-    \r
+\r
     Status =  PeCoffLoaderLoadImage (&ImageContext);\r
     if (EFI_ERROR (Status)) {\r
       Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);\r
       free ((VOID *) MemoryImagePointer);\r
       return Status;\r
     }\r
-         \r
+\r
     ImageContext.DestinationAddress = NewPe32BaseAddress;\r
     Status                          = PeCoffLoaderRelocateImage (&ImageContext);\r
     if (EFI_ERROR (Status)) {\r
@@ -3665,15 +3665,15 @@ Returns:
     //\r
     SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (\r
                        (UINTN) ImgHdr +\r
-                       sizeof (UINT32) + \r
-                       sizeof (EFI_IMAGE_FILE_HEADER) +  \r
+                       sizeof (UINT32) +\r
+                       sizeof (EFI_IMAGE_FILE_HEADER) +\r
                        ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader\r
                        );\r
-    \r
+\r
     for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {\r
       CopyMem (\r
-        (UINT8 *) CurrentPe32Section.Pe32Section + CurSecHdrSize + SectionHeader->PointerToRawData, \r
-        (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress), \r
+        (UINT8 *) CurrentPe32Section.Pe32Section + CurSecHdrSize + SectionHeader->PointerToRawData,\r
+        (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),\r
         SectionHeader->SizeOfRawData\r
         );\r
     }\r
@@ -3684,7 +3684,7 @@ Returns:
       free (PeFileBuffer);\r
       PeFileBuffer = NULL;\r
     }\r
-    \r
+\r
     //\r
     // Update Image Base Address\r
     //\r
@@ -3739,13 +3739,13 @@ Returns:
     //\r
     return EFI_SUCCESS;\r
   }\r
-  \r
+\r
   //\r
   // Now process TE sections\r
   //\r
   for (Index = 1;; Index++) {\r
     NewPe32BaseAddress = 0;\r
-    \r
+\r
     //\r
     // Find Te Image\r
     //\r
@@ -3755,7 +3755,7 @@ Returns:
     }\r
 \r
     CurSecHdrSize = GetSectionHeaderLength(CurrentPe32Section.CommonHeader);\r
-    \r
+\r
     //\r
     // Calculate the TE base address, the FFS file base plus the offset of the TE section less the size stripped off\r
     // by GenTEImage\r
@@ -3800,7 +3800,7 @@ Returns:
     //\r
     if (ImageContext.RelocationsStripped) {\r
       //\r
-      // Construct the original efi file name \r
+      // Construct the original efi file name\r
       //\r
       if (strlen (FileName) >= MAX_LONG_FILE_PATH) {\r
         Error (NULL, 0, 2000, "Invalid", "The file name %s is too long.", FileName);\r
@@ -3889,7 +3889,7 @@ Returns:
     }\r
     //\r
     // Reloacate TeImage\r
-    // \r
+    //\r
     ImageContext.DestinationAddress = NewPe32BaseAddress;\r
     Status                          = PeCoffLoaderRelocateImage (&ImageContext);\r
     if (EFI_ERROR (Status)) {\r
@@ -3897,7 +3897,7 @@ Returns:
       free ((VOID *) MemoryImagePointer);\r
       return Status;\r
     }\r
-    \r
+\r
     //\r
     // Copy the relocated image into raw image file.\r
     //\r
@@ -3905,19 +3905,19 @@ Returns:
     for (Index = 0; Index < TEImageHeader->NumberOfSections; Index ++, SectionHeader ++) {\r
       if (!ImageContext.IsTeImage) {\r
         CopyMem (\r
-          (UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData, \r
-          (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress), \r
+          (UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData,\r
+          (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),\r
           SectionHeader->SizeOfRawData\r
           );\r
       } else {\r
         CopyMem (\r
-          (UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData, \r
-          (VOID*) (UINTN) (ImageContext.ImageAddress + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->VirtualAddress), \r
+          (UINT8 *) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->PointerToRawData,\r
+          (VOID*) (UINTN) (ImageContext.ImageAddress + sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize + SectionHeader->VirtualAddress),\r
           SectionHeader->SizeOfRawData\r
           );\r
       }\r
     }\r
-    \r
+\r
     //\r
     // Free the allocated memory resource\r
     //\r
@@ -3927,7 +3927,7 @@ Returns:
       free (PeFileBuffer);\r
       PeFileBuffer = NULL;\r
     }\r
-    \r
+\r
     //\r
     // Update Image Base Address\r
     //\r
@@ -3958,14 +3958,14 @@ Returns:
     }\r
 \r
     WriteMapFile (\r
-      FvMapFile, \r
-      PdbPointer, \r
+      FvMapFile,\r
+      PdbPointer,\r
       FfsFile,\r
-      NewPe32BaseAddress, \r
+      NewPe32BaseAddress,\r
       &OrigImageContext\r
       );\r
   }\r
\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -4013,7 +4013,7 @@ Returns:
     // Get Pad file size.\r
     //\r
     FileLength = GetFfsFileLength(PadFile);\r
-    FileLength = (FileLength + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1); \r
+    FileLength = (FileLength + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1);\r
     //\r
     // FixPoint must be align on 0x1000 relative to FvImage Header\r
     //\r
@@ -4026,7 +4026,7 @@ Returns:
       FixPoint += 0x1000;\r
     }\r
     FixPoint -= 0x1000;\r
-    \r
+\r
     if ((UINTN) FixPoint < ((UINTN) PadFile + GetFfsHeaderLength(PadFile))) {\r
       //\r
       // No alignment FixPoint in this Pad File.\r
@@ -4034,7 +4034,7 @@ Returns:
       continue;\r
     }\r
 \r
-    if ((UINTN) FvImage->Eof - (UINTN)FixPoint <= 0x20000) {    \r
+    if ((UINTN) FvImage->Eof - (UINTN)FixPoint <= 0x20000) {\r
       //\r
       // Find the position to place ApResetVector\r
       //\r
@@ -4042,7 +4042,7 @@ Returns:
       return EFI_SUCCESS;\r
     }\r
   }\r
-  \r
+\r
   return EFI_NOT_FOUND;\r
 }\r
 \r
@@ -4121,7 +4121,7 @@ Returns:
         CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;\r
       }\r
     } else if (strstr (Value, "PersistAcrossReset") != NULL) {\r
-      CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET; \r
+      CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET;\r
       if (strstr (Value, "InitiateReset") != NULL) {\r
         CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;\r
       }\r
@@ -4174,12 +4174,12 @@ Returns:
       // Add the file\r
       //\r
       strcpy (CapInfo->CapFiles[Index], Value);\r
-      DebugMsg (NULL, 0, 9, "Capsule component file", "the %uth file name is %s", (unsigned) Index, CapInfo->CapFiles[Index]); \r
+      DebugMsg (NULL, 0, 9, "Capsule component file", "the %uth file name is %s", (unsigned) Index, CapInfo->CapFiles[Index]);\r
     } else {\r
       break;\r
     }\r
   }\r
-  \r
+\r
   if (Index == 0) {\r
     Warning (NULL, 0, 0, "Capsule components are not specified.", NULL);\r
   }\r
@@ -4222,7 +4222,7 @@ Returns:
   UINT32                Index;\r
   FILE                  *fpin, *fpout;\r
   EFI_STATUS            Status;\r
-  \r
+\r
   if (InfFileImage != NULL) {\r
     //\r
     // Initialize file structures\r
@@ -4230,7 +4230,7 @@ Returns:
     InfMemoryFile.FileImage           = InfFileImage;\r
     InfMemoryFile.CurrentFilePointer  = InfFileImage;\r
     InfMemoryFile.Eof                 = InfFileImage + InfFileSize;\r
-  \r
+\r
     //\r
     // Parse the Cap inf file for header information\r
     //\r
@@ -4239,7 +4239,7 @@ Returns:
       return Status;\r
     }\r
   }\r
-  \r
+\r
   if (mCapDataInfo.HeaderSize == 0) {\r
     //\r
     // make header size align 16 bytes.\r
@@ -4252,16 +4252,16 @@ Returns:
     Error (NULL, 0, 2000, "Invalid parameter", "The specified HeaderSize cannot be less than the size of EFI_CAPSULE_HEADER.");\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   if (CapFileName == NULL && mCapDataInfo.CapName[0] != '\0') {\r
     CapFileName = mCapDataInfo.CapName;\r
   }\r
-  \r
+\r
   if (CapFileName == NULL) {\r
     Error (NULL, 0, 2001, "Missing required argument", "Output Capsule file name");\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   //\r
   // Set Default Capsule Guid value\r
   //\r
@@ -4299,7 +4299,7 @@ Returns:
   // Initialize the capsule header to zero\r
   //\r
   memset (CapBuffer, 0, mCapDataInfo.HeaderSize);\r
-  \r
+\r
   //\r
   // create capsule header and get capsule body\r
   //\r
@@ -4325,7 +4325,7 @@ Returns:
     Index ++;\r
     CapSize += FileSize;\r
   }\r
-  \r
+\r
   //\r
   // write capsule data into the output file\r
   //\r
@@ -4339,7 +4339,7 @@ Returns:
   fwrite (CapBuffer, 1, CapSize, fpout);\r
   fclose (fpout);\r
   free (CapBuffer);\r
-  \r
+\r
   VerboseMsg ("The size of the generated capsule image is %u bytes", (unsigned) CapSize);\r
 \r
   return EFI_SUCCESS;\r