Browse Source

BaseTools: Clean up source files

1. Do not use tab characters
2. No trailing white space in one line
3. All files must end with CRLF

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Liming Gao 6 years ago
parent
commit
f7496d7173
100 changed files with 2940 additions and 2940 deletions
  1. 91 91
      BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
  2. 9 9
      BaseTools/BuildNotes.txt
  3. 1 1
      BaseTools/Conf/ReadMe.txt
  4. 3 3
      BaseTools/ReadMe.txt
  5. 6 6
      BaseTools/Scripts/MemoryProfileSymbolGen.py
  6. 2 2
      BaseTools/Source/BinaryFiles.txt
  7. 25 25
      BaseTools/Source/C/BootSectImage/bootsectimage.c
  8. 8 8
      BaseTools/Source/C/BootSectImage/fat.h
  9. 8 8
      BaseTools/Source/C/BootSectImage/mbr.h
  10. 58 58
      BaseTools/Source/C/Common/BasePeCoff.c
  11. 4 4
      BaseTools/Source/C/Common/BinderFuncs.h
  12. 30 30
      BaseTools/Source/C/Common/CommonLib.c
  13. 3 3
      BaseTools/Source/C/Common/CommonLib.h
  14. 10 10
      BaseTools/Source/C/Common/Compress.h
  15. 8 8
      BaseTools/Source/C/Common/Crc32.c
  16. 8 8
      BaseTools/Source/C/Common/Crc32.h
  17. 2 2
      BaseTools/Source/C/Common/Decompress.c
  18. 8 8
      BaseTools/Source/C/Common/Decompress.h
  19. 214 214
      BaseTools/Source/C/Common/EfiCompress.c
  20. 9 9
      BaseTools/Source/C/Common/EfiUtilityMsgs.h
  21. 3 3
      BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
  22. 19 19
      BaseTools/Source/C/Common/FvLib.c
  23. 10 10
      BaseTools/Source/C/Common/FvLib.h
  24. 8 8
      BaseTools/Source/C/Common/MemoryFile.c
  25. 8 8
      BaseTools/Source/C/Common/MemoryFile.h
  26. 8 8
      BaseTools/Source/C/Common/MyAlloc.c
  27. 8 8
      BaseTools/Source/C/Common/MyAlloc.h
  28. 10 10
      BaseTools/Source/C/Common/OsPath.c
  29. 9 9
      BaseTools/Source/C/Common/OsPath.h
  30. 10 10
      BaseTools/Source/C/Common/ParseGuidedSectionTools.c
  31. 8 8
      BaseTools/Source/C/Common/ParseGuidedSectionTools.h
  32. 27 27
      BaseTools/Source/C/Common/ParseInf.c
  33. 20 20
      BaseTools/Source/C/Common/ParseInf.h
  34. 29 29
      BaseTools/Source/C/Common/PeCoffLib.h
  35. 64 64
      BaseTools/Source/C/Common/PeCoffLoaderEx.c
  36. 23 23
      BaseTools/Source/C/Common/SimpleFileParsing.c
  37. 8 8
      BaseTools/Source/C/Common/SimpleFileParsing.h
  38. 9 9
      BaseTools/Source/C/Common/StringFuncs.c
  39. 8 8
      BaseTools/Source/C/Common/StringFuncs.h
  40. 48 48
      BaseTools/Source/C/Common/TianoCompress.c
  41. 26 26
      BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
  42. 38 38
      BaseTools/Source/C/EfiRom/EfiRom.c
  43. 11 11
      BaseTools/Source/C/EfiRom/EfiRom.h
  44. 8 8
      BaseTools/Source/C/GenBootSector/FatFormat.h
  45. 71 71
      BaseTools/Source/C/GenBootSector/GenBootSector.c
  46. 8 8
      BaseTools/Source/C/GenBootSector/GetDrvNumOffset.c
  47. 31 31
      BaseTools/Source/C/GenCrc32/GenCrc32.c
  48. 64 64
      BaseTools/Source/C/GenFfs/GenFfs.c
  49. 70 70
      BaseTools/Source/C/GenFv/GenFv.c
  50. 185 185
      BaseTools/Source/C/GenFv/GenFvInternalLib.c
  51. 45 45
      BaseTools/Source/C/GenFv/GenFvInternalLib.h
  52. 21 21
      BaseTools/Source/C/GenFw/Elf32Convert.c
  53. 4 4
      BaseTools/Source/C/GenFw/Elf32Convert.h
  54. 10 10
      BaseTools/Source/C/GenFw/Elf64Convert.c
  55. 4 4
      BaseTools/Source/C/GenFw/Elf64Convert.h
  56. 7 7
      BaseTools/Source/C/GenFw/ElfConvert.c
  57. 5 5
      BaseTools/Source/C/GenFw/ElfConvert.h
  58. 25 25
      BaseTools/Source/C/GenFw/GenFw.c
  59. 4 4
      BaseTools/Source/C/GenFw/GenFw.h
  60. 106 106
      BaseTools/Source/C/GenFw/elf32.h
  61. 108 108
      BaseTools/Source/C/GenFw/elf64.h
  62. 562 562
      BaseTools/Source/C/GenFw/elf_common.h
  63. 30 30
      BaseTools/Source/C/GenPage/GenPage.c
  64. 15 15
      BaseTools/Source/C/GenPage/VirtualMemory.h
  65. 79 79
      BaseTools/Source/C/GenSec/GenSec.c
  66. 13 13
      BaseTools/Source/C/GenVtf/GenVtf.c
  67. 21 21
      BaseTools/Source/C/GenVtf/GenVtf.h
  68. 8 8
      BaseTools/Source/C/GnuGenBootSector/FatFormat.h
  69. 62 62
      BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c
  70. 8 8
      BaseTools/Source/C/Include/AArch64/ProcessorBind.h
  71. 20 20
      BaseTools/Source/C/Include/Arm/ProcessorBind.h
  72. 15 15
      BaseTools/Source/C/Include/Common/BaseTypes.h
  73. 2 2
      BaseTools/Source/C/Include/Common/BuildVersion.h
  74. 31 31
      BaseTools/Source/C/Include/Common/PiFirmwareFile.h
  75. 7 7
      BaseTools/Source/C/Include/Common/PiFirmwareVolume.h
  76. 35 35
      BaseTools/Source/C/Include/Common/UefiBaseTypes.h
  77. 37 37
      BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
  78. 22 22
      BaseTools/Source/C/Include/Common/UefiMultiPhase.h
  79. 2 2
      BaseTools/Source/C/Include/Common/VariableFormat.h
  80. 3 3
      BaseTools/Source/C/Include/Guid/PcAnsi.h
  81. 2 2
      BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h
  82. 10 10
      BaseTools/Source/C/Include/Ia32/ProcessorBind.h
  83. 2 2
      BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h
  84. 22 22
      BaseTools/Source/C/Include/IndustryStandard/PeImage.h
  85. 5 5
      BaseTools/Source/C/Include/IndustryStandard/pci22.h
  86. 17 17
      BaseTools/Source/C/Include/Protocol/GraphicsOutput.h
  87. 7 7
      BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h
  88. 2 2
      BaseTools/Source/C/Include/Protocol/HiiFramework.h
  89. 18 18
      BaseTools/Source/C/Include/Protocol/UgaDraw.h
  90. 16 16
      BaseTools/Source/C/Include/X64/ProcessorBind.h
  91. 1 1
      BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt
  92. 10 10
      BaseTools/Source/C/LzmaCompress/LzmaCompress.c
  93. 2 2
      BaseTools/Source/C/LzmaCompress/LzmaF86Compress.bat
  94. 2 2
      BaseTools/Source/C/Makefiles/NmakeSubdirs.bat
  95. 3 3
      BaseTools/Source/C/PyEfiCompressor/EfiCompressor.c
  96. 5 5
      BaseTools/Source/C/PyUtility/PyUtility.c
  97. 100 100
      BaseTools/Source/C/TianoCompress/TianoCompress.c
  98. 11 11
      BaseTools/Source/C/TianoCompress/TianoCompress.h
  99. 9 9
      BaseTools/Source/C/VfrCompile/EfiVfr.h
  100. 29 29
      BaseTools/Source/C/VfrCompile/VfrCompiler.cpp

+ 91 - 91
BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py

@@ -1,94 +1,94 @@
-#!/usr/bin/env python
-#
-# 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.
-#
-
-#
-# ARMCC tools do not support cygwin paths. Ths script converts cygwin paths to DOS paths
-# in any arguments. 
-#
-# armcc_wrapper.py ToolToExec [command line to convert]
-#
-# anthing with the / will be converted via cygpath cygwin call or manually. 
-# -I/cygpath/c/example is a special case as you can not pass -I to cygpath
-#
-# ExceptionList if a tool takes an argument with a / add it to the exception list
-#
+#!/usr/bin/env python
+#
+# 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.
+#
+
+#
+# ARMCC tools do not support cygwin paths. Ths script converts cygwin paths to DOS paths
+# in any arguments.
+#
+# armcc_wrapper.py ToolToExec [command line to convert]
+#
+# anthing with the / will be converted via cygpath cygwin call or manually.
+# -I/cygpath/c/example is a special case as you can not pass -I to cygpath
+#
+# ExceptionList if a tool takes an argument with a / add it to the exception list
+#
 from __future__ import print_function
-import sys
-import os
-import subprocess
-import pipes
-
-#
-# Convert using cygpath command line tool
-# Currently not used, but just in case we need it in the future
-#
-def ConvertCygPathToDosViacygpath(CygPath):
-  p = subprocess.Popen("cygpath -m " + pipes.quote(CygPath), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
-  return p.stdout.read().strip()
-
-#
-#
-#
-def ConvertCygPathToDos(CygPath):
-  if CygPath.find("/cygdrive/") == 0:
-    # convert /cygdrive/c/Xyz to c:/Xyz
-    DosPath = CygPath[10] + ':' + CygPath[11:]
-  else:
-    DosPath = CygPath
-  
-  # pipes.quote will add the extra \\ for us.
+import sys
+import os
+import subprocess
+import pipes
+
+#
+# Convert using cygpath command line tool
+# Currently not used, but just in case we need it in the future
+#
+def ConvertCygPathToDosViacygpath(CygPath):
+  p = subprocess.Popen("cygpath -m " + pipes.quote(CygPath), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
+  return p.stdout.read().strip()
+
+#
+#
+#
+def ConvertCygPathToDos(CygPath):
+  if CygPath.find("/cygdrive/") == 0:
+    # convert /cygdrive/c/Xyz to c:/Xyz
+    DosPath = CygPath[10] + ':' + CygPath[11:]
+  else:
+    DosPath = CygPath
+
+  # pipes.quote will add the extra \\ for us.
   return DosPath.replace('/', '\\')
-
-
-# we receive our options as a list, but we will be passing them to the shell as a line
-# this means we have to requote things as they will get one round of unquoting.
-# we can't set "shell=False" because we are running commands from the PATH and
-# if you don't use the shell you don't get a PATH search.
-def main(argv):
-
-  # use 1st argument as name of tool to call
-  Command = pipes.quote(sys.argv[1]);
-  
-  ExceptionList = ["/interwork"]
-  
-  for arg in argv:
-    if arg.find('/') == -1:
-      # if we don't need to convert just add to the command line
-      Command = Command + ' ' + pipes.quote(arg)
-    elif arg in ExceptionList:
-      # if it is in the list, then don't do a cygpath
-      # assembler stuff after --apcs has the /.
-      Command = Command + ' ' + pipes.quote(arg)
-    else:
-      if ((arg[0] == '-') and (arg[1] == 'I' or arg[1] == 'i')):
-        CygPath = arg[0] + arg[1] + ConvertCygPathToDos(arg[2:])
-      else:
-        CygPath = ConvertCygPathToDos(arg)
-
-      Command = Command + ' ' + pipes.quote(CygPath)
-    
-  # call the real tool with the converted paths
-  return subprocess.call(Command, shell=True)
-
- 
-if __name__ == "__main__":
-  try:
-     ret = main(sys.argv[2:])
-
-  except:
+
+
+# we receive our options as a list, but we will be passing them to the shell as a line
+# this means we have to requote things as they will get one round of unquoting.
+# we can't set "shell=False" because we are running commands from the PATH and
+# if you don't use the shell you don't get a PATH search.
+def main(argv):
+
+  # use 1st argument as name of tool to call
+  Command = pipes.quote(sys.argv[1]);
+
+  ExceptionList = ["/interwork"]
+
+  for arg in argv:
+    if arg.find('/') == -1:
+      # if we don't need to convert just add to the command line
+      Command = Command + ' ' + pipes.quote(arg)
+    elif arg in ExceptionList:
+      # if it is in the list, then don't do a cygpath
+      # assembler stuff after --apcs has the /.
+      Command = Command + ' ' + pipes.quote(arg)
+    else:
+      if ((arg[0] == '-') and (arg[1] == 'I' or arg[1] == 'i')):
+        CygPath = arg[0] + arg[1] + ConvertCygPathToDos(arg[2:])
+      else:
+        CygPath = ConvertCygPathToDos(arg)
+
+      Command = Command + ' ' + pipes.quote(CygPath)
+
+  # call the real tool with the converted paths
+  return subprocess.call(Command, shell=True)
+
+
+if __name__ == "__main__":
+  try:
+     ret = main(sys.argv[2:])
+
+  except:
     print("exiting: exception from " + sys.argv[0])
-    ret = 2
-
-  sys.exit(ret)
-
+    ret = 2
+
+  sys.exit(ret)
+

+ 9 - 9
BaseTools/BuildNotes.txt

@@ -6,7 +6,7 @@ Root Package 1.00
 Intel is a trademark or registered trademark of Intel Corporation or its
 subsidiaries in the United States and other countries.
 * Other names and brands may be claimed as the property of others.
-Copyright (c) 2007, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
 
 -------------------------------------------------------------------------------
 Quick Start
@@ -33,28 +33,28 @@ Tools in Python
 ---------------
 * Convert Python source to exe file
 
-  The tools written in Python can be converted into executable program which can 
+  The tools written in Python can be converted into executable program which can
   be executed without installing a Python interpreter. (Generally it is easier
   to run the scripts from their source on operating systems other than Windows.)
 
   For Windows and Linux, the conversion tool package is called cx_Freeze, its
   home page is:
 
-		http://sourceforge.net/projects/cx-freeze/
+    http://sourceforge.net/projects/cx-freeze/
 
-	If you have installed cx_Freeze at c:\cx_Freeze-3.0.3. Use following command
+  If you have installed cx_Freeze at c:\cx_Freeze-3.0.3. Use following command
   lines to convert MyBuild.py to MyBuild.exe (note this is an example, there is
   no MyBuild Python project in the BaseTools\Python tree.
 
     set PYTHONPATH=<BaseToolsDirPath>\Source\Python
-  	c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=.\mybuild MyBuild.py
+    c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=.\mybuild MyBuild.py
 
-	The generated .exe (and .dll) files are put in "mybuild" subdirectory.
+  The generated .exe (and .dll) files are put in "mybuild" subdirectory.
 
-  The following is a real example with the BuildTools/trunk/BaseTools project 
+  The following is a real example with the BuildTools/trunk/BaseTools project
   installed in: C:\Work\BaseTools
 
-  
+
   C:\Work\BaseTools\Source\Python> set PYTHONPATH=C:\Work\BaseTools\Source\Python
   C:\Work\BaseTools\Source\Python> c:\cx_Freeze-3.0.3\FreezePython.exe --include-modules=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_16_le,encodings.utf_8 --install-dir=C:\Work\BaseTools\Bin\Win32 build\build.py
 
@@ -70,7 +70,7 @@ Windows:
 
   The tools written in Python can be executed directly from its source directory
 as long as the Python interpreter (Python 2.5) has been installed. Before the execution,
-please make sure the environment variable PYTHONPATH is set to 
+please make sure the environment variable PYTHONPATH is set to
 
         <buildtools_project>/BaseTools/Source/Python
 

+ 1 - 1
BaseTools/Conf/ReadMe.txt

@@ -6,4 +6,4 @@ These files may be updated frequently.
 
 The XMLSchema directory contains the EDK II Packaging XML definitions.  The
 schema may change in the future.  It differs somewhat from the early versions
-of the XML Schema.
+of the XML Schema.

+ 3 - 3
BaseTools/ReadMe.txt

@@ -1,6 +1,6 @@
 This directory contains the next generation of EDK II build tools and template files.
 Templates are located in the Conf directory, while the tools executables for
-Microsoft Windows 32-bit Operating Systems are located in the Bin\Win32 directory, other 
+Microsoft Windows 32-bit Operating Systems are located in the Bin\Win32 directory, other
 directory contatins tools source.
 
 1. Build step to generate the binary tools.
@@ -38,8 +38,8 @@ packages to build all the C BaseTools:
   sudo apt-get install build-essential uuid-dev
 
 === Python sqlite3 module ===
-On Windows, the cx_freeze will not copy the sqlite3.dll to the frozen 
-binary directory (the same directory as build.exe and GenFds.exe). 
+On Windows, the cx_freeze will not copy the sqlite3.dll to the frozen
+binary directory (the same directory as build.exe and GenFds.exe).
 Please copy it manually from <PythonHome>\DLLs.
 
 The Python distributed with most recent Linux will have sqlite3 module

+ 6 - 6
BaseTools/Scripts/MemoryProfileSymbolGen.py

@@ -3,7 +3,7 @@
 #
 # This tool depends on DIA2Dump.exe (VS) or nm (gcc) to parse debug entry.
 #
-# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2016 - 2018, 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 that accompanies this distribution.
 # The full text of the license may be found at
@@ -21,7 +21,7 @@ import sys
 from optparse import OptionParser
 
 versionNumber = "1.1"
-__copyright__ = "Copyright (c) 2016, Intel Corporation. All rights reserved."
+__copyright__ = "Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved."
 
 class Symbols:
     def __init__(self):
@@ -72,7 +72,7 @@ class Symbols:
         reportLines = linefile.readlines()
         linefile.close()
 
-        # 000113ca T AllocatePool	c:\home\edk-ii\MdePkg\Library\UefiMemoryAllocationLib\MemoryAllocationLib.c:399
+        # 000113ca T AllocatePool  c:\home\edk-ii\MdePkg\Library\UefiMemoryAllocationLib\MemoryAllocationLib.c:399
         patchLineFileMatchString = "([0-9a-fA-F]*)\s+[T|D|t|d]\s+(\w+)\s*((?:[a-zA-Z]:)?[\w+\-./_a-zA-Z0-9\\\\]*):?([0-9]*)"
 
         for reportLine in reportLines:
@@ -127,9 +127,9 @@ class Symbols:
         linefile.close()
 
         #   ** GetDebugPrintErrorLevel
-        #	line 32 at [0000C790][0001:0000B790], len = 0x3	c:\home\edk-ii\mdepkg\library\basedebugprinterrorlevellib\basedebugprinterrorlevellib.c (MD5: 687C0AE564079D35D56ED5D84A6164CC)
-        #	line 36 at [0000C793][0001:0000B793], len = 0x5
-        #	line 37 at [0000C798][0001:0000B798], len = 0x2
+        #  line 32 at [0000C790][0001:0000B790], len = 0x3  c:\home\edk-ii\mdepkg\library\basedebugprinterrorlevellib\basedebugprinterrorlevellib.c (MD5: 687C0AE564079D35D56ED5D84A6164CC)
+        #  line 36 at [0000C793][0001:0000B793], len = 0x5
+        #  line 37 at [0000C798][0001:0000B798], len = 0x2
 
         patchLineFileMatchString = "\s+line ([0-9]+) at \[([0-9a-fA-F]{8})\]\[[0-9a-fA-F]{4}\:[0-9a-fA-F]{8}\], len = 0x[0-9a-fA-F]+\s*([\w+\-\:./_a-zA-Z0-9\\\\]*)\s*"
         patchLineFileMatchStringFunc = "\*\*\s+(\w+)\s*"

+ 2 - 2
BaseTools/Source/BinaryFiles.txt

@@ -8,10 +8,10 @@
 # If a tool requires additional files, the developer must list those files in the
 # [ExtraFiles.Win32] section.
 # The [CxFreeze.Win32] section is maintained by the owner of the Build Server who
-# must ensure that files that are required by the cx_freeze frozen binaries are 
+# must ensure that files that are required by the cx_freeze frozen binaries are
 # present in the Bin\Win32 directory.
 #
-# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2014 - 2018, 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.

+ 25 - 25
BaseTools/Source/C/BootSectImage/bootsectimage.c

@@ -4,14 +4,14 @@ Abstract:
   Patch the BPB information in boot sector image file.
   Patch the MBR code in MBR image file.
 
-Copyright (c) 2006 - 2016, 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.             
+Copyright (c) 2006 - 2018, 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.
 
 **/
 
@@ -98,7 +98,7 @@ Returns:
 }
 
 int WriteToFile (
-  void *BootSector, 
+  void *BootSector,
   char *FileName
   )
 /*++
@@ -136,7 +136,7 @@ Return:
 }
 
 int ReadFromFile (
-  void *BootSector, 
+  void *BootSector,
   char *FileName
   )
 /*++
@@ -446,17 +446,17 @@ Return:
         FatBpb->Fat32.BS_BootSig, FAT_BS_BOOTSIG);
     return FatTypeUnknown;
   }
-  
+
   if ((FatType == FatTypeFat12) || (FatType == FatTypeFat16)) {
     memcpy (FilSysType, FatBpb->Fat12_16.BS_FilSysType, 8);
     FilSysType[8] = 0;
-    if ((FatType == FatTypeFat12) && 
+    if ((FatType == FatTypeFat12) &&
         (strcmp (FilSysType, FAT12_FILSYSTYPE) != 0) &&
         (strcmp (FilSysType, FAT_FILSYSTYPE) != 0)) {
       DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT12 - BS_FilSysType - %s, expected: %s, or %s\n",
           FilSysType, FAT12_FILSYSTYPE, FAT_FILSYSTYPE);
     }
-    if ((FatType == FatTypeFat16) && 
+    if ((FatType == FatTypeFat16) &&
         (strcmp (FilSysType, FAT16_FILSYSTYPE) != 0) &&
         (strcmp (FilSysType, FAT_FILSYSTYPE) != 0)) {
       DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT16 - BS_FilSysType - %s, expected: %s, or %s\n",
@@ -486,11 +486,11 @@ ParseBootSector (
 {
   FAT_BPB_STRUCT  FatBpb;
   FAT_TYPE        FatType;
-  
+
   if (ReadFromFile ((void *)&FatBpb, FileName) == 0) {
     return ;
   }
-  
+
   FatType = GetFatType (&FatBpb);
   if (FatType <= FatTypeUnknown || FatType >= FatTypeMax) {
     printf ("ERROR: E3002: Unknown FAT Type!\n");
@@ -608,7 +608,7 @@ ParseBootSector (
   printf ("  1FE    Signature                    %04x\n", FatBpb.Fat12_16.Signature);
   printf ("\n");
 
-  
+
   return ;
 }
 
@@ -634,14 +634,14 @@ Arguments:
   FAT_TYPE        SourceFatType;
   CHAR8           VolLab[11];
   CHAR8           FilSysType[8];
-  
+
   if (ReadFromFile ((void *)&DestFatBpb, DestFileName) == 0) {
     return ;
   }
   if (ReadFromFile ((void *)&SourceFatBpb, SourceFileName) == 0) {
     return ;
   }
-  
+
   DestFatType = GetFatType (&DestFatBpb);
   SourceFatType = GetFatType (&SourceFatBpb);
 
@@ -650,10 +650,10 @@ Arguments:
     // FAT type mismatch
     //
     if (ForcePatch) {
-      DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3004: FAT type mismatch: Source - %s, Dest - %s", 
+      DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3004: FAT type mismatch: Source - %s, Dest - %s",
         FatTypeToString(SourceFatType), FatTypeToString(DestFatType));
     } else {
-      DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3004: FAT type mismatch: Source - %s, Dest - %s", 
+      DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3004: FAT type mismatch: Source - %s, Dest - %s",
         FatTypeToString(SourceFatType), FatTypeToString(DestFatType));
       return ;
     }
@@ -707,7 +707,7 @@ Arguments:
     memcpy (DestFatBpb.Fat32.BS_VolLab, VolLab, sizeof(VolLab));
     memcpy (DestFatBpb.Fat32.BS_FilSysType, FilSysType, sizeof(FilSysType));
   }
-  
+
   //
   // Set Signature of DestFatBpb to 55AA
   //
@@ -731,11 +731,11 @@ ParseMbr (
   )
 {
   MASTER_BOOT_RECORD  Mbr;
-  
+
   if (ReadFromFile ((void *)&Mbr, FileName) == 0) {
     return ;
   }
- 
+
   printf ("\nMaster Boot Record:\n");
   printf ("\n");
   printf ("  Offset Title                        Value\n");
@@ -805,14 +805,14 @@ PatchMbr (
 {
   MASTER_BOOT_RECORD  DestMbr;
   MASTER_BOOT_RECORD  SourceMbr;
-  
+
   if (ReadFromFile ((void *)&DestMbr, DestFileName) == 0) {
     return ;
   }
   if (ReadFromFile ((void *)&SourceMbr, SourceFileName) == 0) {
     return ;
   }
-  
+
   if (SourceMbr.Signature != MBR_SIGNATURE) {
     printf ("ERROR: E3000: Invalid MBR!\n");
     return;

+ 8 - 8
BaseTools/Source/C/BootSectImage/fat.h

@@ -2,14 +2,14 @@
 
   Fat file system structure and definition.
 
-Copyright (c) 2006 - 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.             
+Copyright (c) 2006 - 2018, 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.
 
 **/
 

+ 8 - 8
BaseTools/Source/C/BootSectImage/mbr.h

@@ -2,14 +2,14 @@
 
   MBR Partition Entry and Table structure defintions.
 
-Copyright (c) 2006 - 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.             
+Copyright (c) 2006 - 2018, 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.
 
 **/
 

+ 58 - 58
BaseTools/Source/C/Common/BasePeCoff.c

@@ -2,15 +2,15 @@
 
   Functions to get info and load PE/COFF image.
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 Portions Copyright (c) 2011 - 2013, ARM Ltd. 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.             
+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.
 
 **/
 
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "PeCoffLib.h"
 
 typedef union {
-  VOID                         *Header; 
+  VOID                         *Header;
   EFI_IMAGE_OPTIONAL_HEADER32  *Optional32;
   EFI_IMAGE_OPTIONAL_HEADER64  *Optional64;
 } EFI_IMAGE_OPTIONAL_HEADER_POINTER;
@@ -90,12 +90,12 @@ Arguments:
   ImageContext  - The context of the image being loaded
 
   PeHdr         - The buffer in which to return the PE header
-  
+
   TeHdr         - The buffer in which to return the TE header
 
 Returns:
 
-  RETURN_SUCCESS if the PE or TE Header is read, 
+  RETURN_SUCCESS if the PE or TE Header is read,
   Otherwise, the error status from reading the PE/COFF or TE image using the ImageRead function.
 
 --*/
@@ -135,7 +135,7 @@ Returns:
     //
     // Check the PE/COFF Header Signature. If not, then try to get a TE header
     //
-    *TeHdr = (EFI_TE_IMAGE_HEADER *)*PeHdr; 
+    *TeHdr = (EFI_TE_IMAGE_HEADER *)*PeHdr;
     if ((*TeHdr)->Signature != EFI_TE_IMAGE_HEADER_SIGNATURE) {
       return RETURN_UNSUPPORTED;
     }
@@ -163,7 +163,7 @@ Arguments:
   ImageContext  - The context of the image being loaded
 
   PeHdr         - The buffer in which to return the PE header
-  
+
   TeHdr         - The buffer in which to return the TE header
 
 Returns:
@@ -174,7 +174,7 @@ Returns:
 --*/
 {
   //
-  // See if the machine type is supported. 
+  // See if the machine type is supported.
   // We support a native machine type (IA-32/Itanium-based)
   //
   if (ImageContext->IsTeImage == FALSE) {
@@ -182,7 +182,7 @@ Returns:
   } else {
     ImageContext->Machine = TeHdr->Machine;
   }
-  
+
   if (ImageContext->Machine != EFI_IMAGE_MACHINE_IA32 && \
       ImageContext->Machine != EFI_IMAGE_MACHINE_IA64 && \
       ImageContext->Machine != EFI_IMAGE_MACHINE_X64  && \
@@ -191,7 +191,7 @@ Returns:
       ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64) {
     if (ImageContext->Machine == IMAGE_FILE_MACHINE_ARM) {
       //
-      // There are two types of ARM images. Pure ARM and ARM/Thumb. 
+      // There are two types of ARM images. Pure ARM and ARM/Thumb.
       // If we see the ARM say it is the ARM/Thumb so there is only
       // a single machine type we need to check for ARM.
       //
@@ -204,8 +204,8 @@ Returns:
 
     } else {
       //
-      // unsupported PeImage machine type 
-      // 
+      // unsupported PeImage machine type
+      //
       return RETURN_UNSUPPORTED;
     }
   }
@@ -225,8 +225,8 @@ Returns:
       ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER && \
       ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER) {
     //
-    // upsupported PeImage subsystem type 
-    // 
+    // upsupported PeImage subsystem type
+    //
     return RETURN_UNSUPPORTED;
   }
 
@@ -348,7 +348,7 @@ Returns:
       ImageContext->ImageSize         = (UINT64) OptionHeader.Optional32->SizeOfImage;
       ImageContext->SectionAlignment  = OptionHeader.Optional32->SectionAlignment;
       ImageContext->SizeOfHeaders     = OptionHeader.Optional32->SizeOfHeaders;
-  
+
       //
       // Modify ImageSize to contain .PDB file name if required and initialize
       // PdbRVA field...
@@ -361,7 +361,7 @@ Returns:
       ImageContext->ImageSize         = (UINT64) OptionHeader.Optional64->SizeOfImage;
       ImageContext->SectionAlignment  = OptionHeader.Optional64->SectionAlignment;
       ImageContext->SizeOfHeaders     = OptionHeader.Optional64->SizeOfHeaders;
-  
+
       //
       // Modify ImageSize to contain .PDB file name if required and initialize
       // PdbRVA field...
@@ -371,7 +371,7 @@ Returns:
         DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
       }
     }
-    
+
     if (DebugDirectoryEntryRva != 0) {
       //
       // Determine the file offset of the debug directory...  This means we walk
@@ -382,8 +382,8 @@ Returns:
 
       SectionHeaderOffset = (UINTN)(
                                ImageContext->PeCoffHeaderOffset +
-                               sizeof (UINT32) + 
-                               sizeof (EFI_IMAGE_FILE_HEADER) + 
+                               sizeof (UINT32) +
+                               sizeof (EFI_IMAGE_FILE_HEADER) +
                                PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
                                );
 
@@ -413,12 +413,12 @@ Returns:
         SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
       }
 
-      if (DebugDirectoryEntryFileOffset != 0) {    
+      if (DebugDirectoryEntryFileOffset != 0) {
         for (Index = 0; Index < DebugDirectoryEntry->Size; Index += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)) {
           //
           // Read next debug directory entry
           //
-          Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);    
+          Size = sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY);
           Status = ImageContext->ImageRead (
                                    ImageContext->Handle,
                                    DebugDirectoryEntryFileOffset + Index,
@@ -489,8 +489,8 @@ Returns:
 
       //
       // In Te image header there is not a field to describe the ImageSize.
-      // Actually, the ImageSize equals the RVA plus the VirtualSize of 
-      // the last section mapped into memory (Must be rounded up to 
+      // Actually, the ImageSize equals the RVA plus the VirtualSize of
+      // the last section mapped into memory (Must be rounded up to
       // a mulitple of Section Alignment). Per the PE/COFF specification, the
       // section headers in the Section Table must appear in order of the RVA
       // values for the corresponding sections. So the ImageSize can be determined
@@ -627,9 +627,9 @@ Returns:
   // Use DestinationAddress field of ImageContext as the relocation address even if it is 0.
   //
   BaseAddress = ImageContext->DestinationAddress;
-  
+
   if (!(ImageContext->IsTeImage)) {
-    PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN)ImageContext->ImageAddress + 
+    PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN)ImageContext->ImageAddress +
                                             ImageContext->PeCoffHeaderOffset);
     OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
     if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
@@ -708,20 +708,20 @@ Returns:
     Adjust            = (UINT64) (BaseAddress - TeHdr->ImageBase);
     TeHdr->ImageBase  = (UINT64) (BaseAddress);
     MachineType = TeHdr->Machine;
-    
+
     //
     // Find the relocation block
     //
     RelocDir = &TeHdr->DataDirectory[0];
     RelocBase = (EFI_IMAGE_BASE_RELOCATION *)(UINTN)(
-                                    ImageContext->ImageAddress + 
+                                    ImageContext->ImageAddress +
                                     RelocDir->VirtualAddress +
-                                    sizeof(EFI_TE_IMAGE_HEADER) - 
+                                    sizeof(EFI_TE_IMAGE_HEADER) -
                                     TeHdr->StrippedSize
                                     );
     RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) ((UINTN) RelocBase + (UINTN) RelocDir->Size - 1);
   }
-  
+
   //
   // Run the relocation information and apply the fixups
   //
@@ -739,13 +739,13 @@ Returns:
     } else {
       FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +
                     RelocBase->VirtualAddress +
-                    sizeof(EFI_TE_IMAGE_HEADER) - 
+                    sizeof(EFI_TE_IMAGE_HEADER) -
                     TeHdr->StrippedSize
                     );
     }
 
     if ((CHAR8 *) RelocEnd < (CHAR8 *) ((UINTN) ImageContext->ImageAddress) ||
-        (CHAR8 *) RelocEnd > (CHAR8 *)((UINTN)ImageContext->ImageAddress + 
+        (CHAR8 *) RelocEnd > (CHAR8 *)((UINTN)ImageContext->ImageAddress +
           (UINTN)ImageContext->ImageSize)) {
       ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
       return RETURN_LOAD_ERROR;
@@ -961,12 +961,12 @@ Returns:
       ((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
 
     OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
-    
+
     FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
                       (UINTN)ImageContext->ImageAddress +
                       ImageContext->PeCoffHeaderOffset +
-                      sizeof(UINT32) + 
-                      sizeof(EFI_IMAGE_FILE_HEADER) + 
+                      sizeof(UINT32) +
+                      sizeof(EFI_IMAGE_FILE_HEADER) +
                       PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
       );
     NumberOfSections = (UINTN) (PeHdr->Pe32.FileHeader.NumberOfSections);
@@ -1016,7 +1016,7 @@ Returns:
       return RETURN_LOAD_ERROR;
     }
 
-	
+
     if (ImageContext->IsTeImage) {
       Base  = (CHAR8 *) ((UINTN) Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
       End   = (CHAR8 *) ((UINTN) End + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize);
@@ -1286,19 +1286,19 @@ PeCoffLoaderGetPdbPointer (
     if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) {
       DirectoryEntry  = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];
       TEImageAdjust   = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
-      
+
       //
       // Get the DebugEntry offset in the raw data image.
       //
       SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);
       Index = Hdr.Te->NumberOfSections;
       for (Index1 = 0; Index1 < Index; Index1 ++) {
-        if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && 
+        if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
            (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
           DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +
-                        DirectoryEntry->VirtualAddress - 
-                        SectionHeader [Index1].VirtualAddress + 
-                        SectionHeader [Index1].PointerToRawData + 
+                        DirectoryEntry->VirtualAddress -
+                        SectionHeader [Index1].VirtualAddress +
+                        SectionHeader [Index1].PointerToRawData +
                         TEImageAdjust);
           break;
         }
@@ -1334,8 +1334,8 @@ PeCoffLoaderGetPdbPointer (
 
     SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
                        (UINT8 *) Hdr.Pe32 +
-                       sizeof (UINT32) + 
-                       sizeof (EFI_IMAGE_FILE_HEADER) +  
+                       sizeof (UINT32) +
+                       sizeof (EFI_IMAGE_FILE_HEADER) +
                        Hdr.Pe32->FileHeader.SizeOfOptionalHeader
                        );
     Index = Hdr.Pe32->FileHeader.NumberOfSections;
@@ -1362,12 +1362,12 @@ PeCoffLoaderGetPdbPointer (
       // Get the DebugEntry offset in the raw data image.
       //
       for (Index1 = 0; Index1 < Index; Index1 ++) {
-        if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) && 
+        if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
            (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
           DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (
-                       (UINTN) Pe32Data + 
-                       DirectoryEntry->VirtualAddress - 
-                       SectionHeader[Index1].VirtualAddress + 
+                       (UINTN) Pe32Data +
+                       DirectoryEntry->VirtualAddress -
+                       SectionHeader[Index1].VirtualAddress +
                        SectionHeader[Index1].PointerToRawData);
           break;
         }
@@ -1383,7 +1383,7 @@ PeCoffLoaderGetPdbPointer (
 
   //
   // Scan the directory to find the debug entry.
-  // 
+  //
   for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
     if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {
       if (DebugEntry->SizeOfData > 0) {
@@ -1392,13 +1392,13 @@ PeCoffLoaderGetPdbPointer (
         //
         CodeViewEntryPointer = NULL;
         for (Index1 = 0; Index1 < Index; Index1 ++) {
-          if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) && 
+          if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
              (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
             CodeViewEntryPointer = (VOID *) (
-                                   ((UINTN)Pe32Data) + 
-                                   (UINTN) DebugEntry->RVA - 
-                                   SectionHeader[Index1].VirtualAddress + 
-                                   SectionHeader[Index1].PointerToRawData + 
+                                   ((UINTN)Pe32Data) +
+                                   (UINTN) DebugEntry->RVA -
+                                   SectionHeader[Index1].VirtualAddress +
+                                   SectionHeader[Index1].PointerToRawData +
                                    (UINTN)TEImageAdjust);
             break;
           }

+ 4 - 4
BaseTools/Source/C/Common/BinderFuncs.h

@@ -1,9 +1,9 @@
 /** @file
-Prototypes for binder functions that allow common code to be written which then 
-links to implementation of these functions which is appropriate for the specific 
+Prototypes for binder functions that allow common code to be written which then
+links to implementation of these functions which is appropriate for the specific
 environment that they are running under.
-  
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
+
+Copyright (c) 1999 - 2018, 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

+ 30 - 30
BaseTools/Source/C/Common/CommonLib.c

@@ -2,13 +2,13 @@
 Common basic Library Functions
 
 Copyright (c) 2004 - 2018, 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.             
+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.
 
 **/
 
@@ -136,7 +136,7 @@ Arguments:
 
 Returns:
   =  0  if Guid1 == Guid2
-  != 0  if Guid1 != Guid2 
+  != 0  if Guid1 != Guid2
 
 --*/
 {
@@ -169,7 +169,7 @@ GetFileImage (
 
 Routine Description:
 
-  This function opens a file and reads it into a memory buffer.  The function 
+  This function opens a file and reads it into a memory buffer.  The function
   will allocate the memory buffer and returns the size of the buffer.
 
 Arguments:
@@ -332,7 +332,7 @@ CalculateChecksum8 (
   IN UINTN        Size
   )
 /*++
-  
+
 Routine Description:
 
   This function calculates the value needed for a valid UINT8 checksum
@@ -357,7 +357,7 @@ CalculateSum8 (
   IN UINTN  Size
   )
 /*++
-  
+
 Routine Description::
 
   This function calculates the UINT8 sum for the requested region.
@@ -394,7 +394,7 @@ CalculateChecksum16 (
   IN UINTN        Size
   )
 /*++
-  
+
 Routine Description::
 
   This function calculates the value needed for a valid UINT16 checksum
@@ -419,7 +419,7 @@ CalculateSum16 (
   IN UINTN        Size
   )
 /*++
-  
+
 Routine Description:
 
   This function calculates the UINT16 sum for the requested region.
@@ -518,7 +518,7 @@ Returns:
   EFI_SUCCESS             The GUID was printed.
   EFI_INVALID_PARAMETER   The input was NULL.
   EFI_BUFFER_TOO_SMALL    The input buffer was not big enough
-  
+
 --*/
 {
   if (Guid == NULL) {
@@ -593,7 +593,7 @@ char *strlwr(char *s)
 #define WINDOWS_UNC_EXTENSION_PATH "\\\\?\\UNC"
 
 //
-// Global data to store full file path. It is not required to be free. 
+// Global data to store full file path. It is not required to be free.
 //
 CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
 
@@ -604,32 +604,32 @@ LongFilePath (
 /*++
 
 Routine Description:
-  Convert FileName to the long file path, which can support larger than 260 length. 
+  Convert FileName to the long file path, which can support larger than 260 length.
 
 Arguments:
-  FileName         - FileName. 
+  FileName         - FileName.
 
 Returns:
   LongFilePath      A pointer to the converted long file path.
-  
+
 --*/
 {
 #ifdef __GNUC__
   //
-  // __GNUC__ may not be good way to differentiate unix and windows. Need more investigation here. 
-  // unix has no limitation on file path. Just return FileName. 
+  // __GNUC__ may not be good way to differentiate unix and windows. Need more investigation here.
+  // unix has no limitation on file path. Just return FileName.
   //
   return FileName;
 #else
   CHAR8 *RootPath;
   CHAR8 *PathPointer;
   CHAR8 *NextPointer;
-  
+
   PathPointer = (CHAR8 *) FileName;
-  
+
   if (FileName != NULL) {
     //
-    // Add the extension string first to support long file path. 
+    // Add the extension string first to support long file path.
     //
     mCommonLibFullPath[0] = 0;
     strcpy (mCommonLibFullPath, WINDOWS_EXTENSION_PATH);
@@ -642,7 +642,7 @@ Returns:
       FileName ++;
     } else if (strlen (FileName) < 3 || FileName[1] != ':' || (FileName[2] != '\\' && FileName[2] != '/')) {
       //
-      // Relative file path. Convert it to absolute path. 
+      // Relative file path. Convert it to absolute path.
       //
       RootPath = getcwd (NULL, 0);
       if (RootPath != NULL) {
@@ -675,7 +675,7 @@ Returns:
       return NULL;
     }
     strncat (mCommonLibFullPath, FileName, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
-    
+
     //
     // Convert directory separator '/' to '\\'
     //
@@ -685,7 +685,7 @@ Returns:
         *PathPointer = '\\';
       }
     } while (*PathPointer ++ != '\0');
-    
+
     //
     // Convert ":\\\\" to ":\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
     //
@@ -693,7 +693,7 @@ Returns:
       *(PathPointer + 2) = '\0';
       strncat (mCommonLibFullPath, PathPointer + 3, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
     }
-    
+
     //
     // Convert ".\\" to "", because it doesn't work with WINDOWS_EXTENSION_PATH.
     //
@@ -701,7 +701,7 @@ Returns:
       *PathPointer = '\0';
       strncat (mCommonLibFullPath, PathPointer + 2, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
     }
-        
+
     //
     // Convert "\\.\\" to "\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
     //
@@ -732,10 +732,10 @@ Returns:
         break;
       }
     }
-    
+
     PathPointer = mCommonLibFullPath;
   }
-  
+
   return PathPointer;
 #endif
 }

+ 3 - 3
BaseTools/Source/C/Common/CommonLib.h

@@ -451,14 +451,14 @@ SplitStr (
 /*++
 
 Routine Description:
-  Convert FileName to the long file path, which can support larger than 260 length. 
+  Convert FileName to the long file path, which can support larger than 260 length.
 
 Arguments:
-  FileName         - FileName. 
+  FileName         - FileName.
 
 Returns:
   LongFilePath      A pointer to the converted long file path.
-  
+
 --*/
 
 #ifdef __cplusplus

+ 10 - 10
BaseTools/Source/C/Common/Compress.h

@@ -1,16 +1,16 @@
 /** @file
 Header file for compression routine.
 Providing both EFI and Tiano Compress algorithms.
-  
-Copyright (c) 2004 - 2014, 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.             
-  
+
+Copyright (c) 2004 - 2018, 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.
+
 **/
 
 #ifndef _COMPRESS_H_

+ 8 - 8
BaseTools/Source/C/Common/Crc32.c

@@ -1,14 +1,14 @@
 /** @file
 CalcuateCrc32 routine.
 
-Copyright (c) 2004 - 2014, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 

+ 8 - 8
BaseTools/Source/C/Common/Crc32.h

@@ -1,14 +1,14 @@
 /** @file
 Header file for CalcuateCrc32 routine
 
-Copyright (c) 2004 - 2014, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 

+ 2 - 2
BaseTools/Source/C/Common/Decompress.c

@@ -1,8 +1,8 @@
 /** @file
-Decompressor. Algorithm Ported from OPSD code (Decomp.asm) for Efi and Tiano 
+Decompressor. Algorithm Ported from OPSD code (Decomp.asm) for Efi and Tiano
 compress algorithm.
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2018, 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

+ 8 - 8
BaseTools/Source/C/Common/Decompress.h

@@ -1,14 +1,14 @@
 /** @file
 Header file for compression routine
 
-Copyright (c) 2006 - 2014, 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.             
+Copyright (c) 2006 - 2018, 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.
 
 **/
 

File diff suppressed because it is too large
+ 214 - 214
BaseTools/Source/C/Common/EfiCompress.c


+ 9 - 9
BaseTools/Source/C/Common/EfiUtilityMsgs.h

@@ -1,14 +1,14 @@
 /** @file
 Defines and prototypes for common EFI utility error and debug messages.
 
-Copyright (c) 2004 - 2014, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 
@@ -32,7 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define STATUS_SUCCESS  0
 #define STATUS_WARNING  1
 #define STATUS_ERROR    2
-#define VOID void 
+#define VOID void
 
 typedef int STATUS;
 

+ 3 - 3
BaseTools/Source/C/Common/FirmwareVolumeBuffer.c

@@ -1,7 +1,7 @@
 /** @file
 EFI Firmware Volume routines which work on a Fv image in buffers.
 
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2018, 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
@@ -1654,7 +1654,7 @@ FvBufCalculateSum16 (
   IN UINTN        Size
   )
 /*++
-  
+
 Routine Description:
 
   This function calculates the UINT16 sum for the requested region.
@@ -1693,7 +1693,7 @@ FvBufCalculateChecksum16 (
   IN UINTN        Size
   )
 /*++
-  
+
 Routine Description::
 
   This function calculates the value needed for a valid UINT16 checksum

+ 19 - 19
BaseTools/Source/C/Common/FvLib.c

@@ -1,14 +1,14 @@
 /** @file
 These functions assist in parsing and manipulating a Firmware Volume.
 
-Copyright (c) 2004 - 2015, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 
@@ -44,9 +44,9 @@ Arguments:
 
   Fv            Buffer containing the FV.
   FvLength      Length of the FV
-    
+
 Returns:
- 
+
   EFI_SUCCESS             Function Completed successfully.
   EFI_INVALID_PARAMETER   A required parameter was NULL.
 
@@ -80,9 +80,9 @@ Arguments:
 
   FvHeader      Pointer to the FV buffer.
   FvLength      Length of the FV
-    
+
 Returns:
- 
+
   EFI_SUCCESS             Function Completed successfully.
   EFI_INVALID_PARAMETER   A required parameter was NULL.
   EFI_ABORTED             The library needs to be initialized.
@@ -117,16 +117,16 @@ GetNextFile (
 Routine Description:
 
   This function returns the next file.  If the current file is NULL, it returns
-  the first file in the FV.  If the function returns EFI_SUCCESS and the file 
+  the first file in the FV.  If the function returns EFI_SUCCESS and the file
   pointer is NULL, then there are no more files in the FV.
 
 Arguments:
 
   CurrentFile   Pointer to the current file, must be within the current FV.
   NextFile      Pointer to the next file in the FV.
-    
+
 Returns:
- 
+
   EFI_SUCCESS             Function completed successfully.
   EFI_INVALID_PARAMETER   A required parameter was NULL or is out of range.
   EFI_ABORTED             The library needs to be initialized.
@@ -496,7 +496,7 @@ GetSectionByType (
 
 Routine Description:
 
-  Find a section in a file by type and instance.  An instance of 1 is the first 
+  Find a section in a file by type and instance.  An instance of 1 is the first
   instance.  The function will return NULL if a matching section cannot be found.
   GUID-defined sections, if special processing is not needed, are handled in a
   depth-first manner.
@@ -543,7 +543,7 @@ Returns:
   // Get the first section
   //
   CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) File + GetFfsHeaderLength(File));
-  
+
   //
   // Depth-first manner to find section file.
   //
@@ -858,7 +858,7 @@ Returns:
   EFI_SUCCESS              The function completed successfully.
   EFI_INVALID_PARAMETER    One of the input parameters was invalid.
   EFI_ABORTED              Operation aborted.
-  
+
 --*/
 {
   EFI_STATUS  Status;
@@ -905,7 +905,7 @@ Routine Description:
   It in no way validate the FFS file.
 
 Arguments:
-  
+
   ErasePolarity The erase polarity for the file state bits.
   FfsHeader     Pointer to a FFS file.
 

+ 10 - 10
BaseTools/Source/C/Common/FvLib.h

@@ -1,14 +1,14 @@
 /** @file
 These functions assist in parsing and manipulating a Firmware Volume.
-  
-Copyright (c) 2004 - 2014, 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.             
+
+Copyright (c) 2004 - 2018, 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.
 
 **/
 
@@ -183,7 +183,7 @@ Routine Description:
   It in no way validate the FFS file.
 
 Arguments:
-  
+
   ErasePolarity The erase polarity for the file state bits.
   FfsHeader     Pointer to a FFS file.
 

+ 8 - 8
BaseTools/Source/C/Common/MemoryFile.c

@@ -1,14 +1,14 @@
 /** @file
 This contains some useful functions for accessing files.
 
-Copyright (c) 2004 - 2016, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 

+ 8 - 8
BaseTools/Source/C/Common/MemoryFile.h

@@ -1,14 +1,14 @@
 /** @file
 Header file for helper functions useful for accessing files.
 
-Copyright (c) 2004 - 2014, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 

+ 8 - 8
BaseTools/Source/C/Common/MyAlloc.c

@@ -1,14 +1,14 @@
 /** @file
 File for memory allocation tracking functions.
 
-Copyright (c) 2004 - 2016, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 

+ 8 - 8
BaseTools/Source/C/Common/MyAlloc.h

@@ -1,14 +1,14 @@
 /** @file
 Header file for memory allocation tracking functions.
 
-Copyright (c) 2004 - 2014, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 

+ 10 - 10
BaseTools/Source/C/Common/OsPath.c

@@ -1,14 +1,14 @@
 /** @file
 Functions useful to operate file directories by parsing file path.
 
-Copyright (c) 2007 - 2014, 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.             
+Copyright (c) 2007 - 2018, 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.
 
 **/
 
@@ -87,7 +87,7 @@ Returns:
   }
 
   //
-  // 
+  //
   //
   for (Offset = Length; Offset > 0; Offset--) {
     if ((Return[Offset] == '/') || (Return[Offset] == '\\')) {
@@ -195,7 +195,7 @@ Returns:
   }
 
   //
-  // 
+  //
   //
   for (Offset = Length; Offset > 0; Offset--) {
     if ((Return[Offset] == '/') || (Return[Offset] == '\\')) {

+ 9 - 9
BaseTools/Source/C/Common/OsPath.h

@@ -1,15 +1,15 @@
 /** @file
-Header file for helper functions useful to operate file directories by parsing 
+Header file for helper functions useful to operate file directories by parsing
 file path.
 
-Copyright (c) 2007 - 2014, 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.             
+Copyright (c) 2007 - 2018, 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.
 
 **/
 

+ 10 - 10
BaseTools/Source/C/Common/ParseGuidedSectionTools.c

@@ -1,14 +1,14 @@
 /** @file
 Helper functions for parsing GuidedSectionTools.txt
 
-Copyright (c) 2007 - 2016, 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.             
+Copyright (c) 2007 - 2018, 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.
 
 **/
 
@@ -76,7 +76,7 @@ Returns:
   ParsedGuidedSectionTools = ParseGuidedSectionToolsMemoryFile (MemoryFile);
 
   FreeMemoryFile (MemoryFile);
-  
+
   return ParsedGuidedSectionTools;
 }
 
@@ -122,7 +122,7 @@ Returns:
     if (NextLine == NULL) {
       break;
     }
-    
+
     Status = StripInfDscStringInPlace (NextLine);
     if (EFI_ERROR (Status)) {
       free (NextLine);

+ 8 - 8
BaseTools/Source/C/Common/ParseGuidedSectionTools.h

@@ -1,14 +1,14 @@
 /** @file
 Header file for helper functions for parsing GuidedSectionTools.txt
 
-Copyright (c) 2007 - 2014, 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.             
+Copyright (c) 2007 - 2018, 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.
 
 **/
 

+ 27 - 27
BaseTools/Source/C/Common/ParseInf.c

@@ -1,14 +1,14 @@
 /** @file
 This contains some useful functions for parsing INF files.
 
-Copyright (c) 2004 - 2016, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 
@@ -31,11 +31,11 @@ ReadLine (
 Routine Description:
 
   This function reads a line, stripping any comments.
-  The function reads a string from the input stream argument and stores it in 
-  the input string. ReadLine reads characters from the current file position 
-  to and including the first newline character, to the end of the stream, or 
-  until the number of characters read is equal to MaxLength - 1, whichever 
-  comes first.  The newline character, if read, is replaced with a \0. 
+  The function reads a string from the input stream argument and stores it in
+  the input string. ReadLine reads characters from the current file position
+  to and including the first newline character, to the end of the stream, or
+  until the number of characters read is equal to MaxLength - 1, whichever
+  comes first.  The newline character, if read, is replaced with a \0.
 
 Arguments:
 
@@ -372,17 +372,17 @@ StringToGuid (
   )
 /*++
 
-Routine Description: 
+Routine Description:
 
-  Converts a string to an EFI_GUID.  The string must be in the 
+  Converts a string to an EFI_GUID.  The string must be in the
   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
 
-Arguments:  
+Arguments:
 
   AsciiGuidBuffer - pointer to ascii string
   GuidBuffer      - pointer to destination Guid
 
-Returns:  
+Returns:
 
   EFI_ABORTED             Could not convert the string
   EFI_SUCCESS             The string was successfully converted
@@ -408,7 +408,7 @@ Returns:
         break;
       }
     } else {
-      if (((AsciiGuidBuffer[Index] >= '0') && (AsciiGuidBuffer[Index] <= '9')) || 
+      if (((AsciiGuidBuffer[Index] >= '0') && (AsciiGuidBuffer[Index] <= '9')) ||
          ((AsciiGuidBuffer[Index] >= 'a') && (AsciiGuidBuffer[Index] <= 'f')) ||
          ((AsciiGuidBuffer[Index] >= 'A') && (AsciiGuidBuffer[Index] <= 'F'))) {
         continue;
@@ -417,12 +417,12 @@ Returns:
       }
     }
   }
-  
+
   if (Index < 36 || AsciiGuidBuffer[36] != '\0') {
     Error (NULL, 0, 1003, "Invalid option value", "Incorrect GUID \"%s\"\n  Correct Format \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"", AsciiGuidBuffer);
     return EFI_ABORTED;
   }
-  
+
   //
   // Scan the guid string into the buffer
   //
@@ -477,9 +477,9 @@ AsciiStringToUint64 (
 
 Routine Description:
 
-  Converts a null terminated ascii string that represents a number into a 
-  UINT64 value.  A hex number may be preceeded by a 0x, but may not be 
-  succeeded by an h.  A number without 0x or 0X is considered to be base 10 
+  Converts a null terminated ascii string that represents a number into a
+  UINT64 value.  A hex number may be preceeded by a 0x, but may not be
+  succeeded by an h.  A number without 0x or 0X is considered to be base 10
   unless the IsHex input is true.
 
 Arguments:
@@ -498,13 +498,13 @@ Returns:
   UINT8   Index;
   UINT64  Value;
   CHAR8   CurrentChar;
-  
+
   //
   // Initialize the result
   //
   Value = 0;
   Index = 0;
-  
+
   //
   // Check input parameter
   //
@@ -514,11 +514,11 @@ Returns:
   while (AsciiString[Index] == ' ') {
     Index ++;
   }
-  
+
   //
   // Add each character to the result
   //
-  
+
   //
   // Skip first two chars only if the string starts with '0x' or '0X'
   //

+ 20 - 20
BaseTools/Source/C/Common/ParseInf.h

@@ -1,14 +1,14 @@
 /** @file
 Header file for helper functions useful for parsing INF files.
 
-Copyright (c) 2004 - 2014, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 
@@ -39,11 +39,11 @@ ReadLine (
 Routine Description:
 
   This function reads a line, stripping any comments.
-  The function reads a string from the input stream argument and stores it in 
-  the input string. ReadLine reads characters from the current file position 
-  to and including the first newline character, to the end of the stream, or 
-  until the number of characters read is equal to MaxLength - 1, whichever 
-  comes first.  The newline character, if read, is replaced with a \0. 
+  The function reads a string from the input stream argument and stores it in
+  the input string. ReadLine reads characters from the current file position
+  to and including the first newline character, to the end of the stream, or
+  until the number of characters read is equal to MaxLength - 1, whichever
+  comes first.  The newline character, if read, is replaced with a \0.
 
 Arguments:
 
@@ -124,17 +124,17 @@ StringToGuid (
 
 /*++
 
-Routine Description: 
+Routine Description:
 
-  Converts a string to an EFI_GUID.  The string must be in the 
+  Converts a string to an EFI_GUID.  The string must be in the
   xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
 
-Arguments:  
+Arguments:
 
   GuidBuffer      - pointer to destination Guid
   AsciiGuidBuffer - pointer to ascii string
 
-Returns:  
+Returns:
 
   EFI_ABORTED    Could not convert the string
   EFI_SUCCESS    The string was successfully converted
@@ -152,9 +152,9 @@ AsciiStringToUint64 (
 
 Routine Description:
 
-  Converts a null terminated ascii string that represents a number into a 
-  UINT64 value.  A hex number may be preceeded by a 0x, but may not be 
-  succeeded by an h.  A number without 0x or 0X is considered to be base 10 
+  Converts a null terminated ascii string that represents a number into a
+  UINT64 value.  A hex number may be preceeded by a 0x, but may not be
+  succeeded by an h.  A number without 0x or 0X is considered to be base 10
   unless the IsHex input is true.
 
 Arguments:

+ 29 - 29
BaseTools/Source/C/Common/PeCoffLib.h

@@ -1,14 +1,14 @@
 /** @file
-	Function prototypes and defines on Memory Only PE COFF loader
+  Function prototypes and defines on Memory Only PE COFF loader
 
-	Copyright (c) 2006 - 2014, 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                                            
+  Copyright (c) 2006 - 2018, 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.             
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
@@ -20,7 +20,7 @@
 // BUGBUG: Find where used and see if can be replaced by RETURN_STATUS codes
 //
 #define IMAGE_ERROR_SUCCESS                      0
-#define IMAGE_ERROR_IMAGE_READ                   1  
+#define IMAGE_ERROR_IMAGE_READ                   1
 #define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE  2
 #define IMAGE_ERROR_INVALID_MACHINE_TYPE         3
 #define IMAGE_ERROR_INVALID_SUBSYSTEM            4
@@ -73,15 +73,15 @@ typedef struct {
 
 
 /**
-	Retrieves information on a PE/COFF image
+  Retrieves information on a PE/COFF image
 
-	@param	ImageContext The context of the image being loaded
+  @param  ImageContext The context of the image being loaded
 
-	@retval	EFI_SUCCESS The information on the PE/COFF image was collected.
-	@retval	EFI_INVALID_PARAMETER ImageContext is NULL.
-	@retval	EFI_UNSUPPORTED The PE/COFF image is not supported.
-	@retval	Otherwise The error status from reading the PE/COFF image using the
-	ImageContext->ImageRead() function
+  @retval  EFI_SUCCESS The information on the PE/COFF image was collected.
+  @retval  EFI_INVALID_PARAMETER ImageContext is NULL.
+  @retval  EFI_UNSUPPORTED The PE/COFF image is not supported.
+  @retval  Otherwise The error status from reading the PE/COFF image using the
+  ImageContext->ImageRead() function
 
 **/
 RETURN_STATUS
@@ -92,13 +92,13 @@ PeCoffLoaderGetImageInfo (
 ;
 
 /**
-	Relocates a PE/COFF image in memory
+  Relocates a PE/COFF image in memory
 
-	@param	ImageContext Contains information on the loaded image to relocate
+  @param  ImageContext Contains information on the loaded image to relocate
 
-	@retval EFI_SUCCESS      if the PE/COFF image was relocated
-	@retval EFI_LOAD_ERROR   if the image is not a valid PE/COFF image
-	@retval EFI_UNSUPPORTED  not support
+  @retval EFI_SUCCESS      if the PE/COFF image was relocated
+  @retval EFI_LOAD_ERROR   if the image is not a valid PE/COFF image
+  @retval EFI_UNSUPPORTED  not support
 
 **/
 RETURN_STATUS
@@ -109,14 +109,14 @@ PeCoffLoaderRelocateImage (
 ;
 
 /**
-	Loads a PE/COFF image into memory
+  Loads a PE/COFF image into memory
 
-	@param	ImageContext Contains information on image to load into memory
+  @param  ImageContext Contains information on image to load into memory
 
-	@retval EFI_SUCCESS            if the PE/COFF image was loaded
-	@retval EFI_BUFFER_TOO_SMALL   if the caller did not provide a large enough buffer
-	@retval EFI_LOAD_ERROR         if the image is a runtime driver with no relocations
-	@retval EFI_INVALID_PARAMETER  if the image address is invalid
+  @retval EFI_SUCCESS            if the PE/COFF image was loaded
+  @retval EFI_BUFFER_TOO_SMALL   if the caller did not provide a large enough buffer
+  @retval EFI_LOAD_ERROR         if the image is a runtime driver with no relocations
+  @retval EFI_INVALID_PARAMETER  if the image address is invalid
 
 **/
 RETURN_STATUS
@@ -148,7 +148,7 @@ PeCoffLoaderGetEntryPoint (
 //
 
 /**
-  Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and 
+  Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and
   return the immediate data encoded in the instruction
 
   @param  Instruction   Pointer to ARM MOVT or MOVW immediate instruction
@@ -178,7 +178,7 @@ ThumbMovtImmediatePatch (
 
 
 /**
-  Pass in a pointer to an ARM MOVW/MOVT instruciton pair and 
+  Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
   return the immediate data encoded in the two` instruction
 
   @param  Instructions  Pointer to ARM MOVW/MOVT insturction pair

+ 64 - 64
BaseTools/Source/C/Common/PeCoffLoaderEx.c

@@ -1,15 +1,15 @@
 /** @file
 IA32, X64 and IPF Specific relocation fixups
 
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 Portions Copyright (c) 2011 - 2013, ARM Ltd. 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.             
+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.
 
 --*/
 
@@ -27,45 +27,45 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     *(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
           ((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
 
-#define IMM64_IMM7B_INST_WORD_X         3  
-#define IMM64_IMM7B_SIZE_X              7  
-#define IMM64_IMM7B_INST_WORD_POS_X     4  
-#define IMM64_IMM7B_VAL_POS_X           0  
-
-#define IMM64_IMM9D_INST_WORD_X         3  
-#define IMM64_IMM9D_SIZE_X              9  
-#define IMM64_IMM9D_INST_WORD_POS_X     18  
-#define IMM64_IMM9D_VAL_POS_X           7  
-
-#define IMM64_IMM5C_INST_WORD_X         3  
-#define IMM64_IMM5C_SIZE_X              5  
-#define IMM64_IMM5C_INST_WORD_POS_X     13  
-#define IMM64_IMM5C_VAL_POS_X           16  
-
-#define IMM64_IC_INST_WORD_X            3  
-#define IMM64_IC_SIZE_X                 1  
-#define IMM64_IC_INST_WORD_POS_X        12  
-#define IMM64_IC_VAL_POS_X              21  
-
-#define IMM64_IMM41a_INST_WORD_X        1  
-#define IMM64_IMM41a_SIZE_X             10  
-#define IMM64_IMM41a_INST_WORD_POS_X    14  
-#define IMM64_IMM41a_VAL_POS_X          22  
-
-#define IMM64_IMM41b_INST_WORD_X        1  
-#define IMM64_IMM41b_SIZE_X             8  
-#define IMM64_IMM41b_INST_WORD_POS_X    24  
-#define IMM64_IMM41b_VAL_POS_X          32  
-
-#define IMM64_IMM41c_INST_WORD_X        2  
-#define IMM64_IMM41c_SIZE_X             23  
-#define IMM64_IMM41c_INST_WORD_POS_X    0  
-#define IMM64_IMM41c_VAL_POS_X          40  
-
-#define IMM64_SIGN_INST_WORD_X          3  
-#define IMM64_SIGN_SIZE_X               1  
-#define IMM64_SIGN_INST_WORD_POS_X      27  
-#define IMM64_SIGN_VAL_POS_X            63  
+#define IMM64_IMM7B_INST_WORD_X         3
+#define IMM64_IMM7B_SIZE_X              7
+#define IMM64_IMM7B_INST_WORD_POS_X     4
+#define IMM64_IMM7B_VAL_POS_X           0
+
+#define IMM64_IMM9D_INST_WORD_X         3
+#define IMM64_IMM9D_SIZE_X              9
+#define IMM64_IMM9D_INST_WORD_POS_X     18
+#define IMM64_IMM9D_VAL_POS_X           7
+
+#define IMM64_IMM5C_INST_WORD_X         3
+#define IMM64_IMM5C_SIZE_X              5
+#define IMM64_IMM5C_INST_WORD_POS_X     13
+#define IMM64_IMM5C_VAL_POS_X           16
+
+#define IMM64_IC_INST_WORD_X            3
+#define IMM64_IC_SIZE_X                 1
+#define IMM64_IC_INST_WORD_POS_X        12
+#define IMM64_IC_VAL_POS_X              21
+
+#define IMM64_IMM41a_INST_WORD_X        1
+#define IMM64_IMM41a_SIZE_X             10
+#define IMM64_IMM41a_INST_WORD_POS_X    14
+#define IMM64_IMM41a_VAL_POS_X          22
+
+#define IMM64_IMM41b_INST_WORD_X        1
+#define IMM64_IMM41b_SIZE_X             8
+#define IMM64_IMM41b_INST_WORD_POS_X    24
+#define IMM64_IMM41b_VAL_POS_X          32
+
+#define IMM64_IMM41c_INST_WORD_X        2
+#define IMM64_IMM41c_SIZE_X             23
+#define IMM64_IMM41c_INST_WORD_POS_X    0
+#define IMM64_IMM41c_VAL_POS_X          40
+
+#define IMM64_SIGN_INST_WORD_X          3
+#define IMM64_SIGN_SIZE_X               1
+#define IMM64_SIGN_INST_WORD_POS_X      27
+#define IMM64_SIGN_VAL_POS_X            63
 
 RETURN_STATUS
 PeCoffLoaderRelocateIa32Image (
@@ -102,7 +102,7 @@ Returns:
 RETURN_STATUS
 PeCoffLoaderRelocateIpfImage (
   IN UINT16      *Reloc,
-  IN OUT CHAR8   *Fixup, 
+  IN OUT CHAR8   *Fixup,
   IN OUT CHAR8   **FixupData,
   IN UINT64      Adjust
   )
@@ -142,8 +142,8 @@ Returns:
 
       Fixup = (CHAR8 *)((UINTN) Fixup & (UINTN) ~(15));
       FixupVal = (UINT64)0;
-                       
-      // 
+
+      //
       // Extract the lower 32 bits of IMM64 from bundle
       //
       EXT_IMM64(FixupVal,
@@ -180,13 +180,13 @@ Returns:
                 IMM64_IMM41a_INST_WORD_POS_X,
                 IMM64_IMM41a_VAL_POS_X
                 );
-                       
-      // 
+
+      //
       // Update 64-bit address
       //
       FixupVal += Adjust;
 
-      // 
+      //
       // Insert IMM64 into bundle
       //
       INS_IMM64(FixupVal,
@@ -261,7 +261,7 @@ Returns:
 }
 
 /**
-  Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and 
+  Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and
   return the immediate data encoded in the instruction
 
   @param  Instruction   Pointer to ARM MOVT or MOVW immediate instruction
@@ -279,7 +279,7 @@ ThumbMovtImmediateAddress (
 
   // Thumb2 is two 16-bit instructions working together. Not a single 32-bit instruction
   // Example MOVT R0, #0 is 0x0000f2c0 or 0xf2c0 0x0000
-  Movt = (*Instruction << 16) | (*(Instruction + 1)); 
+  Movt = (*Instruction << 16) | (*(Instruction + 1));
 
   // imm16 = imm4:i:imm3:imm8
   //         imm4 -> Bit19:Bit16
@@ -308,7 +308,7 @@ ThumbMovtImmediatePatch (
   UINT16  Patch;
 
   // First 16-bit chunk of instruciton
-  Patch  = ((Address >> 12) & 0x000f);             // imm4 
+  Patch  = ((Address >> 12) & 0x000f);             // imm4
   Patch |= (((Address & BIT11) != 0) ? BIT10 : 0); // i
   *Instruction = (*Instruction & ~0x040f) | Patch;
 
@@ -320,7 +320,7 @@ ThumbMovtImmediatePatch (
 }
 
 /**
-  Pass in a pointer to an ARM MOVW/MOVT instruciton pair and 
+  Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
   return the immediate data encoded in the two` instruction
 
   @param  Instructions  Pointer to ARM MOVW/MOVT insturction pair
@@ -336,10 +336,10 @@ ThumbMovwMovtImmediateAddress (
 {
   UINT16  *Word;
   UINT16  *Top;
-  
+
   Word = Instructions;  // MOVW
   Top  = Word + 2;      // MOVT
-  
+
   return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word);
 }
 
@@ -359,7 +359,7 @@ ThumbMovwMovtImmediatePatch (
 {
   UINT16  *Word;
   UINT16  *Top;
-  
+
   Word = (UINT16 *)Instructions;  // MOVW
   Top  = Word + 2;                // MOVT
 
@@ -394,19 +394,19 @@ PeCoffLoaderRelocateArmImage (
   Fixup16   = (UINT16 *) Fixup;
 
   switch ((**Reloc) >> 12) {
-  
+
   case EFI_IMAGE_REL_BASED_ARM_MOV32T:
     FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
     ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
-    
-    
+
+
     if (*FixupData != NULL) {
       *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
       CopyMem (*FixupData, Fixup16, sizeof (UINT64));
       *FixupData = *FixupData + sizeof(UINT64);
     }
     break;
-  
+
   case EFI_IMAGE_REL_BASED_ARM_MOV32A:
      // break omitted - ARM instruction encoding not implemented
   default:

+ 23 - 23
BaseTools/Source/C/Common/SimpleFileParsing.c

@@ -1,14 +1,14 @@
 /** @file
 Generic but simple file parsing routines.
 
-Copyright (c) 2004 - 2017, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 --*/
 
@@ -238,7 +238,7 @@ Arguments:
   FileName  - name of the file to parse
 
 Returns:
-  
+
 
 --*/
 {
@@ -345,7 +345,7 @@ SFPGetNextToken (
 /*++
 
 Routine Description:
-  Get the next token from the input stream. 
+  Get the next token from the input stream.
 
 Arguments:
   Str - pointer to a copy of the next token
@@ -356,7 +356,7 @@ Returns:
   FALSE - otherwise
 
 Notes:
-  Preceeding white space is ignored. 
+  Preceeding white space is ignored.
   The parser's buffer pointer is advanced past the end of the
   token.
 
@@ -580,7 +580,7 @@ Arguments:
   None.
 
 Returns:
-  STATUS_SUCCESS - the file was closed 
+  STATUS_SUCCESS - the file was closed
   STATUS_ERROR   - no file is currently open
 
 --*/
@@ -605,7 +605,7 @@ ProcessIncludeFile (
 Routine Description:
 
   Given a source file, open the file and parse it
-  
+
 Arguments:
 
   SourceFile        - name of file to parse
@@ -614,7 +614,7 @@ Arguments:
 Returns:
 
   Standard status.
-  
+
 --*/
 {
   STATIC UINTN NestDepth = 0;
@@ -674,7 +674,7 @@ Routine Description:
 
   Given a source file that's been opened, read the contents into an internal
   buffer and pre-process it to remove comments.
-  
+
 Arguments:
 
   SourceFile        - structure containing info on the file to process
@@ -682,7 +682,7 @@ Arguments:
 Returns:
 
   Standard status.
-  
+
 --*/
 {
   //
@@ -722,13 +722,13 @@ PreprocessFile (
 Routine Description:
   Preprocess a file to replace all carriage returns with NULLs so
   we can print lines (as part of error messages) from the file to the screen.
-  
+
 Arguments:
   SourceFile - structure that we use to keep track of an input file.
 
 Returns:
   Nothing.
-  
+
 --*/
 {
   BOOLEAN InComment;
@@ -826,8 +826,8 @@ SFPGetQuotedString (
 /*++
 
 Routine Description:
-  Retrieve a quoted-string from the input file. 
-  
+  Retrieve a quoted-string from the input file.
+
 Arguments:
   Str    - pointer to a copy of the quoted string parsed
   Length - size of buffer pointed to by Str
@@ -836,7 +836,7 @@ Returns:
   TRUE    - next token in input stream was a quoted string, and
             the string value was returned in Str
   FALSE   - otherwise
-  
+
 --*/
 {
   SkipWhiteSpace (&mGlobals.SourceFile);
@@ -881,14 +881,14 @@ SFPIsEOF (
 Routine Description:
   Return TRUE of FALSE to indicate whether or not we've reached the end of the
   file we're parsing.
-  
+
 Arguments:
   NA
 
 Returns:
   TRUE    - EOF reached
   FALSE   - otherwise
-  
+
 --*/
 {
   SkipWhiteSpace (&mGlobals.SourceFile);

+ 8 - 8
BaseTools/Source/C/Common/SimpleFileParsing.h

@@ -1,14 +1,14 @@
 /** @file
 Function prototypes and defines for the simple file parsing routines.
 
-Copyright (c) 2004 - 2014, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 

+ 9 - 9
BaseTools/Source/C/Common/StringFuncs.c

@@ -1,14 +1,14 @@
 /** @file
 Function prototypes and defines for string routines.
 
-Copyright (c) 2007 - 2014, 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.             
+Copyright (c) 2007 - 2018, 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.
 
 **/
 
@@ -383,7 +383,7 @@ Returns:
     strcat (NewString, "\"");
   }
   strcat (NewString, "]");
-  
+
   return NewString;
 }
 

+ 8 - 8
BaseTools/Source/C/Common/StringFuncs.h

@@ -1,14 +1,14 @@
 /** @file
 String routines implementation
 
-Copyright (c) 2007 - 2014, 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.             
+Copyright (c) 2007 - 2018, 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.
 
 **/
 

+ 48 - 48
BaseTools/Source/C/Common/TianoCompress.c

@@ -1,17 +1,17 @@
 /** @file
-Compression routine. The compression algorithm is a mixture of LZ77 and Huffman 
-coding. LZ77 transforms the source data into a sequence of Original Characters 
-and Pointers to repeated strings. This sequence is further divided into Blocks 
+Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
+coding. LZ77 transforms the source data into a sequence of Original Characters
+and Pointers to repeated strings. This sequence is further divided into Blocks
 and Huffman codings are applied to each Block.
-  
-Copyright (c) 2006 - 2016, 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.             
+
+Copyright (c) 2006 - 2018, 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.
 
 **/
 
@@ -367,13 +367,13 @@ PutDword (
 Routine Description:
 
   Put a dword to output stream
-  
+
 Arguments:
 
   Data    - the dword to put
-  
+
 Returns: (VOID)
-  
+
 --*/
 {
   if (mDst < mDstUpperLimit) {
@@ -403,8 +403,8 @@ AllocateMemory (
 Routine Description:
 
   Allocate memory spaces for data structures used in compression process
-  
-Argements: 
+
+Argements:
   VOID
 
 Returns:
@@ -460,7 +460,7 @@ FreeMemory (
 Routine Description:
 
   Called when compression is completed to free memory previously allocated.
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -512,7 +512,7 @@ InitSlide (
 Routine Description:
 
   Initialize String Info Log data structures
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -552,16 +552,16 @@ Child (
 Routine Description:
 
   Find child node given the parent node and the edge character
-  
+
 Arguments:
 
   NodeQ       - the parent node
   CharC       - the edge character
-  
+
 Returns:
 
-  The child node (NIL if not found)  
-  
+  The child node (NIL if not found)
+
 --*/
 {
   NODE  NodeR;
@@ -590,13 +590,13 @@ MakeChild (
 Routine Description:
 
   Create a new child for a given parent node.
-  
+
 Arguments:
 
   Parent       - the parent node
   CharC   - the edge character
   Child       - the child node
-  
+
 Returns: (VOID)
 
 --*/
@@ -624,11 +624,11 @@ Split (
 Routine Description:
 
   Split a node.
-  
+
 Arguments:
 
   Old     - the node to split
-  
+
 Returns: (VOID)
 
 --*/
@@ -662,7 +662,7 @@ InsertNode (
 Routine Description:
 
   Insert string info for current position into the String Info Log
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -795,7 +795,7 @@ Routine Description:
 
   Delete outdated string info. (The Usage of PERC_FLAG
   ensures a clean deletion)
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -926,7 +926,7 @@ Routine Description:
 Arguments: (VOID)
 
 Returns:
-  
+
   EFI_SUCCESS           - The compression is successful
   EFI_OUT_0F_RESOURCES  - Not enough memory for compression process
 
@@ -1012,7 +1012,7 @@ CountTFreq (
 Routine Description:
 
   Count the frequencies for the Extra Set
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -1071,13 +1071,13 @@ WritePTLen (
 Routine Description:
 
   Outputs the code length array for the Extra Set or the Position Set.
-  
+
 Arguments:
 
   Number       - the number of symbols
   nbit    - the number of bits needed to represent 'n'
   Special - the special symbol that needs to be take care of
-  
+
 Returns: (VOID)
 
 --*/
@@ -1119,7 +1119,7 @@ WriteCLen (
 Routine Description:
 
   Outputs the code length array for Char&Length Set
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -1209,11 +1209,11 @@ SendBlock (
 Routine Description:
 
   Huffman code the block and output it.
-  
-Arguments: 
+
+Arguments:
   (VOID)
 
-Returns: 
+Returns:
   (VOID)
 
 --*/
@@ -1420,7 +1420,7 @@ Routine Description:
 Arguments:
 
   Number   - the rightmost n bits of the data is used
-  x   - the data 
+  x   - the data
 
 Returns: (VOID)
 
@@ -1456,7 +1456,7 @@ FreadCrc (
 Routine Description:
 
   Read in source data
-  
+
 Arguments:
 
   Pointer   - the buffer to hold the data
@@ -1465,7 +1465,7 @@ Arguments:
 Returns:
 
   number of bytes actually read
-  
+
 --*/
 {
   INT32 Index;
@@ -1507,11 +1507,11 @@ CountLen (
 Routine Description:
 
   Count the number of each code length for a Huffman tree.
-  
+
 Arguments:
 
   Index   - the top node
-  
+
 Returns: (VOID)
 
 --*/
@@ -1538,11 +1538,11 @@ MakeLen (
 Routine Description:
 
   Create code length array for a Huffman tree
-  
+
 Arguments:
 
   Root   - the root of the tree
-  
+
 Returns:
 
   VOID
@@ -1634,7 +1634,7 @@ MakeCode (
 Routine Description:
 
   Assign code to each symbol based on the code length array
-  
+
 Arguments:
 
   Number     - number of symbols
@@ -1671,18 +1671,18 @@ MakeTree (
 Routine Description:
 
   Generates Huffman codes given a frequency distribution of symbols
-  
+
 Arguments:
 
   NParm    - number of symbols
   FreqParm - frequency of each symbol
   LenParm  - code length for each symbol
   CodeParm - code for each symbol
-  
+
 Returns:
 
   Root of the Huffman tree.
-  
+
 --*/
 {
   INT32 Index;

+ 26 - 26
BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c

@@ -5,15 +5,15 @@ FILE := EFILDR_HEADER
         EFILDR_IMAGE +
         <PeImageFileContent> +
 The order of EFILDR_IMAGE is same as the order of placing PeImageFileContent.
-  
-Copyright (c) 2006 - 2017, 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.             
+Copyright (c) 2006 - 2018, 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.
 
 **/
 
@@ -36,8 +36,8 @@ typedef struct {
   UINT8  FileName[52];
 } EFILDR_IMAGE;
 
-typedef struct {          
-  UINT32       Signature;     
+typedef struct {
+  UINT32       Signature;
   UINT32       HeaderCheckSum;
   UINT32       FileLength;
   UINT32       NumberOfImages;
@@ -102,7 +102,7 @@ CountVerboseLevel (
     }
     ++(*ReturnValue);
   }
-  
+
   return EFI_SUCCESS;
 }
 
@@ -176,29 +176,29 @@ Returns:
   UINT64        DebugLevel = 0;
   UINT64        VerboseLevel = 0;
   EFI_STATUS Status = EFI_SUCCESS;
-  
+
   SetUtilityName (UTILITY_NAME);
 
   if (argc == 1) {
     printf ("Usage: EfiLdrImage -o OutImage LoaderImage PeImage1 PeImage2 ... PeImageN\n");
     return STATUS_ERROR;
   }
-  
+
   argc --;
   argv ++;
 
   if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
     Usage();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   if (stricmp (argv[0], "--version") == 0) {
     Version();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   while (argc > 0) {
-   
+
     if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
       OutputFileName = argv[1];
       if (OutputFileName == NULL) {
@@ -207,39 +207,39 @@ Returns:
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
-    
+
     if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
       argc --;
       argv ++;
-      continue; 
+      continue;
     }
-    
+
     if ((strlen(argv[0]) >= 2 && argv[0][0] == '-' && (argv[0][1] == 'v' || argv[0][1] == 'V')) || (stricmp (argv[0], "--verbose") == 0)) {
       VerboseLevel = 1;
       if (strlen(argv[0]) > 2) {
         Status = CountVerboseLevel (&argv[0][2], strlen(argv[0]) - 2, &VerboseLevel);
         if (EFI_ERROR (Status)) {
           Error (NULL, 0, 1003, "Invalid option value", "%s", argv[0]);
-          return STATUS_ERROR;        
+          return STATUS_ERROR;
         }
       }
-      
+
       argc --;
       argv ++;
-      continue; 
+      continue;
     }
-    
+
     if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
       Status = AsciiStringToUint64 (argv[1], FALSE, &DebugLevel);
       if (EFI_ERROR (Status)) {
         Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
-        return STATUS_ERROR;        
+        return STATUS_ERROR;
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
     //
     // Don't recognize the parameter, should be regarded as the input file name.

+ 38 - 38
BaseTools/Source/C/EfiRom/EfiRom.c

@@ -1,9 +1,9 @@
 /** @file
 Utility program to create an EFI option ROM image from binary and EFI PE32 files.
 
-Copyright (c) 1999 - 2017, 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 
+Copyright (c) 1999 - 2018, 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
 
@@ -26,8 +26,8 @@ main (
 /*++
 
 Routine Description:
-  
-  Given an EFI image filename, create a ROM-able image by creating an option 
+
+  Given an EFI image filename, create a ROM-able image by creating an option
   ROM header and PCI data structure, filling them in, and then writing the
   option ROM header + PCI data structure + EFI image out to the output file.
 
@@ -71,11 +71,11 @@ Returns:
   } else if (mOptions.Debug) {
     SetPrintLevel(DebugLevel);
   }
-  
+
   if (mOptions.Verbose) {
     VerboseMsg("%s tool start.\n", UTILITY_NAME);
   }
-  
+
   //
   // If dumping an image, then do that and quit
   //
@@ -208,7 +208,7 @@ BailOut:
     VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());
   }
 
-  return GetUtilityStatus (); 
+  return GetUtilityStatus ();
 }
 
 static
@@ -221,7 +221,7 @@ ProcessBinFile (
 /*++
 
 Routine Description:
-  
+
   Process a binary input file.
 
 Arguments:
@@ -247,7 +247,7 @@ Returns:
   UINT32                    Index;
   UINT8                     ByteCheckSum;
   UINT16                    CodeType;
- 
+
   PciDs23 = NULL;
   PciDs30 = NULL;
   Status = STATUS_SUCCESS;
@@ -351,7 +351,7 @@ Returns:
   } else {
     PciDs30->ImageLength = (UINT16) (TotalSize / 512);
     CodeType = PciDs30->CodeType;
-	}
+  }
 
   //
   // If this is the last image, then set the LAST bit unless requested not
@@ -362,13 +362,13 @@ Returns:
       PciDs23->Indicator = INDICATOR_LAST;
     } else {
       PciDs30->Indicator = INDICATOR_LAST;
-		}
+    }
   } else {
     if (mOptions.Pci23 == 1) {
       PciDs23->Indicator = 0;
     } else {
       PciDs30->Indicator = 0;
-		}
+    }
   }
 
   if (CodeType != PCI_CODE_TYPE_EFI_IMAGE) {
@@ -431,7 +431,7 @@ ProcessEfiFile (
 /*++
 
 Routine Description:
-  
+
   Process a PE32 EFI file.
 
 Arguments:
@@ -502,7 +502,7 @@ Returns:
   } else {
     HeaderPadBytes = 0;
   }
-  
+
   //
   // For Pci3.0 to use the different data structure.
   //
@@ -600,7 +600,7 @@ Returns:
   // Check size
   //
   if (TotalSize > MAX_OPTION_ROM_SIZE) {
-    Error (NULL, 0, 2000, "Invalid", "Option ROM image %s size exceeds limit of 0x%X bytes.", InFile->FileName, MAX_OPTION_ROM_SIZE);	
+    Error (NULL, 0, 2000, "Invalid", "Option ROM image %s size exceeds limit of 0x%X bytes.", InFile->FileName, MAX_OPTION_ROM_SIZE);
     Status = STATUS_ERROR;
     goto BailOut;
   }
@@ -685,12 +685,12 @@ Returns:
   if ((InFile->Next == NULL) && (mOptions.NoLast == 0)) {
     if (mOptions.Pci23 == 1) {
       PciDs23.Indicator = INDICATOR_LAST;
-	  } else {
+    } else {
     PciDs30.Indicator = INDICATOR_LAST;}
   } else {
     if (mOptions.Pci23 == 1) {
       PciDs23.Indicator = 0;
-	} else {
+  } else {
       PciDs30.Indicator = 0;
     }
   }
@@ -723,13 +723,13 @@ Returns:
       Error (NULL, 0, 0002, "Failed to write PCI ROM header to output file!", NULL);
       Status = STATUS_ERROR;
       goto BailOut;
-    } 
+    }
   } else {
     if (fwrite (&PciDs30, sizeof (PciDs30), 1, OutFptr) != 1) {
       Error (NULL, 0, 0002, "Failed to write PCI ROM header to output file!", NULL);
       Status = STATUS_ERROR;
       goto BailOut;
-    } 
+    }
   }
 
   //
@@ -819,7 +819,7 @@ CheckPE32File (
 /*++
 
 Routine Description:
-  
+
   Given a file pointer to a supposed PE32 image file, verify that it is indeed a
   PE32 image file, and then return the machine type in the supplied pointer.
 
@@ -911,7 +911,7 @@ ParseCommandLine (
 /*++
 
 Routine Description:
-  
+
   Given the Argc/Argv program arguments, and a pointer to an options structure,
   parse the command-line options and check their validity.
 
@@ -973,12 +973,12 @@ Returns:
     Usage ();
     return STATUS_ERROR;
   }
-  
+
   if ((stricmp(Argv[0], "-h") == 0) || (stricmp(Argv[0], "--help") == 0)) {
     Usage();
     return STATUS_ERROR;
   }
-  
+
   if ((stricmp(Argv[0], "--version") == 0)) {
     Version();
     return STATUS_ERROR;
@@ -1222,7 +1222,7 @@ Returns:
         ReturnStatus = STATUS_ERROR;
         goto Done;
       }
-      
+
       //
       // set flag and class code for this image.
       //
@@ -1239,7 +1239,7 @@ Returns:
       } else {
         if (PrevFileList == NULL) {
           PrevFileList = FileList;
-        } else {          
+        } else {
           PrevFileList->Next = FileList;
         }
       }
@@ -1273,7 +1273,7 @@ Returns:
       ReturnStatus = STATUS_ERROR;
       goto Done;
     }
-  
+
     if (!Options->DevIdCount) {
       Error (NULL, 0, 2000, "Missing Device ID in command line", NULL);
       ReturnStatus = STATUS_ERROR;
@@ -1307,7 +1307,7 @@ Version (
 /*++
 
 Routine Description:
-  
+
   Print version information for this utility.
 
 Arguments:
@@ -1321,7 +1321,7 @@ Returns:
 {
  fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
 }
-   
+
 static
 void
 Usage (
@@ -1330,7 +1330,7 @@ Usage (
 /*++
 
 Routine Description:
-  
+
   Print usage information for this utility.
 
 Arguments:
@@ -1347,11 +1347,11 @@ Returns:
   // Summary usage
   //
   fprintf (stdout, "Usage: %s -f VendorId -i DeviceId [options] [file name<s>] \n\n", UTILITY_NAME);
-  
+
   //
   // Copyright declaration
-  // 
-  fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
+  //
+  fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
 
   //
   // Details Option
@@ -1386,7 +1386,7 @@ Returns:
   fprintf (stdout, "  -q, --quiet\n\
             Disable all messages except FATAL ERRORS.\n");
   fprintf (stdout, "  --debug [#,0-9]\n\
-            Enable debug messages at level #.\n");  
+            Enable debug messages at level #.\n");
 }
 
 static
@@ -1515,7 +1515,7 @@ Returns:
     fprintf (stdout, "    Device ID               0x%04X\n", PciDs30.DeviceId);
     fprintf (stdout, "    Length                  0x%04X\n", PciDs30.Length);
     fprintf (stdout, "    Revision                0x%04X\n", PciDs30.Revision);
-    fprintf (stdout, "    DeviceListOffset        0x%02X\n", PciDs30.DeviceListOffset);    
+    fprintf (stdout, "    DeviceListOffset        0x%02X\n", PciDs30.DeviceListOffset);
     if (PciDs30.DeviceListOffset) {
       //
       // Print device ID list
@@ -1549,8 +1549,8 @@ Returns:
     fprintf (stdout, "    Code revision:          0x%04X\n", PciDs30.CodeRevision);
     fprintf (stdout, "    MaxRuntimeImageLength   0x%02X\n", PciDs30.MaxRuntimeImageLength);
     fprintf (stdout, "    ConfigUtilityCodeHeaderOffset 0x%02X\n", PciDs30.ConfigUtilityCodeHeaderOffset);
-    fprintf (stdout, "    DMTFCLPEntryPointOffset 0x%02X\n", PciDs30.DMTFCLPEntryPointOffset);   
-    fprintf (stdout, "    Indicator               0x%02X", PciDs30.Indicator);    
+    fprintf (stdout, "    DMTFCLPEntryPointOffset 0x%02X\n", PciDs30.DMTFCLPEntryPointOffset);
+    fprintf (stdout, "    Indicator               0x%02X", PciDs30.Indicator);
     }
     //
     // Print the indicator, used to flag the last image
@@ -1566,7 +1566,7 @@ Returns:
     if (mOptions.Pci23 == 1) {
       fprintf (stdout, "    Code type              0x%02X", PciDs23.CodeType);
     } else {
-      fprintf (stdout, "    Code type               0x%02X", PciDs30.CodeType); 
+      fprintf (stdout, "    Code type               0x%02X", PciDs30.CodeType);
     }
     if (PciDs23.CodeType == PCI_CODE_TYPE_EFI_IMAGE || PciDs30.CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
       fprintf (stdout, "   (EFI image)\n");

+ 11 - 11
BaseTools/Source/C/EfiRom/EfiRom.h

@@ -1,9 +1,9 @@
 /** @file
 This file contains the relevant declarations required to generate Option Rom File
 
-Copyright (c) 1999 - 2017, 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 
+Copyright (c) 1999 - 2018, 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
 
@@ -93,7 +93,7 @@ typedef struct {
   INT8      Pci30;
   INT8      DumpOption;
 //  INT8      Help;
-//  INT8      Version;  
+//  INT8      Version;
   FILE_LIST *FileList;
 } OPTIONS;
 
@@ -177,7 +177,7 @@ Returns:
 
   None
 
---*/  
+--*/
 ;
 
 static
@@ -190,7 +190,7 @@ ParseCommandLine (
 /*++
 
 Routine Description:
-  
+
   Given the Argc/Argv program arguments, and a pointer to an options structure,
   parse the command-line options and check their validity.
 
@@ -218,7 +218,7 @@ CheckPE32File (
 /*++
 
 Routine Description:
-  
+
   Given the Argc/Argv program arguments, and a pointer to an options structure,
   parse the command-line options and check their validity.
 
@@ -233,7 +233,7 @@ Returns:
   STATUS_SUCCESS    success
   non-zero          otherwise
 
---*/  
+--*/
 ;
 
 static
@@ -248,7 +248,7 @@ ProcessEfiFile (
 /*++
 
 Routine Description:
-  
+
   Process a PE32 EFI file.
 
 Arguments:
@@ -276,7 +276,7 @@ ProcessBinFile (
 /*++
 
 Routine Description:
-  
+
   Process a binary input file.
 
 Arguments:
@@ -289,7 +289,7 @@ Returns:
 
   0 - successful
 
---*/  
+--*/
 ;
 
 static

+ 8 - 8
BaseTools/Source/C/GenBootSector/FatFormat.h

@@ -2,14 +2,14 @@
 
   Fat file system structure and definition.
 
-Copyright (c) 2006 - 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.             
+Copyright (c) 2006 - 2018, 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.
 
 --*/
 

+ 71 - 71
BaseTools/Source/C/GenBootSector/GenBootSector.c

@@ -3,15 +3,15 @@ Reading/writing MBR/DBR.
   NOTE:
     If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written.
     If we process DBR, we will patch MBR to set first partition active if no active partition exists.
-    
-Copyright (c) 2006 - 2017, 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.             
+
+Copyright (c) 2006 - 2018, 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.
 
 **/
 
@@ -166,16 +166,16 @@ Return:
                    );
   if (VolumeHandle == INVALID_HANDLE_VALUE) {
     fprintf (
-      stderr, 
-      "error E0005: CreateFile failed: Volume = %s, LastError = 0x%lx\n", 
-      VolumeAccessPath, 
+      stderr,
+      "error E0005: CreateFile failed: Volume = %s, LastError = 0x%lx\n",
+      VolumeAccessPath,
       GetLastError ()
       );
     return FALSE;
   }
 
   //
-  // Get Disk Number. It should fail when operating on floppy. That's ok 
+  // Get Disk Number. It should fail when operating on floppy. That's ok
   //  because Disk Number is only needed when operating on Hard or USB disk.
   //
   // To direct write to disk:
@@ -183,13 +183,13 @@ Return:
   //   for floppy:     use path = \\.\X:, where X can be A or B
   //
   Success = DeviceIoControl(
-              VolumeHandle, 
+              VolumeHandle,
               IOCTL_STORAGE_GET_DEVICE_NUMBER,
-              NULL, 
-              0, 
-              &StorageDeviceNumber, 
+              NULL,
+              0,
+              &StorageDeviceNumber,
               sizeof(StorageDeviceNumber),
-              &BytesReturned, 
+              &BytesReturned,
               NULL
               );
   //
@@ -207,7 +207,7 @@ Return:
     DriveInfo->DiskNumber = StorageDeviceNumber.DeviceNumber;
   }
   CloseHandle(VolumeHandle);
-  
+
   //
   // Fill in the type string
   //
@@ -241,7 +241,7 @@ Routine Description:
 {
   UINT       Index;
   DRIVE_INFO DriveInfo;
-  
+
   UINT Mask =  GetLogicalDrives();
 
   for (Index = 0; Index < MAX_DRIVE; Index++) {
@@ -258,9 +258,9 @@ Routine Description:
         } else {
           fprintf (
             stdout,
-            "%c: - DiskNum: %u, Type: %s\n", 
+            "%c: - DiskNum: %u, Type: %s\n",
             DriveInfo.VolumeLetter,
-            (unsigned) DriveInfo.DiskNumber, 
+            (unsigned) DriveInfo.DiskNumber,
             DriveInfo.DriveType->Description
             );
         }
@@ -301,7 +301,7 @@ Return:
 
   DbrOffset = 0;
   HasMbr    = FALSE;
-  
+
   SetFilePointer(DiskHandle, 0, NULL, FILE_BEGIN);
   if (!ReadFile (DiskHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
     return -1;
@@ -359,12 +359,12 @@ Return:
 }
 
 /**
- * Get window file handle for input/ouput disk/file. 
- *  
+ * Get window file handle for input/ouput disk/file.
+ *
  * @param PathInfo
  * @param ProcessMbr
  * @param FileHandle
- * 
+ *
  * @return ERROR_STATUS
  */
 ERROR_STATUS
@@ -384,11 +384,11 @@ GetFileHandle (
 
   *FileHandle = CreateFile(
                    PathInfo->PhysicalPath,
-                   GENERIC_READ | GENERIC_WRITE, 
-                   FILE_SHARE_READ, 
-                   NULL, 
-                   OpenFlag, 
-                   FILE_ATTRIBUTE_NORMAL, 
+                   GENERIC_READ | GENERIC_WRITE,
+                   FILE_SHARE_READ,
+                   NULL,
+                   OpenFlag,
+                   FILE_ATTRIBUTE_NORMAL,
                    NULL
                    );
   if (*FileHandle == INVALID_HANDLE_VALUE) {
@@ -419,19 +419,19 @@ GetFileHandle (
 }
 
 /**
-  Writing or reading boot sector or MBR according to the argument. 
-   
+  Writing or reading boot sector or MBR according to the argument.
+
   @param InputInfo PATH_INFO instance for input path
   @param OutputInfo PATH_INFO instance for output path
   @param ProcessMbr TRUE is to process MBR, otherwise, processing boot sector
-  
+
   @return ERROR_STATUS
  **/
 ERROR_STATUS
 ProcessBsOrMbr (
   PATH_INFO     *InputInfo,
   PATH_INFO     *OutputInfo,
-  BOOL        	ProcessMbr
+  BOOL          ProcessMbr
   )
 {
   BYTE              DiskPartition[0x200] = {0};
@@ -462,14 +462,14 @@ ProcessBsOrMbr (
 
   //
   // Read boot sector from source disk/file
-  // 
+  //
   if (!ReadFile (InputHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
     Status = ErrorFileReadWrite;
     goto Done;
   }
 
   if (InputInfo->Type == PathUsb) {
-      // Manually set BS_DrvNum to 0x80 as window's format.exe has a bug which will clear this field discarding USB disk's MBR. 
+      // Manually set BS_DrvNum to 0x80 as window's format.exe has a bug which will clear this field discarding USB disk's MBR.
       // offset of BS_DrvNum is 0x24 for FAT12/16
       //                        0x40 for FAT32
       //
@@ -509,7 +509,7 @@ ProcessBsOrMbr (
 
   //
   // Write boot sector to taget disk/file
-  // 
+  //
   if (!WriteFile (OutputHandle, DiskPartition, 0x200, &BytesReturn, NULL)) {
     Status = ErrorFileReadWrite;
     goto Done;
@@ -555,7 +555,7 @@ PrintUsage (
   )
 {
   printf ("Usage: GenBootSector [options] --cfg-file CFG_FILE\n\n\
-Copyright (c) 2009 - 2014, Intel Corporation.  All rights reserved.\n\n\
+Copyright (c) 2009 - 2018, Intel Corporation.  All rights reserved.\n\n\
   Utility to retrieve and update the boot sector or MBR.\n\n\
 optional arguments:\n\
   -h, --help            Show this help message and exit\n\
@@ -601,7 +601,7 @@ GetPathInfo (
   //
   if (IsLetter(PathInfo->Path[0]) && (PathInfo->Path[1] == ':') && (PathInfo->Path[2] == '\0')) {
     VolumeLetter = PathInfo->Path[0];
-    if ((VolumeLetter == 'A') || (VolumeLetter == 'a') || 
+    if ((VolumeLetter == 'A') || (VolumeLetter == 'a') ||
         (VolumeLetter == 'B') || (VolumeLetter == 'b')) {
       PathInfo->Type = PathFloppy;
       sprintf (PathInfo->PhysicalPath, FloppyPathTemplate, VolumeLetter);
@@ -628,8 +628,8 @@ GetPathInfo (
       return ErrorPath;
     }
 
-	return ErrorSuccess;
-  } 
+  return ErrorSuccess;
+  }
 
   //
   // Check the path length
@@ -660,7 +660,7 @@ GetPathInfo (
   PathInfo->PhysicalPath[sizeof (PathInfo->PhysicalPath) / sizeof (PathInfo->PhysicalPath[0]) - 1] = 0;
 
   return ErrorSuccess;
-}    
+}
 
 INT
 main (
@@ -682,14 +682,14 @@ main (
   AppName = *argv;
   argv ++;
   argc --;
-  
+
   ProcessMbr    = FALSE;
 
   if (argc == 0) {
     PrintUsage();
     return 0;
   }
-   
+
   //
   // Parse command line
   //
@@ -697,23 +697,23 @@ main (
     if ((stricmp (argv[Index], "-l") == 0) || (stricmp (argv[Index], "--list") == 0)) {
       ListDrive ();
       return 0;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-m") == 0) || (stricmp (argv[Index], "--mbr") == 0)) {
       ProcessMbr = TRUE;
       continue;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-i") == 0) || (stricmp (argv[Index], "--input") == 0)) {
       InputPathInfo.Path  = argv[Index + 1];
       InputPathInfo.Input = TRUE;
       if (InputPathInfo.Path == NULL) {
         Error (NULL, 0, 1003, "Invalid option value", "Input file name can't be NULL");
         return 1;
-      } 
+      }
       if (InputPathInfo.Path[0] == '-') {
         Error (NULL, 0, 1003, "Invalid option value", "Input file is missing");
-        return 1;       
+        return 1;
       }
       ++Index;
       continue;
@@ -725,33 +725,33 @@ main (
       if (OutputPathInfo.Path == NULL) {
         Error (NULL, 0, 1003, "Invalid option value", "Output file name can't be NULL");
         return 1;
-      } 
+      }
       if (OutputPathInfo.Path[0] == '-') {
         Error (NULL, 0, 1003, "Invalid option value", "Output file is missing");
-        return 1;       
+        return 1;
       }
       ++Index;
       continue;
     }
-    
+
     if ((stricmp (argv[Index], "-h") == 0) || (stricmp (argv[Index], "--help") == 0)) {
       PrintUsage ();
       return 0;
-    } 
-    
+    }
+
     if (stricmp (argv[Index], "--version") == 0) {
       Version ();
       return 0;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
       continue;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-q") == 0) || (stricmp (argv[Index], "--quiet") == 0)) {
       continue;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-d") == 0) || (stricmp (argv[Index], "--debug") == 0)) {
       EfiStatus = AsciiStringToUint64 (argv[Index + 1], FALSE, &LogLevel);
       if (EFI_ERROR (EfiStatus)) {
@@ -774,7 +774,7 @@ main (
     Error (NULL, 0, 1000, "Unknown option", "%s", argv[Index]);
     return 1;
   }
-  
+
   if (InputPathInfo.Path == NULL) {
     Error (NULL, 0, 1001, "Missing options", "Input file is missing");
     return 1;
@@ -784,7 +784,7 @@ main (
     Error (NULL, 0, 1001, "Missing options", "Output file is missing");
     return 1;
   }
-  
+
   if (GetPathInfo(&InputPathInfo) != ErrorSuccess) {
     Error (NULL, 0, 1003, "Invalid option value", "Input file can't be found.");
     return 1;
@@ -794,7 +794,7 @@ main (
     Error (NULL, 0, 1003, "Invalid option value", "Output file can't be found.");
     return 1;
   }
-  
+
   //
   // Process DBR (Patch or Read)
   //
@@ -802,19 +802,19 @@ main (
 
   if (Status == ErrorSuccess) {
     fprintf (
-      stdout, 
-      "%s %s: successful!\n", 
-      (OutputPathInfo.Type != PathFile) ? "Write" : "Read", 
+      stdout,
+      "%s %s: successful!\n",
+      (OutputPathInfo.Type != PathFile) ? "Write" : "Read",
       ProcessMbr ? "MBR" : "DBR"
       );
     return 0;
   } else {
     fprintf (
-      stderr, 
+      stderr,
       "%s: %s %s: failed - %s (LastError: 0x%lx)!\n",
       (Status == ErrorNoMbr) ? "WARNING" : "ERROR",
-      (OutputPathInfo.Type != PathFile) ? "Write" : "Read", 
-      ProcessMbr ? "MBR" : "DBR", 
+      (OutputPathInfo.Type != PathFile) ? "Write" : "Read",
+      ProcessMbr ? "MBR" : "DBR",
       ErrorStatusDesc[Status],
       GetLastError ()
       );

+ 8 - 8
BaseTools/Source/C/GenBootSector/GetDrvNumOffset.c

@@ -2,14 +2,14 @@
 
   Get Drv Num offset from Fat file system.
 
-Copyright (c) 2006 - 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.             
+Copyright (c) 2006 - 2018, 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.
 
 **/
 

+ 31 - 31
BaseTools/Source/C/GenCrc32/GenCrc32.c

@@ -1,14 +1,14 @@
 /** @file
 Calculate Crc32 value and Verify Crc32 value for input data.
 
-Copyright (c) 2007 - 2017, 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.             
+Copyright (c) 2007 - 2018, 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.
 
 **/
 
@@ -27,7 +27,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 #define CRC32_NULL              0
 #define CRC32_ENCODE            1
-#define CRC32_DECODE            2 
+#define CRC32_DECODE            2
 
 VOID
 Version (
@@ -76,11 +76,11 @@ Returns:
   // Summary usage
   //
   fprintf (stdout, "Usage: GenCrc32 -e|-d [options] <input_file>\n\n");
-  
+
   //
   // Copyright declaration
-  // 
-  fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
+  //
+  fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
 
   //
   // Details Option
@@ -100,7 +100,7 @@ Returns:
   fprintf (stdout, "  -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\
                         Output file name\n");
   fprintf (stdout, "  --sfo                 Reserved for future use\n");
-  
+
 }
 
 int
@@ -135,7 +135,7 @@ Returns:
   UINT32                  Crc32Value;
   FILE                    *InFile;
   FILE                    *OutFile;
-  
+
   //
   // Init local variables
   //
@@ -165,12 +165,12 @@ Returns:
 
   if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
     Usage ();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   if (stricmp (argv[0], "--version") == 0) {
     Version ();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   while (argc > 0) {
@@ -182,21 +182,21 @@ Returns:
       OutputFileName = argv[1];
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-e") == 0) || (stricmp (argv[0], "--encode") == 0)) {
       FileAction     = CRC32_ENCODE;
       argc --;
       argv ++;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--decode") == 0)) {
       FileAction     = CRC32_DECODE;
       argc --;
       argv ++;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
@@ -246,7 +246,7 @@ Returns:
   }
 
   VerboseMsg ("%s tool start.", UTILITY_NAME);
-  
+
   //
   // Check Input parameters
   //
@@ -258,7 +258,7 @@ Returns:
   } else if (FileAction == CRC32_DECODE) {
     VerboseMsg ("File will be decoded by Crc32");
   }
-  
+
   if (InputFileName == NULL) {
     Error (NULL, 0, 1001, "Missing option", "Input files are not specified");
     goto Finish;
@@ -272,7 +272,7 @@ Returns:
   } else {
     VerboseMsg ("Output file name is %s", OutputFileName);
   }
-  
+
   //
   // Open Input file and read file data.
   //
@@ -285,18 +285,18 @@ Returns:
   fseek (InFile, 0, SEEK_END);
   FileSize = ftell (InFile);
   fseek (InFile, 0, SEEK_SET);
-  
+
   FileBuffer = (UINT8 *) malloc (FileSize);
   if (FileBuffer == NULL) {
     Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated!");
     fclose (InFile);
     goto Finish;
   }
-  
+
   fread (FileBuffer, 1, FileSize, InFile);
   fclose (InFile);
   VerboseMsg ("the size of the input file is %u bytes", (unsigned) FileSize);
-  
+
   //
   // Open output file
   //
@@ -305,7 +305,7 @@ Returns:
     Error (NULL, 0, 0001, "Error opening file", OutputFileName);
     goto Finish;
   }
-  
+
   //
   // Calculate Crc32 value
   //
@@ -352,16 +352,16 @@ Finish:
   if (FileBuffer != NULL) {
     free (FileBuffer);
   }
-  
+
   if (OutFile != NULL) {
     fclose (OutFile);
   }
-  
+
   VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
 
   return GetUtilityStatus ();
 }
 
-  
-  
-  
+
+
+

+ 64 - 64
BaseTools/Source/C/GenFfs/GenFfs.c

@@ -1,14 +1,14 @@
 /** @file
 This file contains functions required to generate a Firmware File System file.
 
-Copyright (c) 2004 - 2017, 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.             
+Copyright (c) 2004 - 2018, 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.
 
 **/
 
@@ -76,7 +76,7 @@ STATIC EFI_GUID mZeroGuid = {0};
 STATIC EFI_GUID mEfiFfsSectionAlignmentPaddingGuid = EFI_FFS_SECTION_ALIGNMENT_PADDING_GUID;
 
 STATIC
-VOID 
+VOID
 Version (
   VOID
   )
@@ -89,12 +89,12 @@ Routine Description:
 Arguments:
 
   None
-  
+
 Returns:
 
   None
-  
---*/ 
+
+--*/
 {
   fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
 }
@@ -124,11 +124,11 @@ Returns:
   // Summary usage
   //
   fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
-  
+
   //
   // Copyright declaration
-  // 
-  fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
+  //
+  fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
 
   //
   // Details Option
@@ -236,7 +236,7 @@ Returns:
 --*/
 {
   UINT8 Index = 0;
-  
+
   if (String == NULL) {
     return EFI_FV_FILETYPE_ALL;
   }
@@ -262,31 +262,31 @@ GetSectionContents (
   OUT UINT8                     *PESectionNum
   )
 /*++
-        
+
 Routine Description:
-           
+
   Get the contents of all section files specified in InputFileName
   into FileBuffer.
-            
+
 Arguments:
-               
+
   InputFileName  - Name of the input file.
-                
+
   InputFileAlign - Alignment required by the input file data.
 
   InputFileNum   - Number of input files. Should be at least 1.
 
   FileBuffer     - Output buffer to contain data
 
-  BufferLength   - On input, this is size of the FileBuffer. 
+  BufferLength   - On input, this is size of the FileBuffer.
                    On output, this is the actual length of the data.
 
   MaxAlignment   - The max alignment required by all the input file datas.
-  
+
   PeSectionNum   - Calculate the number of Pe/Te Section in this FFS file.
 
 Returns:
-                       
+
   EFI_SUCCESS on successful return
   EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
   EFI_ABORTED if unable to open input file.
@@ -323,8 +323,8 @@ Returns:
     while ((Size & 0x03) != 0) {
       Size++;
     }
-    
-    // 
+
+    //
     // Open file and read contents
     //
     InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
@@ -336,8 +336,8 @@ Returns:
     fseek (InFile, 0, SEEK_END);
     FileSize = ftell (InFile);
     fseek (InFile, 0, SEEK_SET);
-    DebugMsg (NULL, 0, 9, "Input section files", 
-              "the input section name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize); 
+    DebugMsg (NULL, 0, 9, "Input section files",
+              "the input section name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
 
     //
     // Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
@@ -371,10 +371,10 @@ Returns:
         }
       }
       (*PESectionNum) ++;
-    } else if (TempSectHeader.Type == EFI_SECTION_COMPRESSION || 
+    } else if (TempSectHeader.Type == EFI_SECTION_COMPRESSION ||
                TempSectHeader.Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
       //
-      // for the encapsulated section, assume it contains Pe/Te section 
+      // for the encapsulated section, assume it contains Pe/Te section
       //
       (*PESectionNum) ++;
     }
@@ -398,7 +398,7 @@ Returns:
     if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
       Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
       Offset = Offset - Size - HeaderSize - TeOffset;
-       
+
       if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
         //
         // The maximal alignment is 64K, the raw section size must be less than 0xffffff
@@ -425,7 +425,7 @@ Returns:
           SectHeader->CommonHeader.Type   = EFI_SECTION_RAW;
         }
       }
-      DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment", 
+      DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment",
                 "Pad Raw section size is %u", (unsigned) Offset);
 
       Size = Size + Offset;
@@ -612,13 +612,13 @@ Returns:
   // unsigned 32-bit integer plus the size unit character.
   //
   CHAR8                   AlignmentBuffer[16];
-  
+
   //
   // Init local variables
   //
   LogLevel       = 0;
   Index          = 0;
-  FfsAttrib      = 0;  
+  FfsAttrib      = 0;
   FfsAlign       = 0;
   FfsFiletype    = EFI_FV_FILETYPE_ALL;
   OutputFileName = NULL;
@@ -649,12 +649,12 @@ Returns:
   if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
     Version ();
     Usage ();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   if (stricmp (argv[0], "--version") == 0) {
     Version ();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   while (argc > 0) {
@@ -670,7 +670,7 @@ Returns:
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
@@ -681,7 +681,7 @@ Returns:
       OutputFileName = argv[1];
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--fileguid") == 0)) {
@@ -755,7 +755,7 @@ Returns:
           return STATUS_ERROR;
         }
         memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
-        
+
         InputFileAlign = (UINT32 *) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
         if (InputFileAlign == NULL) {
           Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
@@ -771,7 +771,7 @@ Returns:
                                     InputFileName,
                                     (InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (CHAR8 *)
                                     );
-  
+
         if (InputFileName == NULL) {
           Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
           free (InputFileAlign);
@@ -783,7 +783,7 @@ Returns:
                                     InputFileAlign,
                                     (InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (UINT32)
                                     );
-  
+
         if (InputFileAlign == NULL) {
           Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
           free (InputFileName);
@@ -791,16 +791,16 @@ Returns:
         }
         memset (&(InputFileAlign[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32)));
       }
-  
+
       InputFileName[InputFileNum] = argv[1];
       argc -= 2;
       argv += 2;
 
       if (argc <= 0) {
-	      InputFileNum ++;
+        InputFileNum ++;
         break;
       }
-      
+
       //
       // Section File alignment requirement
       //
@@ -834,7 +834,7 @@ Returns:
         argv += 2;
       }
       InputFileNum ++;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--sectionalign") == 0)) {
@@ -886,25 +886,25 @@ Returns:
   //
   if (FfsFiletype == EFI_FV_FILETYPE_ALL) {
     Error (NULL, 0, 1001, "Missing option", "filetype");
-    goto Finish;      
+    goto Finish;
   }
 
   if (CompareGuid (&FileGuid, &mZeroGuid) == 0) {
     Error (NULL, 0, 1001, "Missing option", "fileguid");
-    goto Finish;    
+    goto Finish;
   }
 
   if (InputFileNum == 0) {
     Error (NULL, 0, 1001, "Missing option", "Input files");
     goto Finish;
   }
-  
+
   //
   // Output input parameter information
   //
   VerboseMsg ("Fv File type is %s", mFfsFileType [FfsFiletype]);
   VerboseMsg ("Output file name is %s", OutputFileName);
-  VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", 
+  VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
                 (unsigned) FileGuid.Data1,
                 FileGuid.Data2,
                 FileGuid.Data3,
@@ -932,10 +932,10 @@ Returns:
     }
     VerboseMsg ("the %dth input section name is %s and section alignment is %u", Index, InputFileName[Index], (unsigned) InputFileAlign[Index]);
   }
-  
+
   //
   // Calculate the size of all input section files.
-  //  
+  //
   Status = GetSectionContents (
              InputFileName,
              InputFileAlign,
@@ -946,20 +946,20 @@ Returns:
              &MaxAlignment,
              &PeSectionNum
              );
-  
-  if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE || 
+
+  if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE ||
       FfsFiletype == EFI_FV_FILETYPE_PEI_CORE ||
       FfsFiletype == EFI_FV_FILETYPE_DXE_CORE) && (PeSectionNum != 1)) {
     Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %u Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);
     goto Finish;
   }
-  
+
   if ((FfsFiletype == EFI_FV_FILETYPE_PEIM ||
       FfsFiletype == EFI_FV_FILETYPE_DRIVER ||
       FfsFiletype == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER ||
       FfsFiletype == EFI_FV_FILETYPE_APPLICATION) && (PeSectionNum < 1)) {
     Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have at least one Pe or Te section, but no Pe/Te section is input", mFfsFileType [FfsFiletype]);
-    goto Finish;   
+    goto Finish;
   }
 
   if (Status == EFI_BUFFER_TOO_SMALL) {
@@ -969,7 +969,7 @@ Returns:
       goto Finish;
     }
     memset (FileBuffer, 0, FileSize);
-    
+
     //
     // read all input file contents into a buffer
     //
@@ -993,7 +993,7 @@ Returns:
     Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
     goto Finish;
   }
-  
+
   //
   // Create Ffs file header.
   //
@@ -1001,9 +1001,9 @@ Returns:
   memcpy (&FfsFileHeader.Name, &FileGuid, sizeof (EFI_GUID));
   FfsFileHeader.Type       = FfsFiletype;
   //
-  // Update FFS Alignment based on the max alignment required by input section files 
+  // Update FFS Alignment based on the max alignment required by input section files
   //
-  VerboseMsg ("the max alignment of all input sections is %u", (unsigned) MaxAlignment); 
+  VerboseMsg ("the max alignment of all input sections is %u", (unsigned) MaxAlignment);
   for (Index = 0; Index < sizeof (mFfsValidAlign) / sizeof (UINT32) - 1; Index ++) {
     if ((MaxAlignment > mFfsValidAlign [Index]) && (MaxAlignment <= mFfsValidAlign [Index + 1])) {
       break;
@@ -1012,8 +1012,8 @@ Returns:
   if (FfsAlign < Index) {
     FfsAlign = Index;
   }
-  VerboseMsg ("the alignment of the generated FFS file is %u", (unsigned) mFfsValidAlign [FfsAlign + 1]);  
-  
+  VerboseMsg ("the alignment of the generated FFS file is %u", (unsigned) mFfsValidAlign [FfsAlign + 1]);
+
   //
   // Now FileSize includes the EFI_FFS_FILE_HEADER
   //
@@ -1056,15 +1056,15 @@ Returns:
     // Ffs header checksum = zero, so only need to calculate ffs body.
     //
     FfsFileHeader.IntegrityCheck.Checksum.File = CalculateChecksum8 (
-                                                   FileBuffer, 
+                                                   FileBuffer,
                                                    FileSize - HeaderSize
-                                                   );    
+                                                   );
   } else {
     FfsFileHeader.IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
   }
 
   FfsFileHeader.State = EFI_FILE_HEADER_CONSTRUCTION | EFI_FILE_HEADER_VALID | EFI_FILE_DATA_VALID;
-  
+
   //
   // Open output file to write ffs data.
   //

+ 70 - 70
BaseTools/Source/C/GenFv/GenFv.c

@@ -1,17 +1,17 @@
 /** @file
-  This contains all code necessary to build the GenFvImage.exe utility.       
+  This contains all code necessary to build the GenFvImage.exe utility.
   This utility relies heavily on the GenFvImage Lib.  Definitions for both
-  can be found in the Tiano Firmware Volume Generation Utility 
+  can be found in the Tiano Firmware Volume Generation Utility
   Specification, review draft.
 
-Copyright (c) 2007 - 2017, 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.             
+Copyright (c) 2007 - 2018, 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.
 
 **/
 
@@ -38,7 +38,7 @@ EFI_GUID  mEfiFirmwareFileSystem2Guid = EFI_FIRMWARE_FILE_SYSTEM2_GUID;
 EFI_GUID  mEfiFirmwareFileSystem3Guid = EFI_FIRMWARE_FILE_SYSTEM3_GUID;
 
 STATIC
-VOID 
+VOID
 Version (
   VOID
 )
@@ -62,7 +62,7 @@ Returns:
 }
 
 STATIC
-VOID 
+VOID
 Usage (
   VOID
   )
@@ -86,11 +86,11 @@ Returns:
   // Summary usage
   //
   fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);
-  
+
   //
   // Copyright declaration
-  // 
-  fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
+  //
+  fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
 
   //
   // Details Option
@@ -128,7 +128,7 @@ Returns:
                         FV base address when current FV base address is set.\n");
   fprintf (stdout, "  -m logfile, --map logfile\n\
                         Logfile is the output fv map file name. if it is not\n\
-                        given, the FvName.map will be the default map file name\n"); 
+                        given, the FvName.map will be the default map file name\n");
   fprintf (stdout, "  -g Guid, --guid Guid\n\
                         GuidValue is one specific capsule guid value\n\
                         or fv file system guid value.\n\
@@ -141,7 +141,7 @@ Returns:
                         Capsule OEM Flag is an integer between 0x0000 and 0xffff\n");
   fprintf (stdout, "  --capheadsize HeadSize\n\
                         HeadSize is one HEX or DEC format value\n\
-                        HeadSize is required by Capsule Image.\n");                        
+                        HeadSize is required by Capsule Image.\n");
   fprintf (stdout, "  -c, --capsule         Create Capsule Image.\n");
   fprintf (stdout, "  -p, --dump            Dump Capsule Image header.\n");
   fprintf (stdout, "  -v, --verbose         Turn on verbose output with informational messages.\n");
@@ -170,14 +170,14 @@ Arguments:
   FvInfFileName      The name of an FV image description file or Capsule Image.
 
   Arguments come in pair in any order.
-    -I FvInfFileName 
+    -I FvInfFileName
 
 Returns:
 
   EFI_SUCCESS            No error conditions detected.
   EFI_INVALID_PARAMETER  One or more of the input parameters is invalid.
-  EFI_OUT_OF_RESOURCES   A resource required by the utility was unavailable.  
-                         Most commonly this will be memory allocation 
+  EFI_OUT_OF_RESOURCES   A resource required by the utility was unavailable.
+                         Most commonly this will be memory allocation
                          or file creation.
   EFI_LOAD_ERROR         GenFvImage.lib could not be loaded.
   EFI_ABORTED            Error executing the GenFvImage lib.
@@ -216,7 +216,7 @@ Returns:
   Status        = EFI_SUCCESS;
 
   SetUtilityName (UTILITY_NAME);
-  
+
   if (argc == 1) {
     Error (NULL, 0, 1001, "Missing options", "No input options specified.");
     Usage ();
@@ -227,13 +227,13 @@ Returns:
   // Init global data to Zero
   //
   memset (&mFvDataInfo, 0, sizeof (FV_INFO));
-  memset (&mCapDataInfo, 0, sizeof (CAP_INFO)); 
+  memset (&mCapDataInfo, 0, sizeof (CAP_INFO));
   //
   // Set the default FvGuid
   //
   memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));
   mFvDataInfo.ForceRebase = -1;
-   
+
   //
   // Parse command line
   //
@@ -243,12 +243,12 @@ Returns:
   if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
     Version ();
     Usage ();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   if (stricmp (argv[0], "--version") == 0) {
     Version ();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   while (argc > 0) {
@@ -260,7 +260,7 @@ Returns:
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-a") == 0) || (stricmp (argv[0], "--addrfile") == 0)) {
@@ -271,7 +271,7 @@ Returns:
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
@@ -282,54 +282,54 @@ Returns:
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {
       Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
       if (EFI_ERROR (Status)) {
         Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
-        return STATUS_ERROR;        
+        return STATUS_ERROR;
       }
       mFvDataInfo.BaseAddress    = TempNumber;
       mFvDataInfo.BaseAddressSet = TRUE;
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--blocksize") == 0)) {
       Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
       if (EFI_ERROR (Status)) {
         Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
-        return STATUS_ERROR;        
+        return STATUS_ERROR;
       }
       if (TempNumber == 0) {
         Error (NULL, 0, 1003, "Invalid option value", "Fv block size can't be be set to zero");
-        return STATUS_ERROR;        
+        return STATUS_ERROR;
       }
       mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber;
       DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%llx", EFI_BLOCK_SIZE_STRING, (unsigned long long) TempNumber);
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--numberblock") == 0)) {
       Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
       if (EFI_ERROR (Status)) {
         Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
-        return STATUS_ERROR;        
+        return STATUS_ERROR;
       }
       if (TempNumber == 0) {
         Error (NULL, 0, 1003, "Invalid option value", "Fv block number can't be set to zero");
-        return STATUS_ERROR;        
+        return STATUS_ERROR;
       }
       mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber;
       DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%llx", EFI_NUM_BLOCKS_STRING, (unsigned long long) TempNumber);
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((strcmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {
@@ -348,38 +348,38 @@ Returns:
       argv += 2;
 
       if (argc > 0) {
-		    if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
-		      if (argv[1] == NULL) {
-		        Error (NULL, 0, 1003, "Invalid option value", "Ffsfile Size can't be null");
-		        return STATUS_ERROR;
-		      }
-		      Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
-		      if (EFI_ERROR (Status)) {
-		        Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
-		        return STATUS_ERROR;        
-		      }
-		      mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;
-	      	DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);
-	      	argc -= 2;
-	      	argv += 2;
+        if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
+          if (argv[1] == NULL) {
+            Error (NULL, 0, 1003, "Invalid option value", "Ffsfile Size can't be null");
+            return STATUS_ERROR;
+          }
+          Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
+          if (EFI_ERROR (Status)) {
+            Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
+            return STATUS_ERROR;
+          }
+          mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;
+          DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);
+          argc -= 2;
+          argv += 2;
         }
       }
       Index ++;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {
       Error (NULL, 0, 1003, "Invalid option", "It must be specified together with -f option to specify the file size.");
-      return STATUS_ERROR; 
+      return STATUS_ERROR;
     }
 
     if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--capsule") == 0)) {
       CapsuleFlag = TRUE;
       argc --;
       argv ++;
-      continue; 
+      continue;
     }
-  
+
     if ((strcmp (argv[0], "-F") == 0) || (stricmp (argv[0], "--force-rebase") == 0)) {
       if (argv[1] == NULL) {
         Error (NULL, 0, 1003, "Invalid option value", "Froce rebase flag can't be null");
@@ -397,8 +397,8 @@ Returns:
 
       argc -= 2;
       argv += 2;
-      continue; 
-    } 
+      continue;
+    }
 
     if (stricmp (argv[0], "--capheadsize") == 0) {
       //
@@ -407,13 +407,13 @@ Returns:
       Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);
       if (EFI_ERROR (Status)) {
         Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
-        return STATUS_ERROR;        
+        return STATUS_ERROR;
       }
       mCapDataInfo.HeaderSize = (UINT32) TempNumber;
       DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%llx", EFI_CAPSULE_HEADER_SIZE_STRING, (unsigned long long) TempNumber);
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if (stricmp (argv[0], "--capflag") == 0) {
@@ -437,7 +437,7 @@ Returns:
       DebugMsg (NULL, 0, 9, "Capsule Flag", argv[1]);
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if (stricmp (argv[0], "--capoemflag") == 0) {
@@ -468,7 +468,7 @@ Returns:
       DebugMsg (NULL, 0, 9, "Capsule Guid", "%s = %s", EFI_CAPSULE_GUID_STRING, argv[1]);
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--guid") == 0)) {
@@ -486,7 +486,7 @@ Returns:
       DebugMsg (NULL, 0, 9, "FV Guid", "%s = %s", EFI_FV_FILESYSTEMGUID_STRING, argv[1]);
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if (stricmp (argv[0], "--FvNameGuid") == 0) {
@@ -502,14 +502,14 @@ Returns:
       DebugMsg (NULL, 0, 9, "FV Name Guid", "%s = %s", EFI_FV_NAMEGUID_STRING, argv[1]);
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--dump") == 0)) {
       DumpCapsule = TRUE;
       argc --;
       argv ++;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-m") == 0) || (stricmp (argv[0], "--map") == 0)) {
@@ -520,7 +520,7 @@ Returns:
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {
@@ -564,7 +564,7 @@ Returns:
   }
 
   VerboseMsg ("%s tool start.", UTILITY_NAME);
-  
+
   //
   // check input parameter, InfFileName can be NULL
   //
@@ -581,7 +581,7 @@ Returns:
   if (OutFileName != NULL) {
     VerboseMsg ("the output file name is %s", OutFileName);
   }
-  
+
   //
   // Read the INF file image
   //
@@ -591,7 +591,7 @@ Returns:
       return STATUS_ERROR;
     }
   }
-  
+
   if (DumpCapsule) {
     VerboseMsg ("Dump the capsule header information for the input capsule image %s", InfFileName);
     //
@@ -636,7 +636,7 @@ Returns:
     }
 
     Status = GenerateCapImage (
-              InfFileImage, 
+              InfFileImage,
               InfFileSize,
               OutFileName
               );
@@ -667,7 +667,7 @@ Returns:
   if (InfFileImage != NULL) {
     free (InfFileImage);
   }
-  
+
   //
   //  update boot driver address and runtime driver address in address file
   //
@@ -689,7 +689,7 @@ Returns:
     fflush (FpFile);
     fclose (FpFile);
   }
-  
+
   if (Status == EFI_SUCCESS) {
     DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
     DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);

File diff suppressed because it is too large
+ 185 - 185
BaseTools/Source/C/GenFv/GenFvInternalLib.c


+ 45 - 45
BaseTools/Source/C/GenFv/GenFvInternalLib.h

@@ -1,15 +1,15 @@
 /** @file
 This file contains describes the public interfaces to the GenFvImage Library.
 The basic purpose of the library is to create Firmware Volume images.
-  
-Copyright (c) 2004 - 2014, 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.             
+
+Copyright (c) 2004 - 2018, 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.
 
 **/
 
@@ -71,7 +71,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define EFI_BLOCK_SIZE_STRING             "EFI_BLOCK_SIZE"
 #define EFI_GUID_STRING                   "EFI_GUID"
 #define EFI_FV_FILESYSTEMGUID_STRING      "EFI_FV_GUID"
-#define EFI_FV_NAMEGUID_STRING            "EFI_FVNAME_GUID" 
+#define EFI_FV_NAMEGUID_STRING            "EFI_FVNAME_GUID"
 #define EFI_CAPSULE_GUID_STRING           "EFI_CAPSULE_GUID"
 #define EFI_CAPSULE_HEADER_SIZE_STRING    "EFI_CAPSULE_HEADER_SIZE"
 #define EFI_CAPSULE_FLAGS_STRING          "EFI_CAPSULE_FLAGS"
@@ -105,38 +105,38 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define EFI_FVB2_WRITE_LOCK_CAP_STRING     "EFI_WRITE_LOCK_CAP"
 #define EFI_FVB2_WRITE_LOCK_STATUS_STRING  "EFI_WRITE_LOCK_STATUS"
 
-#define EFI_FVB2_ALIGNMENT_1_STRING       "EFI_FVB2_ALIGNMENT_1"   
-#define EFI_FVB2_ALIGNMENT_2_STRING       "EFI_FVB2_ALIGNMENT_2"   
-#define EFI_FVB2_ALIGNMENT_4_STRING       "EFI_FVB2_ALIGNMENT_4"   
-#define EFI_FVB2_ALIGNMENT_8_STRING       "EFI_FVB2_ALIGNMENT_8"   
-#define EFI_FVB2_ALIGNMENT_16_STRING      "EFI_FVB2_ALIGNMENT_16"  
-#define EFI_FVB2_ALIGNMENT_32_STRING      "EFI_FVB2_ALIGNMENT_32"  
-#define EFI_FVB2_ALIGNMENT_64_STRING      "EFI_FVB2_ALIGNMENT_64"  
-#define EFI_FVB2_ALIGNMENT_128_STRING     "EFI_FVB2_ALIGNMENT_128" 
-#define EFI_FVB2_ALIGNMENT_256_STRING     "EFI_FVB2_ALIGNMENT_256" 
-#define EFI_FVB2_ALIGNMENT_512_STRING     "EFI_FVB2_ALIGNMENT_512" 
-#define EFI_FVB2_ALIGNMENT_1K_STRING      "EFI_FVB2_ALIGNMENT_1K"  
-#define EFI_FVB2_ALIGNMENT_2K_STRING      "EFI_FVB2_ALIGNMENT_2K"  
-#define EFI_FVB2_ALIGNMENT_4K_STRING      "EFI_FVB2_ALIGNMENT_4K"  
-#define EFI_FVB2_ALIGNMENT_8K_STRING      "EFI_FVB2_ALIGNMENT_8K"  
-#define EFI_FVB2_ALIGNMENT_16K_STRING     "EFI_FVB2_ALIGNMENT_16K" 
-#define EFI_FVB2_ALIGNMENT_32K_STRING     "EFI_FVB2_ALIGNMENT_32K" 
-#define EFI_FVB2_ALIGNMENT_64K_STRING     "EFI_FVB2_ALIGNMENT_64K" 
+#define EFI_FVB2_ALIGNMENT_1_STRING       "EFI_FVB2_ALIGNMENT_1"
+#define EFI_FVB2_ALIGNMENT_2_STRING       "EFI_FVB2_ALIGNMENT_2"
+#define EFI_FVB2_ALIGNMENT_4_STRING       "EFI_FVB2_ALIGNMENT_4"
+#define EFI_FVB2_ALIGNMENT_8_STRING       "EFI_FVB2_ALIGNMENT_8"
+#define EFI_FVB2_ALIGNMENT_16_STRING      "EFI_FVB2_ALIGNMENT_16"
+#define EFI_FVB2_ALIGNMENT_32_STRING      "EFI_FVB2_ALIGNMENT_32"
+#define EFI_FVB2_ALIGNMENT_64_STRING      "EFI_FVB2_ALIGNMENT_64"
+#define EFI_FVB2_ALIGNMENT_128_STRING     "EFI_FVB2_ALIGNMENT_128"
+#define EFI_FVB2_ALIGNMENT_256_STRING     "EFI_FVB2_ALIGNMENT_256"
+#define EFI_FVB2_ALIGNMENT_512_STRING     "EFI_FVB2_ALIGNMENT_512"
+#define EFI_FVB2_ALIGNMENT_1K_STRING      "EFI_FVB2_ALIGNMENT_1K"
+#define EFI_FVB2_ALIGNMENT_2K_STRING      "EFI_FVB2_ALIGNMENT_2K"
+#define EFI_FVB2_ALIGNMENT_4K_STRING      "EFI_FVB2_ALIGNMENT_4K"
+#define EFI_FVB2_ALIGNMENT_8K_STRING      "EFI_FVB2_ALIGNMENT_8K"
+#define EFI_FVB2_ALIGNMENT_16K_STRING     "EFI_FVB2_ALIGNMENT_16K"
+#define EFI_FVB2_ALIGNMENT_32K_STRING     "EFI_FVB2_ALIGNMENT_32K"
+#define EFI_FVB2_ALIGNMENT_64K_STRING     "EFI_FVB2_ALIGNMENT_64K"
 #define EFI_FVB2_ALIGNMENT_128K_STRING    "EFI_FVB2_ALIGNMENT_128K"
 #define EFI_FVB2_ALIGNMENT_256K_STRING    "EFI_FVB2_ALIGNMENT_256K"
 #define EFI_FVB2_ALIGNMENT_512K_STRING    "EFI_FVB2_ALIGNMENT_512K"
-#define EFI_FVB2_ALIGNMENT_1M_STRING      "EFI_FVB2_ALIGNMENT_1M"  
-#define EFI_FVB2_ALIGNMENT_2M_STRING      "EFI_FVB2_ALIGNMENT_2M"  
-#define EFI_FVB2_ALIGNMENT_4M_STRING      "EFI_FVB2_ALIGNMENT_4M"  
-#define EFI_FVB2_ALIGNMENT_8M_STRING      "EFI_FVB2_ALIGNMENT_8M"  
-#define EFI_FVB2_ALIGNMENT_16M_STRING     "EFI_FVB2_ALIGNMENT_16M" 
-#define EFI_FVB2_ALIGNMENT_32M_STRING     "EFI_FVB2_ALIGNMENT_32M" 
-#define EFI_FVB2_ALIGNMENT_64M_STRING     "EFI_FVB2_ALIGNMENT_64M" 
+#define EFI_FVB2_ALIGNMENT_1M_STRING      "EFI_FVB2_ALIGNMENT_1M"
+#define EFI_FVB2_ALIGNMENT_2M_STRING      "EFI_FVB2_ALIGNMENT_2M"
+#define EFI_FVB2_ALIGNMENT_4M_STRING      "EFI_FVB2_ALIGNMENT_4M"
+#define EFI_FVB2_ALIGNMENT_8M_STRING      "EFI_FVB2_ALIGNMENT_8M"
+#define EFI_FVB2_ALIGNMENT_16M_STRING     "EFI_FVB2_ALIGNMENT_16M"
+#define EFI_FVB2_ALIGNMENT_32M_STRING     "EFI_FVB2_ALIGNMENT_32M"
+#define EFI_FVB2_ALIGNMENT_64M_STRING     "EFI_FVB2_ALIGNMENT_64M"
 #define EFI_FVB2_ALIGNMENT_128M_STRING    "EFI_FVB2_ALIGNMENT_128M"
 #define EFI_FVB2_ALIGNMENT_256M_STRING    "EFI_FVB2_ALIGNMENT_256M"
 #define EFI_FVB2_ALIGNMENT_512M_STRING    "EFI_FVB2_ALIGNMENT_512M"
-#define EFI_FVB2_ALIGNMENT_1G_STRING      "EFI_FVB2_ALIGNMENT_1G"  
-#define EFI_FVB2_ALIGNMENT_2G_STRING      "EFI_FVB2_ALIGNMENT_2G"  
+#define EFI_FVB2_ALIGNMENT_1G_STRING      "EFI_FVB2_ALIGNMENT_1G"
+#define EFI_FVB2_ALIGNMENT_2G_STRING      "EFI_FVB2_ALIGNMENT_2G"
 
 #define EFI_FV_WEAK_ALIGNMENT_STRING      "EFI_WEAK_ALIGNMENT"
 
@@ -336,7 +336,7 @@ EFI_STATUS
 FindApResetVectorPosition (
   IN  MEMORY_FILE  *FvImage,
   OUT UINT8        **Pointer
-  ); 
+  );
 
 EFI_STATUS
 CalculateFvSize (
@@ -344,9 +344,9 @@ CalculateFvSize (
   );
 
 EFI_STATUS
-FfsRebase ( 
-  IN OUT  FV_INFO               *FvInfo, 
-  IN      CHAR8                 *FileName,           
+FfsRebase (
+  IN OUT  FV_INFO               *FvInfo,
+  IN      CHAR8                 *FileName,
   IN OUT  EFI_FFS_FILE_HEADER   *FfsFile,
   IN      UINTN                 XipOffset,
   IN      FILE                  *FvMapFile
@@ -365,7 +365,7 @@ GenerateCapImage (
 
 Routine Description:
 
-  This is the main function which will be called from application to 
+  This is the main function which will be called from application to
   generate UEFI Capsule image.
 
 Arguments:
@@ -388,14 +388,14 @@ EFI_STATUS
 GenerateFvImage (
   IN CHAR8                *InfFileImage,
   IN UINTN                InfFileSize,
-  IN CHAR8                *FvFileName,  
+  IN CHAR8                *FvFileName,
   IN CHAR8                *MapFileName
   )
 /*++
 
 Routine Description:
 
-  This is the main function which will be called from application to 
+  This is the main function which will be called from application to
   generate Firmware Image conforms to PI spec.
 
 Arguments:
@@ -404,9 +404,9 @@ Arguments:
   InfFileSize    Size of the contents of the InfFileImage buffer.
   FvFileName     Requested name for the FV file.
   MapFileName    Fv map file to log fv driver information.
-    
+
 Returns:
- 
+
   EFI_SUCCESS             Function completed successfully.
   EFI_OUT_OF_RESOURCES    Could not allocate required resources.
   EFI_ABORTED             Error encountered.

+ 21 - 21
BaseTools/Source/C/GenFw/Elf32Convert.c

@@ -130,7 +130,7 @@ InitializeElf32 (
   //
   // Initialize data pointer and structures.
   //
-  mEhdr = (Elf_Ehdr*) FileBuffer;  
+  mEhdr = (Elf_Ehdr*) FileBuffer;
 
   //
   // Check the ELF32 specific header information.
@@ -142,12 +142,12 @@ InitializeElf32 (
   if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) {
     Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB");
     return FALSE;
-  }  
+  }
   if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) {
     Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN");
     return FALSE;
   }
-  if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) { 
+  if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) {
     Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_386 or EM_ARM");
     return FALSE;
   }
@@ -155,13 +155,13 @@ InitializeElf32 (
     Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT);
     return FALSE;
   }
-  
+
   //
   // Update section header pointers
   //
   mShdrBase  = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff);
   mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff);
-  
+
   //
   // Create COFF Section offset buffer and zero.
   //
@@ -707,20 +707,20 @@ WriteSections32 (
     if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) {
       continue;
     }
-    
+
     //
     // Relocation section found.  Now extract section information that the relocations
     // apply to in the ELF data and the new COFF data.
     //
     SecShdr = GetShdrByIndex(RelShdr->sh_info);
     SecOffset = mCoffSectionsOffset[RelShdr->sh_info];
-    
+
     //
     // Only process relocations for the current filter type.
     //
     if (RelShdr->sh_type == SHT_REL && (*Filter)(SecShdr)) {
       UINT32 RelOffset;
-      
+
       //
       // Determine the symbol table referenced by the relocation data.
       //
@@ -735,18 +735,18 @@ WriteSections32 (
         // Set pointer to relocation entry
         //
         Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelOffset);
-        
+
         //
         // Set pointer to symbol table entry associated with the relocation entry.
         //
         Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
-        
+
         Elf_Shdr *SymShdr;
         UINT8 *Targ;
         UINT16 Address;
 
         //
-        // Check section header index found in symbol table and get the section 
+        // Check section header index found in symbol table and get the section
         // header location.
         //
         if (Sym->st_shndx == SHN_UNDEF
@@ -768,7 +768,7 @@ WriteSections32 (
         //
         // Convert the relocation data to a pointer into the coff file.
         //
-        // Note: 
+        // Note:
         //   r_offset is the virtual address of the storage unit to be relocated.
         //   sh_addr is the virtual address for the base of the section.
         //
@@ -814,9 +814,9 @@ WriteSections32 (
           case R_ARM_THM_JUMP19:
           case R_ARM_CALL:
           case R_ARM_JMP24:
-          case R_ARM_THM_JUMP24:  
-          case R_ARM_PREL31:  
-          case R_ARM_MOVW_PREL_NC:  
+          case R_ARM_THM_JUMP24:
+          case R_ARM_PREL31:
+          case R_ARM_MOVW_PREL_NC:
           case R_ARM_MOVT_PREL:
           case R_ARM_THM_MOVW_PREL_NC:
           case R_ARM_THM_MOVT_PREL:
@@ -909,7 +909,7 @@ WriteRelocations32 (
         for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
           Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
 
-          if (mEhdr->e_machine == EM_386) { 
+          if (mEhdr->e_machine == EM_386) {
             switch (ELF_R_TYPE(Rel->r_info)) {
             case R_386_NONE:
             case R_386_PC32:
@@ -941,9 +941,9 @@ WriteRelocations32 (
             case R_ARM_THM_JUMP19:
             case R_ARM_CALL:
             case R_ARM_JMP24:
-            case R_ARM_THM_JUMP24:  
-            case R_ARM_PREL31:  
-            case R_ARM_MOVW_PREL_NC:  
+            case R_ARM_THM_JUMP24:
+            case R_ARM_PREL31:
+            case R_ARM_MOVW_PREL_NC:
             case R_ARM_MOVT_PREL:
             case R_ARM_THM_MOVW_PREL_NC:
             case R_ARM_THM_MOVT_PREL:
@@ -1090,7 +1090,7 @@ WriteRelocations32 (
           case  R_ARM_RABS32:
             CoffAddFixup (Rel->r_offset, EFI_IMAGE_REL_BASED_HIGHLOW);
             break;
-          
+
           default:
             Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unkown type %d.", mInImageName, ELF32_R_TYPE (Rel->r_info));
             break;
@@ -1163,7 +1163,7 @@ SetImageSize32 (
   )
 {
   EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
-  
+
   //
   // Set image size
   //

+ 4 - 4
BaseTools/Source/C/GenFw/Elf32Convert.h

@@ -1,11 +1,11 @@
 /** @file
 Header file for Elf32 Convert solution
 
-Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2018, 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 
+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,

+ 10 - 10
BaseTools/Source/C/GenFw/Elf64Convert.c

@@ -800,24 +800,24 @@ WriteSections64 (
             // Absolute relocation.
             //
             VerboseMsg ("R_X86_64_64");
-            VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX", 
-              (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), 
+            VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX",
+              (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
               *(UINT64 *)Targ);
             *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
             VerboseMsg ("Relocation:  0x%016LX", *(UINT64*)Targ);
             break;
           case R_X86_64_32:
             VerboseMsg ("R_X86_64_32");
-            VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", 
-              (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), 
+            VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+              (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
               *(UINT32 *)Targ);
             *(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
             VerboseMsg ("Relocation:  0x%08X", *(UINT32*)Targ);
             break;
           case R_X86_64_32S:
             VerboseMsg ("R_X86_64_32S");
-            VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", 
-              (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), 
+            VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+              (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
               *(UINT32 *)Targ);
             *(INT32 *)Targ = (INT32)((INT64)(*(INT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
             VerboseMsg ("Relocation:  0x%08X", *(UINT32*)Targ);
@@ -838,8 +838,8 @@ WriteSections64 (
             // Relative relocation: Symbol - Ip + Addend
             //
             VerboseMsg ("R_X86_64_PC32");
-            VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", 
-              (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), 
+            VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+              (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
               *(UINT32 *)Targ);
             *(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
               + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
@@ -986,7 +986,7 @@ WriteRelocations64 (
             case R_X86_64_PLT32:
               break;
             case R_X86_64_64:
-              VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X", 
+              VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X",
                 mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
               CoffAddFixup(
                 (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
@@ -995,7 +995,7 @@ WriteRelocations64 (
               break;
             case R_X86_64_32S:
             case R_X86_64_32:
-              VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X", 
+              VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X",
                 mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
               CoffAddFixup(
                 (UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]

+ 4 - 4
BaseTools/Source/C/GenFw/Elf64Convert.h

@@ -1,11 +1,11 @@
 /** @file
 Header file for Elf64 convert solution
 
-Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2018, 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 
+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,

+ 7 - 7
BaseTools/Source/C/GenFw/ElfConvert.c

@@ -3,9 +3,9 @@ Elf convert solution
 
 Copyright (c) 2010 - 2018, 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 
+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,
@@ -92,7 +92,7 @@ CoffAddFixup(
       // Add a null entry (is it required ?)
       //
       CoffAddFixupEntry (0);
-      
+
       //
       // Pad for alignment.
       //
@@ -163,7 +163,7 @@ IsElfHeader (
   UINT8  *FileBuffer
 )
 {
-  return (FileBuffer[EI_MAG0] == ELFMAG0 && 
+  return (FileBuffer[EI_MAG0] == ELFMAG0 &&
           FileBuffer[EI_MAG1] == ELFMAG1 &&
           FileBuffer[EI_MAG2] == ELFMAG2 &&
           FileBuffer[EI_MAG3] == ELFMAG3);
@@ -199,7 +199,7 @@ ConvertElf (
 
   //
   // Compute sections new address.
-  //  
+  //
   VerboseMsg ("Compute sections new address.");
   ElfFunctions.ScanSections ();
 
@@ -246,6 +246,6 @@ ConvertElf (
   // Free resources used by ELF functions.
   //
   ElfFunctions.CleanUp ();
-  
+
   return TRUE;
 }

+ 5 - 5
BaseTools/Source/C/GenFw/ElfConvert.h

@@ -3,9 +3,9 @@ Header file for Elf convert solution
 
 Copyright (c) 2010 - 2018, 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 
+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,
@@ -45,7 +45,7 @@ typedef enum {
   SECTION_TEXT,
   SECTION_HII,
   SECTION_DATA
-  
+
 } SECTION_FILTER_TYPES;
 
 //
@@ -58,7 +58,7 @@ typedef struct {
   VOID    (*WriteDebug) ();
   VOID    (*SetImageSize) ();
   VOID    (*CleanUp) ();
-  
+
 } ELF_FUNCTION_TABLE;
 
 //

+ 25 - 25
BaseTools/Source/C/GenFw/GenFw.c

@@ -1,7 +1,7 @@
 /** @file
 Converts a pe32+ image to an FW, Te image type, or other specific image.
 
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2018, 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
@@ -169,7 +169,7 @@ Returns:
   //
   // Copyright declaration
   //
-  fprintf (stdout, "Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.\n\n");
+  fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
 
   //
   // Details Option
@@ -242,7 +242,7 @@ Returns:
                         If it is combined with other action options, the later\n\
                         input action option will override the previous one.\n");
   fprintf (stdout, "  -a NUM, --align NUM   NUM is one HEX or DEC format alignment value.\n\
-                        This option is only used together with -j option.\n");  
+                        This option is only used together with -j option.\n");
   fprintf (stdout, "  -p NUM, --pad NUM     NUM is one HEX or DEC format padding value.\n\
                         This option is only used together with -j option.\n");
   fprintf (stdout, "  --keepexceptiontable  Don't clear exception table.\n\
@@ -490,7 +490,7 @@ SetHiiResourceHeader (
         }
 
         //
-        // Now it ought to be resource Data and update its OffsetToData value 
+        // Now it ought to be resource Data and update its OffsetToData value
         //
         if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) {
           ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (HiiBinData + ResourceDirectoryEntry->u2.OffsetToData);
@@ -501,7 +501,7 @@ SetHiiResourceHeader (
     }
     ResourceDirectoryEntry++;
   }
-  
+
   return;
 }
 
@@ -530,7 +530,7 @@ GetPeCoffHeader (
       return NULL;
     }
   }
-  
+
   return PeHdr;
 }
 
@@ -555,7 +555,7 @@ PeCoffConvertImageToXip (
   if (PeHdr == NULL) {
     return;
   }
-  
+
   if (PeHdr->Pe32.OptionalHeader.SectionAlignment != PeHdr->Pe32.OptionalHeader.FileAlignment) {
     //
     // The only reason to expand zero fill sections is to make them compatible with XIP images.
@@ -672,7 +672,7 @@ PeCoffConvertImageToXip (
 
 UINT8 *
 CreateHiiResouceSectionHeader (
-  UINT32 *pSectionHeaderSize, 
+  UINT32 *pSectionHeaderSize,
   UINT32 HiiDataSize
   )
 /*++
@@ -705,8 +705,8 @@ Returns:
   // Calculate the total size for the resource header (include Type, Name and Language)
   // then allocate memory for the resource header.
   //
-  HiiSectionHeaderSize = 3 * (sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY)) 
-                          + 3 * (sizeof (UINT16) + 3 * sizeof (CHAR16)) 
+  HiiSectionHeaderSize = 3 * (sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY))
+                          + 3 * (sizeof (UINT16) + 3 * sizeof (CHAR16))
                           + sizeof (EFI_IMAGE_RESOURCE_DATA_ENTRY);
   HiiSectionHeader = malloc (HiiSectionHeaderSize);
   if (HiiSectionHeader == NULL) {
@@ -717,7 +717,7 @@ Returns:
 
   HiiSectionOffset = 0;
   //
-  // Create Type entry 
+  // Create Type entry
   //
   ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiSectionHeader + HiiSectionOffset);
   HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);
@@ -877,7 +877,7 @@ Returns:
 
   if (ImageContext.RelocationsStripped) {
     Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
-    return Status;    
+    return Status;
   }
 
   //
@@ -890,8 +890,8 @@ Returns:
   //
   SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
     (UINTN) ImgHdr +
-    sizeof (UINT32) + 
-    sizeof (EFI_IMAGE_FILE_HEADER) +  
+    sizeof (UINT32) +
+    sizeof (EFI_IMAGE_FILE_HEADER) +
     ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
     );
 
@@ -957,7 +957,7 @@ Returns:
 
   if (ImageContext.RelocationsStripped) {
     Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
-    return Status;    
+    return Status;
   }
 
   //
@@ -996,15 +996,15 @@ Returns:
   //
   SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
     (UINTN) ImgHdr +
-    sizeof (UINT32) + 
-    sizeof (EFI_IMAGE_FILE_HEADER) +  
+    sizeof (UINT32) +
+    sizeof (EFI_IMAGE_FILE_HEADER) +
     ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
     );
 
   for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
     CopyMem (
-      FileBuffer + SectionHeader->PointerToRawData, 
-      (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress), 
+      FileBuffer + SectionHeader->PointerToRawData,
+      (VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
       SectionHeader->SizeOfRawData
       );
   }
@@ -2186,7 +2186,7 @@ Returns:
         goto Finish;
       }
     }
-    
+
     if (NegativeAddr) {
       //
       // Set Base Address to a negative value.
@@ -2534,7 +2534,7 @@ Returns:
     (TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress == 0) && \
     (TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size == 0)) {
       //
-      // PeImage can be loaded into memory, but it has no relocation section. 
+      // PeImage can be loaded into memory, but it has no relocation section.
       // Fix TeImage Header to set VA of relocation data directory to not zero, the size is still zero.
       //
       if (Optional32 != NULL) {
@@ -2716,7 +2716,7 @@ Finish:
       }
     }
   }
-  
+
   if (InputFileBuffer != NULL) {
     free (InputFileBuffer);
   }
@@ -2735,7 +2735,7 @@ Finish:
     ReportFileName = (CHAR8 *) malloc (FileLen + 1);
     if (ReportFileName != NULL) {
       strcpy (ReportFileName, OutImageName);
-      strcpy (ReportFileName + (FileLen - 4), ".txt"); 
+      strcpy (ReportFileName + (FileLen - 4), ".txt");
       ReportFile = fopen (LongFilePath (ReportFileName), "w+");
       if (ReportFile != NULL) {
         fprintf (ReportFile, "MODULE_SIZE = %u\n", (unsigned) mImageSize);
@@ -2789,7 +2789,7 @@ Returns:
   EFI_IMAGE_SECTION_HEADER        *SectionHeader;
   EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
   EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY *RsdsEntry;
-  UINT32                          *NewTimeStamp;  
+  UINT32                          *NewTimeStamp;
 
   //
   // Init variable.
@@ -2968,7 +2968,7 @@ Returns:
   EFI_IMAGE_OPTIONAL_HEADER64     *Optional64Hdr;
   EFI_IMAGE_SECTION_HEADER        *SectionHeader;
   UINT32                          *NewTimeStamp;
-  
+
   //
   // Init variable.
   //

+ 4 - 4
BaseTools/Source/C/GenFw/GenFw.h

@@ -1,11 +1,11 @@
 /** @file
 Header file for GenFw
 
-Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2018, 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 
+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,

+ 106 - 106
BaseTools/Source/C/GenFw/elf32.h

@@ -48,38 +48,38 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  * ELF definitions common to all 32-bit architectures.
  */
 
-typedef UINT32	Elf32_Addr;
-typedef UINT16	Elf32_Half;
-typedef UINT32	Elf32_Off;
-typedef INT32		Elf32_Sword;
-typedef UINT32	Elf32_Word;
-typedef UINT64	Elf32_Lword;
+typedef UINT32  Elf32_Addr;
+typedef UINT16  Elf32_Half;
+typedef UINT32  Elf32_Off;
+typedef INT32    Elf32_Sword;
+typedef UINT32  Elf32_Word;
+typedef UINT64  Elf32_Lword;
 
-typedef Elf32_Word	Elf32_Hashelt;
+typedef Elf32_Word  Elf32_Hashelt;
 
 /* Non-standard class-dependent datatype used for abstraction. */
-typedef Elf32_Word	Elf32_Size;
-typedef Elf32_Sword	Elf32_Ssize;
+typedef Elf32_Word  Elf32_Size;
+typedef Elf32_Sword  Elf32_Ssize;
 
 /*
  * ELF header.
  */
 
 typedef struct {
-	unsigned char	e_ident[EI_NIDENT];	/* File identification. */
-	Elf32_Half	e_type;		/* File type. */
-	Elf32_Half	e_machine;	/* Machine architecture. */
-	Elf32_Word	e_version;	/* ELF format version. */
-	Elf32_Addr	e_entry;	/* Entry point. */
-	Elf32_Off	e_phoff;	/* Program header file offset. */
-	Elf32_Off	e_shoff;	/* Section header file offset. */
-	Elf32_Word	e_flags;	/* Architecture-specific flags. */
-	Elf32_Half	e_ehsize;	/* Size of ELF header in bytes. */
-	Elf32_Half	e_phentsize;	/* Size of program header entry. */
-	Elf32_Half	e_phnum;	/* Number of program header entries. */
-	Elf32_Half	e_shentsize;	/* Size of section header entry. */
-	Elf32_Half	e_shnum;	/* Number of section header entries. */
-	Elf32_Half	e_shstrndx;	/* Section name strings section. */
+  unsigned char  e_ident[EI_NIDENT];  /* File identification. */
+  Elf32_Half  e_type;    /* File type. */
+  Elf32_Half  e_machine;  /* Machine architecture. */
+  Elf32_Word  e_version;  /* ELF format version. */
+  Elf32_Addr  e_entry;  /* Entry point. */
+  Elf32_Off  e_phoff;  /* Program header file offset. */
+  Elf32_Off  e_shoff;  /* Section header file offset. */
+  Elf32_Word  e_flags;  /* Architecture-specific flags. */
+  Elf32_Half  e_ehsize;  /* Size of ELF header in bytes. */
+  Elf32_Half  e_phentsize;  /* Size of program header entry. */
+  Elf32_Half  e_phnum;  /* Number of program header entries. */
+  Elf32_Half  e_shentsize;  /* Size of section header entry. */
+  Elf32_Half  e_shnum;  /* Number of section header entries. */
+  Elf32_Half  e_shstrndx;  /* Section name strings section. */
 } Elf32_Ehdr;
 
 /*
@@ -87,17 +87,17 @@ typedef struct {
  */
 
 typedef struct {
-	Elf32_Word	sh_name;	/* Section name (index into the
-					   section header string table). */
-	Elf32_Word	sh_type;	/* Section type. */
-	Elf32_Word	sh_flags;	/* Section flags. */
-	Elf32_Addr	sh_addr;	/* Address in memory image. */
-	Elf32_Off	sh_offset;	/* Offset in file. */
-	Elf32_Word	sh_size;	/* Size in bytes. */
-	Elf32_Word	sh_link;	/* Index of a related section. */
-	Elf32_Word	sh_info;	/* Depends on section type. */
-	Elf32_Word	sh_addralign;	/* Alignment in bytes. */
-	Elf32_Word	sh_entsize;	/* Size of each entry in section. */
+  Elf32_Word  sh_name;  /* Section name (index into the
+             section header string table). */
+  Elf32_Word  sh_type;  /* Section type. */
+  Elf32_Word  sh_flags;  /* Section flags. */
+  Elf32_Addr  sh_addr;  /* Address in memory image. */
+  Elf32_Off  sh_offset;  /* Offset in file. */
+  Elf32_Word  sh_size;  /* Size in bytes. */
+  Elf32_Word  sh_link;  /* Index of a related section. */
+  Elf32_Word  sh_info;  /* Depends on section type. */
+  Elf32_Word  sh_addralign;  /* Alignment in bytes. */
+  Elf32_Word  sh_entsize;  /* Size of each entry in section. */
 } Elf32_Shdr;
 
 /*
@@ -105,14 +105,14 @@ typedef struct {
  */
 
 typedef struct {
-	Elf32_Word	p_type;		/* Entry type. */
-	Elf32_Off	p_offset;	/* File offset of contents. */
-	Elf32_Addr	p_vaddr;	/* Virtual address in memory image. */
-	Elf32_Addr	p_paddr;	/* Physical address (not used). */
-	Elf32_Word	p_filesz;	/* Size of contents in file. */
-	Elf32_Word	p_memsz;	/* Size of contents in memory. */
-	Elf32_Word	p_flags;	/* Access permission flags. */
-	Elf32_Word	p_align;	/* Alignment in memory and file. */
+  Elf32_Word  p_type;    /* Entry type. */
+  Elf32_Off  p_offset;  /* File offset of contents. */
+  Elf32_Addr  p_vaddr;  /* Virtual address in memory image. */
+  Elf32_Addr  p_paddr;  /* Physical address (not used). */
+  Elf32_Word  p_filesz;  /* Size of contents in file. */
+  Elf32_Word  p_memsz;  /* Size of contents in memory. */
+  Elf32_Word  p_flags;  /* Access permission flags. */
+  Elf32_Word  p_align;  /* Alignment in memory and file. */
 } Elf32_Phdr;
 
 /*
@@ -120,11 +120,11 @@ typedef struct {
  */
 
 typedef struct {
-	Elf32_Sword	d_tag;		/* Entry type. */
-	union {
-		Elf32_Word	d_val;	/* Integer value. */
-		Elf32_Addr	d_ptr;	/* Address value. */
-	} d_un;
+  Elf32_Sword  d_tag;    /* Entry type. */
+  union {
+    Elf32_Word  d_val;  /* Integer value. */
+    Elf32_Addr  d_ptr;  /* Address value. */
+  } d_un;
 } Elf32_Dyn;
 
 /*
@@ -133,60 +133,60 @@ typedef struct {
 
 /* Relocations that don't need an addend field. */
 typedef struct {
-	Elf32_Addr	r_offset;	/* Location to be relocated. */
-	Elf32_Word	r_info;		/* Relocation type and symbol index. */
+  Elf32_Addr  r_offset;  /* Location to be relocated. */
+  Elf32_Word  r_info;    /* Relocation type and symbol index. */
 } Elf32_Rel;
 
 /* Relocations that need an addend field. */
 typedef struct {
-	Elf32_Addr	r_offset;	/* Location to be relocated. */
-	Elf32_Word	r_info;		/* Relocation type and symbol index. */
-	Elf32_Sword	r_addend;	/* Addend. */
+  Elf32_Addr  r_offset;  /* Location to be relocated. */
+  Elf32_Word  r_info;    /* Relocation type and symbol index. */
+  Elf32_Sword  r_addend;  /* Addend. */
 } Elf32_Rela;
 
 /* Macros for accessing the fields of r_info. */
-#define ELF32_R_SYM(info)	((info) >> 8)
-#define ELF32_R_TYPE(info)	((unsigned char)(info))
+#define ELF32_R_SYM(info)  ((info) >> 8)
+#define ELF32_R_TYPE(info)  ((unsigned char)(info))
 
 /* Macro for constructing r_info from field values. */
-#define ELF32_R_INFO(sym, type)	(((sym) << 8) + (unsigned char)(type))
+#define ELF32_R_INFO(sym, type)  (((sym) << 8) + (unsigned char)(type))
 
 /*
- *	Note entry header
+ *  Note entry header
  */
 typedef Elf_Note Elf32_Nhdr;
 
 /*
- *	Move entry
+ *  Move entry
  */
 typedef struct {
-	Elf32_Lword	m_value;	/* symbol value */
-	Elf32_Word 	m_info;		/* size + index */
-	Elf32_Word	m_poffset;	/* symbol offset */
-	Elf32_Half	m_repeat;	/* repeat count */
-	Elf32_Half	m_stride;	/* stride info */
+  Elf32_Lword  m_value;  /* symbol value */
+  Elf32_Word   m_info;    /* size + index */
+  Elf32_Word  m_poffset;  /* symbol offset */
+  Elf32_Half  m_repeat;  /* repeat count */
+  Elf32_Half  m_stride;  /* stride info */
 } Elf32_Move;
 
 /*
- *	The macros compose and decompose values for Move.r_info
+ *  The macros compose and decompose values for Move.r_info
  *
- *	sym = ELF32_M_SYM(M.m_info)
- *	size = ELF32_M_SIZE(M.m_info)
- *	M.m_info = ELF32_M_INFO(sym, size)
+ *  sym = ELF32_M_SYM(M.m_info)
+ *  size = ELF32_M_SIZE(M.m_info)
+ *  M.m_info = ELF32_M_INFO(sym, size)
  */
-#define	ELF32_M_SYM(info)	((info)>>8)
-#define	ELF32_M_SIZE(info)	((unsigned char)(info))
-#define	ELF32_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
+#define  ELF32_M_SYM(info)  ((info)>>8)
+#define  ELF32_M_SIZE(info)  ((unsigned char)(info))
+#define  ELF32_M_INFO(sym, size)  (((sym)<<8)+(unsigned char)(size))
 
 /*
- *	Hardware/Software capabilities entry
+ *  Hardware/Software capabilities entry
  */
 typedef struct {
-	Elf32_Word	c_tag;		/* how to interpret value */
-	union {
-		Elf32_Word	c_val;
-		Elf32_Addr	c_ptr;
-	} c_un;
+  Elf32_Word  c_tag;    /* how to interpret value */
+  union {
+    Elf32_Word  c_val;
+    Elf32_Addr  c_ptr;
+  } c_un;
 } Elf32_Cap;
 
 /*
@@ -194,65 +194,65 @@ typedef struct {
  */
 
 typedef struct {
-	Elf32_Word	st_name;	/* String table index of name. */
-	Elf32_Addr	st_value;	/* Symbol value. */
-	Elf32_Word	st_size;	/* Size of associated object. */
-	unsigned char	st_info;	/* Type and binding information. */
-	unsigned char	st_other;	/* Reserved (not used). */
-	Elf32_Half	st_shndx;	/* Section index of symbol. */
+  Elf32_Word  st_name;  /* String table index of name. */
+  Elf32_Addr  st_value;  /* Symbol value. */
+  Elf32_Word  st_size;  /* Size of associated object. */
+  unsigned char  st_info;  /* Type and binding information. */
+  unsigned char  st_other;  /* Reserved (not used). */
+  Elf32_Half  st_shndx;  /* Section index of symbol. */
 } Elf32_Sym;
 
 /* Macros for accessing the fields of st_info. */
-#define ELF32_ST_BIND(info)		((info) >> 4)
-#define ELF32_ST_TYPE(info)		((info) & 0xf)
+#define ELF32_ST_BIND(info)    ((info) >> 4)
+#define ELF32_ST_TYPE(info)    ((info) & 0xf)
 
 /* Macro for constructing st_info from field values. */
-#define ELF32_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf))
+#define ELF32_ST_INFO(bind, type)  (((bind) << 4) + ((type) & 0xf))
 
 /* Macro for accessing the fields of st_other. */
-#define ELF32_ST_VISIBILITY(oth)	((oth) & 0x3)
+#define ELF32_ST_VISIBILITY(oth)  ((oth) & 0x3)
 
 /* Structures used by Sun & GNU symbol versioning. */
 typedef struct
 {
-	Elf32_Half	vd_version;
-	Elf32_Half	vd_flags;
-	Elf32_Half	vd_ndx;
-	Elf32_Half	vd_cnt;
-	Elf32_Word	vd_hash;
-	Elf32_Word	vd_aux;
-	Elf32_Word	vd_next;
+  Elf32_Half  vd_version;
+  Elf32_Half  vd_flags;
+  Elf32_Half  vd_ndx;
+  Elf32_Half  vd_cnt;
+  Elf32_Word  vd_hash;
+  Elf32_Word  vd_aux;
+  Elf32_Word  vd_next;
 } Elf32_Verdef;
 
 typedef struct
 {
-	Elf32_Word	vda_name;
-	Elf32_Word	vda_next;
+  Elf32_Word  vda_name;
+  Elf32_Word  vda_next;
 } Elf32_Verdaux;
 
 typedef struct
 {
-	Elf32_Half	vn_version;
-	Elf32_Half	vn_cnt;
-	Elf32_Word	vn_file;
-	Elf32_Word	vn_aux;
-	Elf32_Word	vn_next;
+  Elf32_Half  vn_version;
+  Elf32_Half  vn_cnt;
+  Elf32_Word  vn_file;
+  Elf32_Word  vn_aux;
+  Elf32_Word  vn_next;
 } Elf32_Verneed;
 
 typedef struct
 {
-	Elf32_Word	vna_hash;
-	Elf32_Half	vna_flags;
-	Elf32_Half	vna_other;
-	Elf32_Word	vna_name;
-	Elf32_Word	vna_next;
+  Elf32_Word  vna_hash;
+  Elf32_Half  vna_flags;
+  Elf32_Half  vna_other;
+  Elf32_Word  vna_name;
+  Elf32_Word  vna_next;
 } Elf32_Vernaux;
 
 typedef Elf32_Half Elf32_Versym;
 
 typedef struct {
-	Elf32_Half	si_boundto;	/* direct bindings - symbol bound to */
-	Elf32_Half	si_flags;	/* per symbol flags */
+  Elf32_Half  si_boundto;  /* direct bindings - symbol bound to */
+  Elf32_Half  si_flags;  /* per symbol flags */
 } Elf32_Syminfo;
 
 #endif /* !_SYS_ELF32_H_ */

+ 108 - 108
BaseTools/Source/C/GenFw/elf64.h

@@ -47,14 +47,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  * ELF definitions common to all 64-bit architectures.
  */
 
-typedef UINT64	Elf64_Addr;
-typedef UINT16	Elf64_Half;
-typedef UINT64	Elf64_Off;
-typedef INT32		Elf64_Sword;
-typedef INT64		Elf64_Sxword;
-typedef UINT32	Elf64_Word;
-typedef UINT64	Elf64_Lword;
-typedef UINT64	Elf64_Xword;
+typedef UINT64  Elf64_Addr;
+typedef UINT16  Elf64_Half;
+typedef UINT64  Elf64_Off;
+typedef INT32    Elf64_Sword;
+typedef INT64    Elf64_Sxword;
+typedef UINT32  Elf64_Word;
+typedef UINT64  Elf64_Lword;
+typedef UINT64  Elf64_Xword;
 
 /*
  * Types of dynamic symbol hash table bucket and chain elements.
@@ -63,31 +63,31 @@ typedef UINT64	Elf64_Xword;
  * typedef is required.
  */
 
-typedef Elf64_Word	Elf64_Hashelt;
+typedef Elf64_Word  Elf64_Hashelt;
 
 /* Non-standard class-dependent datatype used for abstraction. */
-typedef Elf64_Xword	  Elf64_Size;
-typedef Elf64_Sxword	Elf64_Ssize;
+typedef Elf64_Xword    Elf64_Size;
+typedef Elf64_Sxword  Elf64_Ssize;
 
 /*
  * ELF header.
  */
 
 typedef struct {
-	unsigned char	e_ident[EI_NIDENT];	/* File identification. */
-	Elf64_Half	e_type;		/* File type. */
-	Elf64_Half	e_machine;	/* Machine architecture. */
-	Elf64_Word	e_version;	/* ELF format version. */
-	Elf64_Addr	e_entry;	/* Entry point. */
-	Elf64_Off	e_phoff;	/* Program header file offset. */
-	Elf64_Off	e_shoff;	/* Section header file offset. */
-	Elf64_Word	e_flags;	/* Architecture-specific flags. */
-	Elf64_Half	e_ehsize;	/* Size of ELF header in bytes. */
-	Elf64_Half	e_phentsize;	/* Size of program header entry. */
-	Elf64_Half	e_phnum;	/* Number of program header entries. */
-	Elf64_Half	e_shentsize;	/* Size of section header entry. */
-	Elf64_Half	e_shnum;	/* Number of section header entries. */
-	Elf64_Half	e_shstrndx;	/* Section name strings section. */
+  unsigned char  e_ident[EI_NIDENT];  /* File identification. */
+  Elf64_Half  e_type;    /* File type. */
+  Elf64_Half  e_machine;  /* Machine architecture. */
+  Elf64_Word  e_version;  /* ELF format version. */
+  Elf64_Addr  e_entry;  /* Entry point. */
+  Elf64_Off  e_phoff;  /* Program header file offset. */
+  Elf64_Off  e_shoff;  /* Section header file offset. */
+  Elf64_Word  e_flags;  /* Architecture-specific flags. */
+  Elf64_Half  e_ehsize;  /* Size of ELF header in bytes. */
+  Elf64_Half  e_phentsize;  /* Size of program header entry. */
+  Elf64_Half  e_phnum;  /* Number of program header entries. */
+  Elf64_Half  e_shentsize;  /* Size of section header entry. */
+  Elf64_Half  e_shnum;  /* Number of section header entries. */
+  Elf64_Half  e_shstrndx;  /* Section name strings section. */
 } Elf64_Ehdr;
 
 /*
@@ -95,17 +95,17 @@ typedef struct {
  */
 
 typedef struct {
-	Elf64_Word	sh_name;	/* Section name (index into the
-					   section header string table). */
-	Elf64_Word	sh_type;	/* Section type. */
-	Elf64_Xword	sh_flags;	/* Section flags. */
-	Elf64_Addr	sh_addr;	/* Address in memory image. */
-	Elf64_Off	sh_offset;	/* Offset in file. */
-	Elf64_Xword	sh_size;	/* Size in bytes. */
-	Elf64_Word	sh_link;	/* Index of a related section. */
-	Elf64_Word	sh_info;	/* Depends on section type. */
-	Elf64_Xword	sh_addralign;	/* Alignment in bytes. */
-	Elf64_Xword	sh_entsize;	/* Size of each entry in section. */
+  Elf64_Word  sh_name;  /* Section name (index into the
+             section header string table). */
+  Elf64_Word  sh_type;  /* Section type. */
+  Elf64_Xword  sh_flags;  /* Section flags. */
+  Elf64_Addr  sh_addr;  /* Address in memory image. */
+  Elf64_Off  sh_offset;  /* Offset in file. */
+  Elf64_Xword  sh_size;  /* Size in bytes. */
+  Elf64_Word  sh_link;  /* Index of a related section. */
+  Elf64_Word  sh_info;  /* Depends on section type. */
+  Elf64_Xword  sh_addralign;  /* Alignment in bytes. */
+  Elf64_Xword  sh_entsize;  /* Size of each entry in section. */
 } Elf64_Shdr;
 
 /*
@@ -113,14 +113,14 @@ typedef struct {
  */
 
 typedef struct {
-	Elf64_Word	p_type;		/* Entry type. */
-	Elf64_Word	p_flags;	/* Access permission flags. */
-	Elf64_Off	p_offset;	/* File offset of contents. */
-	Elf64_Addr	p_vaddr;	/* Virtual address in memory image. */
-	Elf64_Addr	p_paddr;	/* Physical address (not used). */
-	Elf64_Xword	p_filesz;	/* Size of contents in file. */
-	Elf64_Xword	p_memsz;	/* Size of contents in memory. */
-	Elf64_Xword	p_align;	/* Alignment in memory and file. */
+  Elf64_Word  p_type;    /* Entry type. */
+  Elf64_Word  p_flags;  /* Access permission flags. */
+  Elf64_Off  p_offset;  /* File offset of contents. */
+  Elf64_Addr  p_vaddr;  /* Virtual address in memory image. */
+  Elf64_Addr  p_paddr;  /* Physical address (not used). */
+  Elf64_Xword  p_filesz;  /* Size of contents in file. */
+  Elf64_Xword  p_memsz;  /* Size of contents in memory. */
+  Elf64_Xword  p_align;  /* Alignment in memory and file. */
 } Elf64_Phdr;
 
 /*
@@ -128,11 +128,11 @@ typedef struct {
  */
 
 typedef struct {
-	Elf64_Sxword	d_tag;		/* Entry type. */
-	union {
-		Elf64_Xword	d_val;	/* Integer value. */
-		Elf64_Addr	d_ptr;	/* Address value. */
-	} d_un;
+  Elf64_Sxword  d_tag;    /* Entry type. */
+  union {
+    Elf64_Xword  d_val;  /* Integer value. */
+    Elf64_Addr  d_ptr;  /* Address value. */
+  } d_un;
 } Elf64_Dyn;
 
 /*
@@ -141,58 +141,58 @@ typedef struct {
 
 /* Relocations that don't need an addend field. */
 typedef struct {
-	Elf64_Addr	r_offset;	/* Location to be relocated. */
-	Elf64_Xword	r_info;		/* Relocation type and symbol index. */
+  Elf64_Addr  r_offset;  /* Location to be relocated. */
+  Elf64_Xword  r_info;    /* Relocation type and symbol index. */
 } Elf64_Rel;
 
 /* Relocations that need an addend field. */
 typedef struct {
-	Elf64_Addr	r_offset;	/* Location to be relocated. */
-	Elf64_Xword	r_info;		/* Relocation type and symbol index. */
-	Elf64_Sxword	r_addend;	/* Addend. */
+  Elf64_Addr  r_offset;  /* Location to be relocated. */
+  Elf64_Xword  r_info;    /* Relocation type and symbol index. */
+  Elf64_Sxword  r_addend;  /* Addend. */
 } Elf64_Rela;
 
 /* Macros for accessing the fields of r_info. */
-#define ELF64_R_SYM(info)	((info) >> 32)
-#define ELF64_R_TYPE(info)	((info) & 0xffffffffL)
+#define ELF64_R_SYM(info)  ((info) >> 32)
+#define ELF64_R_TYPE(info)  ((info) & 0xffffffffL)
 
 /* Macro for constructing r_info from field values. */
-#define ELF64_R_INFO(sym, type)	(((sym) << 32) + ((type) & 0xffffffffL))
+#define ELF64_R_INFO(sym, type)  (((sym) << 32) + ((type) & 0xffffffffL))
 
-#define	ELF64_R_TYPE_DATA(info)	(((Elf64_Xword)(info)<<32)>>40)
-#define	ELF64_R_TYPE_ID(info)	(((Elf64_Xword)(info)<<56)>>56)
-#define	ELF64_R_TYPE_INFO(data, type)	\
-		(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
+#define  ELF64_R_TYPE_DATA(info)  (((Elf64_Xword)(info)<<32)>>40)
+#define  ELF64_R_TYPE_ID(info)  (((Elf64_Xword)(info)<<56)>>56)
+#define  ELF64_R_TYPE_INFO(data, type)  \
+    (((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
 
 /*
- *	Note entry header
+ *  Note entry header
  */
 typedef Elf_Note Elf64_Nhdr;
 
 /*
- *	Move entry
+ *  Move entry
  */
 typedef struct {
-	Elf64_Lword	m_value;	/* symbol value */
-	Elf64_Xword 	m_info;		/* size + index */
-	Elf64_Xword	m_poffset;	/* symbol offset */
-	Elf64_Half	m_repeat;	/* repeat count */
-	Elf64_Half	m_stride;	/* stride info */
+  Elf64_Lword  m_value;  /* symbol value */
+  Elf64_Xword   m_info;    /* size + index */
+  Elf64_Xword  m_poffset;  /* symbol offset */
+  Elf64_Half  m_repeat;  /* repeat count */
+  Elf64_Half  m_stride;  /* stride info */
 } Elf64_Move;
 
-#define	ELF64_M_SYM(info)	((info)>>8)
-#define	ELF64_M_SIZE(info)	((unsigned char)(info))
-#define	ELF64_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
+#define  ELF64_M_SYM(info)  ((info)>>8)
+#define  ELF64_M_SIZE(info)  ((unsigned char)(info))
+#define  ELF64_M_INFO(sym, size)  (((sym)<<8)+(unsigned char)(size))
 
 /*
- *	Hardware/Software capabilities entry
+ *  Hardware/Software capabilities entry
  */
 typedef struct {
-	Elf64_Xword	c_tag;		/* how to interpret value */
-	union {
-		Elf64_Xword	c_val;
-		Elf64_Addr	c_ptr;
-	} c_un;
+  Elf64_Xword  c_tag;    /* how to interpret value */
+  union {
+    Elf64_Xword  c_val;
+    Elf64_Addr  c_ptr;
+  } c_un;
 } Elf64_Cap;
 
 /*
@@ -200,61 +200,61 @@ typedef struct {
  */
 
 typedef struct {
-	Elf64_Word	st_name;	/* String table index of name. */
-	unsigned char	st_info;	/* Type and binding information. */
-	unsigned char	st_other;	/* Reserved (not used). */
-	Elf64_Half	st_shndx;	/* Section index of symbol. */
-	Elf64_Addr	st_value;	/* Symbol value. */
-	Elf64_Xword	st_size;	/* Size of associated object. */
+  Elf64_Word  st_name;  /* String table index of name. */
+  unsigned char  st_info;  /* Type and binding information. */
+  unsigned char  st_other;  /* Reserved (not used). */
+  Elf64_Half  st_shndx;  /* Section index of symbol. */
+  Elf64_Addr  st_value;  /* Symbol value. */
+  Elf64_Xword  st_size;  /* Size of associated object. */
 } Elf64_Sym;
 
 /* Macros for accessing the fields of st_info. */
-#define ELF64_ST_BIND(info)		((info) >> 4)
-#define ELF64_ST_TYPE(info)		((info) & 0xf)
+#define ELF64_ST_BIND(info)    ((info) >> 4)
+#define ELF64_ST_TYPE(info)    ((info) & 0xf)
 
 /* Macro for constructing st_info from field values. */
-#define ELF64_ST_INFO(bind, type)	(((bind) << 4) + ((type) & 0xf))
+#define ELF64_ST_INFO(bind, type)  (((bind) << 4) + ((type) & 0xf))
 
 /* Macro for accessing the fields of st_other. */
-#define ELF64_ST_VISIBILITY(oth)	((oth) & 0x3)
+#define ELF64_ST_VISIBILITY(oth)  ((oth) & 0x3)
 
 /* Structures used by Sun & GNU-style symbol versioning. */
 typedef struct {
-	Elf64_Half	vd_version;
-	Elf64_Half	vd_flags;
-	Elf64_Half	vd_ndx;
-	Elf64_Half	vd_cnt;
-	Elf64_Word	vd_hash;
-	Elf64_Word	vd_aux;
-	Elf64_Word	vd_next;
+  Elf64_Half  vd_version;
+  Elf64_Half  vd_flags;
+  Elf64_Half  vd_ndx;
+  Elf64_Half  vd_cnt;
+  Elf64_Word  vd_hash;
+  Elf64_Word  vd_aux;
+  Elf64_Word  vd_next;
 } Elf64_Verdef;
 
 typedef struct {
-	Elf64_Word	vda_name;
-	Elf64_Word	vda_next;
+  Elf64_Word  vda_name;
+  Elf64_Word  vda_next;
 } Elf64_Verdaux;
 
 typedef struct {
-	Elf64_Half	vn_version;
-	Elf64_Half	vn_cnt;
-	Elf64_Word	vn_file;
-	Elf64_Word	vn_aux;
-	Elf64_Word	vn_next;
+  Elf64_Half  vn_version;
+  Elf64_Half  vn_cnt;
+  Elf64_Word  vn_file;
+  Elf64_Word  vn_aux;
+  Elf64_Word  vn_next;
 } Elf64_Verneed;
 
 typedef struct {
-	Elf64_Word	vna_hash;
-	Elf64_Half	vna_flags;
-	Elf64_Half	vna_other;
-	Elf64_Word	vna_name;
-	Elf64_Word	vna_next;
+  Elf64_Word  vna_hash;
+  Elf64_Half  vna_flags;
+  Elf64_Half  vna_other;
+  Elf64_Word  vna_name;
+  Elf64_Word  vna_next;
 } Elf64_Vernaux;
 
 typedef Elf64_Half Elf64_Versym;
 
 typedef struct {
-	Elf64_Half	si_boundto;	/* direct bindings - symbol bound to */
-	Elf64_Half	si_flags;	/* per symbol flags */
+  Elf64_Half  si_boundto;  /* direct bindings - symbol bound to */
+  Elf64_Half  si_flags;  /* per symbol flags */
 } Elf64_Syminfo;
 
 #endif /* !_SYS_ELF64_H_ */

File diff suppressed because it is too large
+ 562 - 562
BaseTools/Source/C/GenFw/elf_common.h


+ 30 - 30
BaseTools/Source/C/GenPage/GenPage.c

@@ -1,9 +1,9 @@
 /** @file
   Pre-Create a 4G page table (2M pages).
   It's used in DUET x64 build needed to enter LongMode.
- 
+
   Create 4G page table (2M pages)
- 
+
                               Linear Address
     63    48 47   39 38           30 29       21 20                          0
    +--------+-------+---------------+-----------+-----------------------------+
@@ -15,14 +15,14 @@
                           Directory-Ptr Directory {512}
                         ) {4}
 
-Copyright (c) 2006 - 2016, 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.             
+Copyright (c) 2006 - 2018, 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.
 
 **/
 
@@ -96,7 +96,7 @@ Usage (
   )
 {
   printf ("Usage: GenPage.exe [options] EfiLoaderImageName \n\n\
-Copyright (c) 2008 - 2014, Intel Corporation.  All rights reserved.\n\n\
+Copyright (c) 2008 - 2018, Intel Corporation.  All rights reserved.\n\n\
   Utility to generate the EfiLoader image containing a page table.\n\n\
 optional arguments:\n\
   -h, --help            Show this help message and exit\n\
@@ -170,7 +170,7 @@ Return:
   for (PML4Index = 0; PML4Index < EFI_PML4_ENTRY_NUM; PML4Index++, PageMapLevel4Entry++) {
     //
     // Each Page-Map-Level-4-Table Entry points to the base address of a Page-Directory-Pointer-Table Entry
-    //  
+    //
     PageTablePtr += EFI_SIZE_OF_PAGE;
     PageDirectoryPointerEntry = (X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *)PageTablePtr;
 
@@ -184,7 +184,7 @@ Return:
     for (PDPTEIndex = 0; PDPTEIndex < EFI_PDPTE_ENTRY_NUM; PDPTEIndex++, PageDirectoryPointerEntry++) {
       //
       // Each Page-Directory-Pointer-Table Entry points to the base address of a Page-Directory Entry
-      //       
+      //
       PageTablePtr += EFI_SIZE_OF_PAGE;
       PageDirectoryEntry2MB = (X64_PAGE_TABLE_ENTRY_2M *)PageTablePtr;
 
@@ -310,20 +310,20 @@ main (
     Usage();
     return STATUS_ERROR;
   }
-  
+
   argc --;
   argv ++;
 
   if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
     Usage();
-    return 0;    
+    return 0;
   }
 
   if (stricmp (argv[0], "--version") == 0) {
     Version();
-    return 0;    
+    return 0;
   }
-  
+
   while (argc > 0) {
     if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
       if (argv[1] == NULL || argv[1][0] == '-') {
@@ -333,9 +333,9 @@ main (
       OutputFile = argv[1];
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
-    
+
     if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {
       if (argv[1] == NULL || argv[1][0] == '-') {
         Error (NULL, 0, 1003, "Invalid option value", "Base address is missing for -b option");
@@ -349,9 +349,9 @@ main (
       gPageTableBaseAddress = (UINT32) TempValue;
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
-    
+
     if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--offset") == 0)) {
       if (argv[1] == NULL || argv[1][0] == '-') {
         Error (NULL, 0, 1003, "Invalid option value", "Offset is missing for -f option");
@@ -365,21 +365,21 @@ main (
       gPageTableOffsetInFile = (UINT32) TempValue;
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-q") == 0) || (stricmp (argv[0], "--quiet") == 0)) {
       argc --;
       argv ++;
-      continue; 
+      continue;
     }
-    
+
     if ((stricmp (argv[0], "-v") ==0) || (stricmp (argv[0], "--verbose") == 0)) {
       argc --;
       argv ++;
-      continue; 
+      continue;
     }
-    
+
     if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {
       if (argv[1] == NULL || argv[1][0] == '-') {
         Error (NULL, 0, 1003, "Invalid option value", "Debug Level is not specified.");
@@ -396,14 +396,14 @@ main (
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if (argv[0][0] == '-') {
       Error (NULL, 0, 1000, "Unknown option", argv[0]);
       return STATUS_ERROR;
     }
-    
+
     //
     // Don't recognize the parameter.
     //
@@ -411,12 +411,12 @@ main (
     argc--;
     argv++;
   }
-  
+
   if (InputFile == NULL) {
     Error (NULL, 0, 1003, "Invalid option value", "Input file is not specified");
     return STATUS_ERROR;
   }
-  
+
   //
   // Create X64 page table
   //

+ 15 - 15
BaseTools/Source/C/GenPage/VirtualMemory.h

@@ -1,21 +1,21 @@
-/** @file 
-x64 Long Mode Virtual Memory Management Definitions  
+/** @file
+x64 Long Mode Virtual Memory Management Definitions
 
   References:
     1) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 1:Basic Architecture, Intel
     2) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 2:Instruction Set Reference, Intel
     3) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 3:System Programmer's Guide, Intel
     4) AMD64 Architecture Programmer's Manual Volume 2: System Programming
-    
-Copyright (c) 2006 - 2014, 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.             
-  
+
+Copyright (c) 2006 - 2018, 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.
+
 **/
 
 #ifndef _VIRTUAL_MEMORY_H_
@@ -82,7 +82,7 @@ typedef union {
     UINT64  CacheDisabled:1;          // 0 = Cached, 1=Non-Cached
     UINT64  Accessed:1;               // 0 = Not accessed, 1 = Accessed (set by CPU)
     UINT64  Dirty:1;                  // 0 = Not Dirty, 1 = written by processor on access to page
-    UINT64  PAT:1;                    // 0 = Ignore Page Attribute Table 
+    UINT64  PAT:1;                    // 0 = Ignore Page Attribute Table
     UINT64  Global:1;                 // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
     UINT64  Available:3;              // Available for use by system software
     UINT64  PageTableBaseAddress:40;  // Page Table Base Address
@@ -105,7 +105,7 @@ typedef union {
     UINT64  CacheDisabled:1;          // 0 = Cached, 1=Non-Cached
     UINT64  Accessed:1;               // 0 = Not accessed, 1 = Accessed (set by CPU)
     UINT64  Dirty:1;                  // 0 = Not Dirty, 1 = written by processor on access to page
-    UINT64  MustBe1:1;                // Must be 1 
+    UINT64  MustBe1:1;                // Must be 1
     UINT64  Global:1;                 // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
     UINT64  Available:3;              // Available for use by system software
     UINT64  PAT:1;                    //
@@ -119,4 +119,4 @@ typedef union {
 
 #pragma pack()
 
-#endif 
+#endif

+ 79 - 79
BaseTools/Source/C/GenSec/GenSec.c

@@ -2,13 +2,13 @@
 Creates output file that is a properly formed section per the PI spec.
 
 Copyright (c) 2004 - 2018, 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.             
+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 __GNUC__
@@ -103,7 +103,7 @@ STATIC EFI_GUID  mZeroGuid                 = {0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0
 STATIC EFI_GUID  mEfiCrc32SectionGuid      = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
 
 STATIC
-VOID 
+VOID
 Version (
   VOID
   )
@@ -116,12 +116,12 @@ Routine Description:
 Arguments:
 
   None
-  
+
 Returns:
 
   None
-  
---*/ 
+
+--*/
 {
   fprintf (stdout, "%s Version %d.%d %s \n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
 }
@@ -151,11 +151,11 @@ Returns:
   // Summary usage
   //
   fprintf (stdout, "\nUsage: %s [options] [input_file]\n\n", UTILITY_NAME);
-  
+
   //
   // Copyright declaration
-  // 
-  fprintf (stdout, "Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.\n\n");
+  //
+  fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
 
   //
   // Details Option
@@ -176,7 +176,7 @@ Returns:
                         EFI_SECTION_ALL is default section type.\n");
   fprintf (stdout, "  -c [Type], --compress [Type]\n\
                         Compress method type can be PI_NONE or PI_STD.\n\
-                        if -c option is not given, PI_STD is default type.\n"); 
+                        if -c option is not given, PI_STD is default type.\n");
   fprintf (stdout, "  -g GuidValue, --vendor GuidValue\n\
                         GuidValue is one specific vendor guid value.\n\
                         Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
@@ -215,7 +215,7 @@ Ascii2UnicodeString (
 
 Routine Description:
 
-  Write ascii string as unicode string format to FILE 
+  Write ascii string as unicode string format to FILE
 
 Arguments:
 
@@ -235,7 +235,7 @@ Returns:
   // End the UniString with a NULL.
   //
   *UniString = '\0';
-} 
+}
 
 STATUS
 GenSectionCommonLeafSection (
@@ -245,19 +245,19 @@ GenSectionCommonLeafSection (
   UINT8   **OutFileBuffer
   )
 /*++
-        
+
 Routine Description:
-           
+
   Generate a leaf section of type other than EFI_SECTION_VERSION
   and EFI_SECTION_USER_INTERFACE. Input file must be well formed.
   The function won't validate the input file's contents. For
   common leaf sections, the input file may be a binary file.
   The utility will add section header to the file.
-            
+
 Arguments:
-               
+
   InputFileName  - Name of the input file.
-                
+
   InputFileNum   - Number of input files. Should be 1 for leaf section.
 
   SectionType    - A valid section type string
@@ -265,7 +265,7 @@ Arguments:
   OutFileBuffer  - Buffer pointer to Output file contents
 
 Returns:
-                       
+
   STATUS_ERROR            - can't continue
   STATUS_SUCCESS          - successful return
 
@@ -323,7 +323,7 @@ Returns:
   //
   Buffer = (UINT8 *) malloc ((size_t) TotalLength);
   if (Buffer == NULL) {
-    Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated"); 
+    Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
     goto Done;
   }
   CommonSect = (EFI_COMMON_SECTION_HEADER *) Buffer;
@@ -336,7 +336,7 @@ Returns:
     memset(CommonSect->Size, 0xff, sizeof(UINT8) * 3);
     ((EFI_COMMON_SECTION_HEADER2 *)CommonSect)->ExtendedSize = TotalLength;
   }
-  
+
   //
   // read data from the input file.
   //
@@ -348,7 +348,7 @@ Returns:
   }
 
   //
-  // Set OutFileBuffer 
+  // Set OutFileBuffer
   //
   *OutFileBuffer = Buffer;
   Status = STATUS_SUCCESS;
@@ -408,14 +408,14 @@ GetSectionContents (
   UINT32  *BufferLength
   )
 /*++
-        
+
 Routine Description:
-           
+
   Get the contents of all section files specified in InputFileName
   into FileBuffer.
-            
+
 Arguments:
-               
+
   InputFileName  - Name of the input file.
 
   InputFileAlign - Alignment required by the input file data.
@@ -424,11 +424,11 @@ Arguments:
 
   FileBuffer     - Output buffer to contain data
 
-  BufferLength   - On input, this is size of the FileBuffer. 
+  BufferLength   - On input, this is size of the FileBuffer.
                    On output, this is the actual length of the data.
 
 Returns:
-                       
+
   EFI_SUCCESS on successful return
   EFI_INVALID_PARAMETER if InputFileNum is less than 1 or BufferLength point is NULL.
   EFI_ABORTED if unable to open input file.
@@ -475,8 +475,8 @@ Returns:
       }
       Size++;
     }
-    
-    // 
+
+    //
     // Open file and read contents
     //
     InFile = fopen (LongFilePath (InputFileName[Index]), "rb");
@@ -488,7 +488,7 @@ Returns:
     fseek (InFile, 0, SEEK_END);
     FileSize = ftell (InFile);
     fseek (InFile, 0, SEEK_SET);
-    DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize); 
+    DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
     //
     // Adjust section buffer when section alignment is required.
     //
@@ -525,7 +525,7 @@ Returns:
             HeaderSize = GuidSectHeader.DataOffset;
           }
         }
-      } 
+      }
 
       fseek (InFile, 0, SEEK_SET);
 
@@ -544,7 +544,7 @@ Returns:
       if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
         Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
         Offset = Offset - Size - HeaderSize - TeOffset;
-         
+
         if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
           //
           // The maximal alignment is 64K, the raw section size must be less than 0xffffff
@@ -577,7 +577,7 @@ Returns:
     fclose (InFile);
     Size += FileSize;
   }
-  
+
   //
   // Set the real required buffer size.
   //
@@ -599,28 +599,28 @@ GenSectionCompressionSection (
   UINT8   **OutFileBuffer
   )
 /*++
-        
+
 Routine Description:
-           
+
   Generate an encapsulating section of type EFI_SECTION_COMPRESSION
   Input file must be already sectioned. The function won't validate
-  the input files' contents. Caller should hand in files already 
+  the input files' contents. Caller should hand in files already
   with section header.
-            
+
 Arguments:
-               
+
   InputFileName  - Name of the input file.
 
   InputFileAlign - Alignment required by the input file data.
 
   InputFileNum   - Number of input files. Should be at least 1.
 
-  SectCompSubType - Specify the compression algorithm requested. 
-  
+  SectCompSubType - Specify the compression algorithm requested.
+
   OutFileBuffer   - Buffer pointer to Output file contents
 
 Returns:
-                       
+
   EFI_SUCCESS           on successful return
   EFI_INVALID_PARAMETER if InputFileNum is less than 1
   EFI_ABORTED           if unable to open input file.
@@ -754,7 +754,7 @@ Returns:
     }
   }
 
-  DebugMsg (NULL, 0, 9, "comprss file size", 
+  DebugMsg (NULL, 0, 9, "comprss file size",
             "the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);
 
   //if (TotalLength >= MAX_SECTION_SIZE) {
@@ -782,7 +782,7 @@ Returns:
     CompressionSect2->UncompressedLength        = InputLength;
   } else {
     CompressionSect = (EFI_COMPRESSION_SECTION *) FileBuffer;
-    
+
     CompressionSect->CommonHeader.Type     = EFI_SECTION_COMPRESSION;
     CompressionSect->CommonHeader.Size[0]  = (UINT8) (TotalLength & 0xff);
     CompressionSect->CommonHeader.Size[1]  = (UINT8) ((TotalLength & 0xff00) >> 8);
@@ -792,7 +792,7 @@ Returns:
   }
 
   //
-  // Set OutFileBuffer 
+  // Set OutFileBuffer
   //
   *OutFileBuffer = FileBuffer;
 
@@ -810,32 +810,32 @@ GenSectionGuidDefinedSection (
   UINT8    **OutFileBuffer
   )
 /*++
-        
+
 Routine Description:
-           
+
   Generate an encapsulating section of type EFI_SECTION_GUID_DEFINED
   Input file must be already sectioned. The function won't validate
-  the input files' contents. Caller should hand in files already 
+  the input files' contents. Caller should hand in files already
   with section header.
-            
+
 Arguments:
-               
+
   InputFileName - Name of the input file.
-                
+
   InputFileAlign - Alignment required by the input file data.
 
   InputFileNum  - Number of input files. Should be at least 1.
 
   VendorGuid    - Specify vendor guid value.
 
-  DataAttribute - Specify attribute for the vendor guid data. 
-  
+  DataAttribute - Specify attribute for the vendor guid data.
+
   DataHeaderSize- Guided Data Header Size
-  
+
   OutFileBuffer   - Buffer pointer to Output file contents
 
 Returns:
-                       
+
   EFI_SUCCESS on successful return
   EFI_INVALID_PARAMETER if InputFileNum is less than 1
   EFI_ABORTED if unable to open input file.
@@ -935,7 +935,7 @@ Returns:
     //
     Crc32Checksum = 0;
     CalculateCrc32 (FileBuffer + Offset, InputLength, &Crc32Checksum);
-    
+
     if (TotalLength >= MAX_SECTION_SIZE) {
       Crc32GuidSect2 = (CRC32_SECTION_HEADER2 *) FileBuffer;
       Crc32GuidSect2->GuidSectionHeader.CommonHeader.Type     = EFI_SECTION_GUID_DEFINED;
@@ -985,9 +985,9 @@ Returns:
     }
   }
   VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
-  
+
   //
-  // Set OutFileBuffer 
+  // Set OutFileBuffer
   //
   *OutFileBuffer = FileBuffer;
 
@@ -1126,7 +1126,7 @@ Returns:
   int                       VersionNumber;
   UINT8                     SectType;
   UINT8                     SectCompSubType;
-  UINT16                    SectGuidAttribute; 
+  UINT16                    SectGuidAttribute;
   UINT64                    SectGuidHeaderLength;
   EFI_VERSION_SECTION       *VersionSect;
   EFI_USER_INTERFACE_SECTION *UiSect;
@@ -1172,9 +1172,9 @@ Returns:
   InFile                = NULL;
   InFileSize            = 0;
   InFileBuffer          = NULL;
-  
+
   SetUtilityName (UTILITY_NAME);
-  
+
   if (argc == 1) {
     Error (NULL, 0, 1001, "Missing options", "No options input");
     Usage ();
@@ -1190,12 +1190,12 @@ Returns:
   if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {
     Version ();
     Usage ();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   if (stricmp (argv[0], "--version") == 0) {
     Version ();
-    return STATUS_SUCCESS;    
+    return STATUS_SUCCESS;
   }
 
   while (argc > 0) {
@@ -1207,7 +1207,7 @@ Returns:
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {
@@ -1218,7 +1218,7 @@ Returns:
       }
       argc -= 2;
       argv += 2;
-      continue; 
+      continue;
     }
 
     if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--compress") == 0)) {
@@ -1387,7 +1387,7 @@ Returns:
       argc -= 2;
       argv += 2;
       InputFileAlignNum ++;
-      continue; 
+      continue;
     }
 
     //
@@ -1529,14 +1529,14 @@ Returns:
     VerboseMsg ("Compress method is %s", mCompressionTypeName [SectCompSubType]);
   } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {
     SectType     = EFI_SECTION_GUID_DEFINED;
-    
+
     if ((SectGuidAttribute & EFI_GUIDED_SECTION_NONE) != 0) {
       //
       // NONE attribute, clear attribute value.
       //
       SectGuidAttribute = SectGuidAttribute & ~EFI_GUIDED_SECTION_NONE;
     }
-    VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", 
+    VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
                 (unsigned) VendorGuid.Data1,
                 VendorGuid.Data2,
                 VendorGuid.Data3,
@@ -1595,7 +1595,7 @@ Returns:
     Error (NULL, 0, 1003, "Invalid option value", "SectionType = %s", SectionName);
     goto Finish;
   }
-  
+
   //
   // GuidValue is only required by Guided section.
   //
@@ -1604,10 +1604,10 @@ Returns:
     (CompareGuid (&VendorGuid, &mZeroGuid) != 0)) {
     fprintf (stdout, "Warning: the input guid value is not required for this section type %s\n", SectionName);
   }
-  
+
   //
   // Check whether there is input file
-  //  
+  //
   if ((SectType != EFI_SECTION_VERSION) && (SectType != EFI_SECTION_USER_INTERFACE)) {
     //
     // The input file are required for other section type.
@@ -1730,7 +1730,7 @@ Returns:
               OutFileBuffer,
               &InputLength
               );
-  
+
     if (Status == EFI_BUFFER_TOO_SMALL) {
       OutFileBuffer = (UINT8 *) malloc (InputLength);
       if (OutFileBuffer == NULL) {
@@ -1762,10 +1762,10 @@ Returns:
               );
     break;
   }
-  
+
   if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {
     Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);
-	  goto Finish;
+    goto Finish;
   }
 
   //
@@ -1778,7 +1778,7 @@ Returns:
       InputLength = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
     }
   }
-  
+
   //
   // Write the output file
   //

+ 13 - 13
BaseTools/Source/C/GenVtf/GenVtf.c

@@ -1,10 +1,10 @@
 /** @file
-This file contains functions required to generate a boot strap file (BSF) also 
+This file contains functions required to generate a boot strap file (BSF) also
 known as the Volume Top File (VTF)
 
-Copyright (c) 1999 - 2017, 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 
+Copyright (c) 1999 - 2018, 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
 
@@ -133,7 +133,7 @@ Returns:
     } else {
       memcpy (TemStr, Str + Length - 4, 4);
     }
-  
+
     sscanf (
       TemStr,
       "%02x%02x",
@@ -2362,7 +2362,7 @@ Returns:
       TokenAddress += BaseAddress &~IPF_CACHE_BIT;
 
       fprintf (DestFile, "%s | %016llX | ", Type, (unsigned long long) TokenAddress);
-      fprintf (DestFile, "%s | %s\n    %s\n", Section, Token, BaseToken); 
+      fprintf (DestFile, "%s | %s\n    %s\n", Section, Token, BaseToken);
     }
   }
 
@@ -2479,7 +2479,7 @@ Returns:
   //
   // Copyright declaration
   //
-  fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
+  fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
   //
   // Details Option
   //
@@ -2628,7 +2628,7 @@ Returns:
       }
       continue;
     }
-    
+
     if ((stricmp (argv[Index], "-r") == 0) || (stricmp (argv[Index], "--baseaddr") == 0)) {
       if (FirstRoundB) {
         Status      = AsciiStringToUint64 (argv[Index + 1], FALSE, &StartAddress1);
@@ -2639,7 +2639,7 @@ Returns:
       if (Status != EFI_SUCCESS) {
         Error (NULL, 0, 2000, "Invalid option value", "%s is Bad FV start address.", argv[Index + 1]);
         goto ERROR;
-      }  
+      }
       continue;
     }
 
@@ -2649,7 +2649,7 @@ Returns:
         FirstRoundS = FALSE;
       } else {
         Status = AsciiStringToUint64 (argv[Index + 1], FALSE, &FwVolSize2);
-    	  SecondVTF = TRUE;
+        SecondVTF = TRUE;
       }
 
       if (Status != EFI_SUCCESS) {
@@ -2660,8 +2660,8 @@ Returns:
     }
 
     if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
-	    VerboseMode = TRUE;
-	    Index--;
+      VerboseMode = TRUE;
+      Index--;
       continue;
     }
 
@@ -2729,7 +2729,7 @@ Returns:
     if (SecondVTF == TRUE) {
       OutFileName1 = VTF_OUTPUT_FILE1;
       OutFileName2 = VTF_OUTPUT_FILE2;
-	  } else {
+    } else {
       OutFileName1 = VTF_OUTPUT_FILE1;
     }
     SymFileName = VTF_SYM_FILE;

+ 21 - 21
BaseTools/Source/C/GenVtf/GenVtf.h

@@ -1,9 +1,9 @@
 /** @file
 This file contains the relevant declarations required to generate Boot Strap File
-  
-Copyright (c) 1999 - 2014, 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 
+
+Copyright (c) 1999 - 2018, 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
 
@@ -80,7 +80,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define SIZE_IA32_RESET_VECT      0x10        // 16 Bytes
 #define SIZE_SALE_ENTRY_POINT     0x08        // 8 Byte
 #define SIZE_FIT_TABLE_ADD        0x08        // 8 Byte
-#define SIZE_FIT_TABLE_PAL_A      0x10     
+#define SIZE_FIT_TABLE_PAL_A      0x10
 #define SIZE_RESERVED             0x10
 
 
@@ -116,7 +116,7 @@ static BOOLEAN VerboseMode = FALSE;
 //
 // Internal Data Structure
 //
-typedef enum _LOC_TYPE 
+typedef enum _LOC_TYPE
 {
   NONE,                   // In case there is - INF file
   FIRST_VTF,              // First VTF
@@ -174,18 +174,18 @@ UpdateVtfBuffer(
 Routine Description:
 
   Update the Firmware Volume Buffer with requested buffer data
-  
+
 Arguments:
 
   StartAddress   - StartAddress in buffer. This number will automatically
-                  point to right address in buffer where data needed 
+                  point to right address in buffer where data needed
                   to be updated.
   Buffer         - Buffer pointer from data will be copied to memory mapped buffer.
   DataSize       - Size of the data needed to be copied.
   LocType        - The type of the VTF
 
 Returns:
-  
+
   EFI_ABORTED  - The input parameter is error
   EFI_SUCCESS  - The function completed successfully
 
@@ -227,22 +227,22 @@ CalculateFitTableChecksum (
   VOID
   )
 /*++
-  
+
 Routine Description:
 
   This function will perform byte checksum on the FIT table, if the the checksum required
   field is set to CheckSum required. If the checksum is not required then checksum byte
   will have value as 0;.
-  
+
 Arguments:
 
   NONE
-  
+
 Returns:
 
   Status       - Value returned by call to CalculateChecksum8 ()
   EFI_SUCCESS  - The function completed successfully
-    
+
 --*/
 ;
 
@@ -262,22 +262,22 @@ Routine Description:
 
 Arguments:
 
-  StartAddress1  - The start address of the first VTF      
+  StartAddress1  - The start address of the first VTF
   Size1          - The size of the first VTF
-  StartAddress2  - The start address of the second VTF      
+  StartAddress2  - The start address of the second VTF
   Size2          - The size of the second VTF
 
 Returns:
- 
+
   EFI_OUT_OF_RESOURCES - Can not allocate memory
-  The return value can be any of the values 
+  The return value can be any of the values
   returned by the calls to following functions:
       GetVtfRelatedInfoFromInfFile
       ProcessAndCreateVtf
       UpdateIA32ResetVector
       UpdateFfsHeader
       WriteVtfBinary
-  
+
 --*/
 ;
 
@@ -294,11 +294,11 @@ Routine Description:
 Arguments:
 
   StartAddress - StartAddress for PEIM.....
-    
+
 Returns:
- 
+
   EFI_SUCCESS   - The function completed successfully
-  EFI_ABORTED   - Error Opening File 
+  EFI_ABORTED   - Error Opening File
 
 --*/
 ;

+ 8 - 8
BaseTools/Source/C/GnuGenBootSector/FatFormat.h

@@ -2,14 +2,14 @@
 
   Fat file system structure and definition.
 
-Copyright (c) 2006 - 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.             
+Copyright (c) 2006 - 2018, 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.
 
 --*/
 

+ 62 - 62
BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c

@@ -3,15 +3,15 @@ Reading/writing MBR/DBR.
   NOTE:
     If we write MBR to disk, we just update the MBR code and the partition table wouldn't be over written.
     If we process DBR, we will patch MBR to set first partition active if no active partition exists.
-    
-Copyright (c) 2006 - 2014, 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.             
+
+Copyright (c) 2006 - 2018, 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.
 
 **/
 
@@ -132,21 +132,21 @@ GetPathInfo (
   if (strncmp(PathInfo->Path, "/dev/", 5) == 0) {
     //
     // Process disk path here.
-    // 
-    
+    //
+
     // Process floppy disk
     if (PathInfo->Path[5] == 'f' && PathInfo->Path[6] == 'd' && PathInfo->Path[8] == '\0') {
       PathInfo->Type = PathFloppy;
       strcpy (PathInfo->PhysicalPath, PathInfo->Path);
-      
+
       return ErrorSuccess;
     } else {
     // Other disk types is not supported yet.
     fprintf (stderr, "ERROR: It's not a floppy disk!\n");
     return ErrorPath;
-    }  
-     
-    // Try to open the device.   
+    }
+
+    // Try to open the device.
     f = fopen (LongFilePath (PathInfo->Path),"r");
     if (f == NULL) {
       printf ("error :open device failed!\n");
@@ -155,7 +155,7 @@ GetPathInfo (
     fclose (f);
     return ErrorSuccess;
   }
- 
+
   // Process file path here.
   PathInfo->Type = PathFile;
   if (PathInfo->Input) {
@@ -183,12 +183,12 @@ ListDrive (
 }
 
 /**
-  Writing or reading boot sector or MBR according to the argument. 
-   
+  Writing or reading boot sector or MBR according to the argument.
+
   @param InputInfo PATH_INFO instance for input path
   @param OutputInfo PATH_INFO instance for output path
   @param ProcessMbr TRUE is to process MBR, otherwise, processing boot sector
-  
+
   @return ERROR_STATUS
  **/
 ERROR_STATUS
@@ -200,34 +200,34 @@ ProcessBsOrMbr (
 {
   CHAR8 FirstSector[0x200] = {0};
   CHAR8 FirstSectorBackup[0x200] = {0};
-  
+
   FILE *InputFile;
   FILE *OutputFile;
-  
-  
+
+
   InputFile = fopen (LongFilePath (InputInfo->PhysicalPath), "r");
   if (InputFile == NULL) {
     return ErrorFileReadWrite;
   }
-   
+
   if (0x200 != fread(FirstSector, 1, 0x200, InputFile)) {
     fclose(InputFile);
     return ErrorFileReadWrite;
   }
-  
+
   fclose(InputFile);
-  
+
   //Not support USB and IDE.
   if (InputInfo->Type == PathUsb) {
     printf("USB has not been supported yet!");
     return ErrorSuccess;
   }
-  
+
   if (InputInfo->Type == PathIde) {
     printf("IDE has not been supported yet!");
     return ErrorSuccess;
-  } 
-  
+  }
+
   //Process Floppy Disk
   OutputFile = fopen (LongFilePath (OutputInfo->PhysicalPath), "r+");
   if (OutputFile == NULL) {
@@ -236,7 +236,7 @@ ProcessBsOrMbr (
       return ErrorFileReadWrite;
     }
   }
-  
+
   if (OutputInfo->Type != PathFile) {
     if (ProcessMbr) {
       //
@@ -244,16 +244,16 @@ ProcessBsOrMbr (
       //
       if (0x200 != fread (FirstSectorBackup, 1, 0x200, OutputFile)) {
         fclose(OutputFile);
-        return ErrorFileReadWrite; 
+        return ErrorFileReadWrite;
         }
-      memcpy (FirstSector + 0x1BE, FirstSectorBackup + 0x1BE, 0x40);  
+      memcpy (FirstSector + 0x1BE, FirstSectorBackup + 0x1BE, 0x40);
     }
   }
   if(0x200 != fwrite(FirstSector, 1, 0x200, OutputFile)) {
     fclose(OutputFile);
     return ErrorFileReadWrite;
   }
-  
+
   fclose(OutputFile);
   return ErrorSuccess;
 }
@@ -308,20 +308,20 @@ main (
   UINT64         LogLevel;
 
   SetUtilityName (UTILITY_NAME);
-  
+
   ZeroMem(&InputPathInfo, sizeof(PATH_INFO));
   ZeroMem(&OutputPathInfo, sizeof(PATH_INFO));
-  
+
   argv ++;
   argc --;
-  
+
   ProcessMbr    = FALSE;
 
   if (argc == 0) {
     PrintUsage();
     return 0;
   }
-   
+
   //
   // Parse command line
   //
@@ -329,61 +329,61 @@ main (
     if ((stricmp (argv[Index], "-l") == 0) || (stricmp (argv[Index], "--list") == 0)) {
       ListDrive ();
       return 0;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-m") == 0) || (stricmp (argv[Index], "--mbr") == 0)) {
       ProcessMbr = TRUE;
       continue;
     }
-    
+
     if ((stricmp (argv[Index], "-i") == 0) || (stricmp (argv[Index], "--input") == 0)) {
       InputPathInfo.Path  = argv[Index + 1];
       InputPathInfo.Input = TRUE;
       if (InputPathInfo.Path == NULL) {
         Error (NULL, 0, 1003, "Invalid option value", "Input file name can't be NULL");
         return 1;
-      } 
+      }
       if (InputPathInfo.Path[0] == '-') {
         Error (NULL, 0, 1003, "Invalid option value", "Input file is missing");
-        return 1;       
+        return 1;
       }
       ++Index;
       continue;
     }
-    
+
     if ((stricmp (argv[Index], "-o") == 0) || (stricmp (argv[Index], "--output") == 0)) {
       OutputPathInfo.Path  = argv[Index + 1];
       OutputPathInfo.Input = FALSE;
       if (OutputPathInfo.Path == NULL) {
         Error (NULL, 0, 1003, "Invalid option value", "Output file name can't be NULL");
         return 1;
-      } 
+      }
       if (OutputPathInfo.Path[0] == '-') {
         Error (NULL, 0, 1003, "Invalid option value", "Output file is missing");
-        return 1;       
+        return 1;
       }
       ++Index;
       continue;
     }
-    
+
     if ((stricmp (argv[Index], "-h") == 0) || (stricmp (argv[Index], "--help") == 0)) {
       PrintUsage ();
       return 0;
     }
-    
+
     if (stricmp (argv[Index], "--version") == 0) {
       Version ();
       return 0;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-v") == 0) || (stricmp (argv[Index], "--verbose") == 0)) {
       continue;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-q") == 0) || (stricmp (argv[Index], "--quiet") == 0)) {
       continue;
-    } 
-    
+    }
+
     if ((stricmp (argv[Index], "-d") == 0) || (stricmp (argv[Index], "--debug") == 0)) {
       EfiStatus = AsciiStringToUint64 (argv[Index + 1], FALSE, &LogLevel);
       if (EFI_ERROR (EfiStatus)) {
@@ -406,7 +406,7 @@ main (
     Error (NULL, 0, 1000, "Unknown option", "%s", argv[Index]);
     return 1;
   }
-  
+
   if (InputPathInfo.Path == NULL) {
     Error (NULL, 0, 1001, "Missing options", "Input file is missing");
     return 1;
@@ -416,7 +416,7 @@ main (
     Error (NULL, 0, 1001, "Missing options", "Output file is missing");
     return 1;
   }
-  
+
   if (GetPathInfo(&InputPathInfo) != ErrorSuccess) {
     Error (NULL, 0, 1003, "Invalid option value", "Input file can't be found.");
     return 1;
@@ -426,7 +426,7 @@ main (
     Error (NULL, 0, 1003, "Invalid option value", "Output file can't be found.");
     return 1;
   }
-  
+
   //
   // Process DBR (Patch or Read)
   //
@@ -434,21 +434,21 @@ main (
 
   if (Status == ErrorSuccess) {
     fprintf (
-      stdout, 
-      "%s %s: successful!\n", 
-      (OutputPathInfo.Type != PathFile) ? "Write" : "Read", 
+      stdout,
+      "%s %s: successful!\n",
+      (OutputPathInfo.Type != PathFile) ? "Write" : "Read",
       ProcessMbr ? "MBR" : "DBR"
       );
     return 0;
   } else {
     fprintf (
-      stderr, 
+      stderr,
       "%s: %s %s: failed - %s (LastError: 0x%x)!\n",
       (Status == ErrorNoMbr) ? "WARNING" : "ERROR",
-      (OutputPathInfo.Type != PathFile) ? "Write" : "Read", 
-      ProcessMbr ? "MBR" : "DBR", 
+      (OutputPathInfo.Type != PathFile) ? "Write" : "Read",
+      ProcessMbr ? "MBR" : "DBR",
       ErrorStatusDesc[Status],
-      errno 
+      errno
       );
     return 1;
   }

+ 8 - 8
BaseTools/Source/C/Include/AArch64/ProcessorBind.h

@@ -1,7 +1,7 @@
 /** @file
   Processor or Compiler specific defines and types for AArch64.
 
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
   Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
 
@@ -32,7 +32,7 @@
 
 #if _MSC_EXTENSIONS
   //
-  // use Microsoft* C complier dependent integer width types 
+  // use Microsoft* C complier dependent integer width types
   //
   typedef unsigned __int64    UINT64;
   typedef __int64             INT64;
@@ -124,21 +124,21 @@ typedef INT64   INTN;
 
     #define GCC_ASM_EXPORT(func__)  \
              .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    ;\
-             .type ASM_PFX(func__), %function  
+             .type ASM_PFX(func__), %function
 
     #define GCC_ASM_IMPORT(func__)  \
              .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
-             
+
   #else
     //
-    // .type not supported by Apple Xcode tools 
+    // .type not supported by Apple Xcode tools
     //
-    #define INTERWORK_FUNC(func__)  
+    #define INTERWORK_FUNC(func__)
 
     #define GCC_ASM_EXPORT(func__)  \
              .globl  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    \
-  
-    #define GCC_ASM_IMPORT(name)  
+
+    #define GCC_ASM_IMPORT(name)
 
   #endif
 #endif

+ 20 - 20
BaseTools/Source/C/Include/Arm/ProcessorBind.h

@@ -1,15 +1,15 @@
 /** @file
   Processor or Compiler specific defines and types for ARM.
 
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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                                            
+  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.             
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
@@ -28,9 +28,9 @@
 #pragma pack()
 #endif
 
-#if _MSC_EXTENSIONS 
+#if _MSC_EXTENSIONS
   //
-  // use Microsoft* C complier dependent integer width types 
+  // use Microsoft* C complier dependent integer width types
   //
   typedef unsigned __int64    UINT64;
   typedef __int64             INT64;
@@ -45,7 +45,7 @@
   typedef signed char         INT8;
 #else
   //
-  // Assume standard ARM alignment. 
+  // Assume standard ARM alignment.
   //
   typedef unsigned long long  UINT64;
   typedef long long           INT64;
@@ -103,7 +103,7 @@ typedef INT32   INTN;
 // use the correct C calling convention. All protocol member functions and
 // EFI intrinsics are required to modify their member functions with EFIAPI.
 //
-#define EFIAPI    
+#define EFIAPI
 
 #if defined(__GNUC__)
   ///
@@ -122,34 +122,34 @@ typedef INT32   INTN;
 
     #define GCC_ASM_EXPORT(func__)  \
              .global  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    ;\
-             .type ASM_PFX(func__), %function  
+             .type ASM_PFX(func__), %function
 
     #define GCC_ASM_IMPORT(func__)  \
              .extern  _CONCATENATE (__USER_LABEL_PREFIX__, func__)
-             
+
   #else
     //
-    // .type not supported by Apple Xcode tools 
+    // .type not supported by Apple Xcode tools
     //
-    #define INTERWORK_FUNC(func__)  
+    #define INTERWORK_FUNC(func__)
 
     #define GCC_ASM_EXPORT(func__)  \
              .globl  _CONCATENATE (__USER_LABEL_PREFIX__, func__)    \
-  
-    #define GCC_ASM_IMPORT(name)  
+
+    #define GCC_ASM_IMPORT(name)
 
   #endif
 #endif
 
 /**
   Return the pointer to the first instruction of a function given a function pointer.
-  On ARM CPU architectures, these two pointer values are the same, 
+  On ARM CPU architectures, these two pointer values are the same,
   so the implementation of this macro is very simple.
-  
+
   @param  FunctionPointer   A pointer to a function.
 
   @return The pointer to the first instruction of a function given a function pointer.
-  
+
 **/
 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
 

+ 15 - 15
BaseTools/Source/C/Include/Common/BaseTypes.h

@@ -1,16 +1,16 @@
 /** @file
   Processor or Compiler specific defines for all supported processors.
 
-  This file is stand alone self consistent set of definitions. 
+  This file is stand alone self consistent set of definitions.
 
-  Copyright (c) 2006 - 2014, 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                                            
+  Copyright (c) 2006 - 2018, 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.             
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
@@ -49,7 +49,7 @@
 //
 #ifndef TRUE
 //
-// BugBug: UEFI specification claims 1 and 0. We are concerned about the 
+// BugBug: UEFI specification claims 1 and 0. We are concerned about the
 //  complier portability so we did it this way.
 //
 #define TRUE  ((BOOLEAN)(1==1))
@@ -65,7 +65,7 @@
 
 //
 //  Support for variable length argument lists using the ANSI standard.
-//  
+//
 //  Since we are using the ANSI standard we used the standard naming and
 //  did not follow the coding convention
 //
@@ -151,7 +151,7 @@ typedef struct {
 } IPv6_ADDRESS;
 
 //
-// Macro that returns the byte offset of a field in a data structure. 
+// Macro that returns the byte offset of a field in a data structure.
 //
 #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
 
@@ -177,8 +177,8 @@ typedef struct {
   (Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
 
 //
-// Return the maximum of two operands. 
-// This macro returns the maximum of two operand specified by a and b.  
+// Return the maximum of two operands.
+// This macro returns the maximum of two operand specified by a and b.
 // Both a and b must be the same numerical types, signed or unsigned.
 //
 #define MAX(a, b)                       \
@@ -186,8 +186,8 @@ typedef struct {
 
 
 //
-// Return the minimum of two operands. 
-// This macro returns the minimal of two operand specified by a and b.  
+// Return the minimum of two operands.
+// This macro returns the minimal of two operand specified by a and b.
 // Both a and b must be the same numerical types, signed or unsigned.
 //
 #define MIN(a, b)                       \

+ 2 - 2
BaseTools/Source/C/Include/Common/BuildVersion.h

@@ -1,7 +1,7 @@
 /** @file
 This file is for build version number auto generation
 
-Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2018, 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
@@ -12,4 +12,4 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
-#define __BUILD_VERSION ""
+#define __BUILD_VERSION "Developer Build based on Revision: Unknown"

+ 31 - 31
BaseTools/Source/C/Include/Common/PiFirmwareFile.h

@@ -1,10 +1,10 @@
 /** @file
   The firmware file related definitions in PI.
-  
+
   @par Revision Reference:
   Version 1.4.
 
-  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -22,7 +22,7 @@
 #pragma pack(1)
 //
 // Used to verify the integrity of the file.
-// 
+//
 typedef union {
   struct {
     UINT8   Header;
@@ -37,7 +37,7 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 
 //
 // File Types Definitions
-// 
+//
 #define EFI_FV_FILETYPE_ALL                   0x00
 #define EFI_FV_FILETYPE_RAW                   0x01
 #define EFI_FV_FILETYPE_FREEFORM              0x02
@@ -61,9 +61,9 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 #define EFI_FV_FILETYPE_FFS_MIN               0xf0
 #define EFI_FV_FILETYPE_FFS_MAX               0xff
 #define EFI_FV_FILETYPE_FFS_PAD               0xf0
-// 
+//
 // FFS File Attributes.
-// 
+//
 #define FFS_ATTRIB_LARGE_FILE         0x01
 #define FFS_ATTRIB_DATA_ALIGNMENT2    0x02
 #define FFS_ATTRIB_FIXED              0x04
@@ -75,9 +75,9 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 //
 #define FFS_FIXED_CHECKSUM  0xAA
 
-// 
+//
 // FFS File State Bits.
-// 
+//
 #define EFI_FILE_HEADER_CONSTRUCTION  0x01
 #define EFI_FILE_HEADER_VALID         0x02
 #define EFI_FILE_DATA_VALID           0x04
@@ -94,9 +94,9 @@ typedef UINT8 EFI_FFS_FILE_STATE;
                                   )
 
 //
-// Each file begins with the header that describe the 
+// Each file begins with the header that describe the
 // contents and state of the files.
-// 
+//
 typedef struct {
   EFI_GUID                Name;
   EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
@@ -164,21 +164,21 @@ typedef struct {
 #define MAX_SECTION_SIZE        0x1000000
 
 //
-// Leaf section type that contains an 
+// Leaf section type that contains an
 // IA-32 16-bit executable image.
-// 
+//
 typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
 typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;
 
 //
 // CompressionType of EFI_COMPRESSION_SECTION.
-// 
+//
 #define EFI_NOT_COMPRESSED        0x00
 #define EFI_STANDARD_COMPRESSION  0x01
 //
-// An encapsulation section type in which the 
+// An encapsulation section type in which the
 // section data is compressed.
-// 
+//
 typedef struct {
   EFI_COMMON_SECTION_HEADER   CommonHeader;
   UINT32                      UncompressedLength;
@@ -193,19 +193,19 @@ typedef struct {
 
 //
 // Leaf section which could be used to determine the dispatch order of DXEs.
-// 
+//
 typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
 typedef EFI_COMMON_SECTION_HEADER2 EFI_DXE_DEPEX_SECTION2;
 
 //
 // Leaf section witch contains a PI FV.
-// 
+//
 typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
 typedef EFI_COMMON_SECTION_HEADER2 EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;
 
 //
 // Leaf section which contains a single GUID.
-// 
+//
 typedef struct {
   EFI_COMMON_SECTION_HEADER   CommonHeader;
   EFI_GUID                    SubTypeGuid;
@@ -218,12 +218,12 @@ typedef struct {
 
 //
 // Attributes of EFI_GUID_DEFINED_SECTION
-// 
+//
 #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED  0x01
 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID    0x02
 //
 // Leaf section which is encapsulation defined by specific GUID
-// 
+//
 typedef struct {
   EFI_COMMON_SECTION_HEADER   CommonHeader;
   EFI_GUID                    SectionDefinitionGuid;
@@ -240,44 +240,44 @@ typedef struct {
 
 //
 // Leaf section which contains PE32+ image.
-// 
+//
 typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
 typedef EFI_COMMON_SECTION_HEADER2 EFI_PE32_SECTION2;
 
 //
 // Leaf section which contains PIC image.
-// 
+//
 typedef EFI_COMMON_SECTION_HEADER EFI_PIC_SECTION;
 typedef EFI_COMMON_SECTION_HEADER2 EFI_PIC_SECTION2;
 
 //
 // Leaf section which used to determine the dispatch order of PEIMs.
-// 
+//
 typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
 typedef EFI_COMMON_SECTION_HEADER2 EFI_PEI_DEPEX_SECTION2;
 
 //
 // Leaf section which constains the position-independent-code image.
-// 
+//
 typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
 typedef EFI_COMMON_SECTION_HEADER2 EFI_TE_SECTION2;
 
 //
 // Leaf section which contains an array of zero or more bytes.
-// 
+//
 typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
 typedef EFI_COMMON_SECTION_HEADER2 EFI_RAW_SECTION2;
 
 //
-// Leaf section which contains a unicode string that 
+// Leaf section which contains a unicode string that
 // is human readable file name.
-// 
+//
 typedef struct {
   EFI_COMMON_SECTION_HEADER   CommonHeader;
 
   //
   // Array of unicode string.
-  // 
+  //
   CHAR16                      FileNameString[1];
 } EFI_USER_INTERFACE_SECTION;
 
@@ -286,14 +286,14 @@ typedef struct {
 
   //
   // Array of unicode string.
-  // 
+  //
   CHAR16                      FileNameString[1];
 } EFI_USER_INTERFACE_SECTION2;
 
 //
 // Leaf section which contains a numeric build number and
-// an optional unicode string that represent the file revision. 
-// 
+// an optional unicode string that represent the file revision.
+//
 typedef struct {
   EFI_COMMON_SECTION_HEADER   CommonHeader;
   UINT16                      BuildNumber;

+ 7 - 7
BaseTools/Source/C/Include/Common/PiFirmwareVolume.h

@@ -4,7 +4,7 @@
   @par Revision Reference:
   Version 1.2C
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -26,16 +26,16 @@ typedef UINT32  EFI_FV_FILE_ATTRIBUTES;
 
 //
 // Value of EFI_FV_FILE_ATTRIBUTES.
-// 
+//
 #define EFI_FV_FILE_ATTRIB_ALIGNMENT      0x0000001F
 #define EFI_FV_FILE_ATTRIB_FIXED          0x00000100
 #define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED  0x00000200
 
 typedef UINT32  EFI_FVB_ATTRIBUTES_2;
 
-// 
+//
 // Attributes bit definitions
-// 
+//
 #define EFI_FVB2_READ_DISABLED_CAP  0x00000001
 #define EFI_FVB2_READ_ENABLED_CAP   0x00000002
 #define EFI_FVB2_READ_STATUS        0x00000004
@@ -118,7 +118,7 @@ typedef struct {
 
 //
 // Extension header pointed by ExtHeaderOffset of volume header.
-// 
+//
 typedef struct {
   EFI_GUID  FvName;
   UINT32    ExtHeaderSize;
@@ -135,9 +135,9 @@ typedef struct {
   UINT32    TypeMask;
 
   //
-  // Array of GUIDs. 
+  // Array of GUIDs.
   // Each GUID represents an OEM file type.
-  // 
+  //
   // EFI_GUID  Types[1];
   //
 } EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;

+ 35 - 35
BaseTools/Source/C/Include/Common/UefiBaseTypes.h

@@ -1,7 +1,7 @@
 /** @file
   Defines data types and constants introduced in UEFI.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -20,7 +20,7 @@
 
 //
 // Basical data type definitions introduced in UEFI.
-// 
+//
 typedef struct {
   UINT32  Data1;
   UINT16  Data2;
@@ -94,41 +94,41 @@ typedef union {
 
 //
 // Enumeration of EFI_STATUS.
-// 
-#define EFI_SUCCESS               RETURN_SUCCESS              
-#define EFI_LOAD_ERROR            RETURN_LOAD_ERROR           
-#define EFI_INVALID_PARAMETER     RETURN_INVALID_PARAMETER    
-#define EFI_UNSUPPORTED           RETURN_UNSUPPORTED          
-#define EFI_BAD_BUFFER_SIZE       RETURN_BAD_BUFFER_SIZE      
-#define EFI_BUFFER_TOO_SMALL      RETURN_BUFFER_TOO_SMALL     
-#define EFI_NOT_READY             RETURN_NOT_READY            
-#define EFI_DEVICE_ERROR          RETURN_DEVICE_ERROR         
-#define EFI_WRITE_PROTECTED       RETURN_WRITE_PROTECTED      
-#define EFI_OUT_OF_RESOURCES      RETURN_OUT_OF_RESOURCES     
-#define EFI_VOLUME_CORRUPTED      RETURN_VOLUME_CORRUPTED     
-#define EFI_VOLUME_FULL           RETURN_VOLUME_FULL          
-#define EFI_NO_MEDIA              RETURN_NO_MEDIA             
-#define EFI_MEDIA_CHANGED         RETURN_MEDIA_CHANGED        
-#define EFI_NOT_FOUND             RETURN_NOT_FOUND            
-#define EFI_ACCESS_DENIED         RETURN_ACCESS_DENIED        
-#define EFI_NO_RESPONSE           RETURN_NO_RESPONSE          
-#define EFI_NO_MAPPING            RETURN_NO_MAPPING           
-#define EFI_TIMEOUT               RETURN_TIMEOUT              
-#define EFI_NOT_STARTED           RETURN_NOT_STARTED          
-#define EFI_ALREADY_STARTED       RETURN_ALREADY_STARTED      
-#define EFI_ABORTED               RETURN_ABORTED              
-#define EFI_ICMP_ERROR            RETURN_ICMP_ERROR           
-#define EFI_TFTP_ERROR            RETURN_TFTP_ERROR           
-#define EFI_PROTOCOL_ERROR        RETURN_PROTOCOL_ERROR       
-#define EFI_INCOMPATIBLE_VERSION  RETURN_INCOMPATIBLE_VERSION 
-#define EFI_SECURITY_VIOLATION    RETURN_SECURITY_VIOLATION   
-#define EFI_CRC_ERROR             RETURN_CRC_ERROR   
+//
+#define EFI_SUCCESS               RETURN_SUCCESS
+#define EFI_LOAD_ERROR            RETURN_LOAD_ERROR
+#define EFI_INVALID_PARAMETER     RETURN_INVALID_PARAMETER
+#define EFI_UNSUPPORTED           RETURN_UNSUPPORTED
+#define EFI_BAD_BUFFER_SIZE       RETURN_BAD_BUFFER_SIZE
+#define EFI_BUFFER_TOO_SMALL      RETURN_BUFFER_TOO_SMALL
+#define EFI_NOT_READY             RETURN_NOT_READY
+#define EFI_DEVICE_ERROR          RETURN_DEVICE_ERROR
+#define EFI_WRITE_PROTECTED       RETURN_WRITE_PROTECTED
+#define EFI_OUT_OF_RESOURCES      RETURN_OUT_OF_RESOURCES
+#define EFI_VOLUME_CORRUPTED      RETURN_VOLUME_CORRUPTED
+#define EFI_VOLUME_FULL           RETURN_VOLUME_FULL
+#define EFI_NO_MEDIA              RETURN_NO_MEDIA
+#define EFI_MEDIA_CHANGED         RETURN_MEDIA_CHANGED
+#define EFI_NOT_FOUND             RETURN_NOT_FOUND
+#define EFI_ACCESS_DENIED         RETURN_ACCESS_DENIED
+#define EFI_NO_RESPONSE           RETURN_NO_RESPONSE
+#define EFI_NO_MAPPING            RETURN_NO_MAPPING
+#define EFI_TIMEOUT               RETURN_TIMEOUT
+#define EFI_NOT_STARTED           RETURN_NOT_STARTED
+#define EFI_ALREADY_STARTED       RETURN_ALREADY_STARTED
+#define EFI_ABORTED               RETURN_ABORTED
+#define EFI_ICMP_ERROR            RETURN_ICMP_ERROR
+#define EFI_TFTP_ERROR            RETURN_TFTP_ERROR
+#define EFI_PROTOCOL_ERROR        RETURN_PROTOCOL_ERROR
+#define EFI_INCOMPATIBLE_VERSION  RETURN_INCOMPATIBLE_VERSION
+#define EFI_SECURITY_VIOLATION    RETURN_SECURITY_VIOLATION
+#define EFI_CRC_ERROR             RETURN_CRC_ERROR
 #define EFI_END_OF_MEDIA          RETURN_END_OF_MEDIA
 #define EFI_END_OF_FILE           RETURN_END_OF_FILE
 
-#define EFI_WARN_UNKNOWN_GLYPH    RETURN_WARN_UNKNOWN_GLYPH   
-#define EFI_WARN_DELETE_FAILURE   RETURN_WARN_DELETE_FAILURE  
-#define EFI_WARN_WRITE_FAILURE    RETURN_WARN_WRITE_FAILURE   
+#define EFI_WARN_UNKNOWN_GLYPH    RETURN_WARN_UNKNOWN_GLYPH
+#define EFI_WARN_DELETE_FAILURE   RETURN_WARN_DELETE_FAILURE
+#define EFI_WARN_WRITE_FAILURE    RETURN_WARN_WRITE_FAILURE
 #define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
 
 
@@ -136,7 +136,7 @@ typedef union {
 
 //
 // Define macro to encode the status code.
-// 
+//
 #define EFIERR(_a)                ENCODE_ERROR(_a)
 
 #define EFI_ERROR(A)              RETURN_ERROR(A)

+ 37 - 37
BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h

@@ -3,7 +3,7 @@
   IFR is primarily consumed by the EFI presentation engine, and produced by EFI
   internal application and drivers as well as all add-in card option-ROM drivers
 
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 
   This program and the accompanying materials are licensed and made available
@@ -55,27 +55,27 @@ typedef struct {
 } EFI_HII_PACKAGE_LIST_HEADER;
 
 /**
-    
-  Each package starts with a header, as defined above, which  
-  indicates the size and type of the package. When added to a  
-  pointer pointing to the start of the header, Length points at  
-  the next package. The package lists form a package list when  
-  concatenated together and terminated with an  
-  EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The  
-  type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII  
-  packages, whose contents are determined by the Guid. The range  
-  of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN  
-  through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system  
-  firmware implementers.  
-  
+
+  Each package starts with a header, as defined above, which
+  indicates the size and type of the package. When added to a
+  pointer pointing to the start of the header, Length points at
+  the next package. The package lists form a package list when
+  concatenated together and terminated with an
+  EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The
+  type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII
+  packages, whose contents are determined by the Guid. The range
+  of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN
+  through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system
+  firmware implementers.
+
   @param Length The size of the package in bytes.
-  
+
   @param Type   The package type. See EFI_HII_PACKAGE_TYPE_x,
                 below.
-  
+
   @param Data   The package data, the format of which is
                 determined by Type.
-  
+
 **/
 typedef struct {
   UINT32  Length:24;
@@ -85,7 +85,7 @@ typedef struct {
 
 //
 // EFI_HII_PACKAGE_TYPE_x.
-// 
+//
 #define EFI_HII_PACKAGE_TYPE_ALL             0x00
 #define EFI_HII_PACKAGE_TYPE_GUID            0x01
 #define EFI_HII_PACKAGE_FORM                 0x02
@@ -222,7 +222,7 @@ typedef struct _EFI_HII_GIBT_GLYPH_BLOCK {
 typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {
   EFI_HII_GLYPH_BLOCK    Header;
   EFI_HII_GLYPH_INFO     Cell;
-  UINT16                 Count;  
+  UINT16                 Count;
   UINT8                  BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height
 } EFI_HII_GIBT_GLYPHS_BLOCK;
 
@@ -1360,12 +1360,12 @@ typedef struct _EFI_IFR_SECURITY {
 
 typedef struct _EFI_IFR_FORM_MAP_METHOD {
   ///
-  /// The string identifier which provides the human-readable name of 
+  /// The string identifier which provides the human-readable name of
   /// the configuration method for this standards map form.
   ///
   EFI_STRING_ID            MethodTitle;
   ///
-  /// Identifier which uniquely specifies the configuration methods 
+  /// Identifier which uniquely specifies the configuration methods
   /// associated with this standards map form.
   ///
   EFI_GUID                 MethodIdentifier;
@@ -1373,8 +1373,8 @@ typedef struct _EFI_IFR_FORM_MAP_METHOD {
 
 typedef struct _EFI_IFR_FORM_MAP {
   ///
-  /// The sequence that defines the type of opcode as well as the length 
-  /// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP. 
+  /// The sequence that defines the type of opcode as well as the length
+  /// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP.
   ///
   EFI_IFR_OP_HEADER        Header;
   ///
@@ -1389,13 +1389,13 @@ typedef struct _EFI_IFR_FORM_MAP {
 
 typedef struct _EFI_IFR_SET {
   ///
-  /// The sequence that defines the type of opcode as well as the length 
-  /// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP. 
+  /// The sequence that defines the type of opcode as well as the length
+  /// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP.
   ///
   EFI_IFR_OP_HEADER  Header;
   ///
-  /// Specifies the identifier of a previously declared variable store to 
-  /// use when storing the question's value. 
+  /// Specifies the identifier of a previously declared variable store to
+  /// use when storing the question's value.
   ///
   EFI_VARSTORE_ID    VarStoreId;
   union {
@@ -1409,20 +1409,20 @@ typedef struct _EFI_IFR_SET {
     UINT16           VarOffset;
   }                  VarStoreInfo;
   ///
-  /// Specifies the type used for storage. 
+  /// Specifies the type used for storage.
   ///
   UINT8              VarStoreType;
 } EFI_IFR_SET;
 
 typedef struct _EFI_IFR_GET {
   ///
-  /// The sequence that defines the type of opcode as well as the length 
-  /// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP. 
+  /// The sequence that defines the type of opcode as well as the length
+  /// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP.
   ///
   EFI_IFR_OP_HEADER  Header;
   ///
-  /// Specifies the identifier of a previously declared variable store to 
-  /// use when retrieving the value. 
+  /// Specifies the identifier of a previously declared variable store to
+  /// use when retrieving the value.
   ///
   EFI_VARSTORE_ID    VarStoreId;
   union {
@@ -1436,7 +1436,7 @@ typedef struct _EFI_IFR_GET {
     UINT16           VarOffset;
   }                  VarStoreInfo;
   ///
-  /// Specifies the type used for storage. 
+  /// Specifies the type used for storage.
   ///
   UINT8              VarStoreType;
 } EFI_IFR_GET;
@@ -1456,9 +1456,9 @@ typedef struct _EFI_IFR_MAP {
 // Keyboard Package
 //
 
-typedef enum {    
+typedef enum {
   EfiKeyLCtrl,
-  EfiKeyA0, 
+  EfiKeyA0,
   EfiKeyLAlt,
   EfiKeySpaceBar,
   EfiKeyA2,
@@ -1575,7 +1575,7 @@ typedef struct {
 } EFI_KEY_DESCRIPTOR;
 
 //
-// A key which is affected by all the standard shift modifiers.  
+// A key which is affected by all the standard shift modifiers.
 // Most keys would be expected to have this bit active.
 //
 #define EFI_AFFECTED_BY_STANDARD_SHIFT       0x0001
@@ -1677,7 +1677,7 @@ typedef struct {
 // token usages.
 //
 //
-// STRING_TOKEN is not defined in UEFI specification. But it is placed 
+// STRING_TOKEN is not defined in UEFI specification. But it is placed
 // here for the easy access by C files and VFR source files.
 //
 #define STRING_TOKEN(t) t

+ 22 - 22
BaseTools/Source/C/Include/Common/UefiMultiPhase.h

@@ -1,5 +1,5 @@
 /** @file
-  This includes some definitions introduced in UEFI that will be used in both PEI 
+  This includes some definitions introduced in UEFI that will be used in both PEI
   and DXE phases.
 
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
@@ -20,7 +20,7 @@
 
 //
 // Enumeration of memory types introduced in UEFI.
-// 
+//
 typedef enum {
   EfiReservedMemoryType,
   EfiLoaderCode,
@@ -43,7 +43,7 @@ typedef enum {
 
 //
 // Data structure that precedes all of the standard EFI table types.
-// 
+//
 typedef struct {
   UINT64  Signature;
   UINT32  Revision;
@@ -54,28 +54,28 @@ typedef struct {
 
 //
 // Attributes of variable.
-// 
+//
 #define EFI_VARIABLE_NON_VOLATILE                 0x00000001
 #define EFI_VARIABLE_BOOTSERVICE_ACCESS           0x00000002
 #define EFI_VARIABLE_RUNTIME_ACCESS               0x00000004
 #define EFI_VARIABLE_HARDWARE_ERROR_RECORD        0x00000008
 
 //
-// This attribute is identified by the mnemonic 'HR' 
+// This attribute is identified by the mnemonic 'HR'
 // elsewhere in this specification.
-// 
+//
 #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS   0x00000010
 
 
 
 //
 // _WIN_CERTIFICATE.wCertificateType
-// 
+//
 #define WIN_CERT_TYPE_EFI_PKCS115   0x0EF0
 #define WIN_CERT_TYPE_EFI_GUID      0x0EF1
 
 /**
-   
+
   The WIN_CERTIFICATE structure is part of the PE/COFF
   specification and has the following definition:
 
@@ -110,13 +110,13 @@ typedef struct _WIN_CERTIFICATE {
 
 //
 // WIN_CERTIFICATE_UEFI_GUID.CertType
-// 
+//
 #define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
   {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
 
 //
 // WIN_CERTIFICATE_UEFI_GUID.CertData
-// 
+//
 typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
   EFI_GUID  HashType;
   UINT8     PublicKey[256];
@@ -125,7 +125,7 @@ typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
 
 
 /**
-   
+
   @param Hdr  This is the standard WIN_CERTIFICATE header, where
               wCertificateType is set to
               WIN_CERT_TYPE_EFI_GUID.
@@ -158,26 +158,26 @@ typedef struct _WIN_CERTIFICATE_UEFI_GUID {
 
 
 /**
-   
+
   Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital
   signature.
-  
+
   The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
-  WIN_CERTIFICATE and encapsulate the information needed to  
-  implement the RSASSA-PKCS1-v1_5 digital signature algorithm as  
-  specified in RFC2437.  
-  
+  WIN_CERTIFICATE and encapsulate the information needed to
+  implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
+  specified in RFC2437.
+
   @param Hdr  This is the standard WIN_CERTIFICATE header, where
               wCertificateType is set to
               WIN_CERT_TYPE_UEFI_PKCS1_15.
-  
+
   @param HashAlgorithm  This is the hashing algorithm which was
                         performed on the UEFI executable when
                         creating the digital signature. It is
                         one of the enumerated values pre-defined
                         in Section 26.4.1. See
                         EFI_HASH_ALGORITHM_x.
-  
+
   @param Signature  This is the actual digital signature. The
                     size of the signature is the same size as
                     the key (1024-bit key is 128 bytes) and can
@@ -195,7 +195,7 @@ typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
 
 
 /**
-   
+
   AuthInfo is a WIN_CERTIFICATE using the wCertificateType
   WIN_CERTIFICATE_UEFI_GUID and the CertType
   EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
@@ -209,12 +209,12 @@ typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
   WIN_CERTIFICATE shall be used to describe the signature of the
   Variable data *Data. In addition, the signature will also
   include the MonotonicCount value to guard against replay attacks
-  
+
   @param  MonotonicCount  Included in the signature of
                           AuthInfo.Used to ensure freshness/no
                           replay. Incremented during each
                           "Write" access.
-  
+
   @param AuthInfo   Provides the authorization for the variable
                     access. It is a signature across the
                     variable data and the  Monotonic Count

+ 2 - 2
BaseTools/Source/C/Include/Common/VariableFormat.h

@@ -1,13 +1,13 @@
 /**@file
   Header file for EFI Variable Services.
 
-  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2018, 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.
 

+ 3 - 3
BaseTools/Source/C/Include/Guid/PcAnsi.h

@@ -2,8 +2,8 @@
   Terminal Device Path Vendor Guid.
   @par Revision Reference:
   GUIDs defined in UEFI 2.0 spec.
-  
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+  Copyright (c) 2006 - 2018, 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
@@ -42,7 +42,7 @@
   { \
     0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
   }
-  
+
 #define EFI_SAS_DEVICE_PATH_GUID \
   { \
     0xd487ddb4, 0x008b, 0x11d9, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \

+ 2 - 2
BaseTools/Source/C/Include/Guid/PiFirmwareFileSystem.h

@@ -1,11 +1,11 @@
 /** @file
   Guid used to define the Firmware File System. See PI spec volume 3 for more
   details.
-  
+
   @par Revision Reference:
   Guids defined in PI Spec Volume 3
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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

+ 10 - 10
BaseTools/Source/C/Include/Ia32/ProcessorBind.h

@@ -1,7 +1,7 @@
 /** @file
   Processor or Compiler specific defines and types for x64.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -64,11 +64,11 @@
   //
   // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
   //
- 
-  #if _MSC_EXTENSIONS 
-    
+
+  #if _MSC_EXTENSIONS
+
     //
-    // use Microsoft* C complier dependent integer width types 
+    // use Microsoft* C complier dependent integer width types
     //
     typedef unsigned __int64    UINT64;
     typedef __int64             INT64;
@@ -84,7 +84,7 @@
   #else
 
     //
-    // Assume standard IA-32 alignment. 
+    // Assume standard IA-32 alignment.
     // BugBug: Need to check portability of long long
     //
     typedef unsigned long long  UINT64;
@@ -144,17 +144,17 @@ typedef INT32   INTN;
 #if _MSC_EXTENSIONS
   //
   // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
-  // 
-  #define EFIAPI __cdecl  
+  //
+  #define EFIAPI __cdecl
 #endif
 
 #if __GNUC__
-  #define EFIAPI __attribute__((cdecl))    
+  #define EFIAPI __attribute__((cdecl))
 #endif
 
 //
 // The Microsoft* C compiler can removed references to unreferenced data items
-//  if the /OPT:REF linker option is used. We defined a macro as this is a 
+//  if the /OPT:REF linker option is used. We defined a macro as this is a
 //  a non standard extension
 //
 #if _MSC_EXTENSIONS

+ 2 - 2
BaseTools/Source/C/Include/IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h

@@ -1,9 +1,9 @@
 /** @file
-  ACPI memory mapped configuration space access table definition, defined at 
+  ACPI memory mapped configuration space access table definition, defined at
   in the PCI Firmware Specification, version 3.0 draft version 0.5.
   Specification is available at http://www.pcisig.com.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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

+ 22 - 22
BaseTools/Source/C/Include/IndustryStandard/PeImage.h

@@ -4,7 +4,7 @@
 
   @bug Fix text - doc as defined in MSFT EFI specification.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
   Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
 
   This program and the accompanying materials are licensed and made available
@@ -52,10 +52,10 @@
 //
 // Support old names for backward compatible
 //
-#define EFI_IMAGE_MACHINE_IA32      IMAGE_FILE_MACHINE_I386 
-#define EFI_IMAGE_MACHINE_IA64      IMAGE_FILE_MACHINE_IA64  
-#define EFI_IMAGE_MACHINE_IPF       IMAGE_FILE_MACHINE_IA64  
-#define EFI_IMAGE_MACHINE_EBC       IMAGE_FILE_MACHINE_EBC  
+#define EFI_IMAGE_MACHINE_IA32      IMAGE_FILE_MACHINE_I386
+#define EFI_IMAGE_MACHINE_IA64      IMAGE_FILE_MACHINE_IA64
+#define EFI_IMAGE_MACHINE_IPF       IMAGE_FILE_MACHINE_IA64
+#define EFI_IMAGE_MACHINE_EBC       IMAGE_FILE_MACHINE_EBC
 #define EFI_IMAGE_MACHINE_X64       IMAGE_FILE_MACHINE_X64
 #define EFI_IMAGE_MACHINE_ARMT      IMAGE_FILE_MACHINE_ARMT
 #define EFI_IMAGE_MACHINE_AARCH64   IMAGE_FILE_MACHINE_ARM64
@@ -475,23 +475,23 @@ typedef struct {
 //
 // x64 processor relocation types.
 //
-#define IMAGE_REL_AMD64_ABSOLUTE	0x0000
-#define IMAGE_REL_AMD64_ADDR64	  0x0001
-#define IMAGE_REL_AMD64_ADDR32	  0x0002
-#define IMAGE_REL_AMD64_ADDR32NB	0x0003
-#define IMAGE_REL_AMD64_REL32	    0x0004
-#define IMAGE_REL_AMD64_REL32_1	  0x0005
-#define IMAGE_REL_AMD64_REL32_2	  0x0006
-#define IMAGE_REL_AMD64_REL32_3	  0x0007
-#define IMAGE_REL_AMD64_REL32_4	  0x0008
-#define IMAGE_REL_AMD64_REL32_5	  0x0009
-#define IMAGE_REL_AMD64_SECTION	  0x000A
-#define IMAGE_REL_AMD64_SECREL	  0x000B
-#define IMAGE_REL_AMD64_SECREL7	  0x000C
-#define IMAGE_REL_AMD64_TOKEN	    0x000D
-#define IMAGE_REL_AMD64_SREL32	  0x000E
-#define IMAGE_REL_AMD64_PAIR	    0x000F
-#define IMAGE_REL_AMD64_SSPAN32	  0x0010
+#define IMAGE_REL_AMD64_ABSOLUTE  0x0000
+#define IMAGE_REL_AMD64_ADDR64    0x0001
+#define IMAGE_REL_AMD64_ADDR32    0x0002
+#define IMAGE_REL_AMD64_ADDR32NB  0x0003
+#define IMAGE_REL_AMD64_REL32      0x0004
+#define IMAGE_REL_AMD64_REL32_1    0x0005
+#define IMAGE_REL_AMD64_REL32_2    0x0006
+#define IMAGE_REL_AMD64_REL32_3    0x0007
+#define IMAGE_REL_AMD64_REL32_4    0x0008
+#define IMAGE_REL_AMD64_REL32_5    0x0009
+#define IMAGE_REL_AMD64_SECTION    0x000A
+#define IMAGE_REL_AMD64_SECREL    0x000B
+#define IMAGE_REL_AMD64_SECREL7    0x000C
+#define IMAGE_REL_AMD64_TOKEN      0x000D
+#define IMAGE_REL_AMD64_SREL32    0x000E
+#define IMAGE_REL_AMD64_PAIR      0x000F
+#define IMAGE_REL_AMD64_SSPAN32    0x0010
 
 ///
 /// Based relocation format.

+ 5 - 5
BaseTools/Source/C/Include/IndustryStandard/pci22.h

@@ -1,7 +1,7 @@
 /** @file
   Support for PCI 2.2 standard.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -168,7 +168,7 @@ typedef struct {
 #define PCI_CLASS_BRIDGE_ISA_PDECODE  0x80
 #define PCI_CLASS_ISA_POSITIVE_DECODE 0x80  // obsolete
 
-#define PCI_CLASS_SCC                 0x07  // Simple communications controllers 
+#define PCI_CLASS_SCC                 0x07  // Simple communications controllers
 #define PCI_SUBCLASS_SERIAL           0x00
 #define PCI_IF_GENERIC_XT             0x00
 #define PCI_IF_16450                  0x01
@@ -197,8 +197,8 @@ typedef struct {
 #define PCI_IF_8259_PIC               0x00
 #define PCI_IF_ISA_PIC                0x01
 #define PCI_IF_EISA_PIC               0x02
-#define PCI_IF_APIC_CONTROLLER        0x10 // I/O APIC interrupt controller , 32 bye none-prefectable memory.  
-#define PCI_IF_APIC_CONTROLLER2       0x20 
+#define PCI_IF_APIC_CONTROLLER        0x10 // I/O APIC interrupt controller , 32 bye none-prefectable memory.
+#define PCI_IF_APIC_CONTROLLER2       0x20
 #define PCI_SUBCLASS_TIMER            0x02
 #define PCI_IF_8254_TIMER             0x00
 #define PCI_IF_ISA_TIMER              0x01
@@ -249,7 +249,7 @@ typedef struct {
 
 #define PCI_SECURITY_CONTROLLER       0x10 // Encryption and decryption controller
 #define PCI_SUBCLASS_NET_COMPUT       0x00
-#define PCI_SUBCLASS_ENTERTAINMENT    0x10 
+#define PCI_SUBCLASS_ENTERTAINMENT    0x10
 
 #define PCI_CLASS_DPIO                0x11
 

+ 17 - 17
BaseTools/Source/C/Include/Protocol/GraphicsOutput.h

@@ -3,7 +3,7 @@
 
   Abstraction of a very simple graphics device.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -108,7 +108,7 @@ typedef union {
 typedef enum {
   EfiBltVideoFill,
   EfiBltVideoToBltBuffer,
-  EfiBltBufferToVideo, 
+  EfiBltBufferToVideo,
   EfiBltVideoToVideo,
   EfiGraphicsOutputBltOperationMax
 } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
@@ -116,28 +116,28 @@ typedef enum {
 /**
   The following table defines actions for BltOperations:
 
-  <B>EfiBltVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY) 
-  directly to every pixel of the video display rectangle 
-  (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). 
+  <B>EfiBltVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY)
+  directly to every pixel of the video display rectangle
+  (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
   Only one pixel will be used from the BltBuffer. Delta is NOT used.
 
-  <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle 
-  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in 
-  the BltBuffer rectangle (DestinationX, DestinationY ) 
-  (DestinationX + Width, DestinationY + Height). If DestinationX or 
-  DestinationY is not zero then Delta must be set to the length in bytes 
+  <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
+  the BltBuffer rectangle (DestinationX, DestinationY )
+  (DestinationX + Width, DestinationY + Height). If DestinationX or
+  DestinationY is not zero then Delta must be set to the length in bytes
   of a row in the BltBuffer.
 
-  <B>EfiBltBufferToVideo</B> - Write data from the  BltBuffer rectangle 
-  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the 
-  video display rectangle (DestinationX, DestinationY) 
-  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is 
-  not zero then Delta must be set to the length in bytes of a row in the 
+  <B>EfiBltBufferToVideo</B> - Write data from the  BltBuffer rectangle
+  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
+  video display rectangle (DestinationX, DestinationY)
+  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
+  not zero then Delta must be set to the length in bytes of a row in the
   BltBuffer.
 
   <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
-  (SourceX + Width, SourceY + Height) .to the video display rectangle 
-  (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). 
+  (SourceX + Width, SourceY + Height) .to the video display rectangle
+  (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
   The BltBuffer and Delta  are not used in this mode.
 
   @param  This         Protocol instance pointer.

+ 7 - 7
BaseTools/Source/C/Include/Protocol/GuidedSectionExtraction.h

@@ -1,15 +1,15 @@
 /** @file
   This file declares GUIDed section extraction protocol.
 
-  This interface provides a means of decoding a GUID defined encapsulation 
+  This interface provides a means of decoding a GUID defined encapsulation
   section. There may be multiple different GUIDs associated with the GUIDed
   section extraction protocol. That is, all instances of the GUIDed section
   extraction protocol must have the same interface structure.
-  
+
   @par Revision Reference: PI
   Version 1.00.
-  
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+
+  Copyright (c) 2006 - 2018, 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
@@ -56,10 +56,10 @@ typedef struct _EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL EFI_GUIDED_SECTION_EXTRAC
   EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is
   defined in RaiseTPL() in the UEFI 2.0 specification.
 
-  
+
   @param This   Indicates the
                 EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.
-  
+
   @param InputSection Buffer containing the input GUIDed section
                       to be processed. OutputBuffer OutputBuffer
                       is allocated from boot services pool
@@ -124,7 +124,7 @@ EFI_STATUS
 
 
 /**
-  
+
   Takes the GUIDed section as input and produces the section
   stream data. See the ExtractSection() function description.
 

+ 2 - 2
BaseTools/Source/C/Include/Protocol/HiiFramework.h

@@ -2,11 +2,11 @@
   This file defines the Human Interface Infrastructure protocol which will
   be used by resources which want to publish IFR/Font/String data and have it
   collected by the Configuration engine.
-  
+
   @par Revision Reference:
   This protocol is defined in HII spec 0.92.
 
-  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2018, 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

+ 18 - 18
BaseTools/Source/C/Include/Protocol/UgaDraw.h

@@ -3,7 +3,7 @@
 
   Abstraction of a very simple graphics device.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -99,33 +99,33 @@ typedef enum {
 
     The following table defines actions for BltOperations:
 
-    <B>EfiUgaVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY) 
-      directly to every pixel of the video display rectangle 
-      (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). 
+    <B>EfiUgaVideoFill</B> - Write data from the  BltBuffer pixel (SourceX, SourceY)
+      directly to every pixel of the video display rectangle
+      (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
       Only one pixel will be used from the BltBuffer. Delta is NOT used.
 
-    <B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle 
-      (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in 
-      the BltBuffer rectangle (DestinationX, DestinationY ) 
-      (DestinationX + Width, DestinationY + Height). If DestinationX or 
-      DestinationY is not zero then Delta must be set to the length in bytes 
+    <B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle
+      (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
+      the BltBuffer rectangle (DestinationX, DestinationY )
+      (DestinationX + Width, DestinationY + Height). If DestinationX or
+      DestinationY is not zero then Delta must be set to the length in bytes
       of a row in the BltBuffer.
 
-    <B>EfiUgaBltBufferToVideo</B> - Write data from the  BltBuffer rectangle 
-      (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the 
-      video display rectangle (DestinationX, DestinationY) 
-      (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is 
-      not zero then Delta must be set to the length in bytes of a row in the 
+    <B>EfiUgaBltBufferToVideo</B> - Write data from the  BltBuffer rectangle
+      (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
+      video display rectangle (DestinationX, DestinationY)
+      (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
+      not zero then Delta must be set to the length in bytes of a row in the
       BltBuffer.
 
     <B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
-     (SourceX + Width, SourceY + Height) .to the video display rectangle 
-     (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). 
+     (SourceX + Width, SourceY + Height) .to the video display rectangle
+     (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
      The BltBuffer and Delta  are not used in this mode.
 
 
     @param[in] This          - Protocol instance pointer.
-    @param[in] BltBuffer     - Buffer containing data to blit into video buffer. This 
+    @param[in] BltBuffer     - Buffer containing data to blit into video buffer. This
                                buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
     @param[in] BltOperation  - Operation to perform on BlitBuffer and video memory
     @param[in] SourceX       - X coordinate of source for the BltBuffer.
@@ -135,7 +135,7 @@ typedef enum {
     @param[in] Width         - Width of rectangle in BltBuffer in pixels.
     @param[in] Height        - Hight of rectangle in BltBuffer in pixels.
     @param[in] Delta         - OPTIONAL
-  
+
     @retval EFI_SUCCESS           - The Blt operation completed.
     @retval EFI_INVALID_PARAMETER - BltOperation is not valid.
     @retval EFI_DEVICE_ERROR      - A hardware error occured writting to the video buffer.

+ 16 - 16
BaseTools/Source/C/Include/X64/ProcessorBind.h

@@ -1,7 +1,7 @@
 /** @file
   Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -30,8 +30,8 @@
 #endif
 
 
-#if _MSC_EXTENSIONS 
-    
+#if _MSC_EXTENSIONS
+
 //
 // Disable warning that make it impossible to compile at /W4
 // This only works for Microsoft* tools
@@ -66,12 +66,12 @@
   //
   // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
   //
- 
-  #if _MSC_EXTENSIONS 
-    
+
+  #if _MSC_EXTENSIONS
+
 
     //
-    // use Microsoft C complier dependent integer width types 
+    // use Microsoft C complier dependent integer width types
     //
     typedef unsigned __int64    UINT64;
     typedef __int64             INT64;
@@ -85,9 +85,9 @@
     typedef char                CHAR8;
     typedef char                INT8;
   #else
-    #ifdef _EFI_P64 
+    #ifdef _EFI_P64
       //
-      // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints 
+      // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
       //  are 32-bits
       //
       typedef unsigned long long  UINT64;
@@ -160,28 +160,28 @@ typedef INT64   INTN;
 // use the correct C calling convention. All protocol member functions and
 // EFI intrinsics are required to modify thier member functions with EFIAPI.
 //
-#if _MSC_EXTENSIONS 
+#if _MSC_EXTENSIONS
   ///
   /// Define the standard calling convention reguardless of optimization level.
   /// __cdecl is Microsoft* specific C extension.
-  /// 
-  #define EFIAPI __cdecl  
+  ///
+  #define EFIAPI __cdecl
 #elif __GNUC__
   ///
   /// Define the standard calling convention reguardless of optimization level.
   /// efidecl is an extension to GCC that supports the differnece between x64
   /// GCC ABI and x64 Microsoft* ABI. EFI is closer to the Microsoft* ABI and
-  /// EFIAPI makes sure the right ABI is used for public interfaces. 
+  /// EFIAPI makes sure the right ABI is used for public interfaces.
   /// eficecl is a work in progress and we do not yet have the compiler
   ///
-  #define EFIAPI 
+  #define EFIAPI
 #else
-  #define EFIAPI       
+  #define EFIAPI
 #endif
 
 //
 // The Microsoft* C compiler can removed references to unreferenced data items
-//  if the /OPT:REF linker option is used. We defined a macro as this is a 
+//  if the /OPT:REF linker option is used. We defined a macro as this is a
 //  a non standard extension
 //
 #if _MSC_EXTENSIONS

+ 1 - 1
BaseTools/Source/C/LzmaCompress/LZMA-SDK-README.txt

@@ -1,3 +1,3 @@
 LzmaCompress is based on the LZMA SDK 16.04.  LZMA SDK 16.04
 was placed in the public domain on 2016-10-04.  It was
-released on the http://www.7-zip.org/sdk.html website.
+released on the http://www.7-zip.org/sdk.html website.

+ 10 - 10
BaseTools/Source/C/LzmaCompress/LzmaCompress.c

@@ -5,7 +5,7 @@
     LzmaUtil.c -- Test application for LZMA compression
     2016-10-04 : Igor Pavlov : Public domain
 
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -33,7 +33,7 @@
 #define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
 
 typedef enum {
-  NoConverter, 
+  NoConverter,
   X86Converter,
   MaxConverter
 } CONVERTER_TYPE;
@@ -50,7 +50,7 @@ static CONVERTER_TYPE mConType = NoConverter;
 #define UTILITY_MAJOR_VERSION 0
 #define UTILITY_MINOR_VERSION 2
 #define INTEL_COPYRIGHT \
-  "Copyright (c) 2009-2016, Intel Corporation. All rights reserved."
+  "Copyright (c) 2009-2018, Intel Corporation. All rights reserved."
 void PrintHelp(char *buffer)
 {
   strcat(buffer,
@@ -113,7 +113,7 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
   } else {
     return SZ_ERROR_INPUT_EOF;
   }
-  
+
   if (SeqInStream_Read(inStream, inBuffer, inSize) != SZ_OK) {
     res = SZ_ERROR_READ;
     goto Done;
@@ -126,7 +126,7 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
     res = SZ_ERROR_MEM;
     goto Done;
   }
-  
+
   {
     int i;
     for (i = 0; i < 8; i++)
@@ -141,7 +141,7 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
       goto Done;
     }
     memcpy(filteredStream, inBuffer, inSize);
-    
+
     if (mConType == X86Converter) {
       {
         UInt32 x86State;
@@ -154,12 +154,12 @@ static SRes Encode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
   {
     size_t outSizeProcessed = outSize - LZMA_HEADER_SIZE;
     size_t outPropsSize = LZMA_PROPS_SIZE;
-    
+
     res = LzmaEncode(outBuffer + LZMA_HEADER_SIZE, &outSizeProcessed,
         mConType != NoConverter ? filteredStream : inBuffer, inSize,
         &props, outBuffer, &outPropsSize, 0,
         NULL, &g_Alloc, &g_Alloc);
-    
+
     if (res != SZ_OK)
       goto Done;
 
@@ -190,13 +190,13 @@ static SRes Decode(ISeqOutStream *outStream, ISeqInStream *inStream, UInt64 file
 
   int i;
 
-  if (inSize < LZMA_HEADER_SIZE) 
+  if (inSize < LZMA_HEADER_SIZE)
     return SZ_ERROR_INPUT_EOF;
 
   inBuffer = (Byte *)MyAlloc(inSize);
   if (inBuffer == 0)
     return SZ_ERROR_MEM;
-  
+
   if (SeqInStream_Read(inStream, inBuffer, inSize) != SZ_OK) {
     res = SZ_ERROR_READ;
     goto Done;

+ 2 - 2
BaseTools/Source/C/LzmaCompress/LzmaF86Compress.bat

@@ -1,8 +1,8 @@
 @REM @file
-@REM This script will exec LzmaCompress tool with --f86 option that enables 
+@REM This script will exec LzmaCompress tool with --f86 option that enables
 @REM converter for x86 code.
 @REM
-@REM Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
+@REM Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
 @REM This program and the accompanying materials
 @REM are licensed and made available under the terms and conditions of the BSD License
 @REM which accompanies this distribution.  The full text of the license may be found at

+ 2 - 2
BaseTools/Source/C/Makefiles/NmakeSubdirs.bat

@@ -1,7 +1,7 @@
 @REM ## @file
 @REM # Makefile
 @REM #
-@REM # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+@REM # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 @REM # This program and the accompanying materials
 @REM # are licensed and made available under the terms and conditions of the BSD License
 @REM # which accompanies this distribution.    The full text of the license may be found at
@@ -9,7 +9,7 @@
 @REM #
 @REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 @REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-@REM # 
+@REM #
 
 @echo off
 setlocal

+ 3 - 3
BaseTools/Source/C/PyEfiCompressor/EfiCompressor.c

@@ -1,9 +1,9 @@
 /** @file
 Efi Compressor
 
-Copyright (c) 2009 - 2014, 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 
+Copyright (c) 2009 - 2018, 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
 

+ 5 - 5
BaseTools/Source/C/PyUtility/PyUtility.c

@@ -1,9 +1,9 @@
 /** @file
 Python Utility
 
-Copyright (c) 2009 - 2014, 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 
+Copyright (c) 2009 - 2018, 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
 
@@ -75,9 +75,9 @@ SaveFileToDisk (
     goto Done;
   }
 
-  // 
+  //
   // Flush buffer may slow down the whole build performance (average 10s slower)
-  // 
+  //
   //if (!FlushFileBuffers(FileHandle)) {
   //  PyErr_SetString(PyExc_Exception, "File flush failure");
   //  goto Done;

+ 100 - 100
BaseTools/Source/C/TianoCompress/TianoCompress.c

@@ -1,18 +1,18 @@
 /** @file
-Compression routine. The compression algorithm is a mixture of LZ77 and Huffman 
-coding. LZ77 transforms the source data into a sequence of Original Characters 
+Compression routine. The compression algorithm is a mixture of LZ77 and Huffman
+coding. LZ77 transforms the source data into a sequence of Original Characters
 and Pointers to repeated strings.
-This sequence is further divided into Blocks and Huffman codings are applied to 
+This sequence is further divided into Blocks and Huffman codings are applied to
 each Block.
-  
-Copyright (c) 2007 - 2016, 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.             
+
+Copyright (c) 2007 - 2018, 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.
 
 **/
 
@@ -100,7 +100,7 @@ Arguments:
   SrcBuffer   - The buffer storing the source data
   SrcSize     - The size of source data
   DstBuffer   - The buffer to store the compressed data
-  
+
   Version     - The version of de/compression algorithm.
                 Version 1 for EFI 1.1 de/compression algorithm.
                 Version 2 for Tiano de/compression algorithm.
@@ -135,12 +135,12 @@ Returns:
   mSrcUpperLimit  = mSrc + SrcSize;
   mDst            = DstBuffer;
   mDstUpperLimit  = mDst +*DstSize;
-    
+
   PutDword (0L);
   PutDword (0L);
-  
+
   MakeCrcTable ();
-  
+
   mOrigSize             = mCompSize = 0;
   mCrc                  = INIT_CRC;
 
@@ -151,7 +151,7 @@ Returns:
   if (EFI_ERROR (Status)) {
     return EFI_OUT_OF_RESOURCES;
   }
-  
+
   //
   // Null terminate the compressed data
   //
@@ -163,8 +163,8 @@ Returns:
   //
   // Fill in compressed size and original size
   //
-  mDst = DstBuffer; 
- 
+  mDst = DstBuffer;
+
   PutDword (mCompSize + 1);
   PutDword (mOrigSize);
   //
@@ -172,10 +172,10 @@ Returns:
   //
 
   if (mCompSize + 1 + 8 > *DstSize) {
-    *DstSize = mCompSize + 1 + 8;    
+    *DstSize = mCompSize + 1 + 8;
     return EFI_BUFFER_TOO_SMALL;
   } else {
-    *DstSize = mCompSize + 1 + 8;   
+    *DstSize = mCompSize + 1 + 8;
     return EFI_SUCCESS;
   }
 }
@@ -190,13 +190,13 @@ PutDword (
 Routine Description:
 
   Put a dword to output stream
-  
+
 Arguments:
 
   Data    - the dword to put
-  
+
 Returns: (VOID)
-  
+
 --*/
 {
   if (mDst < mDstUpperLimit) {
@@ -226,8 +226,8 @@ AllocateMemory (
 Routine Description:
 
   Allocate memory spaces for data structures used in compression process
-  
-Argements: 
+
+Argements:
   VOID
 
 Returns:
@@ -285,7 +285,7 @@ FreeMemory (
 Routine Description:
 
   Called when compression is completed to free memory previously allocated.
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -337,7 +337,7 @@ InitSlide (
 Routine Description:
 
   Initialize String Info Log data structures
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -377,16 +377,16 @@ Child (
 Routine Description:
 
   Find child node given the parent node and the edge character
-  
+
 Arguments:
 
   NodeQ       - the parent node
   CharC       - the edge character
-  
+
 Returns:
 
-  The child node (NIL if not found)  
-  
+  The child node (NIL if not found)
+
 --*/
 {
   NODE  NodeR;
@@ -415,13 +415,13 @@ MakeChild (
 Routine Description:
 
   Create a new child for a given parent node.
-  
+
 Arguments:
 
   Parent       - the parent node
   CharC   - the edge character
   Child       - the child node
-  
+
 Returns: (VOID)
 
 --*/
@@ -449,11 +449,11 @@ Split (
 Routine Description:
 
   Split a node.
-  
+
 Arguments:
 
   Old     - the node to split
-  
+
 Returns: (VOID)
 
 --*/
@@ -487,7 +487,7 @@ InsertNode (
 Routine Description:
 
   Insert string info for current position into the String Info Log
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -620,7 +620,7 @@ Routine Description:
 
   Delete outdated string info. (The Usage of PERC_FLAG
   ensures a clean deletion)
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -751,7 +751,7 @@ Routine Description:
 Arguments: (VOID)
 
 Returns:
-  
+
   EFI_SUCCESS           - The compression is successful
   EFI_OUT_0F_RESOURCES  - Not enough memory for compression process
 
@@ -837,7 +837,7 @@ CountTFreq (
 Routine Description:
 
   Count the frequencies for the Extra Set
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -896,13 +896,13 @@ WritePTLen (
 Routine Description:
 
   Outputs the code length array for the Extra Set or the Position Set.
-  
+
 Arguments:
 
   Number       - the number of symbols
   nbit    - the number of bits needed to represent 'n'
   Special - the special symbol that needs to be take care of
-  
+
 Returns: (VOID)
 
 --*/
@@ -944,7 +944,7 @@ WriteCLen (
 Routine Description:
 
   Outputs the code length array for Char&Length Set
-  
+
 Arguments: (VOID)
 
 Returns: (VOID)
@@ -1034,11 +1034,11 @@ SendBlock (
 Routine Description:
 
   Huffman code the block and output it.
-  
-Arguments: 
+
+Arguments:
   (VOID)
 
-Returns: 
+Returns:
   (VOID)
 
 --*/
@@ -1246,7 +1246,7 @@ Routine Description:
 Arguments:
 
   Number   - the rightmost n bits of the data is used
-  x   - the data 
+  x   - the data
 
 Returns: (VOID)
 
@@ -1283,7 +1283,7 @@ FreadCrc (
 Routine Description:
 
   Read in source data
-  
+
 Arguments:
 
   Pointer   - the buffer to hold the data
@@ -1292,7 +1292,7 @@ Arguments:
 Returns:
 
   number of bytes actually read
-  
+
 --*/
 {
   INT32 Index;
@@ -1335,11 +1335,11 @@ CountLen (
 Routine Description:
 
   Count the number of each code length for a Huffman tree.
-  
+
 Arguments:
 
   Index   - the top node
-  
+
 Returns: (VOID)
 
 --*/
@@ -1366,11 +1366,11 @@ MakeLen (
 Routine Description:
 
   Create code length array for a Huffman tree
-  
+
 Arguments:
 
   Root   - the root of the tree
-  
+
 Returns:
 
   VOID
@@ -1462,7 +1462,7 @@ MakeCode (
 Routine Description:
 
   Assign code to each symbol based on the code length array
-  
+
 Arguments:
 
   Number     - number of symbols
@@ -1499,18 +1499,18 @@ MakeTree (
 Routine Description:
 
   Generates Huffman codes given a frequency distribution of symbols
-  
+
 Arguments:
 
   NParm    - number of symbols
   FreqParm - frequency of each symbol
   LenParm  - code length for each symbol
   CodeParm - code for each symbol
-  
+
 Returns:
 
   Root of the Huffman tree.
-  
+
 --*/
 {
   INT32 Index;
@@ -1586,22 +1586,22 @@ GetFileContents (
   OUT UINT32  *BufferLength
   )
 /*++
-        
+
 Routine Description:
-           
+
   Get the contents of file specified in InputFileName
   into FileBuffer.
-            
+
 Arguments:
-               
+
   InputFileName  - Name of the input file.
-                
+
   FileBuffer     - Output buffer to contain data
 
-  BufferLength   - Actual length of the data 
+  BufferLength   - Actual length of the data
 
 Returns:
-                       
+
   EFI_SUCCESS on successful return
   EFI_ABORTED if unable to open input file.
 
@@ -1620,13 +1620,13 @@ Returns:
       Error (NULL, 0, 0001, "Error opening file: %s", InputFileName);
       return EFI_ABORTED;
     }
-  
+
   fseek (InputFile, 0, SEEK_END);
   FileSize = ftell (InputFile);
   fseek (InputFile, 0, SEEK_SET);
     //
     // Now read the contents of the file into the buffer
-    // 
+    //
     if (FileSize > 0 && FileBuffer != NULL) {
       if (fread (FileBuffer, FileSize, 1, InputFile) != 1) {
         Error (NULL, 0, 0004, "Error reading contents of input file: %s", InputFileName);
@@ -1638,7 +1638,7 @@ Returns:
   fclose (InputFile);
   Size += (UINTN) FileSize;
   *BufferLength = Size;
-  
+
   if (FileBuffer != NULL) {
     return EFI_SUCCESS;
   } else {
@@ -1693,11 +1693,11 @@ Returns:
   // Summary usage
   //
   fprintf (stdout, "Usage: %s -e|-d [options] <input_file>\n\n", UTILITY_NAME);
-  
+
   //
   // Copyright declaration
-  // 
-  fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
+  //
+  fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
 
   //
   // Details Option
@@ -1739,7 +1739,7 @@ Returns:
   EFI_ABORTED    Could not generate the section
   EFI_OUT_OF_RESOURCES  No resource to complete the operation.
 
---*/  
+--*/
 {
   FILE       *OutputFile;
   char       *OutputFileName;
@@ -1755,7 +1755,7 @@ Returns:
   UINT32     OrigSize;
 
   SetUtilityName(UTILITY_NAME);
-  
+
   FileBuffer = NULL;
   Src = NULL;
   OutBuffer = NULL;
@@ -1778,12 +1778,12 @@ Returns:
     Usage();
     return 0;
   }
-  
+
   if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
     Usage();
     return 0;
   }
-  
+
   if ((strcmp(argv[1], "--version") == 0)) {
     Version();
     return 0;
@@ -1854,7 +1854,7 @@ Returns:
       OutputFileName = argv[1];
       argc -=2;
       argv +=2;
-      continue; 
+      continue;
     }
 
     if (argv[0][0]!='-') {
@@ -1865,7 +1865,7 @@ Returns:
     }
 
     Error (NULL, 0, 1000, "Unknown option", argv[0]);
-    goto ERROR;     
+    goto ERROR;
   }
 
   if (InputFileName == NULL) {
@@ -1883,7 +1883,7 @@ Returns:
   } else if (DebugMode) {
     SetPrintLevel(DebugLevel);
   }
-  
+
   if (VerboseMode) {
     VerboseMsg("%s tool start.\n", UTILITY_NAME);
    }
@@ -1892,13 +1892,13 @@ Returns:
     Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
     goto ERROR;
   }
-    
+
   InputFile = fopen (LongFilePath (InputFileName), "rb");
   if (InputFile == NULL) {
     Error (NULL, 0, 0001, "Error opening input file", InputFileName);
     goto ERROR;
   }
-        
+
   Status = GetFileContents(
             InputFileName,
             FileBuffer,
@@ -1931,7 +1931,7 @@ Returns:
     Error (NULL, 0, 0001, "Error opening output file for writing", OutputFileName);
     goto ERROR;
   }
-    
+
   if (ENCODE) {
   //
   // First call TianoCompress to get DstSize
@@ -1940,7 +1940,7 @@ Returns:
     DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding", NULL);
   }
   Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, &DstSize);
-  
+
   if (Status == EFI_BUFFER_TOO_SMALL) {
     OutBuffer = (UINT8 *) malloc (DstSize);
     if (OutBuffer == NULL) {
@@ -1973,7 +1973,7 @@ Returns:
   if (VerboseMode) {
     VerboseMsg("Encoding successful\n");
   }
-  return 0;  
+  return 0;
   }
   else if (DECODE) {
   if (DebugMode) {
@@ -1981,10 +1981,10 @@ Returns:
   }
   //
   // Get Compressed file original size
-  // 
-  Src     = (UINT8 *)FileBuffer;                     
-  OrigSize  = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);  
-  
+  //
+  Src     = (UINT8 *)FileBuffer;
+  OrigSize  = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+
   //
   // Allocate OutputBuffer
   //
@@ -1992,11 +1992,11 @@ Returns:
   if (OutBuffer == NULL) {
     Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
     goto ERROR;
-   }  
+   }
 
   Status = Decompress((VOID *)FileBuffer, (VOID *)OutBuffer, (VOID *)Scratch, 2);
   if (Status != EFI_SUCCESS) {
-   goto ERROR; 	
+   goto ERROR;
   }
 
   fwrite(OutBuffer, (size_t)(Scratch->mOrigSize), 1, OutputFile);
@@ -2009,13 +2009,13 @@ Returns:
   if (DebugMode) {
     DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding successful!\n", NULL);
   }
-  
+
   if (VerboseMode) {
     VerboseMsg("Decoding successful\n");
   }
   return 0;
   }
-  
+
 ERROR:
   if (DebugMode) {
     if (ENCODE) {
@@ -2039,7 +2039,7 @@ ERROR:
   if (OutBuffer != NULL) {
     free(OutBuffer);
   }
-    
+
   if (VerboseMode) {
     VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME, GetUtilityStatus ());
   }
@@ -2104,8 +2104,8 @@ GetBits (
 
 Routine Description:
 
-  Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent 
-  NumOfBits of bits from source. Returns NumOfBits of bits that are 
+  Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
+  NumOfBits of bits from source. Returns NumOfBits of bits that are
   popped out.
 
 Arguments:
@@ -2149,9 +2149,9 @@ Arguments:
   BitLen    - Code length array
   TableBits - The width of the mapping table
   Table     - The table
-  
+
 Returns:
-  
+
   0         - OK.
   BAD_TABLE - The table is corrupted.
 
@@ -2341,7 +2341,7 @@ Arguments:
   Sd        - The global scratch data
   nn        - Number of symbols
   nbit      - Number of bits needed to represent nn
-  Special   - The special symbol that needs to be taken care of 
+  Special   - The special symbol that needs to be taken care of
 
 Returns:
 
@@ -2673,14 +2673,14 @@ Returns:
   assert(Source);
 //  assert(Destination);
   assert(Scratch);
-  
+
   Src     = (UINT8 *)Source;
   Dst     = (UINT8 *)Destination;
 
   Sd      = (SCRATCH_DATA *) Scratch;
   CompSize  = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
   OrigSize  = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
-  
+
   //
   // If compressed file size is 0, return
   //
@@ -2721,9 +2721,9 @@ Returns:
   //
   // Decompress it
   //
-  
+
   Decode (Sd);
-  
+
   if (Sd->mBadTableFlag != 0) {
     //
     // Something wrong with the source

+ 11 - 11
BaseTools/Source/C/TianoCompress/TianoCompress.h

@@ -1,7 +1,7 @@
 /** @file
   Internal include file for Tiano Decompress Library.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2018, 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
@@ -95,7 +95,7 @@ GetFileContents (
   OUT UINT8   *FileBuffer,
   OUT UINT32  *BufferLength
   );
-  
+
 STATIC
 VOID
 PutDword(
@@ -228,7 +228,7 @@ MakeCrcTable (
   VOID
   );
 
-  
+
 STATIC
 VOID
 PutBits (
@@ -283,7 +283,7 @@ MakeTree (
   OUT UINT8   LenParm[ ],
   OUT UINT16  CodeParm[]
   );
-  
+
 /**
   Read NumOfBit of bits from source into mBitBuf
 
@@ -302,8 +302,8 @@ FillBuf (
 /**
   Get NumOfBits of bits out from mBitBuf
 
-  Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent 
-  NumOfBits of bits from source. Returns NumOfBits of bits that are 
+  Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
+  NumOfBits of bits from source. Returns NumOfBits of bits that are
   popped out.
 
   @param  Sd        The global scratch data.
@@ -321,7 +321,7 @@ GetBits (
 /**
   Creates Huffman Code mapping table according to code length array.
 
-  Creates Huffman Code mapping table for Extra Set, Char&Len Set 
+  Creates Huffman Code mapping table for Extra Set, Char&Len Set
   and Position Set according to code length array.
 
   @param  Sd        The global scratch data
@@ -347,7 +347,7 @@ MakeTable (
   Decodes a position value.
 
   Get a position value according to Position Huffman Table.
-  
+
   @param  Sd the global scratch data
 
   @return The position value decoded.
@@ -383,7 +383,7 @@ ReadPTLen (
 
 /**
   Reads code lengths for Char&Len Set.
-  
+
   Read in and decode the Char&Len Set Code Length Array, then
   generate the Huffman Code mapping table for the Char&Len Set.
 
@@ -397,7 +397,7 @@ ReadCLen (
 
 /**
   Decode a character/length value.
-  
+
   Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
   Huffman code mapping table for Extra Set, Code&Len Set and
   Position Set.
@@ -416,7 +416,7 @@ DecodeC (
   Decode the source data and put the resulting data into the destination buffer.
 
   Decode the source data and put the resulting data into the destination buffer.
-  
+
   @param  Sd The global scratch data
 
 **/

+ 9 - 9
BaseTools/Source/C/VfrCompile/EfiVfr.h

@@ -1,15 +1,15 @@
 /** @file
 Defines and prototypes for the UEFI VFR compiler internal use.
 
-Copyright (c) 2004 - 2017, 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.             
- 
+Copyright (c) 2004 - 2018, 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.
+
 **/
 
 #ifndef _EFIVFR_H_

+ 29 - 29
BaseTools/Source/C/VfrCompile/VfrCompiler.cpp

@@ -1,15 +1,15 @@
 /** @file
-  
+
   VfrCompiler main class and main function.
 
 Copyright (c) 2004 - 2018, 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.             
+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.
 
 **/
 
@@ -24,7 +24,7 @@ PACKAGE_DATA  gCBuffer;
 PACKAGE_DATA  gRBuffer;
 CVfrStringDB  gCVfrStringDB;
 
-VOID 
+VOID
 CVfrCompiler::DebugError (
   IN CHAR8         *FileName,
   IN UINT32        LineNumber,
@@ -32,7 +32,7 @@ CVfrCompiler::DebugError (
   IN CONST CHAR8   *Text,
   IN CONST CHAR8   *MsgFmt,
   ...
-  ) 
+  )
 {
   va_list List;
   va_start (List, MsgFmt);
@@ -58,7 +58,7 @@ CVfrCompiler::IS_RUN_STATUS (
 
 VOID
 CVfrCompiler::OptionInitialization (
-  IN INT32      Argc, 
+  IN INT32      Argc,
   IN CHAR8      **Argv
   )
 {
@@ -86,7 +86,7 @@ CVfrCompiler::OptionInitialization (
   mOptions.AutoDefault                   = FALSE;
   mOptions.CheckDefault                  = FALSE;
   memset (&mOptions.OverrideClassGuid, 0, sizeof (EFI_GUID));
-  
+
   if (Argc == 1) {
     Usage ();
     SET_RUN_STATUS (STATUS_DEAD);
@@ -108,7 +108,7 @@ CVfrCompiler::OptionInitialization (
     } else if (stricmp(Argv[Index], "-i") == 0) {
       Index++;
       if ((Index >= Argc) || (Argv[Index][0] == '-')) {
-        DebugError (NULL, 0, 1001, "Missing option", "-i missing path argument"); 
+        DebugError (NULL, 0, 1001, "Missing option", "-i missing path argument");
         goto Fail;
       }
 
@@ -126,7 +126,7 @@ CVfrCompiler::OptionInitialization (
         goto Fail;
       }
       strcpy (mOptions.OutputDirectory, Argv[Index]);
-      
+
       CHAR8 lastChar = mOptions.OutputDirectory[strlen(mOptions.OutputDirectory) - 1];
       if ((lastChar != '/') && (lastChar != '\\')) {
         if (strchr(mOptions.OutputDirectory, '/') != NULL) {
@@ -253,7 +253,7 @@ Fail:
   if (mOptions.IncludePaths != NULL) {
     delete mOptions.IncludePaths;
     mOptions.IncludePaths                = NULL;
-  } 
+  }
   if (mOptions.CPreprocessorOptions != NULL) {
     delete mOptions.CPreprocessorOptions;
     mOptions.CPreprocessorOptions        = NULL;
@@ -473,7 +473,7 @@ CVfrCompiler::SetRecordListFileName (
 }
 
 CVfrCompiler::CVfrCompiler (
-  IN INT32      Argc, 
+  IN INT32      Argc,
   IN CHAR8      **Argv
   )
 {
@@ -543,14 +543,14 @@ CVfrCompiler::~CVfrCompiler (
   SET_RUN_STATUS(STATUS_DEAD);
 }
 
-VOID 
+VOID
 CVfrCompiler::Usage (
   VOID
   )
 {
   UINT32 Index;
   CONST  CHAR8 *Help[] = {
-    " ", 
+    " ",
     "VfrCompile version " VFR_COMPILER_VERSION "Build " __BUILD_VERSION,
     "Copyright (c) 2004-2016 Intel Corporation. All rights reserved.",
     " ",
@@ -585,7 +585,7 @@ CVfrCompiler::Usage (
   }
 }
 
-VOID 
+VOID
 CVfrCompiler::Version (
   VOID
   )
@@ -623,8 +623,8 @@ CVfrCompiler::PreProcess (
   }
   fclose (pVfrFile);
 
-  CmdLen = strlen (mPreProcessCmd) + strlen (mPreProcessOpt) + 
-  	       strlen (mOptions.VfrFileName) + strlen (mOptions.PreprocessorOutputFileName);
+  CmdLen = strlen (mPreProcessCmd) + strlen (mPreProcessOpt) +
+           strlen (mOptions.VfrFileName) + strlen (mOptions.PreprocessorOutputFileName);
   if (mOptions.CPreprocessorOptions != NULL) {
     CmdLen += strlen (mOptions.CPreprocessorOptions);
   }
@@ -756,7 +756,7 @@ CVfrCompiler::AdjustBin (
   // Get Package Data and IfrRecord Data
   //
   gCFormPkg.BuildPkg (gCBuffer);
-  gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer); 
+  gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer);
 
   //
   // Compare Form and Record data
@@ -799,7 +799,7 @@ CVfrCompiler::AdjustBin (
     //
     // Re get the IfrRecord Buffer.
     //
-    gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer); 
+    gCIfrRecordInfoDB.IfrRecordOutput (gRBuffer);
   }
 
   return;
@@ -858,7 +858,7 @@ CVfrCompiler::GenCFile (
   if (!IS_RUN_STATUS(STATUS_GENBINARY)) {
     goto Fail;
   }
-  
+
   if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {
     if ((pFile = fopen (LongFilePath (mOptions.COutputFileName), "w")) == NULL) {
       DebugError (NULL, 0, 0001, "Error opening output C file", "%s", mOptions.COutputFileName);
@@ -869,7 +869,7 @@ CVfrCompiler::GenCFile (
       fprintf (pFile, "%s\n", gSourceFileHeader[Index]);
     }
 
-    if (mOptions.CompatibleMode) { 
+    if (mOptions.CompatibleMode) {
       gCVfrBufferConfig.OutputCFile (pFile, mOptions.VfrBaseFileName);
     }
 
@@ -926,7 +926,7 @@ CVfrCompiler::GenRecordListFile (
         gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, LineNo);
       }
     }
-    
+
     fprintf (pOutFile, "\n//\n// All Opcode Record List \n//\n");
     gCIfrRecordInfoDB.IfrRecordOutput (pOutFile, 0);
     gCVfrVarDataTypeDB.Dump(pOutFile);
@@ -943,7 +943,7 @@ Err1:
 
 int
 main (
-  IN int             Argc, 
+  IN int             Argc,
   IN char            **Argv
   )
 {
@@ -951,7 +951,7 @@ main (
 
   SetPrintLevel(WARNING_LOG_LEVEL);
   CVfrCompiler         Compiler(Argc, Argv);
-  
+
   Compiler.PreProcess();
   Compiler.Compile();
   Compiler.AdjustBin();
@@ -967,7 +967,7 @@ main (
   if (gCBuffer.Buffer != NULL) {
     delete[] gCBuffer.Buffer;
   }
-  
+
   if (gRBuffer.Buffer != NULL) {
     delete[] gRBuffer.Buffer;
   }

Some files were not shown because too many files changed in this diff