public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify
@ 2023-02-25  0:54 Rebecca Cran
  2023-02-25  0:54 ` [PATCH 1/3] BaseTools: Source/C/Common: Fix doc block locations and convert to Doxygen Rebecca Cran
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Rebecca Cran @ 2023-02-25  0:54 UTC (permalink / raw)
  To: devel, Bob Feng, Liming Gao, Yuwei Chen; +Cc: Rebecca Cran

Fix the formatting and location of documentation blocks in Source/C/Common,
and replace the duplicate prototype of __PcdSet with __PcdGet. Those patches
will fail CI because it appears Uncrustify was never run on BaseTools?

Patch 3/3 reformats the files in Source/C/Common according to
Uncrustify.

Rebecca Cran (3):
  BaseTools: Source/C/Common: Fix doc block locations and convert to
    Doxygen
  BaseTools: Replace duplicate __PcdSet prototype with __PcdGet
  BaseTools: Run Uncrustify over files in Source/C/Common

 BaseTools/Source/C/Common/BinderFuncs.h             |   27 +-
 BaseTools/Source/C/Common/CommonLib.h               |  267 ++--
 BaseTools/Source/C/Common/Compress.h                |   45 +-
 BaseTools/Source/C/Common/Crc32.h                   |   36 +-
 BaseTools/Source/C/Common/Decompress.h              |  122 +-
 BaseTools/Source/C/Common/EfiUtilityMsgs.h          |   38 +-
 BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h |  101 +-
 BaseTools/Source/C/Common/FvLib.h                   |   51 +-
 BaseTools/Source/C/Common/MemoryFile.h              |   76 +-
 BaseTools/Source/C/Common/MyAlloc.h                 |  196 +--
 BaseTools/Source/C/Common/OsPath.h                  |   92 +-
 BaseTools/Source/C/Common/ParseGuidedSectionTools.h |  101 +-
 BaseTools/Source/C/Common/ParseInf.h                |  228 ++--
 BaseTools/Source/C/Common/PcdValueCommon.h          |  196 +--
 BaseTools/Source/C/Common/PeCoffLib.h               |   66 +-
 BaseTools/Source/C/Common/SimpleFileParsing.h       |   24 +-
 BaseTools/Source/C/Common/StringFuncs.h             |  203 +--
 BaseTools/Source/C/Common/WinNtInclude.h            |   28 +-
 BaseTools/Source/C/Common/BasePeCoff.c              | 1068 +++++++--------
 BaseTools/Source/C/Common/BinderFuncs.c             |   31 +-
 BaseTools/Source/C/Common/CommonLib.c               |  914 ++++++-------
 BaseTools/Source/C/Common/Crc32.c                   |   38 +-
 BaseTools/Source/C/Common/Decompress.c              |  795 +++++------
 BaseTools/Source/C/Common/EfiCompress.c             | 1189 ++++++++--------
 BaseTools/Source/C/Common/EfiUtilityMsgs.c          |  663 ++++-----
 BaseTools/Source/C/Common/FirmwareVolumeBuffer.c    | 1426 ++++++++------------
 BaseTools/Source/C/Common/FvLib.c                   |  638 ++++-----
 BaseTools/Source/C/Common/MemoryFile.c              |  131 +-
 BaseTools/Source/C/Common/MyAlloc.c                 |  265 ++--
 BaseTools/Source/C/Common/OsPath.c                  |  180 +--
 BaseTools/Source/C/Common/ParseGuidedSectionTools.c |  142 +-
 BaseTools/Source/C/Common/ParseInf.c                |  401 +++---
 BaseTools/Source/C/Common/PcdValueCommon.c          |  618 ++++-----
 BaseTools/Source/C/Common/PeCoffLoaderEx.c          |  277 ++--
 BaseTools/Source/C/Common/SimpleFileParsing.c       |  737 +++++-----
 BaseTools/Source/C/Common/StringFuncs.c             |  310 ++---
 BaseTools/Source/C/Common/TianoCompress.c           | 1075 ++++++---------
 37 files changed, 5544 insertions(+), 7251 deletions(-)

-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] BaseTools: Source/C/Common: Fix doc block locations and convert to Doxygen
  2023-02-25  0:54 [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify Rebecca Cran
@ 2023-02-25  0:54 ` Rebecca Cran
  2023-02-25  0:54 ` [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with __PcdGet Rebecca Cran
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Rebecca Cran @ 2023-02-25  0:54 UTC (permalink / raw)
  To: devel, Bob Feng, Liming Gao, Yuwei Chen; +Cc: Rebecca Cran

Move the documentation blocks from between the parameter list and function
body to above the function.

Convert all the documentation blocks to Doxygen format.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 BaseTools/Source/C/Common/CommonLib.h               |  14 +-
 BaseTools/Source/C/Common/Compress.h                |  45 +-
 BaseTools/Source/C/Common/Crc32.h                   |  30 +-
 BaseTools/Source/C/Common/Decompress.h              | 118 ++-
 BaseTools/Source/C/Common/MemoryFile.h              |  72 +-
 BaseTools/Source/C/Common/MyAlloc.h                 | 146 ++--
 BaseTools/Source/C/Common/OsPath.h                  |  90 +-
 BaseTools/Source/C/Common/ParseGuidedSectionTools.h |  95 +--
 BaseTools/Source/C/Common/ParseInf.h                | 204 ++---
 BaseTools/Source/C/Common/PcdValueCommon.h          | 175 ++--
 BaseTools/Source/C/Common/StringFuncs.h             | 191 ++---
 BaseTools/Source/C/Common/BasePeCoff.c              | 202 ++---
 BaseTools/Source/C/Common/CommonLib.c               | 336 +++-----
 BaseTools/Source/C/Common/Crc32.c                   |  30 +-
 BaseTools/Source/C/Common/Decompress.c              | 470 ++++-------
 BaseTools/Source/C/Common/EfiCompress.c             | 574 +++++--------
 BaseTools/Source/C/Common/EfiUtilityMsgs.c          | 522 +++++-------
 BaseTools/Source/C/Common/FirmwareVolumeBuffer.c    | 869 +++++++-------------
 BaseTools/Source/C/Common/FvLib.c                   | 401 ++++-----
 BaseTools/Source/C/Common/MemoryFile.c              |  84 +-
 BaseTools/Source/C/Common/MyAlloc.c                 | 155 ++--
 BaseTools/Source/C/Common/OsPath.c                  | 101 +--
 BaseTools/Source/C/Common/ParseGuidedSectionTools.c |  92 +--
 BaseTools/Source/C/Common/ParseInf.c                | 225 ++---
 BaseTools/Source/C/Common/PcdValueCommon.c          | 303 +++----
 BaseTools/Source/C/Common/PeCoffLoaderEx.c          |  66 +-
 BaseTools/Source/C/Common/SimpleFileParsing.c       | 430 ++++------
 BaseTools/Source/C/Common/StringFuncs.c             | 246 ++----
 BaseTools/Source/C/Common/TianoCompress.c           | 610 +++++---------
 29 files changed, 2452 insertions(+), 4444 deletions(-)

diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h
index 0f05d88db206..a841029c2aaa 100644
--- a/BaseTools/Source/C/Common/CommonLib.h
+++ b/BaseTools/Source/C/Common/CommonLib.h
@@ -95,13 +95,6 @@ GetFileImage (
   )
 ;
 
-EFI_STATUS
-PutFileImage (
-  IN CHAR8    *OutputFileName,
-  IN CHAR8    *OutputFileImage,
-  IN UINT32   BytesToWrite
-  )
-;
 /*++
 
 Routine Description:
@@ -122,6 +115,13 @@ Routine Description:
   EFI_OUT_OF_RESOURCES     No resource to complete operations.
 
 **/
+EFI_STATUS
+PutFileImage (
+  IN CHAR8    *OutputFileName,
+  IN CHAR8    *OutputFileImage,
+  IN UINT32   BytesToWrite
+  )
+;
 
 UINT8
 CalculateChecksum8 (
diff --git a/BaseTools/Source/C/Common/Compress.h b/BaseTools/Source/C/Common/Compress.h
index 40255a9665da..499e183c2b40 100644
--- a/BaseTools/Source/C/Common/Compress.h
+++ b/BaseTools/Source/C/Common/Compress.h
@@ -15,13 +15,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "CommonLib.h"
 #include <Common/UefiBaseTypes.h>
-/*++
-
-Routine Description:
 
+/**
   Tiano compression routine.
-
---*/
+**/
 EFI_STATUS
 TianoCompress (
   IN      UINT8   *SrcBuffer,
@@ -31,13 +28,9 @@ TianoCompress (
   )
 ;
 
-/*++
-
-Routine Description:
-
+/**
   Efi compression routine.
-
---*/
+**/
 EFI_STATUS
 EfiCompress (
   IN      UINT8   *SrcBuffer,
@@ -47,29 +40,21 @@ EfiCompress (
   )
 ;
 
-/*++
-
-Routine Description:
-
+/**
   The compression routine.
 
-Arguments:
+  @param SrcBuffer   The buffer storing the source data
+  @param SrcSize     The size of source data
+  @param DstBuffer   The buffer to store the compressed data
+  @param DstSize     On input, the size of DstBuffer; On output,
+              the size of the actual compressed data.
 
-  SrcBuffer   - The buffer storing the source data
-  SrcSize     - The size of source data
-  DstBuffer   - The buffer to store the compressed data
-  DstSize     - On input, the size of DstBuffer; On output,
-                the size of the actual compressed data.
-
-Returns:
-
-  EFI_BUFFER_TOO_SMALL  - The DstBuffer is too small. In this case,
+  @retval EFI_BUFFER_TOO_SMALL  The DstBuffer is too small. In this case,
                 DstSize contains the size needed.
-  EFI_SUCCESS           - Compression is successful.
-  EFI_OUT_OF_RESOURCES  - No resource to complete function.
-  EFI_INVALID_PARAMETER - Parameter supplied is wrong.
-
---*/
+  @retval EFI_SUCCESS           Compression is successful.
+  @retval EFI_OUT_OF_RESOURCES  No resource to complete function.
+  @retval EFI_INVALID_PARAMETER Parameter supplied is wrong.
+**/
 typedef
 EFI_STATUS
 (*COMPRESS_FUNCTION) (
diff --git a/BaseTools/Source/C/Common/Crc32.h b/BaseTools/Source/C/Common/Crc32.h
index 61f99b96b565..3f6b5b35fc36 100644
--- a/BaseTools/Source/C/Common/Crc32.h
+++ b/BaseTools/Source/C/Common/Crc32.h
@@ -11,31 +11,23 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include <Common/UefiBaseTypes.h>
 
+/**
+  The CalculateCrc32 routine.
+
+  @param Data        The buffer containing the data to be processed
+  @param DataSize    The size of data to be processed
+  @param CrcOut      A pointer to the caller allocated UINT32 that on
+                    contains the CRC32 checksum of Data
+
+  @retval EFI_SUCCESS               - Calculation is successful.
+  @retval EFI_INVALID_PARAMETER     - Data / CrcOut = NULL, or DataSize = 0
+**/
 EFI_STATUS
 CalculateCrc32 (
   IN  UINT8                             *Data,
   IN  UINTN                             DataSize,
   IN OUT UINT32                         *CrcOut
   )
-/*++
-
-Routine Description:
-
-  The CalculateCrc32 routine.
-
-Arguments:
-
-  Data        - The buffer containing the data to be processed
-  DataSize    - The size of data to be processed
-  CrcOut      - A pointer to the caller allocated UINT32 that on
-                contains the CRC32 checksum of Data
-
-Returns:
-
-  EFI_SUCCESS               - Calculation is successful.
-  EFI_INVALID_PARAMETER     - Data / CrcOut = NULL, or DataSize = 0
-
---*/
 ;
 
 #endif
diff --git a/BaseTools/Source/C/Common/Decompress.h b/BaseTools/Source/C/Common/Decompress.h
index 983a27d8fc26..00a1e31b8c21 100644
--- a/BaseTools/Source/C/Common/Decompress.h
+++ b/BaseTools/Source/C/Common/Decompress.h
@@ -11,13 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include <Common/UefiBaseTypes.h>
 
-EFI_STATUS
-EfiGetInfo (
-  IN      VOID    *Source,
-  IN      UINT32  SrcSize,
-  OUT     UINT32  *DstSize,
-  OUT     UINT32  *ScratchSize
-  );
 /**
 
 Routine Description:
@@ -37,95 +30,78 @@ Routine Description:
   EFI_INVALID_PARAMETER - The source data is corrupted
 
 **/
-
 EFI_STATUS
-EfiDecompress (
+EfiGetInfo (
   IN      VOID    *Source,
   IN      UINT32  SrcSize,
-  IN OUT  VOID    *Destination,
-  IN      UINT32  DstSize,
-  IN OUT  VOID    *Scratch,
-  IN      UINT32  ScratchSize
+  OUT     UINT32  *DstSize,
+  OUT     UINT32  *ScratchSize
   );
+
 /**
-
-Routine Description:
-
   The implementation of Efi Decompress().
 
-Arguments:
-
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  Destination - The destination buffer to store the decompressed data
-  DstSize     - The size of destination buffer.
-  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - Decompression is successful
-  EFI_INVALID_PARAMETER - The source data is corrupted
-
+  @param Source      The source buffer containing the compressed data.
+  @param SrcSize     The size of source buffer
+  @param Destination The destination buffer to store the decompressed data
+  @param DstSize     The size of destination buffer.
+  @param Scratch     The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
+  @param ScratchSize The size of scratch buffer.
+
+  @retval EFI_SUCCESS           Decompression is successful
+  @retval EFI_INVALID_PARAMETER The source data is corrupted
 **/
-
 EFI_STATUS
-TianoGetInfo (
+EfiDecompress (
   IN      VOID    *Source,
   IN      UINT32  SrcSize,
-  OUT     UINT32  *DstSize,
-  OUT     UINT32  *ScratchSize
+  IN OUT  VOID    *Destination,
+  IN      UINT32  DstSize,
+  IN OUT  VOID    *Scratch,
+  IN      UINT32  ScratchSize
   );
+
 /**
-
-Routine Description:
-
   The implementation Tiano Decompress GetInfo().
 
-Arguments:
-
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  DstSize     - The size of destination buffer.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
-  EFI_INVALID_PARAMETER - The source data is corrupted
+  @param Source      The source buffer containing the compressed data.
+  @param SrcSize     The size of source buffer
+  @param DstSize     The size of destination buffer.
+  @param ScratchSize The size of scratch buffer.
 
+  @retval EFI_SUCCESS           The size of destination buffer and the size of scratch buffer are successfully retrieved.
+  @retval EFI_INVALID_PARAMETER The source data is corrupted
 **/
-
 EFI_STATUS
-TianoDecompress (
+TianoGetInfo (
   IN      VOID    *Source,
   IN      UINT32  SrcSize,
-  IN OUT  VOID    *Destination,
-  IN      UINT32  DstSize,
-  IN OUT  VOID    *Scratch,
-  IN      UINT32  ScratchSize
+  OUT     UINT32  *DstSize,
+  OUT     UINT32  *ScratchSize
   );
+
 /**
-
-Routine Description:
-
   The implementation of Tiano Decompress().
 
-Arguments:
-
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  Destination - The destination buffer to store the decompressed data
-  DstSize     - The size of destination buffer.
-  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - Decompression is successful
-  EFI_INVALID_PARAMETER - The source data is corrupted
-
+  @param Source      The source buffer containing the compressed data.
+  @param SrcSize     The size of source buffer
+  @param Destination The destination buffer to store the decompressed data
+  @param DstSize     The size of destination buffer.
+  @param Scratch     The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
+  @param ScratchSize The size of scratch buffer.
+
+  @retval EFI_SUCCESS           Decompression is successful
+  @retval EFI_INVALID_PARAMETER The source data is corrupted
 **/
+EFI_STATUS
+TianoDecompress (
+  IN      VOID    *Source,
+  IN      UINT32  SrcSize,
+  IN OUT  VOID    *Destination,
+  IN      UINT32  DstSize,
+  IN OUT  VOID    *Scratch,
+  IN      UINT32  ScratchSize
+  );
 
 typedef
 EFI_STATUS
diff --git a/BaseTools/Source/C/Common/MemoryFile.h b/BaseTools/Source/C/Common/MemoryFile.h
index 58fc8bb224f3..c84848cf15d6 100644
--- a/BaseTools/Source/C/Common/MemoryFile.h
+++ b/BaseTools/Source/C/Common/MemoryFile.h
@@ -27,79 +27,53 @@ typedef struct {
 // Functions declarations
 //
 
-EFI_STATUS
-GetMemoryFile (
-  IN CHAR8       *InputFileName,
-  OUT EFI_HANDLE *OutputMemoryFile
-  )
-;
 /**
-
-Routine Description:
-
   This opens a file, reads it into memory and returns a memory file
   object.
 
-Arguments:
+  @param InputFile          Memory file image.
+  @param OutputMemoryFile   Handle to memory file
 
-  InputFile          Memory file image.
-  OutputMemoryFile   Handle to memory file
-
-Returns:
-
-  EFI_STATUS
+  @return EFI_STATUS
   OutputMemoryFile is valid if !EFI_ERROR
-
 **/
+EFI_STATUS
+GetMemoryFile (
+  IN CHAR8       *InputFileName,
+  OUT EFI_HANDLE *OutputMemoryFile
+  )
+;
+
+/**
+  Frees all memory associated with the input memory file.
 
+  @param InputMemoryFile   Handle to memory file
 
+  @return EFI_STATUS
+**/
 EFI_STATUS
 FreeMemoryFile (
   IN EFI_HANDLE InputMemoryFile
   )
 ;
-/**
-
-Routine Description:
-
-  Frees all memory associated with the input memory file.
-
-Arguments:
-
-  InputMemoryFile   Handle to memory file
-
-Returns:
 
-  EFI_STATUS
-
-**/
-
-
-CHAR8 *
-ReadMemoryFileLine (
-  IN EFI_HANDLE     InputMemoryFile
-  )
-;
 /**
-
-Routine Description:
-
   This function reads a line from the memory file.  The newline characters
   are stripped and a null terminated string is returned.
 
   If the string pointer returned is non-NULL, then the caller must free the
   memory associated with this string.
 
-Arguments:
-
-  InputMemoryFile   Handle to memory file
-
-Returns:
-
-  NULL if error or EOF
-  NULL character termincated string otherwise (MUST BE FREED BY CALLER)
+  @param InputMemoryFile   Handle to memory file
 
+  @retval NULL if error or EOF
+  @retval NULL character termincated string otherwise (MUST BE FREED BY CALLER)
 **/
+CHAR8 *
+ReadMemoryFileLine (
+  IN EFI_HANDLE     InputMemoryFile
+  )
+;
 
 
 #endif
diff --git a/BaseTools/Source/C/Common/MyAlloc.h b/BaseTools/Source/C/Common/MyAlloc.h
index aff29d05ab7d..de3323d30d97 100644
--- a/BaseTools/Source/C/Common/MyAlloc.h
+++ b/BaseTools/Source/C/Common/MyAlloc.h
@@ -71,6 +71,17 @@ typedef struct MyAllocStruct {
 #define MYALLOC_HEAD_MAGIK  0xBADFACED
 #define MYALLOC_TAIL_MAGIK  0xDEADBEEF
 
+/**
+  Check for corruptions in the allocated memory chain.  If a corruption
+  is detection program operation stops w/ an exit(1) call.
+
+  @param Final When FALSE, MyCheck() returns if the allocated memory chain
+               has not been corrupted.  When TRUE, MyCheck() returns if there
+               are no un-freed allocations.  If there are un-freed allocations,
+               they are displayed and exit(1) is called.
+  @param File Set to __FILE__ by macro expansion.
+  @param Line Set to __LINE__ by macro expansion.
+**/
 VOID
 MyCheck (
   BOOLEAN      Final,
@@ -78,31 +89,20 @@ MyCheck (
   UINTN        Line
   )
 ;
-//
-// *++
-// Description:
-//
-//  Check for corruptions in the allocated memory chain.  If a corruption
-//  is detection program operation stops w/ an exit(1) call.
-//
-// Parameters:
-//
-//  Final := When FALSE, MyCheck() returns if the allocated memory chain
-//           has not been corrupted.  When TRUE, MyCheck() returns if there
-//           are no un-freed allocations.  If there are un-freed allocations,
-//           they are displayed and exit(1) is called.
-//
-//
-//  File := Set to __FILE__ by macro expansion.
-//
-//  Line := Set to __LINE__ by macro expansion.
-//
-// Returns:
-//
-//  n/a
-//
-// --*/
-//
+
+/**
+  Allocate a new link in the allocation chain along with enough storage
+  for the File[] string, requested Size and alignment overhead.  If
+  memory cannot be allocated or the allocation chain has been corrupted,
+  exit(1) will be called.
+
+  @param Size Number of bytes (UINT8) requested by the called.
+              Size cannot be zero.
+  @param File Set to __FILE__ by macro expansion.
+  @param Line Set to __LINE__ by macro expansion.
+
+  @return Pointer to the caller's buffer.
+**/
 VOID  *
 MyAlloc (
   UINTN      Size,
@@ -110,30 +110,20 @@ MyAlloc (
   UINTN      Line
   )
 ;
-//
-// *++
-// Description:
-//
-//  Allocate a new link in the allocation chain along with enough storage
-//  for the File[] string, requested Size and alignment overhead.  If
-//  memory cannot be allocated or the allocation chain has been corrupted,
-//  exit(1) will be called.
-//
-// Parameters:
-//
-//  Size := Number of bytes (UINT8) requested by the called.
-//          Size cannot be zero.
-//
-//  File := Set to __FILE__ by macro expansion.
-//
-//  Line := Set to __LINE__ by macro expansion.
-//
-// Returns:
-//
-//  Pointer to the caller's buffer.
-//
-// --*/
-//
+
+/**
+  This does a MyAlloc(), memcpy() and MyFree().  There is no optimization
+  for shrinking or expanding buffers.  An invalid parameter will cause
+  MyRealloc() to fail with a call to exit(1).
+
+  @param Ptr Pointer to the caller's buffer to be re-allocated.
+             Ptr cannot be NULL.
+  @param Size Size of new buffer.  Size cannot be zero.
+  @param File Set to __FILE__ by macro expansion.
+  @param Line Set to __LINE__ by macro expansion.
+
+  @return Pointer to new caller's buffer.
+**/
 VOID  *
 MyRealloc (
   VOID       *Ptr,
@@ -142,31 +132,16 @@ MyRealloc (
   UINTN      Line
   )
 ;
-//
-// *++
-// Description:
-//
-//  This does a MyAlloc(), memcpy() and MyFree().  There is no optimization
-//  for shrinking or expanding buffers.  An invalid parameter will cause
-//  MyRealloc() to fail with a call to exit(1).
-//
-// Parameters:
-//
-//  Ptr := Pointer to the caller's buffer to be re-allocated.
-//         Ptr cannot be NULL.
-//
-//  Size := Size of new buffer.  Size cannot be zero.
-//
-//  File := Set to __FILE__ by macro expansion.
-//
-//  Line := Set to __LINE__ by macro expansion.
-//
-// Returns:
-//
-//  Pointer to new caller's buffer.
-//
-// --*/
-//
+
+/**
+  Release a previously allocated buffer.  Invalid parameters will cause
+  MyFree() to fail with an exit(1) call.
+
+  @param Ptr Pointer to the caller's buffer to be freed.
+             A NULL pointer will be ignored.
+  @param File Set to __FILE__ by macro expansion.
+  @param Line Set to __LINE__ by macro expansion.
+**/
 VOID
 MyFree (
   VOID       *Ptr,
@@ -174,28 +149,7 @@ MyFree (
   UINTN      Line
   )
 ;
-//
-// *++
-// Description:
-//
-//  Release a previously allocated buffer.  Invalid parameters will cause
-//  MyFree() to fail with an exit(1) call.
-//
-// Parameters:
-//
-//  Ptr := Pointer to the caller's buffer to be freed.
-//         A NULL pointer will be ignored.
-//
-//  File := Set to __FILE__ by macro expansion.
-//
-//  Line := Set to __LINE__ by macro expansion.
-//
-// Returns:
-//
-//  n/a
-//
-// --*/
-//
+
 #else /* USE_MYALLOC */
 
 //
diff --git a/BaseTools/Source/C/Common/OsPath.h b/BaseTools/Source/C/Common/OsPath.h
index 1868103e7f1b..b1881c4a1ec7 100644
--- a/BaseTools/Source/C/Common/OsPath.h
+++ b/BaseTools/Source/C/Common/OsPath.h
@@ -16,15 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // Functions declarations
 //
 
-CHAR8*
-OsPathDirName (
-  IN CHAR8    *FilePath
-  )
-;
 /**
-
-Routine Description:
-
   This function returns the directory path which contains the particular path.
   Some examples:
     "a/b/c"  -> "a/b"
@@ -37,26 +29,17 @@ Routine Description:
 
   The caller must free the string returned.
 
-Arguments:
-
-  FilePath     Path name of file to get the parent directory for.
-
-Returns:
-
-  NULL if error
+  @param FilePath     Path name of file to get the parent directory for.
 
+  @return NULL if error
 **/
-
-
-VOID
-OsPathNormPathInPlace (
-  IN CHAR8    *Path
+CHAR8*
+OsPathDirName (
+  IN CHAR8    *FilePath
   )
 ;
+
 /**
-
-Routine Description:
-
   This function returns the directory path which contains the particular path.
   Some examples:
     "a/b/../c" -> "a/c"
@@ -65,27 +48,17 @@ Routine Description:
 
   This function does not check for the existence of the file.
 
-Arguments:
-
-  Path     Path name of file to normalize
-
-Returns:
-
-  The string is altered in place.
+  @param Path     Path name of file to normalize
 
+  @return The string is altered in place.
 **/
-
-
-CHAR8*
-OsPathPeerFilePath (
-  IN CHAR8    *OldPath,
-  IN CHAR8    *Peer
+VOID
+OsPathNormPathInPlace (
+  IN CHAR8    *Path
   )
 ;
+
 /**
-
-Routine Description:
-
   This function replaces the final portion of a path with an alternative
   'peer' filename.  For example:
     "a/b/../c", "peer" -> "a/b/../peer"
@@ -95,39 +68,30 @@ Routine Description:
 
   This function does not check for the existence of the file.
 
-Arguments:
+  @param OldPath     Path name of replace the final segment
+  @param Peer        The new path name to concatenate to become the peer path
 
-  OldPath     Path name of replace the final segment
-  Peer        The new path name to concatenate to become the peer path
+  @return A CHAR8* string, which must be freed by the caller
+**/
+CHAR8*
+OsPathPeerFilePath (
+  IN CHAR8    *OldPath,
+  IN CHAR8    *Peer
+  )
+;
 
-Returns:
+/**
+  Checks if a file exists
 
-  A CHAR8* string, which must be freed by the caller
+  @param InputFileName     The name of the file to check for existence
 
+  @retval TRUE              The file exists
+  @retval FALSE             The file does not exist
 **/
-
-
 BOOLEAN
 OsPathExists (
   IN CHAR8    *InputFileName
   )
 ;
-/**
-
-Routine Description:
-
-  Checks if a file exists
-
-Arguments:
-
-  InputFileName     The name of the file to check for existence
-
-Returns:
-
-  TRUE              The file exists
-  FALSE             The file does not exist
-
-**/
-
 
 #endif
diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.h b/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
index 2714b8ce8222..2180bbd0740f 100644
--- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
+++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
@@ -15,106 +15,73 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // Functions declarations
 //
 
+/**
+  This function parses the tools_def.txt file.  It returns a
+  EFI_HANDLE object which can be used for the other library
+  functions and should be passed to FreeParsedToolsDefHandle
+  to free resources when the tools_def.txt information is no
+  longer needed.
+
+  @param InputFile     Path name of file to read
+
+  @retval NULL if error parsing
+  @retval A non-NULL EFI_HANDLE otherwise
+**/
 EFI_HANDLE
 ParseGuidedSectionToolsFile (
   IN CHAR8    *InputFile
   )
 ;
+
 /**
-
-Routine Description:
-
   This function parses the tools_def.txt file.  It returns a
   EFI_HANDLE object which can be used for the other library
   functions and should be passed to FreeParsedToolsDefHandle
   to free resources when the tools_def.txt information is no
   longer needed.
 
-Arguments:
-
-  InputFile     Path name of file to read
-
-Returns:
-
-  NULL if error parsing
-  A non-NULL EFI_HANDLE otherwise
+  @param InputFile     Memory file image.
 
+  @retval NULL if error parsing
+  @retval A non-NULL EFI_HANDLE otherwise
 **/
-
-
 EFI_HANDLE
 ParseGuidedSectionToolsMemoryFile (
   IN EFI_HANDLE    InputFile
   )
 ;
+
 /**
+  This function looks up the appropriate tool to use for extracting
+  a GUID defined FV section.
 
-Routine Description:
-
-  This function parses the tools_def.txt file.  It returns a
-  EFI_HANDLE object which can be used for the other library
-  functions and should be passed to FreeParsedToolsDefHandle
-  to free resources when the tools_def.txt information is no
-  longer needed.
-
-Arguments:
-
-  InputFile     Memory file image.
-
-Returns:
-
-  NULL if error parsing
-  A non-NULL EFI_HANDLE otherwise
+  @param ParsedGuidedSectionToolsHandle    A parsed GUID section tools handle.
+  @param SectionGuid                       The GUID for the section.
 
+  @retval NULL     if no tool is found or there is another error
+  @retval Non-NULL The tool to use to access the section contents.  (The caller
+             must free the memory associated with this string.)
 **/
-
 CHAR8*
 LookupGuidedSectionToolPath (
   IN EFI_HANDLE ParsedGuidedSectionToolsHandle,
   IN EFI_GUID   *SectionGuid
   )
 ;
-/**
-
-Routine Description:
-
-  This function looks up the appropriate tool to use for extracting
-  a GUID defined FV section.
-
-Arguments:
-
-  ParsedGuidedSectionToolsHandle    A parsed GUID section tools handle.
-  SectionGuid                       The GUID for the section.
 
-Returns:
-
-  NULL     - if no tool is found or there is another error
-  Non-NULL - The tool to use to access the section contents.  (The caller
-             must free the memory associated with this string.)
-
-**/
-
-EFI_STATUS
-FreeParsedGuidedSectionToolsHandle (
-  IN EFI_HANDLE ParsedGuidedSectionToolsHandle
-  )
-;
 /**
-
-Routine Description:
-
   Frees resources that were allocated by ParseGuidedSectionToolsFile.
   After freeing these resources, the information that was parsed
   is no longer accessible.
 
-Arguments:
-
-  ParsedToolDefHandle   Handle returned from ParseGuidedSectionToolsFile
-
-Returns:
-
-  EFI_STATUS
+  @param ParsedToolDefHandle   Handle returned from ParseGuidedSectionToolsFile
 
+  @return EFI_STATUS
 **/
+EFI_STATUS
+FreeParsedGuidedSectionToolsHandle (
+  IN EFI_HANDLE ParsedGuidedSectionToolsHandle
+  )
+;
 
 #endif
diff --git a/BaseTools/Source/C/Common/ParseInf.h b/BaseTools/Source/C/Common/ParseInf.h
index 596cb3aa3bbb..a0881a5c9ed0 100644
--- a/BaseTools/Source/C/Common/ParseInf.h
+++ b/BaseTools/Source/C/Common/ParseInf.h
@@ -20,18 +20,8 @@ extern "C" {
 //
 // Functions declarations
 //
-CHAR8 *
-ReadLine (
-  IN MEMORY_FILE    *InputFile,
-  IN OUT CHAR8      *InputBuffer,
-  IN UINTN          MaxLength
-  )
-;
-
-/*++
-
-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
@@ -39,18 +29,31 @@ Routine Description:
   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:
+  @param InputFile     Memory file image.
+  @param InputBuffer   Buffer to read into, must be MaxLength size.
+  @param MaxLength     The maximum size of the input buffer.
 
-  InputFile     Memory file image.
-  InputBuffer   Buffer to read into, must be MaxLength size.
-  MaxLength     The maximum size of the input buffer.
+  @retval NULL if error or EOF
+  @retval InputBuffer otherwise
+**/
+CHAR8 *
+ReadLine (
+  IN MEMORY_FILE    *InputFile,
+  IN OUT CHAR8      *InputBuffer,
+  IN UINTN          MaxLength
+  )
+;
 
-Returns:
+/**
+  This function parses a file from the beginning to find a section.
+  The section string may be anywhere within a line.
 
-  NULL if error or EOF
-  InputBuffer otherwise
+  @param InputFile     Memory file image.
+  @param Section       Section to search for
 
---*/
+  @retval FALSE if error or EOF
+  @retval TRUE if section found
+**/
 BOOLEAN
 FindSection (
   IN MEMORY_FILE    *InputFile,
@@ -58,24 +61,21 @@ FindSection (
   )
 ;
 
-/*++
-
-Routine Description:
-
-  This function parses a file from the beginning to find a section.
-  The section string may be anywhere within a line.
-
-Arguments:
-
-  InputFile     Memory file image.
-  Section       Section to search for
-
-Returns:
-
-  FALSE if error or EOF
-  TRUE if section found
-
---*/
+/**
+  Finds a token value given the section and token to search for.
+
+  @param InputFile Memory file image.
+  @param Section   The section to search for, a string within [].
+  @param Token     The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
+  @param Instance  The instance of the token to search for.  Zero is the first instance.
+  @param Value     The string that holds the value following the =.  Must be MAX_LONG_FILE_PATH in size.
+
+  @retval EFI_SUCCESS             Value found.
+  @retval EFI_ABORTED             Format error detected in INF file.
+  @retval EFI_INVALID_PARAMETER   Input argument was null.
+  @retval EFI_LOAD_ERROR          Error reading from the file.
+  @retval EFI_NOT_FOUND           Section/Token/Value not found.
+**/
 EFI_STATUS
 FindToken (
   IN MEMORY_FILE    *InputFile,
@@ -86,29 +86,16 @@ FindToken (
   )
 ;
 
-/*++
+/**
+  Converts a string to an EFI_GUID.  The string must be in the
+  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
 
-Routine Description:
+  @param GuidBuffer      pointer to destination Guid
+  @param AsciiGuidBuffer pointer to ascii string
 
-  Finds a token value given the section and token to search for.
-
-Arguments:
-
-  InputFile Memory file image.
-  Section   The section to search for, a string within [].
-  Token     The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
-  Instance  The instance of the token to search for.  Zero is the first instance.
-  Value     The string that holds the value following the =.  Must be MAX_LONG_FILE_PATH in size.
-
-Returns:
-
-  EFI_SUCCESS             Value found.
-  EFI_ABORTED             Format error detected in INF file.
-  EFI_INVALID_PARAMETER   Input argument was null.
-  EFI_LOAD_ERROR          Error reading from the file.
-  EFI_NOT_FOUND           Section/Token/Value not found.
-
---*/
+  @retval EFI_ABORTED    Could not convert the string
+  @retval EFI_SUCCESS    The string was successfully converted
+**/
 EFI_STATUS
 StringToGuid (
   IN CHAR8        *AsciiGuidBuffer,
@@ -116,53 +103,36 @@ StringToGuid (
   )
 ;
 
-/*++
-
-Routine Description:
-
-  Converts a string to an EFI_GUID.  The string must be in the
-  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
-
-Arguments:
-
-  GuidBuffer      - pointer to destination Guid
-  AsciiGuidBuffer - pointer to ascii string
-
-Returns:
-
-  EFI_ABORTED    Could not convert the string
-  EFI_SUCCESS    The string was successfully converted
-
---*/
-EFI_STATUS
-AsciiStringToUint64 (
-  IN CONST CHAR8  *AsciiString,
-  IN BOOLEAN      IsHex,
-  OUT UINT64      *ReturnValue
-  )
-;
-
-/*++
-
-Routine Description:
-
+/**
   Converts a null terminated ascii string that represents a number into a
   UINT64 value.  A hex number may be preceded 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:
+  @param AsciiString   The string to convert.
+  @param IsHex         Force the string to be treated as a hex number.
+  @param ReturnValue   The return value.
 
-  AsciiString   The string to convert.
-  IsHex         Force the string to be treated as a hex number.
-  ReturnValue   The return value.
+  @retval EFI_SUCCESS   Number successfully converted.
+  @retval EFI_ABORTED   Invalid character encountered.
+**/
+EFI_STATUS
+AsciiStringToUint64 (
+  IN CONST CHAR8  *AsciiString,
+  IN BOOLEAN      IsHex,
+  OUT UINT64      *ReturnValue
+  )
+;
 
-Returns:
+/**
+  This function reads a line, stripping any comments.
 
-  EFI_SUCCESS   Number successfully converted.
-  EFI_ABORTED   Invalid character encountered.
+  @param InputFile     Stream pointer.
+  @param InputBuffer   Buffer to read into, must be MAX_LONG_FILE_PATH size.
 
---*/
+  @retval NULL if error or EOF
+  @retval InputBuffer otherwise
+**/
 CHAR8 *
 ReadLineInStream (
   IN FILE       *InputFile,
@@ -170,23 +140,16 @@ ReadLineInStream (
   )
 ;
 
-/*++
+/**
+  This function parses a stream file from the beginning to find a section.
+  The section string may be anywhere within a line.
 
-Routine Description:
+  @param InputFile     Stream pointer.
+  @param Section       Section to search for
 
-  This function reads a line, stripping any comments.
-
-Arguments:
-
-  InputFile     Stream pointer.
-  InputBuffer   Buffer to read into, must be MAX_LONG_FILE_PATH size.
-
-Returns:
-
-  NULL if error or EOF
-  InputBuffer otherwise
-
---*/
+  @retval FALSE if error or EOF
+  @retval TRUE if section found
+**/
 BOOLEAN
 FindSectionInStream (
   IN FILE       *InputFile,
@@ -194,25 +157,6 @@ FindSectionInStream (
   )
 ;
 
-/*++
-
-Routine Description:
-
-  This function parses a stream file from the beginning to find a section.
-  The section string may be anywhere within a line.
-
-Arguments:
-
-  InputFile     Stream pointer.
-  Section       Section to search for
-
-Returns:
-
-  FALSE if error or EOF
-  TRUE if section found
-
---*/
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h b/BaseTools/Source/C/Common/PcdValueCommon.h
index 1652bd543039..02ef803be479 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.h
+++ b/BaseTools/Source/C/Common/PcdValueCommon.h
@@ -24,101 +24,81 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define __STATIC_ASSERT _Static_assert
 #endif
 
+/**
+  Main function updates PCD values. It is auto generated by Build
+**/
 VOID
 PcdEntryPoint (
   VOID
   )
-/*++
 
-Routine Description:
-
-  Main function updates PCD values. It is auto generated by Build
-
-Arguments:
-
-  None
-
-Returns:
-  None
---*/
 ;
 
+/**
+  Main function updates PCD values.
+
+  @param argc            Number of command line parameters.
+  @param argv            Array of pointers to parameter strings.
+
+  @retval EXIT_SUCCESS
+**/
 int
 PcdValueMain (
   int   argc,
   char  *argv[]
   )
-/*++
-
-Routine Description:
-
-  Main function updates PCD values.
-
-Arguments:
-
-  argc            Number of command line parameters.
-  argv            Array of pointers to parameter strings.
-
-Returns:
-  EXIT_SUCCESS
---*/
 ;
 
-VOID
-__PcdSet (
-  CHAR8   *SkuName             OPTIONAL,
-  CHAR8   *DefaultValueName    OPTIONAL,
-  CHAR8   *TokenSpaceGuidName,
-  CHAR8   *TokenName,
-  UINT64  Value
-  )
-/*++
-
-Routine Description:
-
-  Get PCD value
-
-Arguments:
-
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-
-Returns:
-
-  PCD value
---*/
-;
-
-VOID
-__PcdSet (
-  CHAR8   *SkuName             OPTIONAL,
-  CHAR8   *DefaultValueName    OPTIONAL,
-  CHAR8   *TokenSpaceGuidName,
-  CHAR8   *TokenName,
-  UINT64  Value
-  )
-/*++
-
-Routine Description:
-
+/**
   Set PCD value
 
-Arguments:
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
+  @param Value                 PCD value to be set
+**/
+VOID
+__PcdSet (
+  CHAR8   *SkuName             OPTIONAL,
+  CHAR8   *DefaultValueName    OPTIONAL,
+  CHAR8   *TokenSpaceGuidName,
+  CHAR8   *TokenName,
+  UINT64  Value
+  )
+;
 
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-  Value                 PCD value to be set
+/**
+  Get PCD value
 
-Returns:
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
 
-  None
---*/
+  @return PCD value
+**/
+VOID
+__PcdSet (
+  CHAR8   *SkuName             OPTIONAL,
+  CHAR8   *DefaultValueName    OPTIONAL,
+  CHAR8   *TokenSpaceGuidName,
+  CHAR8   *TokenName,
+  UINT64  Value
+  )
 ;
 
+/**
+  Get PCD value buffer
+
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
+  @param Size                  Size of PCD value buffer
+
+  @return PCD value buffer
+**/
 VOID *
 __PcdGetPtr (
   CHAR8   *SkuName             OPTIONAL,
@@ -127,26 +107,18 @@ __PcdGetPtr (
   CHAR8   *TokenName,
   UINT32  *Size
   )
-/*++
-
-Routine Description:
-
-  Get PCD value buffer
-
-Arguments:
-
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-  Size                  Size of PCD value buffer
-
-Returns:
-
-  PCD value buffer
---*/
 ;
 
+/**
+  Set PCD value buffer
+
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
+  @param Size                  Size of PCD value
+  @param Value                 Pointer to the updated PCD value buffer
+**/
 VOID
 __PcdSetPtr (
   CHAR8   *SkuName             OPTIONAL,
@@ -156,25 +128,6 @@ __PcdSetPtr (
   UINT32  Size,
   UINT8   *Value
   )
-/*++
-
-Routine Description:
-
-  Set PCD value buffer
-
-Arguments:
-
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-  Size                  Size of PCD value
-  Value                 Pointer to the updated PCD value buffer
-
-Returns:
-
-  None
---*/
 ;
 
 #define PcdGet(A, B, C, D)  __PcdGet(#A, #B, #C, #D)
diff --git a/BaseTools/Source/C/Common/StringFuncs.h b/BaseTools/Source/C/Common/StringFuncs.h
index 8fc616de8034..23dce2724448 100644
--- a/BaseTools/Source/C/Common/StringFuncs.h
+++ b/BaseTools/Source/C/Common/StringFuncs.h
@@ -29,216 +29,139 @@ typedef struct {
 // Functions declarations
 //
 
-CHAR8*
-CloneString (
-  IN CHAR8       *String
-  )
-;
 /**
-
-Routine Description:
-
   Allocates a new string and copies 'String' to clone it
 
-Arguments:
-
-  String          The string to clone
-
-Returns:
-
-  CHAR8* - NULL if there are not enough resources
+  @param String          The string to clone
 
+  @return CHAR8* - NULL if there are not enough resources
 **/
-
-
-EFI_STATUS
-StripInfDscStringInPlace (
+CHAR8*
+CloneString (
   IN CHAR8       *String
   )
 ;
+
 /**
-
-Routine Description:
-
   Remove all comments, leading and trailing whitespace from the string.
 
-Arguments:
-
-  String          The string to 'strip'
-
-Returns:
-
-  EFI_STATUS
+  @param String          The string to 'strip'
 
+  @return EFI_STATUS
 **/
-
-
-STRING_LIST*
-SplitStringByWhitespace (
+EFI_STATUS
+StripInfDscStringInPlace (
   IN CHAR8       *String
   )
 ;
+
 /**
-
-Routine Description:
-
   Creates and returns a 'split' STRING_LIST by splitting the string
   on whitespace boundaries.
 
-Arguments:
-
-  String          The string to 'split'
-
-Returns:
-
-  EFI_STATUS
+  @param String          The string to 'split'
 
+  @return EFI_STATUS
 **/
-
-
 STRING_LIST*
-NewStringList (
+SplitStringByWhitespace (
+  IN CHAR8       *String
   )
 ;
+
 /**
-
-Routine Description:
-
   Creates a new STRING_LIST with 0 strings.
 
-Returns:
-
-  STRING_LIST* - Null if there is not enough resources to create the object.
-
+  @return STRING_LIST* - Null if there is not enough resources to create the object.
 **/
-
-
-EFI_STATUS
-AppendCopyOfStringToList (
-  IN OUT STRING_LIST **StringList,
-  IN CHAR8       *String
+STRING_LIST*
+NewStringList (
   )
 ;
+
+
 /**
-
-Routine Description:
-
   Adds String to StringList.  A new copy of String is made before it is
   added to StringList.
 
-Returns:
-
-  EFI_STATUS
-
+  @return EFI_STATUS
 **/
-
-
 EFI_STATUS
-RemoveLastStringFromList (
-  IN STRING_LIST       *StringList
+AppendCopyOfStringToList (
+  IN OUT STRING_LIST **StringList,
+  IN CHAR8       *String
   )
 ;
+
 /**
-
-Routine Description:
-
   Removes the last string from StringList and frees the memory associated
   with it.
 
-Arguments:
+  @param StringList        The string list to remove the string from
 
-  StringList        The string list to remove the string from
-
-Returns:
+  @return EFI_STATUS
+**/
+EFI_STATUS
+RemoveLastStringFromList (
+  IN STRING_LIST       *StringList
+  )
+;
 
-  EFI_STATUS
 
-**/
+/**
+  Allocates a STRING_LIST structure that can store StringCount strings.
 
+  @param StringCount        The number of strings that need to be stored
 
+  @return EFI_STATUS
+**/
 STRING_LIST*
 AllocateStringListStruct (
   IN UINTN StringCount
   )
 ;
-/**
-
-Routine Description:
-
-  Allocates a STRING_LIST structure that can store StringCount strings.
-
-Arguments:
-
-  StringCount        The number of strings that need to be stored
 
-Returns:
 
-  EFI_STATUS
-
-**/
-
-
-VOID
-FreeStringList (
-  IN STRING_LIST       *StringList
-  )
-;
 /**
-
-Routine Description:
-
   Frees all memory associated with StringList.
 
-Arguments:
-
-  StringList        The string list to free
-
-Returns:
-
-  EFI_STATUS
+  @param StringList        The string list to free
 
+  @return EFI_STATUS
 **/
-
-
-CHAR8*
-StringListToString (
+VOID
+FreeStringList (
   IN STRING_LIST       *StringList
   )
 ;
+
+
 /**
-
-Routine Description:
-
   Generates a string that represents the STRING_LIST
 
-Arguments:
+  @param StringList        The string list to convert to a string
 
-  StringList        The string list to convert to a string
-
-Returns:
-
-  CHAR8* - The string list represented with a single string.  The returned
+  @return CHAR8* The string list represented with a single string.  The returned
            string must be freed by the caller.
-
 **/
-
-
-VOID
-PrintStringList (
+CHAR8*
+StringListToString (
   IN STRING_LIST       *StringList
   )
 ;
+
+
 /**
-
-Routine Description:
-
   Prints out the string list
 
-Arguments:
-
-  StringList        The string list to print
-
+  @param StringList        The string list to print
 **/
+VOID
+PrintStringList (
+  IN STRING_LIST       *StringList
+  )
+;
+
 
 
 #endif
diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c
index 30400d1341dc..b8bfb7b58b91 100644
--- a/BaseTools/Source/C/Common/BasePeCoff.c
+++ b/BaseTools/Source/C/Common/BasePeCoff.c
@@ -77,33 +77,23 @@ PeCoffLoaderRelocateLoongArch64Image (
   IN UINT64      Adjust
   );
 
-STATIC
-RETURN_STATUS
-PeCoffLoaderGetPeHeader (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,
-  OUT    EFI_IMAGE_OPTIONAL_HEADER_UNION **PeHdr,
-  OUT    EFI_TE_IMAGE_HEADER             **TeHdr
-  )
-/*++
-
-Routine Description:
-
+/**
   Retrieves the PE or TE Header from a PE/COFF or TE image
 
-Arguments:
+  @param ImageContext  The context of the image being loaded
+  @param PeHdr         The buffer in which to return the PE header
+  @param TeHdr         The buffer in which to return the TE header
 
-  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 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.
-
---*/
+**/
+STATIC
+RETURN_STATUS
+PeCoffLoaderGetPeHeader (
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,
+  OUT    EFI_IMAGE_OPTIONAL_HEADER_UNION **PeHdr,
+  OUT    EFI_TE_IMAGE_HEADER             **TeHdr
+  )
 {
   RETURN_STATUS         Status;
   EFI_IMAGE_DOS_HEADER  DosHdr;
@@ -150,6 +140,17 @@ Routine Description:
   return RETURN_SUCCESS;
 }
 
+/**
+  Checks the PE or TE header of a PE/COFF or TE image to determine if it supported
+
+  @param ImageContext  The context of the image being loaded
+  @param PeHdr         The buffer in which to return the PE header
+  @param TeHdr         The buffer in which to return the TE header
+
+  @retval RETURN_SUCCESS if the PE/COFF or TE image is supported
+  @retval RETURN_UNSUPPORTED of the PE/COFF or TE image is not supported.
+
+**/
 STATIC
 RETURN_STATUS
 PeCoffLoaderCheckImageType (
@@ -157,26 +158,6 @@ PeCoffLoaderCheckImageType (
   IN     EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr,
   IN     EFI_TE_IMAGE_HEADER                   *TeHdr
   )
-/*++
-
-Routine Description:
-
-  Checks the PE or TE header of a PE/COFF or TE image to determine if it supported
-
-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/COFF or TE image is supported
-  RETURN_UNSUPPORTED of the PE/COFF or TE image is not supported.
-
---*/
 {
   //
   // See if the machine type is supported.
@@ -239,31 +220,24 @@ Routine Description:
   return RETURN_SUCCESS;
 }
 
+/**
+  Retrieves information on a PE/COFF image
+
+  @param This         Calling context
+  @param ImageContext The context of the image being loaded
+
+  @retval RETURN_SUCCESS           The information on the PE/COFF image was collected.
+  @retval RETURN_INVALID_PARAMETER ImageContext is NULL.
+  @retval RETURN_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
 EFIAPI
 PeCoffLoaderGetImageInfo (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT           *ImageContext
   )
-/*++
-
-Routine Description:
-
-  Retrieves information on a PE/COFF image
-
-Arguments:
-
-  This         - Calling context
-  ImageContext - The context of the image being loaded
-
-Returns:
-
-  RETURN_SUCCESS           - The information on the PE/COFF image was collected.
-  RETURN_INVALID_PARAMETER - ImageContext is NULL.
-  RETURN_UNSUPPORTED       - The PE/COFF image is not supported.
-  Otherwise             - The error status from reading the PE/COFF image using the
-                          ImageContext->ImageRead() function
-
---*/
 {
   RETURN_STATUS                   Status;
   EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
@@ -539,29 +513,21 @@ Routine Description:
   return RETURN_SUCCESS;
 }
 
-STATIC
-VOID *
-PeCoffLoaderImageAddress (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,
-  IN     UINTN                                 Address
-  )
-/*++
-
-Routine Description:
-
+/**
   Converts an image address to the loaded address
 
-Arguments:
+  @param ImageContext  The context of the image being loaded
+  @param Address       The address to be converted to the loaded address
 
-  ImageContext  - The context of the image being loaded
-
-  Address       - The address to be converted to the loaded address
-
-Returns:
-
-  NULL if the address can not be converted, otherwise, the converted address
+  @return NULL if the address can not be converted, otherwise, the converted address
 
 --*/
+STATIC
+VOID *
+PeCoffLoaderImageAddress (
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,
+  IN     UINTN                                 Address
+  )
 {
   if (Address >= ImageContext->ImageSize) {
     ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS;
@@ -571,30 +537,22 @@ Routine Description:
   return (UINT8 *) ((UINTN) ImageContext->ImageAddress + Address);
 }
 
-RETURN_STATUS
-EFIAPI
-PeCoffLoaderRelocateImage (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
-  )
-/*++
-
-Routine Description:
-
+/**
   Relocates a PE/COFF image in memory
 
-Arguments:
-
-  This         - Calling context
-
-  ImageContext - Contains information on the loaded image to relocate
-
-Returns:
-
-  RETURN_SUCCESS      if the PE/COFF image was relocated
-  RETURN_LOAD_ERROR   if the image is not a valid PE/COFF image
-  RETURN_UNSUPPORTED  not support
-
---*/
+  @param This         Calling context
+  @param ImageContext Contains information on the loaded image to relocate
+
+  @retval RETURN_SUCCESS      if the PE/COFF image was relocated
+  @retval RETURN_LOAD_ERROR   if the image is not a valid PE/COFF image
+  @retval RETURN_UNSUPPORTED  not support
+
+**/
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderRelocateImage (
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
+  )
 {
   RETURN_STATUS                         Status;
   EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr;
@@ -853,31 +811,23 @@ Routine Description:
   return RETURN_SUCCESS;
 }
 
-RETURN_STATUS
-EFIAPI
-PeCoffLoaderLoadImage (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
-  )
-/*++
-
-Routine Description:
-
+/**
   Loads a PE/COFF image into memory
 
-Arguments:
-
-  This         - Calling context
-
-  ImageContext - Contains information on image to load into memory
-
-Returns:
-
-  RETURN_SUCCESS            if the PE/COFF image was loaded
-  RETURN_BUFFER_TOO_SMALL   if the caller did not provide a large enough buffer
-  RETURN_LOAD_ERROR         if the image is a runtime driver with no relocations
-  RETURN_INVALID_PARAMETER  if the image address is invalid
-
---*/
+  @param This         Calling context
+  @param ImageContext Contains information on image to load into memory
+
+  @retval RETURN_SUCCESS            if the PE/COFF image was loaded
+  @retval RETURN_BUFFER_TOO_SMALL   if the caller did not provide a large enough buffer
+  @retval RETURN_LOAD_ERROR         if the image is a runtime driver with no relocations
+  @retval RETURN_INVALID_PARAMETER  if the image address is invalid
+
+**/
+RETURN_STATUS
+EFIAPI
+PeCoffLoaderLoadImage (
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
+  )
 {
   RETURN_STATUS                         Status;
   EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr;
diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c
index 7fb4ab764fcd..cd270f9a9074 100644
--- a/BaseTools/Source/C/Common/CommonLib.c
+++ b/BaseTools/Source/C/Common/CommonLib.c
@@ -26,28 +26,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
     } \
   } while (FALSE)
 
-VOID
-PeiZeroMem (
-  IN VOID   *Buffer,
-  IN UINTN  Size
-  )
-/*++
-
-Routine Description:
-
+/**
   Set Buffer to zero for Size bytes.
 
-Arguments:
-
-  Buffer  - Memory to set.
-
-  Size    - Number of bytes to set
-
-Returns:
-
-  None
-
---*/
+  @param Buffer  Memory to set.
+  @param Size    Number of bytes to set
+**/
+VOID
+PeiZeroMem (
+  IN VOID   *Buffer,
+  IN UINTN  Size
+  )
 {
   INT8  *Ptr;
 
@@ -57,31 +46,19 @@ Routine Description:
   }
 }
 
-VOID
-PeiCopyMem (
-  IN VOID   *Destination,
-  IN VOID   *Source,
-  IN UINTN  Length
-  )
-/*++
-
-Routine Description:
-
+/**
   Copy Length bytes from Source to Destination.
 
-Arguments:
-
-  Destination - Target of copy
-
-  Source      - Place to copy from
-
-  Length      - Number of bytes to copy
-
-Returns:
-
-  None
-
---*/
+  @param Destination Target of copy
+  @param Source      Place to copy from
+  @param Length      Number of bytes to copy
+**/
+VOID
+PeiCopyMem (
+  IN VOID   *Destination,
+  IN VOID   *Source,
+  IN UINTN  Length
+  )
 {
   CHAR8 *Destination8;
   CHAR8 *Source8;
@@ -112,27 +89,20 @@ CopyMem (
   PeiCopyMem (Destination, Source, Length);
 }
 
+/**
+  Compares to GUIDs
+
+  @param Guid1 guid to compare
+  @param Guid2 guid to compare
+
+  @retval =  0  if Guid1 == Guid2
+  @retval != 0  if Guid1 != Guid2
+**/
 INTN
 CompareGuid (
   IN EFI_GUID     *Guid1,
   IN EFI_GUID     *Guid2
   )
-/*++
-
-Routine Description:
-
-  Compares to GUIDs
-
-Arguments:
-
-  Guid1 - guid to compare
-  Guid2 - guid to compare
-
-Returns:
-  =  0  if Guid1 == Guid2
-  != 0  if Guid1 != Guid2
-
---*/
 {
   INT32 *g1;
   INT32 *g2;
@@ -152,34 +122,25 @@ Routine Description:
   return r;
 }
 
+/**
+  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.
 
+  @param InputFileName     The name of the file to read.
+  @param InputFileImage    A pointer to the memory buffer.
+  @param BytesRead         The size of the memory buffer.
+
+  @retval EFI_SUCCESS              The function completed successfully.
+  @retval EFI_INVALID_PARAMETER    One of the input parameters was invalid.
+  @retval EFI_ABORTED              An error occurred.
+  @retval EFI_OUT_OF_RESOURCES     No resource to complete operations.
+**/
 EFI_STATUS
 GetFileImage (
   IN CHAR8    *InputFileName,
   OUT CHAR8   **InputFileImage,
   OUT UINT32  *BytesRead
   )
-/*++
-
-Routine Description:
-
-  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:
-
-  InputFileName     The name of the file to read.
-  InputFileImage    A pointer to the memory buffer.
-  BytesRead         The size of the memory buffer.
-
-Returns:
-
-  EFI_SUCCESS              The function completed successfully.
-  EFI_INVALID_PARAMETER    One of the input parameters was invalid.
-  EFI_ABORTED              An error occurred.
-  EFI_OUT_OF_RESOURCES     No resource to complete operations.
-
---*/
 {
   FILE    *InputFile;
   UINT32  FileSize;
@@ -255,32 +216,24 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  This function opens a file and writes OutputFileImage into the file.
+
+  @param OutputFileName     The name of the file to write.
+  @param OutputFileImage    A pointer to the memory buffer.
+  @param BytesToWrite       The size of the memory buffer.
+
+  @retval EFI_SUCCESS              The function completed successfully.
+  @retval EFI_INVALID_PARAMETER    One of the input parameters was invalid.
+  @retval EFI_ABORTED              An error occurred.
+  @retval EFI_OUT_OF_RESOURCES     No resource to complete operations.
+**/
 EFI_STATUS
 PutFileImage (
   IN CHAR8    *OutputFileName,
   IN CHAR8    *OutputFileImage,
   IN UINT32   BytesToWrite
   )
-/*++
-
-Routine Description:
-
-  This function opens a file and writes OutputFileImage into the file.
-
-Arguments:
-
-  OutputFileName     The name of the file to write.
-  OutputFileImage    A pointer to the memory buffer.
-  BytesToWrite       The size of the memory buffer.
-
-Returns:
-
-  EFI_SUCCESS              The function completed successfully.
-  EFI_INVALID_PARAMETER    One of the input parameters was invalid.
-  EFI_ABORTED              An error occurred.
-  EFI_OUT_OF_RESOURCES     No resource to complete operations.
-
---*/
 {
   FILE    *OutputFile;
   UINT32  BytesWrote;
@@ -320,52 +273,36 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  This function calculates the value needed for a valid UINT8 checksum
+
+  @param Buffer      Pointer to buffer containing byte data of component.
+  @param Size        Size of the buffer
+
+  @return The 8 bit checksum value needed.
+**/
 UINT8
 CalculateChecksum8 (
   IN UINT8        *Buffer,
   IN UINTN        Size
   )
-/*++
-
-Routine Description:
-
-  This function calculates the value needed for a valid UINT8 checksum
-
-Arguments:
-
-  Buffer      Pointer to buffer containing byte data of component.
-  Size        Size of the buffer
-
-Returns:
-
-  The 8 bit checksum value needed.
-
---*/
 {
   return (UINT8) (0x100 - CalculateSum8 (Buffer, Size));
 }
 
+/**
+  This function calculates the UINT8 sum for the requested region.
+
+  @param Buffer      Pointer to buffer containing byte data of component.
+  @param Size      Size of the buffer
+
+  @return The 8 bit checksum value needed.
+**/
 UINT8
 CalculateSum8 (
   IN UINT8  *Buffer,
   IN UINTN  Size
   )
-/*++
-
-Routine Description::
-
-  This function calculates the UINT8 sum for the requested region.
-
-Arguments:
-
-  Buffer      Pointer to buffer containing byte data of component.
-  Size        Size of the buffer
-
-Returns:
-
-  The 8 bit checksum value needed.
-
---*/
 {
   UINTN Index;
   UINT8 Sum;
@@ -382,52 +319,36 @@ Routine Description::
   return Sum;
 }
 
-UINT16
-CalculateChecksum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
-  )
-/*++
-
-Routine Description::
-
+/**
   This function calculates the value needed for a valid UINT16 checksum
 
-Arguments:
-
-  Buffer      Pointer to buffer containing byte data of component.
-  Size        Size of the buffer
-
-Returns:
-
-  The 16 bit checksum value needed.
-
---*/
+  @param Buffer      Pointer to buffer containing byte data of component.
+  @param Size        Size of the buffer
+ 
+  @return The 16 bit checksum value needed.
+**/
+UINT16
+CalculateChecksum16 (
+  IN UINT16       *Buffer,
+  IN UINTN        Size
+  )
 {
   return (UINT16) (0x10000 - CalculateSum16 (Buffer, Size));
 }
 
-UINT16
-CalculateSum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
-  )
-/*++
-
-Routine Description:
-
+/**
   This function calculates the UINT16 sum for the requested region.
 
-Arguments:
-
-  Buffer      Pointer to buffer containing byte data of component.
-  Size        Size of the buffer
-
-Returns:
-
-  The 16 bit checksum
-
---*/
+  @param Buffer      Pointer to buffer containing byte data of component.
+  @param Size        Size of the buffer
+
+  @return The 16 bit checksum
+**/
+UINT16
+CalculateSum16 (
+  IN UINT16       *Buffer,
+  IN UINTN        Size
+  )
 {
   UINTN   Index;
   UINT16  Sum;
@@ -444,26 +365,18 @@ Routine Description:
   return (UINT16) Sum;
 }
 
+/**
+  This function prints a GUID to STDOUT.
+
+  @param Guid    Pointer to a GUID to print.
+
+  @retval EFI_SUCCESS             The GUID was printed.
+  @retval EFI_INVALID_PARAMETER   The input was NULL.
+**/
 EFI_STATUS
 PrintGuid (
   IN EFI_GUID *Guid
   )
-/*++
-
-Routine Description:
-
-  This function prints a GUID to STDOUT.
-
-Arguments:
-
-  Guid    Pointer to a GUID to print.
-
-Returns:
-
-  EFI_SUCCESS             The GUID was printed.
-  EFI_INVALID_PARAMETER   The input was NULL.
-
---*/
 {
   if (Guid == NULL) {
     Error (NULL, 0, 2000, "Invalid parameter", "PrintGuidToBuffer() called with a NULL value");
@@ -487,6 +400,18 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  This function prints a GUID to a buffer
+
+  @param Guid      Pointer to a GUID to print.
+  @param Buffer    Pointer to a user-provided buffer to print to
+  @param BufferLen Size of the Buffer
+  @param Uppercase If use upper case.
+
+  @retval EFI_SUCCESS             The GUID was printed.
+  @retval EFI_INVALID_PARAMETER   The input was NULL.
+  @retval EFI_BUFFER_TOO_SMALL    The input buffer was not big enough
+**/
 EFI_STATUS
 PrintGuidToBuffer (
   IN EFI_GUID     *Guid,
@@ -494,26 +419,6 @@ PrintGuidToBuffer (
   IN UINT32       BufferLen,
   IN BOOLEAN      Uppercase
   )
-/*++
-
-Routine Description:
-
-  This function prints a GUID to a buffer
-
-Arguments:
-
-  Guid      - Pointer to a GUID to print.
-  Buffer    - Pointer to a user-provided buffer to print to
-  BufferLen - Size of the Buffer
-  Uppercase - If use upper case.
-
-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) {
     Error (NULL, 0, 2000, "Invalid parameter", "PrintGuidToBuffer() called with a NULL value");
@@ -591,22 +496,17 @@ char *strlwr(char *s)
 //
 CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
 
+/**
+  Convert FileName to the long file path, which can support larger than 260 length.
+
+  @param FileName         FileName.
+
+  @return LongFilePath      A pointer to the converted long file path.
+**/
 CHAR8 *
 LongFilePath (
  IN CHAR8 *FileName
  )
-/*++
-
-Routine Description:
-  Convert FileName to the long file path, which can support larger than 260 length.
-
-Arguments:
-  FileName         - FileName.
-
-Returns:
-  LongFilePath      A pointer to the converted long file path.
-
---*/
 {
 #ifdef __GNUC__
   //
diff --git a/BaseTools/Source/C/Common/Crc32.c b/BaseTools/Source/C/Common/Crc32.c
index 7281d5f0e913..00cae948985d 100644
--- a/BaseTools/Source/C/Common/Crc32.c
+++ b/BaseTools/Source/C/Common/Crc32.c
@@ -268,31 +268,23 @@ UINT32  mCrcTable[256] = {
   0x2D02EF8D
 };
 
+/**
+  The CalculateCrc32 routine.
+
+  @param Data        The buffer containing the data to be processed
+  @param DataSize    The size of data to be processed
+  @param CrcOut      A pointer to the caller allocated UINT32 that on
+                     contains the CRC32 checksum of Data
+
+  @retval EFI_SUCCESS               Calculation is successful.
+  @retval EFI_INVALID_PARAMETER     Data / CrcOut = NULL, or DataSize = 0
+**/
 EFI_STATUS
 CalculateCrc32 (
   IN  UINT8                             *Data,
   IN  UINTN                             DataSize,
   IN OUT UINT32                         *CrcOut
   )
-/*++
-
-Routine Description:
-
-  The CalculateCrc32 routine.
-
-Arguments:
-
-  Data        - The buffer containing the data to be processed
-  DataSize    - The size of data to be processed
-  CrcOut      - A pointer to the caller allocated UINT32 that on
-                contains the CRC32 checksum of Data
-
-Returns:
-
-  EFI_SUCCESS               - Calculation is successful.
-  EFI_INVALID_PARAMETER     - Data / CrcOut = NULL, or DataSize = 0
-
---*/
 {
   UINT32  Crc;
   UINTN   Index;
diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c
index d85098f13140..a0f54c08342b 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -62,26 +62,18 @@ typedef struct {
 
 STATIC UINT16 mPbit = EFIPBIT;
 
-STATIC
-VOID
-FillBuf (
-  IN  SCRATCH_DATA  *Sd,
-  IN  UINT16        NumOfBits
-  )
-/*++
-
-Routine Description:
-
+/**
   Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
 
-Arguments:
-
-  Sd        - The global scratch data
-  NumOfBit  - The number of bits to shift and read.
-
-Returns: (VOID)
-
---*/
+  @param Sd        The global scratch data
+  @param NumOfBit  The number of bits to shift and read.
+**/
+STATIC
+VOID
+FillBuf (
+  IN  SCRATCH_DATA  *Sd,
+  IN  UINT16        NumOfBits
+  )
 {
   Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
 
@@ -112,30 +104,22 @@ Returns: (VOID)
   Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
 }
 
-STATIC
-UINT32
-GetBits (
-  IN  SCRATCH_DATA  *Sd,
-  IN  UINT16        NumOfBits
-  )
-/*++
-
-Routine Description:
-
+/**
   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:
-
-  Sd            - The global scratch data.
-  NumOfBits     - The number of bits to pop and read.
-
-Returns:
-
-  The bits that are popped out.
-
---*/
+  @param Sd            The global scratch data.
+  @param NumOfBits     The number of bits to pop and read.
+
+  @return The bits that are popped out.
+**/
+STATIC
+UINT32
+GetBits (
+  IN  SCRATCH_DATA  *Sd,
+  IN  UINT16        NumOfBits
+  )
 {
   UINT32  OutBits;
 
@@ -146,6 +130,18 @@ Routine Description:
   return OutBits;
 }
 
+/**
+  Creates Huffman Code mapping table according to code length array.
+
+  @param Sd        The global scratch data
+  @param NumOfChar Number of symbols in the symbol set
+  @param BitLen    Code length array
+  @param TableBits The width of the mapping table
+  @param Table     The table
+
+  @retval 0         - OK.
+  @retval BAD_TABLE - The table is corrupted.
+**/
 STATIC
 UINT16
 MakeTable (
@@ -155,26 +151,6 @@ MakeTable (
   IN  UINT16        TableBits,
   OUT UINT16        *Table
   )
-/*++
-
-Routine Description:
-
-  Creates Huffman Code mapping table according to code length array.
-
-Arguments:
-
-  Sd        - The global scratch data
-  NumOfChar - Number of symbols in the symbol set
-  BitLen    - Code length array
-  TableBits - The width of the mapping table
-  Table     - The table
-
-Returns:
-
-  0         - OK.
-  BAD_TABLE - The table is corrupted.
-
---*/
 {
   UINT16  Count[17];
   UINT16  Weight[17];
@@ -290,26 +266,18 @@ Routine Description:
   return 0;
 }
 
+/**
+  Decodes a position value.
+
+  @param Sd      the global scratch data
+
+  @return The position value decoded.
+**/
 STATIC
 UINT32
 DecodeP (
   IN  SCRATCH_DATA  *Sd
   )
-/*++
-
-Routine Description:
-
-  Decodes a position value.
-
-Arguments:
-
-  Sd      - the global scratch data
-
-Returns:
-
-  The position value decoded.
-
---*/
 {
   UINT16  Val;
   UINT32  Mask;
@@ -344,6 +312,17 @@ Routine Description:
   return Pos;
 }
 
+/**
+  Reads code lengths for the Extra Set or the Position Set
+
+  @param Sd        The global scratch data
+  @param nn        Number of symbols
+  @param nbit      Number of bits needed to represent nn
+  @param Special   The special symbol that needs to be taken care of
+
+  @retval 0         - OK.
+  @retval BAD_TABLE - Table is corrupted.
+**/
 STATIC
 UINT16
 ReadPTLen (
@@ -352,25 +331,6 @@ ReadPTLen (
   IN  UINT16        nbit,
   IN  UINT16        Special
   )
-/*++
-
-Routine Description:
-
-  Reads code lengths for the Extra Set or the Position Set
-
-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
-
-Returns:
-
-  0         - OK.
-  BAD_TABLE - Table is corrupted.
-
---*/
 {
   UINT16  Number;
   UINT16  CharC;
@@ -430,24 +390,16 @@ Routine Description:
   return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
 }
 
-STATIC
-VOID
-ReadCLen (
-  SCRATCH_DATA  *Sd
-  )
-/*++
-
-Routine Description:
-
+/**
   Reads code lengths for Char&Len Set.
 
-Arguments:
-
-  Sd    - the global scratch data
-
-Returns: (VOID)
-
---*/
+  @param Sd    the global scratch data
+**/
+STATIC
+VOID
+ReadCLen (
+  SCRATCH_DATA  *Sd
+  )
 {
   UINT16  Number;
   UINT16  CharC;
@@ -526,26 +478,18 @@ Returns: (VOID)
   return ;
 }
 
-STATIC
-UINT16
-DecodeC (
-  SCRATCH_DATA  *Sd
-  )
-/*++
-
-Routine Description:
-
+/**
   Decode a character/length value.
 
-Arguments:
-
-  Sd    - The global scratch data.
-
-Returns:
-
-  The value decoded.
-
---*/
+  @param Sd    The global scratch data.
+
+  @return The value decoded.
+**/
+STATIC
+UINT16
+DecodeC (
+  SCRATCH_DATA  *Sd
+  )
 {
   UINT16  Index2;
   UINT32  Mask;
@@ -592,24 +536,16 @@ Routine Description:
   return Index2;
 }
 
-STATIC
-VOID
-Decode (
-  SCRATCH_DATA  *Sd
-  )
-/*++
-
-Routine Description:
-
+/**
   Decode the source data and put the resulting data into the destination buffer.
 
-Arguments:
-
-  Sd            - The global scratch data
-
-Returns: (VOID)
-
- --*/
+  @param Sd            The global scratch data
+ **/
+STATIC
+VOID
+Decode (
+  SCRATCH_DATA  *Sd
+  )
 {
   UINT16  BytesRemain;
   UINT32  DataIdx;
@@ -669,32 +605,24 @@ Returns: (VOID)
   return ;
 }
 
-EFI_STATUS
-GetInfo (
-  IN      VOID    *Source,
-  IN      UINT32  SrcSize,
-  OUT     UINT32  *DstSize,
-  OUT     UINT32  *ScratchSize
-  )
-/*++
-
-Routine Description:
-
+/**
   The implementation of EFI_DECOMPRESS_PROTOCOL.GetInfo().
 
-Arguments:
-
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  DstSize     - The size of destination buffer.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
-  EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
+  @param Source      The source buffer containing the compressed data.
+  @param SrcSize     The size of source buffer
+  @param DstSize     The size of destination buffer.
+  @param ScratchSize The size of scratch buffer.
+
+  @retval EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
+  @retval EFI_INVALID_PARAMETER - The source data is corrupted
+**/
+EFI_STATUS
+GetInfo (
+  IN      VOID    *Source,
+  IN      UINT32  SrcSize,
+  OUT     UINT32  *DstSize,
+  OUT     UINT32  *ScratchSize
+  )
 {
   UINT8 *Src;
   UINT32 CompSize;
@@ -716,36 +644,28 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-Decompress (
-  IN      VOID    *Source,
-  IN      UINT32  SrcSize,
-  IN OUT  VOID    *Destination,
-  IN      UINT32  DstSize,
-  IN OUT  VOID    *Scratch,
-  IN      UINT32  ScratchSize
-  )
-/*++
-
-Routine Description:
-
+/**
   The implementation Efi and Tiano Decompress().
 
-Arguments:
+  @param Source      - The source buffer containing the compressed data.
+  @param SrcSize     - The size of source buffer
+  @param Destination - The destination buffer to store the decompressed data
+  @param DstSize     - The size of destination buffer.
+  @param Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
+  @param ScratchSize - The size of scratch buffer.
 
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  Destination - The destination buffer to store the decompressed data
-  DstSize     - The size of destination buffer.
-  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - Decompression is successful
-  EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
+  @retval EFI_SUCCESS           - Decompression is successful
+  @retval EFI_INVALID_PARAMETER - The source data is corrupted
+**/
+EFI_STATUS
+Decompress (
+  IN      VOID    *Source,
+  IN      UINT32  SrcSize,
+  IN OUT  VOID    *Destination,
+  IN      UINT32  DstSize,
+  IN OUT  VOID    *Scratch,
+  IN      UINT32  ScratchSize
+  )
 {
   UINT32        Index;
   UINT32        CompSize;
@@ -811,131 +731,99 @@ Routine Description:
   return Status;
 }
 
-EFI_STATUS
-EfiGetInfo (
-  IN      VOID    *Source,
-  IN      UINT32  SrcSize,
-  OUT     UINT32  *DstSize,
-  OUT     UINT32  *ScratchSize
-  )
-/*++
-
-Routine Description:
-
+/**
   The implementation Efi Decompress GetInfo().
 
-Arguments:
-
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  DstSize     - The size of destination buffer.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
-  EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
-  return GetInfo (Source, SrcSize, DstSize, ScratchSize);
-}
-
+  @param Source      The source buffer containing the compressed data.
+  @param SrcSize     The size of source buffer
+  @param DstSize     The size of destination buffer.
+  @param ScratchSize The size of scratch buffer.
+
+  @retval EFI_SUCCESS           The size of destination buffer and the size of scratch buffer are successfully retrieved.
+  @retval EFI_INVALID_PARAMETER The source data is corrupted
+**/
 EFI_STATUS
-TianoGetInfo (
+EfiGetInfo (
   IN      VOID    *Source,
   IN      UINT32  SrcSize,
   OUT     UINT32  *DstSize,
   OUT     UINT32  *ScratchSize
   )
-/*++
-
-Routine Description:
+{
+  return GetInfo (Source, SrcSize, DstSize, ScratchSize);
+}
 
+/**
   The implementation Tiano Decompress GetInfo().
 
-Arguments:
-
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  DstSize     - The size of destination buffer.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
-  EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
-  return GetInfo (Source, SrcSize, DstSize, ScratchSize);
-}
-
+  @param Source      The source buffer containing the compressed data.
+  @param SrcSize     The size of source buffer
+  @param DstSize     The size of destination buffer.
+  @param ScratchSize The size of scratch buffer.
+
+  @retval EFI_SUCCESS           The size of destination buffer and the size of scratch buffer are successfully retrieved.
+  @retval EFI_INVALID_PARAMETER The source data is corrupted
+**/
 EFI_STATUS
-EfiDecompress (
+TianoGetInfo (
   IN      VOID    *Source,
   IN      UINT32  SrcSize,
-  IN OUT  VOID    *Destination,
-  IN      UINT32  DstSize,
-  IN OUT  VOID    *Scratch,
-  IN      UINT32  ScratchSize
+  OUT     UINT32  *DstSize,
+  OUT     UINT32  *ScratchSize
   )
-/*++
-
-Routine Description:
+{
+  return GetInfo (Source, SrcSize, DstSize, ScratchSize);
+}
 
+/**
   The implementation of Efi Decompress().
 
-Arguments:
+  @param Source      The source buffer containing the compressed data.
+  @param SrcSize     The size of source buffer
+  @param Destination The destination buffer to store the decompressed data
+  @param DstSize     The size of destination buffer.
+  @param Scratch     The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
+  @param ScratchSize The size of scratch buffer.
 
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  Destination - The destination buffer to store the decompressed data
-  DstSize     - The size of destination buffer.
-  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - Decompression is successful
-  EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
+  @retval EFI_SUCCESS           Decompression is successful
+  @retval EFI_INVALID_PARAMETER The source data is corrupted
+**/
+EFI_STATUS
+EfiDecompress (
+  IN      VOID    *Source,
+  IN      UINT32  SrcSize,
+  IN OUT  VOID    *Destination,
+  IN      UINT32  DstSize,
+  IN OUT  VOID    *Scratch,
+  IN      UINT32  ScratchSize
+  )
 {
   mPbit = EFIPBIT;
   return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
 }
 
-EFI_STATUS
-TianoDecompress (
-  IN      VOID    *Source,
-  IN      UINT32  SrcSize,
-  IN OUT  VOID    *Destination,
-  IN      UINT32  DstSize,
-  IN OUT  VOID    *Scratch,
-  IN      UINT32  ScratchSize
-  )
-/*++
-
-Routine Description:
-
+/**
   The implementation of Tiano Decompress().
 
-Arguments:
+  @param Source      The source buffer containing the compressed data.
+  @param SrcSize     The size of source buffer
+  @param Destination The destination buffer to store the decompressed data
+  @param DstSize     The size of destination buffer.
+  @param Scratch     The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
+  @param ScratchSize The size of scratch buffer.
 
-  Source      - The source buffer containing the compressed data.
-  SrcSize     - The size of source buffer
-  Destination - The destination buffer to store the decompressed data
-  DstSize     - The size of destination buffer.
-  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
-  ScratchSize - The size of scratch buffer.
-
-Returns:
-
-  EFI_SUCCESS           - Decompression is successful
-  EFI_INVALID_PARAMETER - The source data is corrupted
-
---*/
+  @retval EFI_SUCCESS           Decompression is successful
+  @retval EFI_INVALID_PARAMETER The source data is corrupted
+**/
+EFI_STATUS
+TianoDecompress (
+  IN      VOID    *Source,
+  IN      UINT32  SrcSize,
+  IN OUT  VOID    *Destination,
+  IN      UINT32  DstSize,
+  IN OUT  VOID    *Scratch,
+  IN      UINT32  ScratchSize
+  )
 {
   mPbit = MAXPBIT;
   return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
diff --git a/BaseTools/Source/C/Common/EfiCompress.c b/BaseTools/Source/C/Common/EfiCompress.c
index db5ebe3157d2..0db958b8535a 100644
--- a/BaseTools/Source/C/Common/EfiCompress.c
+++ b/BaseTools/Source/C/Common/EfiCompress.c
@@ -250,6 +250,20 @@ STATIC NODE   mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NU
 // functions
 //
 
+/**
+  The main compression routine.
+
+  @param SrcBuffer   The buffer storing the source data
+  @param SrcSize     The size of source data
+  @param DstBuffer   The buffer to store the compressed data
+  @param DstSize     On input, the size of DstBuffer; On output,
+                     the size of the actual compressed data.
+
+  @retval EFI_BUFFER_TOO_SMALL  The DstBuffer is too small. In this case,
+                               DstSize contains the size needed.
+  @retval EFI_SUCCESS           Compression is successful.
+
+**/
 EFI_STATUS
 EfiCompress (
   IN      UINT8   *SrcBuffer,
@@ -257,27 +271,6 @@ EfiCompress (
   IN      UINT8   *DstBuffer,
   IN OUT  UINT32  *DstSize
   )
-/*++
-
-Routine Description:
-
-  The main compression routine.
-
-Arguments:
-
-  SrcBuffer   - The buffer storing the source data
-  SrcSize     - The size of source data
-  DstBuffer   - The buffer to store the compressed data
-  DstSize     - On input, the size of DstBuffer; On output,
-                the size of the actual compressed data.
-
-Returns:
-
-  EFI_BUFFER_TOO_SMALL  - The DstBuffer is too small. In this case,
-                DstSize contains the size needed.
-  EFI_SUCCESS           - Compression is successful.
-
---*/
 {
   EFI_STATUS Status = EFI_SUCCESS;
 
@@ -345,24 +338,16 @@ Routine Description:
 
 }
 
-STATIC
-VOID
-PutDword(
-  IN UINT32 Data
-  )
-/*++
-
-Routine Description:
-
+/**
   Put a dword to output stream
 
-Arguments:
-
-  Data    - the dword to put
-
-Returns: (VOID)
-
---*/
+  @param Data    the dword to put
+**/
+STATIC
+VOID
+PutDword(
+  IN UINT32 Data
+  )
 {
   if (mDst < mDstUpperLimit) {
     *mDst++ = (UINT8)(((UINT8)(Data        )) & 0xff);
@@ -381,23 +366,15 @@ Returns: (VOID)
   }
 }
 
-STATIC
-EFI_STATUS
-AllocateMemory ()
-/*++
-
-Routine Description:
-
+/**
   Allocate memory spaces for data structures used in compression process
 
-Arguments: (VOID)
-
-Returns:
-
-  EFI_SUCCESS           - Memory is allocated successfully
-  EFI_OUT_OF_RESOURCES  - Allocation fails
-
---*/
+  @retval EFI_SUCCESS           Memory is allocated successfully
+  @retva; EFI_OUT_OF_RESOURCES  Allocation fails
+**/
+STATIC
+EFI_STATUS
+AllocateMemory ()
 {
   UINT32      i;
 
@@ -432,19 +409,11 @@ Arguments: (VOID)
   return EFI_SUCCESS;
 }
 
-VOID
-FreeMemory ()
-/*++
-
-Routine Description:
-
+/**
   Called when compression is completed to free memory previously allocated.
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+VOID
+FreeMemory ()
 {
   if (mText) {
     free (mText);
@@ -481,21 +450,12 @@ Returns: (VOID)
   return;
 }
 
-
-STATIC
-VOID
-InitSlide ()
-/*++
-
-Routine Description:
-
+/**
   Initialize String Info Log data structures
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+InitSlide ()
 {
   NODE i;
 
@@ -517,29 +477,20 @@ Returns: (VOID)
   }
 }
 
-
-STATIC
-NODE
-Child (
-  IN NODE q,
-  IN UINT8 c
-  )
-/*++
-
-Routine Description:
-
+/**
   Find child node given the parent node and the edge character
 
-Arguments:
-
-  q       - the parent node
-  c       - the edge character
-
-Returns:
-
-  The child node (NIL if not found)
-
---*/
+  @param q       the parent node
+  @param c       the edge character
+
+  @return The child node (NIL if not found)
+**/
+STATIC
+NODE
+Child (
+  IN NODE q,
+  IN UINT8 c
+  )
 {
   NODE r;
 
@@ -552,28 +503,20 @@ Routine Description:
   return r;
 }
 
-STATIC
-VOID
-MakeChild (
-  IN NODE q,
-  IN UINT8 c,
-  IN NODE r
-  )
-/*++
-
-Routine Description:
-
+/**
   Create a new child for a given parent node.
 
-Arguments:
-
-  q       - the parent node
-  c       - the edge character
-  r       - the child node
-
-Returns: (VOID)
-
---*/
+  @param q       the parent node
+  @param c       the edge character
+  @param r       the child node
+**/
+STATIC
+VOID
+MakeChild (
+  IN NODE q,
+  IN UINT8 c,
+  IN NODE r
+  )
 {
   NODE h, t;
 
@@ -587,24 +530,16 @@ Returns: (VOID)
   mChildCount[q]++;
 }
 
-STATIC
-VOID
-Split (
-  NODE Old
-  )
-/*++
-
-Routine Description:
-
+/**
   Split a node.
 
-Arguments:
-
-  Old     - the node to split
-
-Returns: (VOID)
-
---*/
+  @param Old     the node to split
+**/
+STATIC
+VOID
+Split (
+  NODE Old
+  )
 {
   NODE New, t;
 
@@ -624,20 +559,12 @@ Returns: (VOID)
   MakeChild(New, mText[mPos + mMatchLen], mPos);
 }
 
-STATIC
-VOID
-InsertNode ()
-/*++
-
-Routine Description:
-
+/**
   Insert string info for current position into the String Info Log
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+InsertNode ()
 {
   NODE q, r, j, t;
   UINT8 c, *t1, *t2;
@@ -739,21 +666,13 @@ Returns: (VOID)
 
 }
 
-STATIC
-VOID
-DeleteNode ()
-/*++
-
-Routine Description:
-
+/**
   Delete outdated string info. (The Usage of PERC_FLAG
   ensures a clean deletion)
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+DeleteNode ()
 {
   NODE q, r, s, t, u;
 
@@ -813,21 +732,13 @@ Returns: (VOID)
   mAvail = r;
 }
 
-STATIC
-VOID
-GetNextMatch ()
-/*++
-
-Routine Description:
-
+/**
   Advance the current position (read in new data if needed).
   Delete outdated string info. Find a match string for current position.
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+GetNextMatch ()
 {
   INT32 n;
 
@@ -842,23 +753,15 @@ Returns: (VOID)
   InsertNode();
 }
 
-STATIC
-EFI_STATUS
-Encode ()
-/*++
-
-Routine Description:
-
+/**
   The main controlling routine for compression process.
 
-Arguments: (VOID)
-
-Returns:
-
-  EFI_SUCCESS           - The compression is successful
-  EFI_OUT_0F_RESOURCES  - Not enough memory for compression process
-
---*/
+  @retval EFI_SUCCESS           The compression is successful
+  @retval EFI_OUT_0F_RESOURCES  Not enough memory for compression process
+**/
+STATIC
+EFI_STATUS
+Encode ()
 {
   EFI_STATUS  Status;
   INT32       LastMatchLen;
@@ -920,20 +823,12 @@ Arguments: (VOID)
   return EFI_SUCCESS;
 }
 
-STATIC
-VOID
-CountTFreq ()
-/*++
-
-Routine Description:
-
+/**
   Count the frequencies for the Extra Set
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+CountTFreq ()
 {
   INT32 i, k, n, Count;
 
@@ -969,28 +864,20 @@ Returns: (VOID)
   }
 }
 
-STATIC
-VOID
-WritePTLen (
-  IN INT32 n,
-  IN INT32 nbit,
-  IN INT32 Special
-  )
-/*++
-
-Routine Description:
-
+/**
   Outputs the code length array for the Extra Set or the Position Set.
 
-Arguments:
-
-  n       - 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)
-
---*/
+  @param n       the number of symbols
+  @param nbit    the number of bits needed to represent 'n'
+  @param Special the special symbol that needs to be take care of
+**/
+STATIC
+VOID
+WritePTLen (
+  IN INT32 n,
+  IN INT32 nbit,
+  IN INT32 Special
+  )
 {
   INT32 i, k;
 
@@ -1015,20 +902,12 @@ Returns: (VOID)
   }
 }
 
-STATIC
-VOID
-WriteCLen ()
-/*++
-
-Routine Description:
-
+/**
   Outputs the code length array for Char&Length Set
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+WriteCLen ()
 {
   INT32 i, k, n, Count;
 
@@ -1096,20 +975,12 @@ EncodeP (
   }
 }
 
-STATIC
-VOID
-SendBlock ()
-/*++
-
-Routine Description:
-
+/**
   Huffman code the block and output it.
-
-Argument: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+SendBlock ()
 {
   UINT32 i, k, Flags, Root, Pos, Size;
   Flags = 0;
@@ -1164,27 +1035,18 @@ Returns: (VOID)
   }
 }
 
-
-STATIC
-VOID
-Output (
-  IN UINT32 c,
-  IN UINT32 p
-  )
-/*++
-
-Routine Description:
-
+/**
   Outputs an Original Character or a Pointer
 
-Arguments:
-
-  c     - The original character or the 'String Length' element of a Pointer
-  p     - The 'Position' field of a Pointer
-
-Returns: (VOID)
-
---*/
+  @param c     The original character or the 'String Length' element of a Pointer
+  @param p     The 'Position' field of a Pointer
+**/
+STATIC
+VOID
+Output (
+  IN UINT32 c,
+  IN UINT32 p
+  )
 {
   STATIC UINT32 CPos;
 
@@ -1263,26 +1125,18 @@ MakeCrcTable ()
   }
 }
 
-STATIC
-VOID
-PutBits (
-  IN INT32 n,
-  IN UINT32 x
-  )
-/*++
-
-Routine Description:
-
+/**
   Outputs rightmost n bits of x
 
-Arguments:
-
-  n   - the rightmost n bits of the data is used
-  x   - the data
-
-Returns: (VOID)
-
---*/
+  @param n   the rightmost n bits of the data is used
+  @param x   the data
+**/
+STATIC
+VOID
+PutBits (
+  IN INT32 n,
+  IN UINT32 x
+  )
 {
   UINT8 Temp;
 
@@ -1311,28 +1165,20 @@ Returns: (VOID)
   }
 }
 
-STATIC
-INT32
-FreadCrc (
-  OUT UINT8 *p,
-  IN  INT32 n
-  )
-/*++
-
-Routine Description:
-
+/**
   Read in source data
 
-Arguments:
-
-  p   - the buffer to hold the data
-  n   - number of bytes to read
-
-Returns:
-
-  number of bytes actually read
-
---*/
+  @param p   the buffer to hold the data
+  @param n   number of bytes to read
+
+  @return number of bytes actually read
+**/
+STATIC
+INT32
+FreadCrc (
+  OUT UINT8 *p,
+  IN  INT32 n
+  )
 {
   INT32 i;
 
@@ -1358,24 +1204,16 @@ InitPutBits ()
   mSubBitBuf = 0;
 }
 
-STATIC
-VOID
-CountLen (
-  IN INT32 i
-  )
-/*++
-
-Routine Description:
-
+/**
   Count the number of each code length for a Huffman tree.
 
-Arguments:
-
-  i   - the top node
-
-Returns: (VOID)
-
---*/
+  @param i   the top node
+**/
+STATIC
+VOID
+CountLen (
+  IN INT32 i
+  )
 {
   STATIC INT32 Depth = 0;
 
@@ -1389,22 +1227,16 @@ Returns: (VOID)
   }
 }
 
-STATIC
-VOID
-MakeLen (
-  IN INT32 Root
-  )
-/*++
-
-Routine Description:
-
+/**
   Create code length array for a Huffman tree
 
-Arguments:
-
-  Root   - the root of the tree
-
---*/
+  @param Root   the root of the tree
+**/
+STATIC
+VOID
+MakeLen (
+  IN INT32 Root
+  )
 {
   INT32 i, k;
   UINT32 Cum;
@@ -1468,28 +1300,20 @@ DownHeap (
   mHeap[i] = (INT16)k;
 }
 
-STATIC
-VOID
-MakeCode (
-  IN  INT32 n,
-  IN  UINT8 Len[],
-  OUT UINT16 Code[]
-  )
-/*++
-
-Routine Description:
-
+/**
   Assign code to each symbol based on the code length array
 
-Arguments:
-
-  n     - number of symbols
-  Len   - the code length array
-  Code  - stores codes for each symbol
-
-Returns: (VOID)
-
---*/
+  @param n     number of symbols
+  @param Len   the code length array
+  @param Code  stores codes for each symbol
+**/
+STATIC
+VOID
+MakeCode (
+  IN  INT32 n,
+  IN  UINT8 Len[],
+  OUT UINT16 Code[]
+  )
 {
   INT32    i;
   UINT16   Start[18];
@@ -1503,32 +1327,24 @@ Returns: (VOID)
   }
 }
 
-STATIC
-INT32
-MakeTree (
-  IN  INT32   NParm,
-  IN  UINT16  FreqParm[],
-  OUT UINT8   LenParm[],
-  OUT UINT16  CodeParm[]
-  )
-/*++
-
-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.
-
---*/
+  @param NParm    number of symbols
+  @param FreqParm frequency of each symbol
+  @param LenParm  code length for each symbol
+  @param CodeParm code for each symbol
+
+  @return Root of the Huffman tree.
+**/
+STATIC
+INT32
+MakeTree (
+  IN  INT32   NParm,
+  IN  UINT16  FreqParm[],
+  OUT UINT8   LenParm[],
+  OUT UINT16  CodeParm[]
+  )
 {
   INT32 i, j, k, Avail;
 
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.c b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
index f8d2a40be1e1..89524550884a 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.c
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
@@ -36,65 +36,59 @@ PrintLimitExceeded (
   VOID
   );
 
-VOID
-Error (
-  CHAR8   *FileName,
-  UINT32  LineNumber,
-  UINT32  MessageCode,
-  CHAR8   *Text,
-  CHAR8   *MsgFmt,
-  ...
-  )
-/*++
-
-Routine Description:
+/**
   Prints an error message.
 
-Arguments:
   All arguments are optional, though the printed message may be useless if
   at least something valid is not specified.
+ 
+ @note:
+   We print the following (similar to the Warn() and Debug()
+   W
+   Typical error/warning message format:
 
-  FileName - name of the file or application. If not specified, then the
+   bin\VfrCompile.cpp(330) : error C2660: 'AddVfrDataStructField' : function does not take 2 parameters
+
+   BUGBUG -- these three utility functions are almost identical, and
+   should be modified to share code.
+
+   Visual Studio does not find error messages with:
+
+      " error :"
+      " error 1:"
+      " error c1:"
+      " error 1000:"
+      " error c100:"
+
+   It does find:
+      " error c1000:"
+
+  @param FileName name of the file or application. If not specified, then the
              utility name (as set by the utility calling SetUtilityName()
              earlier) is used. Otherwise "Unknown utility" is used.
 
-  LineNumber - the line number of error, typically used by parsers. If the
+  @param LineNumber the line number of error, typically used by parsers. If the
                utility is not a parser, then 0 should be specified. Otherwise
                the FileName and LineNumber info can be used to cause
                MS Visual Studio to jump to the error.
 
-  MessageCode - an application-specific error code that can be referenced in
+  @param MessageCode an application-specific error code that can be referenced in
               other documentation.
 
-  Text        - the text in question, typically used by parsers.
+  @param Text        the text in question, typically used by parsers.
 
-  MsgFmt - the format string for the error message. Can contain formatting
+  @param MsgFmt the format string for the error message. Can contain formatting
            controls for use with the varargs.
-
-Returns:
-  None.
-
-Notes:
-  We print the following (similar to the Warn() and Debug()
-  W
-  Typical error/warning message format:
-
-  bin\VfrCompile.cpp(330) : error C2660: 'AddVfrDataStructField' : function does not take 2 parameters
-
-  BUGBUG -- these three utility functions are almost identical, and
-  should be modified to share code.
-
-  Visual Studio does not find error messages with:
-
-     " error :"
-     " error 1:"
-     " error c1:"
-     " error 1000:"
-     " error c100:"
-
-  It does find:
-     " error c1000:"
---*/
+**/
+VOID
+Error (
+  CHAR8   *FileName,
+  UINT32  LineNumber,
+  UINT32  MessageCode,
+  CHAR8   *Text,
+  CHAR8   *MsgFmt,
+  ...
+  )
 {
   va_list List;
   //
@@ -127,28 +121,21 @@ Routine Description:
   va_end (List);
 }
 
-VOID
-ParserError (
-  UINT32  MessageCode,
-  CHAR8   *Text,
-  CHAR8   *MsgFmt,
-  ...
-  )
-/*++
-
-Routine Description:
+/**
   Print a parser error, using the source file name and line number
   set by a previous call to SetParserPosition().
 
-Arguments:
-  MessageCode   - application-specific error code
-  Text          - text to print in the error message
-  MsgFmt        - format string to print at the end of the error message
-
-Returns:
-  NA
-
---*/
+  @param MessageCode   application-specific error code
+  @param Text          text to print in the error message
+  @param MsgFmt        format string to print at the end of the error message
+**/
+VOID
+ParserError (
+  UINT32  MessageCode,
+  CHAR8   *Text,
+  CHAR8   *MsgFmt,
+  ...
+  )
 {
   va_list List;
   //
@@ -181,6 +168,14 @@ Routine Description:
   va_end (List);
 }
 
+/**
+  Print a parser warning, using the source file name and line number
+  set by a previous call to SetParserPosition().
+
+  @param ErrorCode     application-specific error code
+  @param OffendingText text to print in the warning message
+  @param MsgFmt        format string to print at the end of the warning message
+**/
 VOID
 ParserWarning (
   UINT32  ErrorCode,
@@ -188,21 +183,6 @@ ParserWarning (
   CHAR8   *MsgFmt,
   ...
   )
-/*++
-
-Routine Description:
-  Print a parser warning, using the source file name and line number
-  set by a previous call to SetParserPosition().
-
-Arguments:
-  ErrorCode     - application-specific error code
-  OffendingText - text to print in the warning message
-  MsgFmt        - format string to print at the end of the warning message
-
-Returns:
-  NA
-
---*/
 {
   va_list List;
   //
@@ -241,39 +221,28 @@ Routine Description:
   //  }
 }
 
-VOID
-Warning (
-  CHAR8   *FileName,
-  UINT32  LineNumber,
-  UINT32  MessageCode,
-  CHAR8   *Text,
-  CHAR8   *MsgFmt,
-  ...
-  )
-/*++
-
-Routine Description:
+/**
   Print a warning message.
 
-Arguments:
-  FileName    - name of the file where the warning was detected, or the name
-                of the application that detected the warning
-
-  LineNumber  - the line number where the warning was detected (parsers).
-                0 should be specified if the utility is not a parser.
-
-  MessageCode - an application-specific warning code that can be referenced in
-                other documentation.
-
-  Text        - the text in question (parsers)
-
-  MsgFmt      - the format string for the warning message. Can contain formatting
-                controls for use with varargs.
-
-Returns:
-  None.
-
---*/
+  @param FileName    name of the file where the warning was detected, or the name
+                     of the application that detected the warning
+  @param LineNumber  the line number where the warning was detected (parsers).
+                     0 should be specified if the utility is not a parser.
+  @param MessageCode an application-specific warning code that can be referenced in
+                     other documentation.
+  @param Text        the text in question (parsers)
+  @param MsgFmt      the format string for the warning message. Can contain formatting
+                     controls for use with varargs.
+**/
+VOID
+Warning (
+  CHAR8   *FileName,
+  UINT32  LineNumber,
+  UINT32  MessageCode,
+  CHAR8   *Text,
+  CHAR8   *MsgFmt,
+  ...
+  )
 {
   va_list List;
 
@@ -313,6 +282,18 @@ Routine Description:
   va_end (List);
 }
 
+/**
+  Print a Debug message.
+ 
+  @param FileName    typically the name of the utility printing the debug message, but
+                     can be the name of a file being parsed.
+  @param LineNumber  the line number in FileName (parsers)
+  @param MsgLevel    Debug message print level (0~9)
+  @param Text        the text in question (parsers)
+  @param MsgFmt      the format string for the debug message. Can contain formatting
+                     controls for use with varargs.
+
+**/
 VOID
 DebugMsg (
   CHAR8   *FileName,
@@ -322,28 +303,6 @@ DebugMsg (
   CHAR8   *MsgFmt,
   ...
   )
-/*++
-
-Routine Description:
-  Print a Debug message.
-
-Arguments:
-  FileName    - typically the name of the utility printing the debug message, but
-                can be the name of a file being parsed.
-
-  LineNumber  - the line number in FileName (parsers)
-
-  MsgLevel    - Debug message print level (0~9)
-
-  Text        - the text in question (parsers)
-
-  MsgFmt      - the format string for the debug message. Can contain formatting
-                controls for use with varargs.
-
-Returns:
-  None.
-
---*/
 {
   va_list List;
   //
@@ -358,64 +317,52 @@ Routine Description:
   va_end (List);
 }
 
-VOID
-PrintMessage (
-  CHAR8   *Type,
-  CHAR8   *FileName,
-  UINT32  LineNumber,
-  UINT32  MessageCode,
-  CHAR8   *Text,
-  CHAR8   *MsgFmt,
-  va_list List
-  )
-/*++
-
-Routine Description:
+/**
   Worker routine for all the utility printing services. Prints the message in
   a format that Visual Studio will find when scanning build outputs for
   errors or warnings.
+ 
+ @note:
+   If FileName == NULL then this utility will use the string passed into SetUtilityName().
 
-Arguments:
-  Type        - "warning" or "error" string to insert into the message to be
+   LineNumber is only used if the caller is a parser, in which case FileName refers to the
+   file being parsed.
+
+   Text and MsgFmt are both optional, though it would be of little use calling this function with
+   them both NULL.
+
+   Output will typically be of the form:
+     <FileName>(<LineNumber>) : <Type> <Type[0]><MessageCode>: <Text> : <MsgFmt>
+
+     Parser (LineNumber != 0)
+       VfrCompile.cpp(330) : error E2660: AddVfrDataStructField : function does not take 2 parameters
+     Generic utility (LineNumber == 0)
+       UtilityName : error E1234 : Text string : MsgFmt string and args
+
+  @param Type        "warning" or "error" string to insert into the message to be
                 printed. The first character of this string (converted to uppercase)
                 is used to precede the MessageCode value in the output string.
-
-  FileName    - name of the file where the warning was detected, or the name
+  @param FileName    name of the file where the warning was detected, or the name
                 of the application that detected the warning
-
-  LineNumber  - the line number where the warning was detected (parsers).
+  @param LineNumber  the line number where the warning was detected (parsers).
                 0 should be specified if the utility is not a parser.
-
-  MessageCode - an application-specific warning code that can be referenced in
+  @param MessageCode an application-specific warning code that can be referenced in
                 other documentation.
-
-  Text        - part of the message to print
-
-  MsgFmt      - the format string for the message. Can contain formatting
+  @param Text        part of the message to print
+  @param MsgFmt      the format string for the message. Can contain formatting
                 controls for use with varargs.
-  List        - the variable list.
-
-Returns:
-  None.
-
-Notes:
-  If FileName == NULL then this utility will use the string passed into SetUtilityName().
-
-  LineNumber is only used if the caller is a parser, in which case FileName refers to the
-  file being parsed.
-
-  Text and MsgFmt are both optional, though it would be of little use calling this function with
-  them both NULL.
-
-  Output will typically be of the form:
-    <FileName>(<LineNumber>) : <Type> <Type[0]><MessageCode>: <Text> : <MsgFmt>
-
-    Parser (LineNumber != 0)
-      VfrCompile.cpp(330) : error E2660: AddVfrDataStructField : function does not take 2 parameters
-    Generic utility (LineNumber == 0)
-      UtilityName : error E1234 : Text string : MsgFmt string and args
-
---*/
+  @param List        the variable list.
+**/
+VOID
+PrintMessage (
+  CHAR8   *Type,
+  CHAR8   *FileName,
+  UINT32  LineNumber,
+  UINT32  MessageCode,
+  CHAR8   *Text,
+  CHAR8   *MsgFmt,
+  va_list List
+  )
 {
   CHAR8       Line[MAX_LINE_LEN];
   CHAR8       Line2[MAX_LINE_LEN];
@@ -523,24 +470,19 @@ Routine Description:
 
 }
 
-STATIC
-VOID
-PrintSimpleMessage (
-  CHAR8   *MsgFmt,
-  va_list List
-  )
-/*++
-Routine Description:
+/**
   Print message into stdout.
 
-Arguments:
-  MsgFmt      - the format string for the message. Can contain formatting
-                controls for use with varargs.
-  List        - the variable list.
-
-Returns:
-  None.
---*/
+  @param MsgFmt      the format string for the message. Can contain formatting
+                     controls for use with varargs.
+  @param List        the variable list.
+**/
+STATIC
+VOID
+PrintSimpleMessage (
+  CHAR8   *MsgFmt,
+  va_list List
+  )
 {
   CHAR8       Line[MAX_LINE_LEN];
   //
@@ -552,51 +494,37 @@ Routine Description:
   }
 }
 
+/**
+  Set the position in a file being parsed. This can be used to
+  print error messages deeper down in a parser.
+
+  @param SourceFileName name of the source file being parsed
+  @param LineNum        line number of the source file being parsed
+**/
 VOID
 ParserSetPosition (
   CHAR8   *SourceFileName,
   UINT32  LineNum
   )
-/*++
-
-Routine Description:
-  Set the position in a file being parsed. This can be used to
-  print error messages deeper down in a parser.
-
-Arguments:
-  SourceFileName - name of the source file being parsed
-  LineNum        - line number of the source file being parsed
-
-Returns:
-  NA
-
---*/
 {
   mSourceFileName     = SourceFileName;
   mSourceFileLineNum  = LineNum;
 }
 
-VOID
-SetUtilityName (
-  CHAR8   *UtilityName
-  )
-/*++
-
-Routine Description:
+/**
   All printed error/warning/debug messages follow the same format, and
   typically will print a filename or utility name followed by the error
   text. However if a filename is not passed to the print routines, then
   they'll print the utility name if you call this function early in your
   app to set the utility name.
 
-Arguments:
-  UtilityName  -  name of the utility, which will be printed with all
-                  error/warning/debug messages.
-
-Returns:
-  NA
-
---*/
+  @param UtilityName  name of the utility, which will be printed with all
+                      error/warning/debug messages.
+**/
+VOID
+SetUtilityName (
+  CHAR8   *UtilityName
+  )
 {
   //
   // Save the name of the utility in our local variable. Make sure its
@@ -613,69 +541,48 @@ Routine Description:
   }
 }
 
-STATUS
-GetUtilityStatus (
-  VOID
-  )
-/*++
-
-Routine Description:
+/**
   When you call Error() or Warning(), this module keeps track of it and
   sets a local mStatus to STATUS_ERROR or STATUS_WARNING. When the utility
   exits, it can call this function to get the status and use it as a return
   value.
 
-Arguments:
-  None.
-
-Returns:
-  Worst-case status reported, as defined by which print function was called.
-
---*/
+  @return Worst-case status reported, as defined by which print function was called.
+**/
+STATUS
+GetUtilityStatus (
+  VOID
+  )
 {
   return mStatus;
 }
 
-VOID
-SetPrintLevel (
-  UINT64  LogLevel
-  )
-/*++
-
-Routine Description:
+/**
   Set the printing message Level. This is used by the PrintMsg() function
   to determine when/if a message should be printed.
 
-Arguments:
-  LogLevel  - 0~50 to specify the different level message.
-
-Returns:
-  NA
-
---*/
+  @param LogLevel  0~50 to specify the different level message.
+**/
+VOID
+SetPrintLevel (
+  UINT64  LogLevel
+  )
 {
   mPrintLogLevel = LogLevel;
 }
 
-VOID
-VerboseMsg (
-  CHAR8   *MsgFmt,
-  ...
-  )
-/*++
-
-Routine Description:
+/**
   Print a verbose level message.
 
-Arguments:
-  MsgFmt      - the format string for the message. Can contain formatting
-                controls for use with varargs.
-  List        - the variable list.
-
-Returns:
-  NA
-
---*/
+  @param MsgFmt      the format string for the message. Can contain formatting
+                     controls for use with varargs.
+  @param List        the variable list.
+**/
+VOID
+VerboseMsg (
+  CHAR8   *MsgFmt,
+  ...
+  )
 {
   va_list List;
   //
@@ -690,25 +597,18 @@ Routine Description:
   va_end (List);
 }
 
-VOID
-NormalMsg (
-  CHAR8   *MsgFmt,
-  ...
-  )
-/*++
-
-Routine Description:
+/**
   Print a default level message.
 
-Arguments:
-  MsgFmt      - the format string for the message. Can contain formatting
-                controls for use with varargs.
-  List        - the variable list.
-
-Returns:
-  NA
-
---*/
+  @param MsgFmt      the format string for the message. Can contain formatting
+                     controls for use with varargs.
+  @param List        the variable list.
+**/
+VOID
+NormalMsg (
+  CHAR8   *MsgFmt,
+  ...
+  )
 {
   va_list List;
   //
@@ -723,25 +623,18 @@ Routine Description:
   va_end (List);
 }
 
-VOID
-KeyMsg (
-  CHAR8   *MsgFmt,
-  ...
-  )
-/*++
-
-Routine Description:
+/**
   Print a key level message.
 
-Arguments:
-  MsgFmt      - the format string for the message. Can contain formatting
-                controls for use with varargs.
-  List        - the variable list.
-
-Returns:
-  NA
-
---*/
+  @param MsgFmt      the format string for the message. Can contain formatting
+                     controls for use with varargs.
+  @param List        the variable list.
+**/
+VOID
+KeyMsg (
+  CHAR8   *MsgFmt,
+  ...
+  )
 {
   va_list List;
   //
@@ -756,28 +649,21 @@ Routine Description:
   va_end (List);
 }
 
+/**
+  Set the limits of how many errors, warnings, and errors+warnings
+  we will print.
+
+  @param MaxErrors       maximum number of error messages to print
+  @param MaxWarnings     maximum number of warning messages to print
+  @param MaxWarningsPlusErrors
+                  maximum number of errors+warnings to print
+**/
 VOID
 SetPrintLimits (
   UINT32  MaxErrors,
   UINT32  MaxWarnings,
   UINT32  MaxWarningsPlusErrors
   )
-/*++
-
-Routine Description:
-  Set the limits of how many errors, warnings, and errors+warnings
-  we will print.
-
-Arguments:
-  MaxErrors       - maximum number of error messages to print
-  MaxWarnings     - maximum number of warning messages to print
-  MaxWarningsPlusErrors
-                  - maximum number of errors+warnings to print
-
-Returns:
-  NA
-
---*/
 {
   mMaxErrors              = MaxErrors;
   mMaxWarnings            = MaxWarnings;
diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
index ace26eb71c6b..3fae6f901da0 100644
--- a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
+++ b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
@@ -78,29 +78,21 @@ FvBufCalculateChecksum8 (
 // Procedures start
 //
 
+/**
+  Clears out all files from the Fv buffer in memory
+
+  @param SourceFv Address of the Fv in memory, this firmware volume will
+                  be modified, if SourceFfsFile exists
+  @param SourceFfsFile Input FFS file to replace
+
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+**/
 EFI_STATUS
 FvBufRemoveFileNew (
   IN OUT VOID *Fv,
   IN EFI_GUID *Name
   )
-/*++
-
-Routine Description:
-
-  Clears out all files from the Fv buffer in memory
-
-Arguments:
-
-  SourceFv - Address of the Fv in memory, this firmware volume will
-             be modified, if SourceFfsFile exists
-  SourceFfsFile - Input FFS file to replace
-
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-
---*/
 {
   EFI_STATUS                  Status;
   EFI_FFS_FILE_HEADER*        FileToRm;
@@ -127,30 +119,21 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Clears out all files from the Fv buffer in memory
 
+  @param SourceFv Address of the Fv in memory, this firmware volume will
+                  be modified, if SourceFfsFile exists
+  @param SourceFfsFile Input FFS file to replace
+
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+**/
 EFI_STATUS
 FvBufRemoveFile (
   IN OUT VOID *Fv,
   IN EFI_GUID *Name
   )
-/*++
-
-Routine Description:
-
-  Clears out all files from the Fv buffer in memory
-
-Arguments:
-
-  SourceFv - Address of the Fv in memory, this firmware volume will
-             be modified, if SourceFfsFile exists
-  SourceFfsFile - Input FFS file to replace
-
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-
---*/
 {
   EFI_STATUS                  Status;
   EFI_FFS_FILE_HEADER        *NextFile;
@@ -216,27 +199,18 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Clears out all files from the Fv buffer in memory
 
+  @param SourceFfsFile Input FFS file to update the checksum for
+
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+**/
 EFI_STATUS
 FvBufChecksumFile (
   IN OUT VOID *FfsFile
   )
-/*++
-
-Routine Description:
-
-  Clears out all files from the Fv buffer in memory
-
-Arguments:
-
-  SourceFfsFile - Input FFS file to update the checksum for
-
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-
---*/
 {
   EFI_FFS_FILE_HEADER* File = (EFI_FFS_FILE_HEADER*)FfsFile;
   EFI_FFS_FILE_STATE StateBackup;
@@ -272,29 +246,20 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Clears out all files from the Fv buffer in memory
 
+  @param SourceFv Address of the Fv in memory, this firmware volume will
+                  be modified, if SourceFfsFile exists
+  @param SourceFfsFile Input FFS file to replace
+
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+**/
 EFI_STATUS
 FvBufChecksumHeader (
   IN OUT VOID *Fv
   )
-/*++
-
-Routine Description:
-
-  Clears out all files from the Fv buffer in memory
-
-Arguments:
-
-  SourceFv - Address of the Fv in memory, this firmware volume will
-             be modified, if SourceFfsFile exists
-  SourceFfsFile - Input FFS file to replace
-
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-
---*/
 {
   EFI_FIRMWARE_VOLUME_HEADER* FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
 
@@ -308,31 +273,22 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-
-EFI_STATUS
-FvBufDuplicate (
-  IN VOID *SourceFv,
-  IN OUT VOID **DestinationFv
-  )
-/*++
-
-Routine Description:
-
+/**
   Clears out all files from the Fv buffer in memory
 
-Arguments:
-
-  SourceFv - Address of the Fv in memory
-  DestinationFv - Output for destination Fv
+  @param SourceFv - Address of the Fv in memory
+  @param DestinationFv - Output for destination Fv
     DestinationFv == NULL - invalid parameter
     *DestinationFv == NULL - memory will be allocated
     *DestinationFv != NULL - this address will be the destination
 
-Returns:
-
-  EFI_SUCCESS
-
---*/
+  @retval EFI_SUCCESS
+**/
+EFI_STATUS
+FvBufDuplicate (
+  IN VOID *SourceFv,
+  IN OUT VOID **DestinationFv
+  )
 {
   EFI_STATUS Status;
   UINTN size;
@@ -358,35 +314,26 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Extends a firmware volume by the given number of bytes.
 
+  BUGBUG: Does not handle the case where the firmware volume has a
+          VTF (Volume Top File).  The VTF will not be moved to the
+          end of the extended FV.
+
+  @param Fv Source and destination firmware volume.
+            Note: The original firmware volume buffer is freed!
+
+  @param Size The minimum size that the firmware volume is to be extended by.
+              The FV may be extended more than this size.
+
+  @retval EFI_SUCCESS
+**/
 EFI_STATUS
 FvBufExtend (
   IN VOID **Fv,
   IN UINTN Size
   )
-/*++
-
-Routine Description:
-
-  Extends a firmware volume by the given number of bytes.
-
-  BUGBUG: Does not handle the case where the firmware volume has a
-          VTF (Volume Top File).  The VTF will not be moved to the
-          end of the extended FV.
-
-Arguments:
-
-  Fv - Source and destination firmware volume.
-       Note: The original firmware volume buffer is freed!
-
-  Size - The minimum size that the firmware volume is to be extended by.
-         The FV may be extended more than this size.
-
-Returns:
-
-  EFI_SUCCESS
-
---*/
 {
   EFI_STATUS Status;
   UINTN OldSize;
@@ -469,27 +416,17 @@ Routine Description:
 
 }
 
+/**
+  Clears out all files from the Fv buffer in memory
 
+  @param Fv Address of the Fv in memory
+
+  @retval EFI_SUCCESS
+**/
 EFI_STATUS
 FvBufClearAllFiles (
   IN OUT VOID *Fv
   )
-/*++
-
-Routine Description:
-
-  Clears out all files from the Fv buffer in memory
-
-Arguments:
-
-  Fv - Address of the Fv in memory
-
-Returns:
-
-  EFI_SUCCESS
-
---*/
-
 {
   EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
   EFI_STATUS Status;
@@ -509,28 +446,18 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Clears out all files from the Fv buffer in memory
 
+  @param Fv Address of the Fv in memory
+
+  @retval EFI_SUCCESS
+**/
 EFI_STATUS
 FvBufGetSize (
   IN VOID *Fv,
   OUT UINTN *Size
   )
-/*++
-
-Routine Description:
-
-  Clears out all files from the Fv buffer in memory
-
-Arguments:
-
-  Fv - Address of the Fv in memory
-
-Returns:
-
-  EFI_SUCCESS
-
---*/
-
 {
   EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
   EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
@@ -554,28 +481,19 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-
-EFI_STATUS
-FvBufAddFile (
-  IN OUT VOID *Fv,
-  IN VOID *File
-  )
-/*++
-
-Routine Description:
-
+/**
   Adds a new FFS file
 
-Arguments:
-
-  Fv - Address of the Fv in memory
-  File - FFS file to add to Fv
-
-Returns:
-
-  EFI_SUCCESS
-
---*/
+  @param Fv Address of the Fv in memory
+  @param File FFS file to add to Fv
+
+  @retval EFI_SUCCESS
+**/
+EFI_STATUS
+FvBufAddFile (
+  IN OUT VOID *Fv,
+  IN VOID *File
+  )
 {
   EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
 
@@ -652,32 +570,23 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-
-EFI_STATUS
-FvBufAddFileWithExtend (
-  IN OUT VOID **Fv,
-  IN VOID *File
-  )
-/*++
-
-Routine Description:
-
+/**
   Adds a new FFS file.  Extends the firmware volume if needed.
 
-Arguments:
-
-  Fv - Source and destination firmware volume.
-       Note: If the FV is extended, then the original firmware volume
+  @param Fv Source and destination firmware volume.
+            Note: If the FV is extended, then the original firmware volume
              buffer is freed!
 
-  Size - The minimum size that the firmware volume is to be extended by.
-         The FV may be extended more than this size.
+  @param Size The minimum size that the firmware volume is to be extended by.
+              The FV may be extended more than this size.
 
-Returns:
-
-  EFI_SUCCESS
-
---*/
+  @retval EFI_SUCCESS
+**/
+EFI_STATUS
+FvBufAddFileWithExtend (
+  IN OUT VOID **Fv,
+  IN VOID *File
+  )
 {
   EFI_STATUS Status;
   EFI_FFS_FILE_HEADER* NewFile;
@@ -706,29 +615,20 @@ Routine Description:
   return Status;
 }
 
-
-EFI_STATUS
-FvBufAddVtfFile (
-  IN OUT VOID *Fv,
-  IN VOID *File
-  )
-/*++
-
-Routine Description:
-
+/**
   Adds a new FFS VFT (Volume Top File) file.  In other words, adds the
   file to the end of the firmware volume.
 
-Arguments:
-
-  Fv - Address of the Fv in memory
-  File - FFS file to add to Fv
-
-Returns:
-
-  EFI_SUCCESS
-
---*/
+  @param Fv Address of the Fv in memory
+  @param File FFS file to add to Fv
+
+  @retval EFI_SUCCESS
+**/
+EFI_STATUS
+FvBufAddVtfFile (
+  IN OUT VOID *Fv,
+  IN VOID *File
+  )
 {
   EFI_STATUS Status;
 
@@ -811,52 +711,35 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Expands the 3 byte size commonly used in Firmware Volume data structures
 
+  @param Size Address of the 3 byte array representing the size
+
+  @return UINT32
+**/
 VOID
 FvBufCompact3ByteSize (
   OUT VOID* SizeDest,
   IN UINT32 Size
   )
-/*++
-
-Routine Description:
-
-  Expands the 3 byte size commonly used in Firmware Volume data structures
-
-Arguments:
-
-  Size - Address of the 3 byte array representing the size
-
-Returns:
-
-  UINT32
-
---*/
 {
   ((UINT8*)SizeDest)[0] = (UINT8)Size;
   ((UINT8*)SizeDest)[1] = (UINT8)(Size >> 8);
   ((UINT8*)SizeDest)[2] = (UINT8)(Size >> 16);
 }
 
-UINT32
-FvBufGetFfsFileSize (
-  IN EFI_FFS_FILE_HEADER *Ffs
-  )
-/*++
-
-Routine Description:
-
+/**
   Get the FFS file size.
 
-Arguments:
-
-  Ffs - Pointer to FFS header
-
-Returns:
-
-  UINT32
-
---*/
+  @param Ffs Pointer to FFS header
+
+  @return UINT32
+**/
+UINT32
+FvBufGetFfsFileSize (
+  IN EFI_FFS_FILE_HEADER *Ffs
+  )
 {
   if (Ffs == NULL) {
     return 0;
@@ -867,25 +750,17 @@ Routine Description:
   return FvBufExpand3ByteSize(Ffs->Size);
 }
 
-UINT32
-FvBufGetFfsHeaderSize (
-  IN EFI_FFS_FILE_HEADER *Ffs
-  )
-/*++
-
-Routine Description:
-
+/**
   Get the FFS header size.
 
-Arguments:
-
-  Ffs - Pointer to FFS header
-
-Returns:
-
-  UINT32
-
---*/
+  @param Ffs Pointer to FFS header
+
+  @return UINT32
+**/
+UINT32
+FvBufGetFfsHeaderSize (
+  IN EFI_FFS_FILE_HEADER *Ffs
+  )
 {
   if (Ffs == NULL) {
     return 0;
@@ -896,60 +771,44 @@ Routine Description:
   return sizeof(EFI_FFS_FILE_HEADER);
 }
 
+/**
+  Expands the 3 byte size commonly used in Firmware Volume data structures
+
+  @param Size Address of the 3 byte array representing the size
+
+  @return UINT32
+**/
 UINT32
 FvBufExpand3ByteSize (
   IN VOID* Size
   )
-/*++
-
-Routine Description:
-
-  Expands the 3 byte size commonly used in Firmware Volume data structures
-
-Arguments:
-
-  Size - Address of the 3 byte array representing the size
-
-Returns:
-
-  UINT32
-
---*/
 {
   return (((UINT8*)Size)[2] << 16) +
          (((UINT8*)Size)[1] << 8) +
          ((UINT8*)Size)[0];
 }
 
-EFI_STATUS
-FvBufFindNextFile (
-  IN VOID *Fv,
-  IN OUT UINTN *Key,
-  OUT VOID **File
-  )
-/*++
-
-Routine Description:
-
+/**
   Iterates through the files contained within the firmware volume
 
-Arguments:
-
-  Fv - Address of the Fv in memory
-  Key - Should be 0 to get the first file.  After that, it should be
-        passed back in without modifying its contents to retrieve
-        subsequent files.
-  File - Output file pointer
+  @param Fv Address of the Fv in memory
+  @param Key Should be 0 to get the first file.  After that, it should be
+             passed back in without modifying its contents to retrieve
+             subsequent files.
+  @param File Output file pointer
     File == NULL - invalid parameter
     otherwise - *File will be update to the location of the file
 
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-  EFI_VOLUME_CORRUPTED
-
---*/
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+  @retval EFI_VOLUME_CORRUPTED
+**/
+EFI_STATUS
+FvBufFindNextFile (
+  IN VOID *Fv,
+  IN OUT UINTN *Key,
+  OUT VOID **File
+  )
 {
   EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
 
@@ -1028,35 +887,26 @@ Routine Description:
   return EFI_NOT_FOUND;
 }
 
-
-EFI_STATUS
-FvBufFindFileByName (
-  IN VOID *Fv,
-  IN EFI_GUID *Name,
-  OUT VOID **File
-  )
-/*++
-
-Routine Description:
-
+/**
   Searches the Fv for a file by its name
 
-Arguments:
-
-  Fv - Address of the Fv in memory
-  Name - Guid filename to search for in the firmware volume
-  File - Output file pointer
+  @param Fv Address of the Fv in memory
+  @param Name Guid filename to search for in the firmware volume
+  @param File Output file pointer
     File == NULL - Only determine if the file exists, based on return
                    value from the function call.
     otherwise - *File will be update to the location of the file
 
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-  EFI_VOLUME_CORRUPTED
-
---*/
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+  @retval EFI_VOLUME_CORRUPTED
+**/
+EFI_STATUS
+FvBufFindFileByName (
+  IN VOID *Fv,
+  IN EFI_GUID *Name,
+  OUT VOID **File
+  )
 {
   EFI_STATUS Status;
   UINTN Key;
@@ -1080,35 +930,26 @@ Routine Description:
   return EFI_NOT_FOUND;
 }
 
-
-EFI_STATUS
-FvBufFindFileByType (
-  IN VOID *Fv,
-  IN EFI_FV_FILETYPE Type,
-  OUT VOID **File
-  )
-/*++
-
-Routine Description:
-
+/**
   Searches the Fv for a file by its type
 
-Arguments:
-
-  Fv - Address of the Fv in memory
-  Type - FFS FILE type to search for
-  File - Output file pointer
+  @param Fv Address of the Fv in memory
+  @param Type FFS FILE type to search for
+  @param File Output file pointer
     (File == NULL) -> Only determine if the file exists, based on return
                       value from the function call.
     otherwise -> *File will be update to the location of the file
 
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-  EFI_VOLUME_CORRUPTED
-
---*/
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+  @retval EFI_VOLUME_CORRUPTED
+**/
+EFI_STATUS
+FvBufFindFileByType (
+  IN VOID *Fv,
+  IN EFI_FV_FILETYPE Type,
+  OUT VOID **File
+  )
 {
   EFI_STATUS Status;
   UINTN Key;
@@ -1132,34 +973,25 @@ Routine Description:
   return EFI_NOT_FOUND;
 }
 
+/**
+  Searches the requested file for raw data.
 
+  This routine either returns all the payload of a EFI_FV_FILETYPE_RAW file,
+  or finds the EFI_SECTION_RAW section within the file and returns its data.
+
+  @param FfsFile Address of the FFS file in memory
+  @param RawData Pointer to the raw data within the file
+                 (This is NOT allocated.  It is within the file.)
+  @param RawDataSize Size of the raw data within the file
+
+  @return EFI_STATUS
+**/
 EFI_STATUS
 FvBufGetFileRawData (
   IN  VOID*     FfsFile,
   OUT VOID**    RawData,
   OUT UINTN*    RawDataSize
   )
-/*++
-
-Routine Description:
-
-  Searches the requested file for raw data.
-
-  This routine either returns all the payload of a EFI_FV_FILETYPE_RAW file,
-  or finds the EFI_SECTION_RAW section within the file and returns its data.
-
-Arguments:
-
-  FfsFile - Address of the FFS file in memory
-  RawData - Pointer to the raw data within the file
-            (This is NOT allocated.  It is within the file.)
-  RawDataSize - Size of the raw data within the file
-
-Returns:
-
-  EFI_STATUS
-
---*/
 {
   EFI_STATUS Status;
   EFI_FFS_FILE_HEADER* File;
@@ -1195,7 +1027,19 @@ Routine Description:
 
 }
 
+/**
+  Packages up a FFS file containing the input raw data.
 
+  The file created will have a type of EFI_FV_FILETYPE_FREEFORM, and will
+  contain one EFI_FV_FILETYPE_RAW section.
+
+  @param RawData Pointer to the raw data to be packed
+  @param RawDataSize Size of the raw data to be packed
+  @param FfsFile Address of the packaged FFS file.
+                 Note: The called must deallocate this memory!
+
+  @return EFI_STATUS
+**/
 EFI_STATUS
 FvBufPackageFreeformRawFile (
   IN EFI_GUID*  Filename,
@@ -1203,27 +1047,6 @@ FvBufPackageFreeformRawFile (
   IN UINTN      RawDataSize,
   OUT VOID**    FfsFile
   )
-/*++
-
-Routine Description:
-
-  Packages up a FFS file containing the input raw data.
-
-  The file created will have a type of EFI_FV_FILETYPE_FREEFORM, and will
-  contain one EFI_FV_FILETYPE_RAW section.
-
-Arguments:
-
-  RawData - Pointer to the raw data to be packed
-  RawDataSize - Size of the raw data to be packed
-  FfsFile - Address of the packaged FFS file.
-            Note: The called must deallocate this memory!
-
-Returns:
-
-  EFI_STATUS
-
---*/
 {
   EFI_FFS_FILE_HEADER* NewFile;
   UINT32 NewFileSize;
@@ -1304,7 +1127,22 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Iterates through the sections contained within a given array of sections
 
+  @param SectionsStart Address of the start of the FFS sections array
+  @param TotalSectionsSize Total size of all the sections
+  @param Key Should be 0 to get the first section.  After that, it should be
+             passed back in without modifying its contents to retrieve
+             subsequent files.
+  @param Section Output section pointer
+    (Section == NULL) -> invalid parameter
+    otherwise -> *Section will be update to the location of the file
+
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+  @retval EFI_VOLUME_CORRUPTED
+**/
 EFI_STATUS
 FvBufFindNextSection (
   IN VOID *SectionsStart,
@@ -1312,30 +1150,6 @@ FvBufFindNextSection (
   IN OUT UINTN *Key,
   OUT VOID **Section
   )
-/*++
-
-Routine Description:
-
-  Iterates through the sections contained within a given array of sections
-
-Arguments:
-
-  SectionsStart - Address of the start of the FFS sections array
-  TotalSectionsSize - Total size of all the sections
-  Key - Should be 0 to get the first section.  After that, it should be
-        passed back in without modifying its contents to retrieve
-        subsequent files.
-  Section - Output section pointer
-    (Section == NULL) -> invalid parameter
-    otherwise -> *Section will be update to the location of the file
-
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-  EFI_VOLUME_CORRUPTED
-
---*/
 {
   EFI_COMMON_SECTION_HEADER *sectionHdr;
   UINTN sectionSize;
@@ -1363,31 +1177,22 @@ Routine Description:
 
 }
 
+/**
+  Searches the FFS file and counts the number of sections found.
+  The sections are NOT recursed.
 
+  @param FfsFile Address of the FFS file in memory
+  @param Count The location to store the section count in
+
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+  @retval EFI_VOLUME_CORRUPTED
+**/
 EFI_STATUS
 FvBufCountSections (
   IN VOID* FfsFile,
   IN UINTN* Count
   )
-/*++
-
-Routine Description:
-
-  Searches the FFS file and counts the number of sections found.
-  The sections are NOT recursed.
-
-Arguments:
-
-  FfsFile - Address of the FFS file in memory
-  Count - The location to store the section count in
-
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-  EFI_VOLUME_CORRUPTED
-
---*/
 {
   EFI_STATUS                 Status;
   UINTN                      Key;
@@ -1424,35 +1229,26 @@ Routine Description:
   return EFI_NOT_FOUND;
 }
 
+/**
+  Searches the FFS file for a section by its type
 
+  @param FfsFile Address of the FFS file in memory
+  @param Type FFS FILE section type to search for
+  @param Section Output section pointer
+    (Section == NULL) -> Only determine if the section exists, based on return
+                         value from the function call.
+    otherwise -> *Section will be update to the location of the file
+
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+  @retval EFI_VOLUME_CORRUPTED
+**/
 EFI_STATUS
 FvBufFindSectionByType (
   IN VOID *FfsFile,
   IN UINT8 Type,
   OUT VOID **Section
   )
-/*++
-
-Routine Description:
-
-  Searches the FFS file for a section by its type
-
-Arguments:
-
-  FfsFile - Address of the FFS file in memory
-  Type - FFS FILE section type to search for
-  Section - Output section pointer
-    (Section == NULL) -> Only determine if the section exists, based on return
-                         value from the function call.
-    otherwise -> *Section will be update to the location of the file
-
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-  EFI_VOLUME_CORRUPTED
-
---*/
 {
   EFI_STATUS Status;
   UINTN Key;
@@ -1487,30 +1283,21 @@ Routine Description:
   return EFI_NOT_FOUND;
 }
 
+/**
+  Shrinks a firmware volume (in place) to provide a minimal FV.
 
+  BUGBUG: Does not handle the case where the firmware volume has a
+          VTF (Volume Top File).  The VTF will not be moved to the
+          end of the extended FV.
+
+  @param Fv Firmware volume.
+  
+ @retval EFI_SUCCESS
+**/
 EFI_STATUS
 FvBufShrinkWrap (
   IN VOID *Fv
   )
-/*++
-
-Routine Description:
-
-  Shrinks a firmware volume (in place) to provide a minimal FV.
-
-  BUGBUG: Does not handle the case where the firmware volume has a
-          VTF (Volume Top File).  The VTF will not be moved to the
-          end of the extended FV.
-
-Arguments:
-
-  Fv - Firmware volume.
-
-Returns:
-
-  EFI_SUCCESS
-
---*/
 {
   EFI_STATUS Status;
   UINTN OldSize;
@@ -1569,32 +1356,23 @@ Routine Description:
 
 }
 
+/**
+  Searches the FFS file for a section by its type
 
+  @param Fv Address of the Fv in memory
+  @param BlockSize The size of the blocks to convert the Fv to.  If the total size
+                   of the Fv is not evenly divisible by this size, then
+                   EFI_INVALID_PARAMETER will be returned.
+
+  @retval EFI_SUCCESS
+  @retval EFI_NOT_FOUND
+  @retval EFI_VOLUME_CORRUPTED
+**/
 EFI_STATUS
 FvBufUnifyBlockSizes (
   IN OUT VOID *Fv,
   IN UINTN BlockSize
   )
-/*++
-
-Routine Description:
-
-  Searches the FFS file for a section by its type
-
-Arguments:
-
-  Fv - Address of the Fv in memory
-  BlockSize - The size of the blocks to convert the Fv to.  If the total size
-              of the Fv is not evenly divisible by this size, then
-              EFI_INVALID_PARAMETER will be returned.
-
-Returns:
-
-  EFI_SUCCESS
-  EFI_NOT_FOUND
-  EFI_VOLUME_CORRUPTED
-
---*/
 {
   EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
   EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
@@ -1641,28 +1419,20 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-STATIC
-UINT16
-FvBufCalculateSum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
-  )
-/*++
-
-Routine Description:
-
+/**
   This function calculates the UINT16 sum for the requested region.
 
-Arguments:
-
-  Buffer      Pointer to buffer containing byte data of component.
-  Size        Size of the buffer
-
-Returns:
-
-  The 16 bit checksum
-
---*/
+  @param Buffer      Pointer to buffer containing byte data of component.
+  @param Size        Size of the buffer
+
+  @return The 16 bit checksum
+**/
+STATIC
+UINT16
+FvBufCalculateSum16 (
+  IN UINT16       *Buffer,
+  IN UINTN        Size
+  )
 {
   UINTN   Index;
   UINT16  Sum;
@@ -1679,56 +1449,38 @@ Routine Description:
   return (UINT16) Sum;
 }
 
-
-STATIC
-UINT16
-FvBufCalculateChecksum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
-  )
-/*++
-
-Routine Description::
-
+/**
   This function calculates the value needed for a valid UINT16 checksum
 
-Arguments:
-
-  Buffer      Pointer to buffer containing byte data of component.
-  Size        Size of the buffer
-
-Returns:
-
-  The 16 bit checksum value needed.
-
---*/
+  @param Buffer      Pointer to buffer containing byte data of component.
+  @param Size        Size of the buffer
+
+  @return The 16 bit checksum value needed.
+**/
+STATIC
+UINT16
+FvBufCalculateChecksum16 (
+  IN UINT16       *Buffer,
+  IN UINTN        Size
+  )
 {
   return (UINT16)(0x10000 - FvBufCalculateSum16 (Buffer, Size));
 }
 
+/**
+  This function calculates the UINT8 sum for the requested region.
 
+  @param Buffer      Pointer to buffer containing byte data of component.
+  @param Size        Size of the buffer
+ 
+  @return The 8 bit checksum value needed.
+**/
 STATIC
 UINT8
 FvBufCalculateSum8 (
   IN UINT8  *Buffer,
   IN UINTN  Size
   )
-/*++
-
-Description:
-
-  This function calculates the UINT8 sum for the requested region.
-
-Input:
-
-  Buffer      Pointer to buffer containing byte data of component.
-  Size        Size of the buffer
-
-Return:
-
-  The 8 bit checksum value needed.
-
---*/
 {
   UINTN   Index;
   UINT8   Sum;
@@ -1745,29 +1497,20 @@ FvBufCalculateSum8 (
   return Sum;
 }
 
-
-STATIC
-UINT8
-FvBufCalculateChecksum8 (
-  IN UINT8        *Buffer,
-  IN UINTN        Size
-  )
-/*++
-
-Description:
-
+/**
   This function calculates the value needed for a valid UINT8 checksum
 
-Input:
-
-  Buffer      Pointer to buffer containing byte data of component.
-  Size        Size of the buffer
-
-Return:
-
-  The 8 bit checksum value needed.
-
---*/
+  @param Buffer      Pointer to buffer containing byte data of component.
+  @param Size        Size of the buffer
+
+  @return The 8 bit checksum value needed.
+**/
+STATIC
+UINT8
+FvBufCalculateChecksum8 (
+  IN UINT8        *Buffer,
+  IN UINTN        Size
+  )
 {
   return (UINT8)(0x100 - FvBufCalculateSum8 (Buffer, Size));
 }
diff --git a/BaseTools/Source/C/Common/FvLib.c b/BaseTools/Source/C/Common/FvLib.c
index 82dc557bb7db..37631f470f2a 100644
--- a/BaseTools/Source/C/Common/FvLib.c
+++ b/BaseTools/Source/C/Common/FvLib.c
@@ -22,29 +22,22 @@ UINT32                      mFvLength   = 0;
 //
 // External function implementations
 //
+
+/**
+  This initializes the FV lib with a pointer to the FV and length.  It does not
+  verify the FV in any way.
+
+  @param Fv            Buffer containing the FV.
+  @param FvLength      Length of the FV
+
+  @retval EFI_SUCCESS             Function Completed successfully.
+  @retval EFI_INVALID_PARAMETER   A required parameter was NULL.
+**/
 EFI_STATUS
 InitializeFvLib (
   IN VOID                         *Fv,
   IN UINT32                       FvLength
   )
-/*++
-
-Routine Description:
-
-  This initializes the FV lib with a pointer to the FV and length.  It does not
-  verify the FV in any way.
-
-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.
-
---*/
 {
   //
   // Verify input arguments
@@ -59,29 +52,21 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  This function returns a pointer to the current FV and the size.
+
+  @param FvHeader      Pointer to the FV buffer.
+  @param FvLength      Length of the FV
+
+  @retval EFI_SUCCESS             Function Completed successfully.
+  @retval EFI_INVALID_PARAMETER   A required parameter was NULL.
+  @retvalEFI_ABORTED             The library needs to be initialized.
+**/
 EFI_STATUS
 GetFvHeader (
   OUT EFI_FIRMWARE_VOLUME_HEADER  **FvHeader,
   OUT UINT32                      *FvLength
   )
-/*++
-
-Routine Description:
-
-  This function returns a pointer to the current FV and the size.
-
-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.
-
---*/
 {
   //
   // Verify library has been initialized.
@@ -101,31 +86,23 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-GetNextFile (
-  IN EFI_FFS_FILE_HEADER          *CurrentFile,
-  OUT EFI_FFS_FILE_HEADER         **NextFile
-  )
-/*++
-
-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
   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.
-
---*/
+  @param CurrentFile   Pointer to the current file, must be within the current FV.
+  @param NextFile      Pointer to the next file in the FV.
+
+  @retval EFI_SUCCESS             Function completed successfully.
+  @retval EFI_INVALID_PARAMETER   A required parameter was NULL or is out of range.
+  @retval EFI_ABORTED             The library needs to be initialized.
+**/
+EFI_STATUS
+GetNextFile (
+  IN EFI_FFS_FILE_HEADER          *CurrentFile,
+  OUT EFI_FFS_FILE_HEADER         **NextFile
+  )
 {
   EFI_STATUS  Status;
 
@@ -214,29 +191,21 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Find a file by name.  The function will return NULL if the file is not found.
+
+  @param FileName    The GUID file name of the file to search for.
+  @param File        Return pointer.  In the case of an error, contents are undefined.
+
+  @retval EFI_SUCCESS             The function completed successfully.
+  @retval EFI_ABORTED             An error was encountered.
+  @retval EFI_INVALID_PARAMETER   One of the parameters was NULL.
+**/
 EFI_STATUS
 GetFileByName (
   IN EFI_GUID                     *FileName,
   OUT EFI_FFS_FILE_HEADER         **File
   )
-/*++
-
-Routine Description:
-
-  Find a file by name.  The function will return NULL if the file is not found.
-
-Arguments:
-
-  FileName    The GUID file name of the file to search for.
-  File        Return pointer.  In the case of an error, contents are undefined.
-
-Returns:
-
-  EFI_SUCCESS             The function completed successfully.
-  EFI_ABORTED             An error was encountered.
-  EFI_INVALID_PARAMETER   One of the parameters was NULL.
-
---*/
 {
   EFI_FFS_FILE_HEADER *CurrentFile;
   EFI_STATUS          Status;
@@ -295,33 +264,25 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-GetFileByType (
-  IN EFI_FV_FILETYPE              FileType,
-  IN UINTN                        Instance,
-  OUT EFI_FFS_FILE_HEADER         **File
-  )
-/*++
-
-Routine Description:
-
+/**
   Find a file by type and instance.  An instance of 1 is the first instance.
   The function will return NULL if a matching file cannot be found.
   File type EFI_FV_FILETYPE_ALL means any file type is valid.
 
-Arguments:
-
-  FileType    Type of file to search for.
-  Instance    Instance of the file type to return.
-  File        Return pointer.  In the case of an error, contents are undefined.
-
-Returns:
-
-  EFI_SUCCESS             The function completed successfully.
-  EFI_ABORTED             An error was encountered.
-  EFI_INVALID_PARAMETER   One of the parameters was NULL.
-
---*/
+  @param FileType    Type of file to search for.
+  @param Instance    Instance of the file type to return.
+  @param File        Return pointer.  In the case of an error, contents are undefined.
+
+  @retval EFI_SUCCESS             The function completed successfully.
+  @retval EFI_ABORTED             An error was encountered.
+  @retval EFI_INVALID_PARAMETER   One of the parameters was NULL.
+**/
+EFI_STATUS
+GetFileByType (
+  IN EFI_FV_FILETYPE              FileType,
+  IN UINTN                        Instance,
+  OUT EFI_FFS_FILE_HEADER         **File
+  )
 {
   EFI_FFS_FILE_HEADER *CurrentFile;
   EFI_STATUS          Status;
@@ -383,6 +344,23 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Helper function to search a sequence of sections from the section pointed
+  by FirstSection to SearchEnd for the Instance-th section of type SectionType.
+  The current counter is saved in StartIndex and when the section is found, it's
+  saved in Section. GUID-defined sections, if special processing is not required,
+  are searched recursively in a depth-first manner.
+
+  @param FirstSection The first section to start searching from.
+  @param SearchEnd    The end address to stop search.
+  @param SectionType  The type of section to search.
+  @param StartIndex   The current counter is saved.
+  @param Instance     The requested n-th section number.
+  @param Section      The found section returned.
+
+  @retval EFI_SUCCESS             The function completed successfully.
+  @retval EFI_NOT_FOUND           The section is not found.
+**/
 EFI_STATUS
 SearchSectionByType (
   IN EFI_FILE_SECTION_POINTER  FirstSection,
@@ -392,30 +370,6 @@ SearchSectionByType (
   IN UINTN                     Instance,
   OUT EFI_FILE_SECTION_POINTER *Section
   )
-/*++
-
-Routine Description:
-
-  Helper function to search a sequence of sections from the section pointed
-  by FirstSection to SearchEnd for the Instance-th section of type SectionType.
-  The current counter is saved in StartIndex and when the section is found, it's
-  saved in Section. GUID-defined sections, if special processing is not required,
-  are searched recursively in a depth-first manner.
-
-Arguments:
-
-  FirstSection The first section to start searching from.
-  SearchEnd    The end address to stop search.
-  SectionType  The type of section to search.
-  StartIndex   The current counter is saved.
-  Instance     The requested n-th section number.
-  Section      The found section returned.
-
-Returns:
-
-  EFI_SUCCESS             The function completed successfully.
-  EFI_NOT_FOUND           The section is not found.
---*/
 {
   EFI_FILE_SECTION_POINTER  CurrentSection;
   EFI_FILE_SECTION_POINTER  InnerSection;
@@ -479,36 +433,29 @@ Routine Description:
   return EFI_NOT_FOUND;
 }
 
-EFI_STATUS
-GetSectionByType (
-  IN EFI_FFS_FILE_HEADER          *File,
-  IN EFI_SECTION_TYPE             SectionType,
-  IN UINTN                        Instance,
-  OUT EFI_FILE_SECTION_POINTER    *Section
-  )
-/*++
-
-Routine Description:
-
+/**
   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.
 
-Arguments:
+  @param File        The file to search.
+  @param SectionType Type of file to search for.
+  @param Instance    Instance of the section to return.
+  @param Section     Return pointer.  In the case of an error, contents are undefined.
 
-  File        The file to search.
-  SectionType Type of file to search for.
-  Instance    Instance of the section to return.
-  Section     Return pointer.  In the case of an error, contents are undefined.
-
-Returns:
-
-  EFI_SUCCESS             The function completed successfully.
-  EFI_ABORTED             An error was encountered.
-  EFI_INVALID_PARAMETER   One of the parameters was NULL.
-  EFI_NOT_FOUND           No found.
---*/
+  @retval EFI_SUCCESS             The function completed successfully.
+  @retval EFI_ABORTED             An error was encountered.
+  @retval EFI_INVALID_PARAMETER   One of the parameters was NULL.
+  @retval EFI_NOT_FOUND           No found.
+**/
+EFI_STATUS
+GetSectionByType (
+  IN EFI_FFS_FILE_HEADER          *File,
+  IN EFI_SECTION_TYPE             SectionType,
+  IN UINTN                        Instance,
+  OUT EFI_FILE_SECTION_POINTER    *Section
+  )
 {
   EFI_FILE_SECTION_POINTER  CurrentSection;
   EFI_STATUS                Status;
@@ -560,31 +507,25 @@ Routine Description:
     return EFI_NOT_FOUND;
   }
 }
+
 //
 // will not parse compressed sections
 //
+
+/**
+  Verify the current pointer points to a valid FV header.
+
+  @param FvHeader     Pointer to an alleged FV file.
+
+  @retval EFI_SUCCESS             The FV header is valid.
+  @retval EFI_VOLUME_CORRUPTED    The FV header is not valid.
+  @retval EFI_INVALID_PARAMETER   A required parameter was NULL.
+  @retval EFI_ABORTED             Operation aborted.
+**/
 EFI_STATUS
 VerifyFv (
   IN EFI_FIRMWARE_VOLUME_HEADER   *FvHeader
   )
-/*++
-
-Routine Description:
-
-  Verify the current pointer points to a valid FV header.
-
-Arguments:
-
-  FvHeader     Pointer to an alleged FV file.
-
-Returns:
-
-  EFI_SUCCESS             The FV header is valid.
-  EFI_VOLUME_CORRUPTED    The FV header is not valid.
-  EFI_INVALID_PARAMETER   A required parameter was NULL.
-  EFI_ABORTED             Operation aborted.
-
---*/
 {
   UINT16  Checksum;
 
@@ -612,28 +553,20 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-VerifyFfsFile (
-  IN EFI_FFS_FILE_HEADER  *FfsHeader
-  )
-/*++
-
-Routine Description:
-
+/**
   Verify the current pointer points to a FFS file header.
 
-Arguments:
-
-  FfsHeader     Pointer to an alleged FFS file.
-
-Returns:
-
-  EFI_SUCCESS           The Ffs header is valid.
-  EFI_NOT_FOUND         This "file" is the beginning of free space.
-  EFI_VOLUME_CORRUPTED  The Ffs header is not valid.
-  EFI_ABORTED           The erase polarity is not known.
-
---*/
+  @param FfsHeader     Pointer to an alleged FFS file.
+
+  @retval EFI_SUCCESS           The Ffs header is valid.
+  @retval EFI_NOT_FOUND         This "file" is the beginning of free space.
+  @retval EFI_VOLUME_CORRUPTED  The Ffs header is not valid.
+  @retval EFI_ABORTED           The erase polarity is not known.
+**/
+EFI_STATUS
+VerifyFfsFile (
+  IN EFI_FFS_FILE_HEADER  *FfsHeader
+  )
 {
   BOOLEAN             ErasePolarity;
   EFI_STATUS          Status;
@@ -754,25 +687,17 @@ GetSectionHeaderLength(
   return sizeof(EFI_COMMON_SECTION_HEADER);
 }
 
+/**
+  Get FFS file length including FFS header.
+
+  @param FfsHeader   Pointer to EFI_FFS_FILE_HEADER.
+
+  @return UINT32      Length of FFS file header.
+**/
 UINT32
 GetFfsFileLength (
   EFI_FFS_FILE_HEADER *FfsHeader
   )
-/*++
-
-Routine Description:
-
-  Get FFS file length including FFS header.
-
-Arguments:
-
-  FfsHeader   Pointer to EFI_FFS_FILE_HEADER.
-
-Returns:
-
-  UINT32      Length of FFS file header.
-
---*/
 {
   if (FfsHeader == NULL) {
     return 0;
@@ -800,25 +725,17 @@ GetSectionFileLength (
   return Length;
 }
 
+/**
+  Converts a three byte length value into a UINT32.
+
+  @param ThreeByteLength   Pointer to the first of the 3 byte length.
+
+  @return UINT32      Size of the section
+**/
 UINT32
 GetLength (
   UINT8     *ThreeByteLength
   )
-/*++
-
-Routine Description:
-
-  Converts a three byte length value into a UINT32.
-
-Arguments:
-
-  ThreeByteLength   Pointer to the first of the 3 byte length.
-
-Returns:
-
-  UINT32      Size of the section
-
---*/
 {
   UINT32  Length;
 
@@ -832,28 +749,20 @@ Routine Description:
   return Length;
 }
 
-EFI_STATUS
-GetErasePolarity (
-  OUT BOOLEAN   *ErasePolarity
-  )
-/*++
-
-Routine Description:
-
+/**
   This function returns with the FV erase polarity.  If the erase polarity
   for a bit is 1, the function return TRUE.
 
-Arguments:
-
-  ErasePolarity   A pointer to the erase polarity.
-
-Returns:
-
-  EFI_SUCCESS              The function completed successfully.
-  EFI_INVALID_PARAMETER    One of the input parameters was invalid.
-  EFI_ABORTED              Operation aborted.
-
---*/
+  @param ErasePolarity   A pointer to the erase polarity.
+
+  @retval EFI_SUCCESS              The function completed successfully.
+  @retval EFI_INVALID_PARAMETER    One of the input parameters was invalid.
+  @retval EFI_ABORTED              Operation aborted.
+**/
+EFI_STATUS
+GetErasePolarity (
+  OUT BOOLEAN   *ErasePolarity
+  )
 {
   EFI_STATUS  Status;
 
@@ -886,28 +795,20 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  This function returns a the highest state bit in the FFS that is set.
+  It in no way validate the FFS file.
+
+  @param ErasePolarity The erase polarity for the file state bits.
+  @param FfsHeader     Pointer to a FFS file.
+
+  @retval UINT8   The hightest set state of the file.
+**/
 UINT8
 GetFileState (
   IN BOOLEAN              ErasePolarity,
   IN EFI_FFS_FILE_HEADER  *FfsHeader
   )
-/*++
-
-Routine Description:
-
-  This function returns a the highest state bit in the FFS that is set.
-  It in no way validate the FFS file.
-
-Arguments:
-
-  ErasePolarity The erase polarity for the file state bits.
-  FfsHeader     Pointer to a FFS file.
-
-Returns:
-
-  UINT8   The hightest set state of the file.
-
---*/
 {
   UINT8 FileState;
   UINT8 HighestBit;
diff --git a/BaseTools/Source/C/Common/MemoryFile.c b/BaseTools/Source/C/Common/MemoryFile.c
index 8154a3c99006..47481326833e 100644
--- a/BaseTools/Source/C/Common/MemoryFile.c
+++ b/BaseTools/Source/C/Common/MemoryFile.c
@@ -27,29 +27,21 @@ CheckMemoryFileState (
 // Function implementations
 //
 
-EFI_STATUS
-GetMemoryFile (
-  IN CHAR8       *InputFileName,
-  OUT EFI_HANDLE *OutputMemoryFile
-  )
-/*++
-
-Routine Description:
-
+/**
   This opens a file, reads it into memory and returns a memory file
   object.
 
-Arguments:
+  @param InputFile          Memory file image.
+  @param OutputMemoryFile   Handle to memory file
 
-  InputFile          Memory file image.
-  OutputMemoryFile   Handle to memory file
-
-Returns:
-
-  EFI_STATUS
+  @return EFI_STATUS
   OutputMemoryFile is valid if !EFI_ERROR
-
---*/
+**/
+EFI_STATUS
+GetMemoryFile (
+  IN CHAR8       *InputFileName,
+  OUT EFI_HANDLE *OutputMemoryFile
+  )
 {
   EFI_STATUS  Status;
   CHAR8       *InputFileImage;
@@ -78,26 +70,17 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-
-EFI_STATUS
-FreeMemoryFile (
-  IN EFI_HANDLE InputMemoryFile
-  )
-/*++
-
-Routine Description:
-
+/**
   Frees all memory associated with the input memory file.
 
-Arguments:
-
-  InputMemoryFile   Handle to memory file
-
-Returns:
-
-  EFI_STATUS
-
---*/
+  @param InputMemoryFile   Handle to memory file
+
+  @return EFI_STATUS
+**/
+EFI_STATUS
+FreeMemoryFile (
+  IN EFI_HANDLE InputMemoryFile
+  )
 {
   MEMORY_FILE *MemoryFile;
 
@@ -118,31 +101,22 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-
-CHAR8 *
-ReadMemoryFileLine (
-  IN EFI_HANDLE     InputMemoryFile
-  )
-/*++
-
-Routine Description:
-
+/**
   This function reads a line from the memory file.  The newline characters
   are stripped and a null terminated string is returned.
 
   If the string pointer returned is non-NULL, then the caller must free the
   memory associated with this string.
 
-Arguments:
-
-  InputMemoryFile   Handle to memory file
-
-Returns:
-
-  NULL if error or EOF
-  NULL character termincated string otherwise (MUST BE FREED BY CALLER)
-
---*/
+  @param InputMemoryFile   Handle to memory file
+
+  @retval NULL if error or EOF
+  @retval NULL character termincated string otherwise (MUST BE FREED BY CALLER)
+**/
+CHAR8 *
+ReadMemoryFileLine (
+  IN EFI_HANDLE     InputMemoryFile
+  )
 {
   CHAR8       *EndOfLine;
   UINTN       CharsToCopy;
diff --git a/BaseTools/Source/C/Common/MyAlloc.c b/BaseTools/Source/C/Common/MyAlloc.c
index d104795d4687..17ff5cfbbd3e 100644
--- a/BaseTools/Source/C/Common/MyAlloc.c
+++ b/BaseTools/Source/C/Common/MyAlloc.c
@@ -27,40 +27,23 @@ STATIC MY_ALLOC_STRUCT  *MyAllocData = NULL;
 STATIC UINT32           MyAllocHeadMagik  = MYALLOC_HEAD_MAGIK;
 STATIC UINT32           MyAllocTailMagik  = MYALLOC_TAIL_MAGIK;
 
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-//
+/**
+  Check for corruptions in the allocated memory chain.  If a corruption
+  is detection program operation stops w/ an exit(1) call.
+
+  @param Final When FALSE, MyCheck() returns if the allocated memory chain
+               has not been corrupted.  When TRUE, MyCheck() returns if there
+               are no un-freed allocations.  If there are un-freed allocations,
+               they are displayed and exit(1) is called.
+  @param File Set to __FILE__ by macro expansion.
+  @param Line Set to __LINE__ by macro expansion.
+**/
 VOID
 MyCheck (
   BOOLEAN      Final,
   UINT8        File[],
   UINTN        Line
   )
-// *++
-// Description:
-//
-//  Check for corruptions in the allocated memory chain.  If a corruption
-//  is detection program operation stops w/ an exit(1) call.
-//
-// Parameters:
-//
-//  Final := When FALSE, MyCheck() returns if the allocated memory chain
-//           has not been corrupted.  When TRUE, MyCheck() returns if there
-//           are no un-freed allocations.  If there are un-freed allocations,
-//           they are displayed and exit(1) is called.
-//
-//
-//  File := Set to __FILE__ by macro expansion.
-//
-//  Line := Set to __LINE__ by macro expansion.
-//
-// Returns:
-//
-//  n/a
-//
-// --*/
-//
 {
   MY_ALLOC_STRUCT *Tmp;
 
@@ -155,39 +138,26 @@ MyCheck (
     }
   }
 }
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-//
+
+/**
+  Allocate a new link in the allocation chain along with enough storage
+  for the File[] string, requested Size and alignment overhead.  If
+  memory cannot be allocated or the allocation chain has been corrupted,
+  exit(1) will be called.
+
+  @param Size Number of bytes (UINT8) requested by the called.
+              Size cannot be zero.
+  @param File Set to __FILE__ by macro expansion.
+  @param Line Set to __LINE__ by macro expansion.
+
+  @return Pointer to the caller's buffer.
+**/
 VOID *
 MyAlloc (
   UINTN      Size,
   UINT8 File[],
   UINTN      Line
   )
-// *++
-// Description:
-//
-//  Allocate a new link in the allocation chain along with enough storage
-//  for the File[] string, requested Size and alignment overhead.  If
-//  memory cannot be allocated or the allocation chain has been corrupted,
-//  exit(1) will be called.
-//
-// Parameters:
-//
-//  Size := Number of bytes (UINT8) requested by the called.
-//          Size cannot be zero.
-//
-//  File := Set to __FILE__ by macro expansion.
-//
-//  Line := Set to __LINE__ by macro expansion.
-//
-// Returns:
-//
-//  Pointer to the caller's buffer.
-//
-// --*/
-//
 {
   MY_ALLOC_STRUCT *Tmp;
   UINTN           Len;
@@ -278,10 +248,19 @@ MyAlloc (
 
   return Tmp->Buffer + sizeof (UINT32);
 }
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-//
+
+/**
+  This does a MyAlloc(), memcpy() and MyFree().  There is no optimization
+  for shrinking or expanding buffers.  An invalid parameter will cause
+  MyRealloc() to fail with a call to exit(1).
+
+  @param Ptr Pointer to the caller's buffer to be re-allocated.
+  @param Size Size of new buffer.  Size cannot be zero.
+  @param File Set to __FILE__ by macro expansion.
+  @param Line Set to __LINE__ by macro expansion.
+
+  @return Pointer to new caller's buffer.
+**/
 VOID *
 MyRealloc (
   VOID       *Ptr,
@@ -289,29 +268,6 @@ MyRealloc (
   UINT8 File[],
   UINTN      Line
   )
-// *++
-// Description:
-//
-//  This does a MyAlloc(), memcpy() and MyFree().  There is no optimization
-//  for shrinking or expanding buffers.  An invalid parameter will cause
-//  MyRealloc() to fail with a call to exit(1).
-//
-// Parameters:
-//
-//  Ptr := Pointer to the caller's buffer to be re-allocated.
-//
-//  Size := Size of new buffer.  Size cannot be zero.
-//
-//  File := Set to __FILE__ by macro expansion.
-//
-//  Line := Set to __LINE__ by macro expansion.
-//
-// Returns:
-//
-//  Pointer to new caller's buffer.
-//
-// --*/
-//
 {
   MY_ALLOC_STRUCT *Tmp;
   VOID            *Buffer;
@@ -398,37 +354,22 @@ MyRealloc (
 
   return Buffer;
 }
-//
-// ////////////////////////////////////////////////////////////////////////////
-//
-//
+
+/**
+  Release a previously allocated buffer.  Invalid parameters will cause
+  MyFree() to fail with an exit(1) call.
+
+  @param Ptr Pointer to the caller's buffer to be freed.
+             A NULL pointer will be ignored.
+  @param File Set to __FILE__ by macro expansion.
+  @param Line Set to __LINE__ by macro expansion.
+**/
 VOID
 MyFree (
   VOID       *Ptr,
   UINT8 File[],
   UINTN      Line
   )
-// *++
-// Description:
-//
-//  Release a previously allocated buffer.  Invalid parameters will cause
-//  MyFree() to fail with an exit(1) call.
-//
-// Parameters:
-//
-//  Ptr := Pointer to the caller's buffer to be freed.
-//         A NULL pointer will be ignored.
-//
-//  File := Set to __FILE__ by macro expansion.
-//
-//  Line := Set to __LINE__ by macro expansion.
-//
-// Returns:
-//
-//  n/a
-//
-// --*/
-//
 {
   MY_ALLOC_STRUCT *Tmp;
   MY_ALLOC_STRUCT *Tmp2;
diff --git a/BaseTools/Source/C/Common/OsPath.c b/BaseTools/Source/C/Common/OsPath.c
index 35ca54761f14..9901f686c98f 100644
--- a/BaseTools/Source/C/Common/OsPath.c
+++ b/BaseTools/Source/C/Common/OsPath.c
@@ -20,14 +20,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
   //
   // BUGBUG: Not fully implemented yet.
   //
-CHAR8*
-OsPathDirName (
-  IN CHAR8    *FilePath
-  )
-/*++
-
-Routine Description:
 
+/**
   This function returns the directory path which contains the particular path.
   Some examples:
     "a/b/c"  -> "a/b"
@@ -40,15 +34,15 @@ Routine Description:
 
   The caller must free the string returned.
 
-Arguments:
+  @param FilePath     Path name of file to get the parent directory for.
 
-  FilePath     Path name of file to get the parent directory for.
+  @return NULL if error
+**/
+CHAR8*
+OsPathDirName (
+  IN CHAR8    *FilePath
+  )
 
-Returns:
-
-  NULL if error
-
---*/
 {
   CHAR8 *Return;
   CHAR8 *Pos;
@@ -97,14 +91,8 @@ Routine Description:
   //
   // BUGBUG: Not fully implemented yet.
   //
-VOID
-OsPathNormPathInPlace (
-  IN CHAR8    *Path
-  )
-/*++
-
-Routine Description:
 
+/**
   This function returns the directory path which contains the particular path.
   Some examples:
     "a/b/../c" -> "a/c"
@@ -113,15 +101,14 @@ Routine Description:
 
   This function does not check for the existence of the file.
 
-Arguments:
-
-  Path     Path name of file to normalize
-
-Returns:
-
-  The string is altered in place.
-
---*/
+  @param Path     Path name of file to normalize
+
+  @return The string is altered in place.
+**/
+VOID
+OsPathNormPathInPlace (
+  IN CHAR8    *Path
+  )
 {
   CHAR8   *Pos;
   INTN    Offset;
@@ -200,16 +187,7 @@ Routine Description:
 }
 #endif
 
-
-CHAR8*
-OsPathPeerFilePath (
-  IN CHAR8    *OldPath,
-  IN CHAR8    *Peer
-  )
-/*++
-
-Routine Description:
-
+/**
   This function replaces the final portion of a path with an alternative
   'peer' filename.  For example:
     "a/b/../c", "peer" -> "a/b/../peer"
@@ -219,16 +197,16 @@ Routine Description:
 
   This function does not check for the existence of the file.
 
-Arguments:
-
-  OldPath     Path name of replace the final segment
-  Peer        The new path name to concatenate to become the peer path
-
-Returns:
-
-  A CHAR8* string, which must be freed by the caller
-
---*/
+  @param OldPath     Path name of replace the final segment
+  @param Peer        The new path name to concatenate to become the peer path
+
+  @return A CHAR8* string, which must be freed by the caller
+**/
+CHAR8*
+OsPathPeerFilePath (
+  IN CHAR8    *OldPath,
+  IN CHAR8    *Peer
+  )
 {
   CHAR8 *Result;
   INTN    Offset;
@@ -259,27 +237,18 @@ Routine Description:
   return Result;
 }
 
+/**
+  Checks if a file exists
 
+  @param InputFileName     The name of the file to check for existence
+
+  @retval TRUE              The file exists
+  @retval FALSE             The file does not exist
+**/
 BOOLEAN
 OsPathExists (
   IN CHAR8    *InputFileName
   )
-/*++
-
-Routine Description:
-
-  Checks if a file exists
-
-Arguments:
-
-  InputFileName     The name of the file to check for existence
-
-Returns:
-
-  TRUE              The file exists
-  FALSE             The file does not exist
-
---*/
 {
   FILE    *InputFile;
   InputFile = fopen (LongFilePath (InputFileName), "rb");
diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
index a34581ecb61a..e1e9a97e7bf6 100644
--- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
+++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
@@ -33,30 +33,22 @@ typedef struct _GUID_SEC_TOOL_ENTRY {
 // Function Implementation
 //
 
+/**
+  This function parses the tools_def.txt file.  It returns a
+  EFI_HANDLE object which can be used for the other library
+  functions and should be passed to FreeParsedGuidedSectionToolsHandle
+  to free resources when the tools_def.txt information is no
+  longer needed.
+
+  @param InputFile     Path name of file to read
+
+  @retval NULL if error parsing
+  @retval A non-NULL EFI_HANDLE otherwise
+**/
 EFI_HANDLE
 ParseGuidedSectionToolsFile (
   IN CHAR8    *InputFile
   )
-/*++
-
-Routine Description:
-
-  This function parses the tools_def.txt file.  It returns a
-  EFI_HANDLE object which can be used for the other library
-  functions and should be passed to FreeParsedGuidedSectionToolsHandle
-  to free resources when the tools_def.txt information is no
-  longer needed.
-
-Arguments:
-
-  InputFile     Path name of file to read
-
-Returns:
-
-  NULL if error parsing
-  A non-NULL EFI_HANDLE otherwise
-
---*/
 {
   EFI_STATUS Status;
   EFI_HANDLE MemoryFile;
@@ -74,31 +66,22 @@ Routine Description:
   return ParsedGuidedSectionTools;
 }
 
+/**
+  This function parses the tools_def.txt file.  It returns a
+  EFI_HANDLE object which can be used for the other library
+  functions and should be passed to FreeParsedGuidedSectionToolsHandle
+  to free resources when the tools_def.txt information is no
+  longer needed.
 
+  @param InputFile     Memory file image.
+
+  @retval NULL if error or EOF
+  @retval InputBuffer otherwise
+**/
 EFI_HANDLE
 ParseGuidedSectionToolsMemoryFile (
   IN EFI_HANDLE    InputFile
   )
-/*++
-
-Routine Description:
-
-  This function parses the tools_def.txt file.  It returns a
-  EFI_HANDLE object which can be used for the other library
-  functions and should be passed to FreeParsedGuidedSectionToolsHandle
-  to free resources when the tools_def.txt information is no
-  longer needed.
-
-Arguments:
-
-  InputFile     Memory file image.
-
-Returns:
-
-  NULL if error or EOF
-  InputBuffer otherwise
-
---*/
 {
   EFI_STATUS  Status;
   CHAR8       *NextLine;
@@ -160,31 +143,22 @@ Routine Description:
   return FirstGuidTool;
 }
 
+/**
+  This function looks up the appropriate tool to use for extracting
+  a GUID defined FV section.
 
+  @param ParsedGuidedSectionToolsHandle    A parsed GUID section tools handle.
+  @param SectionGuid                       The GUID for the section.
+
+  @retval NULL     if no tool is found or there is another error
+  @retval Non-NULL The tool to use to access the section contents.  (The caller
+             must free the memory associated with this string.)
+**/
 CHAR8*
 LookupGuidedSectionToolPath (
   IN EFI_HANDLE ParsedGuidedSectionToolsHandle,
   IN EFI_GUID   *SectionGuid
   )
-/*++
-
-Routine Description:
-
-  This function looks up the appropriate tool to use for extracting
-  a GUID defined FV section.
-
-Arguments:
-
-  ParsedGuidedSectionToolsHandle    A parsed GUID section tools handle.
-  SectionGuid                       The GUID for the section.
-
-Returns:
-
-  NULL     - if no tool is found or there is another error
-  Non-NULL - The tool to use to access the section contents.  (The caller
-             must free the memory associated with this string.)
-
---*/
 {
   GUID_SEC_TOOL_ENTRY *GuidTool;
 
diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c
index 5ef8f1306d65..63da3d647cb7 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -14,16 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "ParseInf.h"
 #include "CommonLib.h"
 
-CHAR8 *
-ReadLine (
-  IN MEMORY_FILE    *InputFile,
-  IN OUT CHAR8      *InputBuffer,
-  IN UINTN          MaxLength
-  )
-/*++
-
-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
@@ -31,18 +22,20 @@ Routine Description:
   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:
+  @param InputFile     Memory file image.
+  @param InputBuffer   Buffer to read into, must be MaxLength size.
+  @param MaxLength     The maximum size of the input buffer.
+
+  @retval NULL if error or EOF
+  @retval InputBuffer otherwise
+**/
+CHAR8 *
+ReadLine (
+  IN MEMORY_FILE    *InputFile,
+  IN OUT CHAR8      *InputBuffer,
+  IN UINTN          MaxLength
+  )
 
-  InputFile     Memory file image.
-  InputBuffer   Buffer to read into, must be MaxLength size.
-  MaxLength     The maximum size of the input buffer.
-
-Returns:
-
-  NULL if error or EOF
-  InputBuffer otherwise
-
---*/
 {
   CHAR8 *CharPtr;
   CHAR8 *EndOfLine;
@@ -129,29 +122,21 @@ Routine Description:
   return InputBuffer;
 }
 
+/**
+  This function parses a file from the beginning to find a section.
+  The section string may be anywhere within a line.
+
+  @param InputFile     Memory file image.
+  @param Section       Section to search for
+
+  @retval FALSE if error or EOF
+  @retval TRUE if section found
+**/
 BOOLEAN
 FindSection (
   IN MEMORY_FILE    *InputFile,
   IN CHAR8          *Section
   )
-/*++
-
-Routine Description:
-
-  This function parses a file from the beginning to find a section.
-  The section string may be anywhere within a line.
-
-Arguments:
-
-  InputFile     Memory file image.
-  Section       Section to search for
-
-Returns:
-
-  FALSE if error or EOF
-  TRUE if section found
-
---*/
 {
   CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
   CHAR8 *CurrentToken;
@@ -190,6 +175,21 @@ Routine Description:
   return FALSE;
 }
 
+/**
+  Finds a token value given the section and token to search for.
+
+  @param InputFile Memory file image.
+  @param Section   The section to search for, a string within [].
+  @param Token     The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
+  @param Instance  The instance of the token to search for.  Zero is the first instance.
+  @param Value     The string that holds the value following the =.  Must be MAX_LONG_FILE_PATH in size.
+
+  @retval EFI_SUCCESS             Value found.
+  @retval EFI_ABORTED             Format error detected in INF file.
+  @retval EFI_INVALID_PARAMETER   Input argument was null.
+  @retval EFI_LOAD_ERROR          Error reading from the file.
+  @retval EFI_NOT_FOUND           Section/Token/Value not found.
+**/
 EFI_STATUS
 FindToken (
   IN MEMORY_FILE    *InputFile,
@@ -198,29 +198,6 @@ FindToken (
   IN UINTN          Instance,
   OUT CHAR8         *Value
   )
-/*++
-
-Routine Description:
-
-  Finds a token value given the section and token to search for.
-
-Arguments:
-
-  InputFile Memory file image.
-  Section   The section to search for, a string within [].
-  Token     The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
-  Instance  The instance of the token to search for.  Zero is the first instance.
-  Value     The string that holds the value following the =.  Must be MAX_LONG_FILE_PATH in size.
-
-Returns:
-
-  EFI_SUCCESS             Value found.
-  EFI_ABORTED             Format error detected in INF file.
-  EFI_INVALID_PARAMETER   Input argument was null.
-  EFI_LOAD_ERROR          Error reading from the file.
-  EFI_NOT_FOUND           Section/Token/Value not found.
-
---*/
 {
   CHAR8   InputBuffer[MAX_LONG_FILE_PATH];
   CHAR8   *CurrentToken;
@@ -359,30 +336,22 @@ Routine Description:
   return EFI_NOT_FOUND;
 }
 
+/**
+  Converts a string to an EFI_GUID.  The string must be in the
+  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
+
+  @param AsciiGuidBuffer pointer to ascii string
+  @param GuidBuffer      pointer to destination Guid
+
+  @retval EFI_ABORTED             Could not convert the string
+  @retval EFI_SUCCESS             The string was successfully converted
+  @retval EFI_INVALID_PARAMETER   Input parameter is invalid.
+**/
 EFI_STATUS
 StringToGuid (
   IN CHAR8      *AsciiGuidBuffer,
   OUT EFI_GUID  *GuidBuffer
   )
-/*++
-
-Routine Description:
-
-  Converts a string to an EFI_GUID.  The string must be in the
-  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
-
-Arguments:
-
-  AsciiGuidBuffer - pointer to ascii string
-  GuidBuffer      - pointer to destination Guid
-
-Returns:
-
-  EFI_ABORTED             Could not convert the string
-  EFI_SUCCESS             The string was successfully converted
-  EFI_INVALID_PARAMETER   Input parameter is invalid.
-
---*/
 {
   INT32 Index;
   int   Data1;
@@ -461,33 +430,25 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-AsciiStringToUint64 (
-  IN CONST CHAR8  *AsciiString,
-  IN BOOLEAN      IsHex,
-  OUT UINT64      *ReturnValue
-  )
-/*++
-
-Routine Description:
-
+/**
   Converts a null terminated ascii string that represents a number into a
   UINT64 value.  A hex number may be preceded 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:
-
-  AsciiString   The string to convert.
-  IsHex         Force the string to be treated as a hex number.
-  ReturnValue   The return value.
-
-Returns:
-
-  EFI_SUCCESS   Number successfully converted.
-  EFI_ABORTED   Invalid character encountered.
-
---*/
+  @param AsciiString   The string to convert.
+  @param IsHex         Force the string to be treated as a hex number.
+  @param ReturnValue   The return value.
+
+  @retval EFI_SUCCESS   Number successfully converted.
+  @retval EFI_ABORTED   Invalid character encountered.
+**/
+EFI_STATUS
+AsciiStringToUint64 (
+  IN CONST CHAR8  *AsciiString,
+  IN BOOLEAN      IsHex,
+  OUT UINT64      *ReturnValue
+  )
 {
   UINT8   Index;
   UINT64  Value;
@@ -577,29 +538,21 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  This function reads a line, stripping any comments.
+  // BUGBUG:  This is obsolete once genmake goes away...
+
+  @param InputFile     Stream pointer.
+  @param InputBuffer   Buffer to read into, must be MAX_LONG_FILE_PATH size.
+
+  @retval NULL if error or EOF
+  @retval InputBuffer otherwise
+**/
 CHAR8 *
 ReadLineInStream (
   IN FILE       *InputFile,
   IN OUT CHAR8  *InputBuffer
   )
-/*++
-
-Routine Description:
-
-  This function reads a line, stripping any comments.
-  // BUGBUG:  This is obsolete once genmake goes away...
-
-Arguments:
-
-  InputFile     Stream pointer.
-  InputBuffer   Buffer to read into, must be MAX_LONG_FILE_PATH size.
-
-Returns:
-
-  NULL if error or EOF
-  InputBuffer otherwise
-
---*/
 {
   CHAR8 *CharPtr;
 
@@ -633,30 +586,22 @@ Routine Description:
   return InputBuffer;
 }
 
+/**
+  This function parses a stream file from the beginning to find a section.
+  The section string may be anywhere within a line.
+  // BUGBUG:  This is obsolete once genmake goes away...
+
+  @param InputFile     Stream pointer.
+  @param Section       Section to search for
+
+  @retval FALSE if error or EOF
+  @retval TRUE if section found
+**/
 BOOLEAN
 FindSectionInStream (
   IN FILE       *InputFile,
   IN CHAR8      *Section
   )
-/*++
-
-Routine Description:
-
-  This function parses a stream file from the beginning to find a section.
-  The section string may be anywhere within a line.
-  // BUGBUG:  This is obsolete once genmake goes away...
-
-Arguments:
-
-  InputFile     Stream pointer.
-  Section       Section to search for
-
-Returns:
-
-  FALSE if error or EOF
-  TRUE if section found
-
---*/
 {
   CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
   CHAR8 *CurrentToken;
diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/C/Common/PcdValueCommon.c
index 98023e8786d8..591a7787828c 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.c
+++ b/BaseTools/Source/C/Common/PcdValueCommon.c
@@ -35,6 +35,15 @@ typedef struct {
 PCD_ENTRY  *PcdList;
 UINT32     PcdListLength;
 
+/**
+  Record new token information
+
+  @param FileBuffer    File Buffer to be record
+  @param PcdIndex      Index of PCD in database
+  @param TokenIndex    Index of Token
+  @param TokenStart    Start of Token
+  @param TokenEnd      End of Token
+**/
 VOID
 STATIC
 RecordToken (
@@ -44,24 +53,7 @@ RecordToken (
   UINT32  TokenStart,
   UINT32  TokenEnd
   )
-/*++
 
-Routine Description:
-
-  Record new token information
-
-Arguments:
-
-  FileBuffer    File Buffer to be record
-  PcdIndex      Index of PCD in database
-  TokenIndex    Index of Token
-  TokenStart    Start of Token
-  TokenEnd      End of Token
-
-Returns:
-
-  None
---*/
 {
   CHAR8  *Token;
 
@@ -109,31 +101,24 @@ Routine Description:
   }
 }
 
-int
-STATIC
-LookupPcdIndex (
-  CHAR8  *SkuName             OPTIONAL,
-  CHAR8  *DefaultValueName    OPTIONAL,
-  CHAR8  *TokenSpaceGuidName,
-  CHAR8  *TokenName
-  )
-/*++
-
-Routine Description:
-
+/**
   Get PCD index in Pcd database
 
-Arguments:
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
 
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-
-Returns:
-
-  Index of PCD in Pcd database
---*/
+  @return Index of PCD in Pcd database
+**/
+int
+STATIC
+LookupPcdIndex (
+  CHAR8  *SkuName             OPTIONAL,
+  CHAR8  *DefaultValueName    OPTIONAL,
+  CHAR8  *TokenSpaceGuidName,
+  CHAR8  *TokenName
+  )
 {
   UINT32  Index;
 
@@ -161,6 +146,16 @@ Routine Description:
   return -1;
 }
 
+/**
+  Get PCD value
+
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
+
+  @return PCD value
+**/
 UINT64
 __PcdGet (
   CHAR8  *SkuName             OPTIONAL,
@@ -168,23 +163,6 @@ __PcdGet (
   CHAR8  *TokenSpaceGuidName,
   CHAR8  *TokenName
   )
-/*++
-
-Routine Description:
-
-  Get PCD value
-
-Arguments:
-
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-
-Returns:
-
-  PCD value
---*/
 {
   int    Index;
   CHAR8  *End;
@@ -212,6 +190,15 @@ Routine Description:
   return 0;
 }
 
+/**
+  Set PCD value
+
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
+  @param Value                 PCD value to be set
+**/
 VOID
 __PcdSet (
   CHAR8   *SkuName             OPTIONAL,
@@ -220,24 +207,6 @@ __PcdSet (
   CHAR8   *TokenName,
   UINT64  Value
   )
-/*++
-
-Routine Description:
-
-  Set PCD value
-
-Arguments:
-
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-  Value                 PCD value to be set
-
-Returns:
-
-  None
---*/
 {
   int    Index;
 
@@ -275,6 +244,17 @@ Routine Description:
   }
 }
 
+/**
+  Get PCD value buffer
+
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
+  @param Size                  Size of PCD value buffer
+ 
+  @return PCD value buffer
+**/
 VOID *
 __PcdGetPtr (
   CHAR8   *SkuName             OPTIONAL,
@@ -283,24 +263,6 @@ __PcdGetPtr (
   CHAR8   *TokenName,
   UINT32  *Size
   )
-/*++
-
-Routine Description:
-
-  Get PCD value buffer
-
-Arguments:
-
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-  Size                  Size of PCD value buffer
-
-Returns:
-
-  PCD value buffer
---*/
 {
   int    Index;
   CHAR8   *Value;
@@ -341,6 +303,16 @@ Routine Description:
   return 0;
 }
 
+/**
+  Set PCD value buffer
+
+  @param SkuName               SkuName String
+  @param DefaultValueName      DefaultValueName String
+  @param TokenSpaceGuidName    TokenSpaceGuidName String
+  @param TokenName             TokenName String
+  @param Size                  Size of PCD value
+  @param Value                 Pointer to the updated PCD value buffer
+**/
 VOID
 __PcdSetPtr (
   CHAR8   *SkuName             OPTIONAL,
@@ -350,25 +322,6 @@ __PcdSetPtr (
   UINT32  Size,
   UINT8   *Value
   )
-/*++
-
-Routine Description:
-
-  Set PCD value buffer
-
-Arguments:
-
-  SkuName               SkuName String
-  DefaultValueName      DefaultValueName String
-  TokenSpaceGuidName    TokenSpaceGuidName String
-  TokenName             TokenName String
-  Size                  Size of PCD value
-  Value                 Pointer to the updated PCD value buffer
-
-Returns:
-
-  None
---*/
 {
   int    Index;
   UINT32  ValueIndex;
@@ -400,6 +353,13 @@ Routine Description:
   }
 }
 
+/**
+  Read the file buffer from the input file.
+ 
+  @param InputFileName Point to the input file name.
+  @param FileBuffer    Point to the input file buffer.
+  @param FileSize      Size of the file buffer.
+**/
 VOID
 STATIC
 ReadInputFile (
@@ -407,22 +367,6 @@ ReadInputFile (
   UINT8   **FileBuffer,
   UINT32  *FileSize
   )
-/*++
-
-Routine Description:
-
-  Read the file buffer from the input file.
-
-Arguments:
-
-  InputFileName Point to the input file name.
-  FileBuffer    Point to the input file buffer.
-  FileSize      Size of the file buffer.
-
-Returns:
-
-  None
---*/
 {
   FILE    *InputFile;
   UINT32  BytesRead;
@@ -492,27 +436,18 @@ Routine Description:
   fclose (InputFile);
 }
 
+/**
+  Read the initial PCD value from the input file buffer.
+
+  @param FileBuffer  Point to the input file buffer.
+  @param FileSize    Size of the file buffer.
+**/
 VOID
 STATIC
 ParseFile (
   UINT8   *FileBuffer,
   UINT32  FileSize
   )
-/*++
-
-Routine Description:
-
-  Read the initial PCD value from the input file buffer.
-
-Arguments:
-
-  FileBuffer  Point to the input file buffer.
-  FileSize    Size of the file buffer.
-
-Returns:
-
-  None
---*/
 {
   UINT32  Index;
   UINT32  NumLines;
@@ -552,25 +487,16 @@ Routine Description:
   }
 }
 
+/**
+  Write the updated PCD value into the output file name.
+
+  @param OutputFileName  Point to the output file name.
+**/
 VOID
 STATIC
 WriteOutputFile (
   CHAR8   *OutputFileName
   )
-/*++
-
-Routine Description:
-
-  Write the updated PCD value into the output file name.
-
-Arguments:
-
-  OutputFileName  Point to the output file name.
-
-Returns:
-
-  None
---*/
 {
   FILE    *OutputFile;
   UINT32  Index;
@@ -605,26 +531,14 @@ Routine Description:
   }
 }
 
+/**
+  Displays the utility usage syntax to STDOUT
+**/
 VOID
 STATIC
 Usage (
   VOID
   )
-/*++
-
-Routine Description:
-
-  Displays the utility usage syntax to STDOUT
-
-Arguments:
-
-  None
-
-Returns:
-
-  None
-
---*/
 {
   fprintf (stdout, "Usage: -i <input_file> -o <output_file>\n\n");
   fprintf (stdout, "optional arguments:\n");
@@ -635,6 +549,14 @@ Routine Description:
                         PCD Database Output file name\n");
 }
 
+/**
+ Parse the input parameters to get the input/output file name.
+
+ @param argc            Number of command line parameters.
+ @param argv            Array of pointers to parameter strings.
+ @param InputFileName   Point to the input file name.
+ @param OutputFileName  Point to the output file name.
+**/
 VOID
 STATIC
 ParseArguments (
@@ -643,23 +565,6 @@ ParseArguments (
   CHAR8  **InputFileName,
   CHAR8  **OutputFileName
   )
-/*++
-
-Routine Description:
-
-  Parse the input parameters to get the input/output file name.
-
-Arguments:
-
-  argc            Number of command line parameters.
-  argv            Array of pointers to parameter strings.
-  InputFileName   Point to the input file name.
-  OutputFileName  Point to the output file name.
-
-Returns:
-
-  None
---*/
 {
   if (argc == 1) {
     fprintf (stderr, "Missing options\n");
@@ -722,25 +627,19 @@ Routine Description:
   }
 }
 
+/**
+ Main function updates PCD values.
+
+ @param argc            Number of command line parameters.
+ @param argv            Array of pointers to parameter strings.
+
+ @retval EXIT_SUCCESS
+**/
 int
 PcdValueMain (
   int   argc,
   char  *argv[]
   )
-/*++
-
-Routine Description:
-
-  Main function updates PCD values.
-
-Arguments:
-
-  argc            Number of command line parameters.
-  argv            Array of pointers to parameter strings.
-
-Returns:
-  EXIT_SUCCESS
---*/
 {
   CHAR8   *InputFileName;
   CHAR8   *OutputFileName;
diff --git a/BaseTools/Source/C/Common/PeCoffLoaderEx.c b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
index 2cc428d733b4..181192035ef1 100644
--- a/BaseTools/Source/C/Common/PeCoffLoaderEx.c
+++ b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
@@ -65,59 +65,37 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 UINT32 *RiscVHi20Fixup = NULL;
 
-RETURN_STATUS
-PeCoffLoaderRelocateIa32Image (
-  IN UINT16      *Reloc,
-  IN OUT CHAR8   *Fixup,
-  IN OUT CHAR8   **FixupData,
-  IN UINT64      Adjust
-  )
-/*++
-
-Routine Description:
-
+/**
   Performs an IA-32 specific relocation fixup
 
-Arguments:
-
-  Reloc      - Pointer to the relocation record
-
-  Fixup      - Pointer to the address to fix up
-
-  FixupData  - Pointer to a buffer to log the fixups
-
-  Adjust     - The offset to adjust the fixup
-
-Returns:
-
-  EFI_UNSUPPORTED   - Unsupported now
-
---*/
+  @param Reloc      Pointer to the relocation record
+  @param Fixup      Pointer to the address to fix up
+  @param FixupData  Pointer to a buffer to log the fixups
+  @param Adjust     The offset to adjust the fixup
+
+  @retval EFI_UNSUPPORTED   - Unsupported now
+**/
+RETURN_STATUS
+PeCoffLoaderRelocateIa32Image (
+  IN UINT16      *Reloc,
+  IN OUT CHAR8   *Fixup,
+  IN OUT CHAR8   **FixupData,
+  IN UINT64      Adjust
+  )
 {
   return RETURN_UNSUPPORTED;
 }
 
-/*++
-
-Routine Description:
-
+/**
   Performs an RISC-V specific relocation fixup
 
-Arguments:
+  @param Reloc      Pointer to the relocation record
+  @param Fixup      Pointer to the address to fix up
+  @param FixupData  Pointer to a buffer to log the fixups
+  @param Adjust     The offset to adjust the fixup
 
-  Reloc      - Pointer to the relocation record
-
-  Fixup      - Pointer to the address to fix up
-
-  FixupData  - Pointer to a buffer to log the fixups
-
-  Adjust     - The offset to adjust the fixup
-
-Returns:
-
-  Status code
-
---*/
+  @return Status code
+**/
 RETURN_STATUS
 PeCoffLoaderRelocateRiscVImage (
   IN UINT16      *Reloc,
diff --git a/BaseTools/Source/C/Common/SimpleFileParsing.c b/BaseTools/Source/C/Common/SimpleFileParsing.c
index eb6abea1bec7..51d59cf4a765 100644
--- a/BaseTools/Source/C/Common/SimpleFileParsing.c
+++ b/BaseTools/Source/C/Common/SimpleFileParsing.c
@@ -152,65 +152,43 @@ SetFilePosition (
   FILE_POSITION *Fpos
   );
 
+/**
+  @retval STATUS_SUCCESS always
+**/
 STATUS
 SFPInit (
   VOID
   )
-/*++
-
-Routine Description:
-
-Arguments:
-  None.
-
-Returns:
-  STATUS_SUCCESS always
-
---*/
 {
   memset ((VOID *) &mGlobals, 0, sizeof (mGlobals));
   return STATUS_SUCCESS;
 }
 
-UINTN
-SFPGetLineNumber (
-  VOID
-  )
-/*++
-
-Routine Description:
+/**
   Return the line number of the file we're parsing. Used
   for error reporting purposes.
 
-Arguments:
-  None.
-
-Returns:
-  The line number, or 0 if no file is being processed
-
---*/
+  @return The line number, or 0 if no file is being processed
+**/
+UINTN
+SFPGetLineNumber (
+  VOID
+  )
 {
   return mGlobals.SourceFile.LineNum;
 }
 
-CHAR8  *
-SFPGetFileName (
-  VOID
-  )
-/*++
-
-Routine Description:
+/**
   Return the name of the file we're parsing. Used
   for error reporting purposes.
 
-Arguments:
-  None.
-
-Returns:
-  A pointer to the file name. Null if no file is being
+  @return A pointer to the file name. Null if no file is being
   processed.
-
---*/
+**/
+CHAR8  *
+SFPGetFileName (
+  VOID
+  )
 {
   if (mGlobals.SourceFile.FileName[0]) {
     return mGlobals.SourceFile.FileName;
@@ -219,22 +197,15 @@ Routine Description:
   return NULL;
 }
 
+/**
+  Open a file for parsing.
+
+  @param FileName  name of the file to parse
+**/
 STATUS
 SFPOpenFile (
   CHAR8      *FileName
   )
-/*++
-
-Routine Description:
-  Open a file for parsing.
-
-Arguments:
-  FileName  - name of the file to parse
-
-Returns:
-
-
---*/
 {
   STATUS  Status;
   t_strcpy (mGlobals.SourceFile.FileName, FileName);
@@ -242,31 +213,26 @@ Routine Description:
   return Status;
 }
 
-BOOLEAN
-SFPIsToken (
-  CHAR8  *Str
-  )
-/*++
-
-Routine Description:
+/**
   Check to see if the specified token is found at
   the current position in the input file.
 
-Arguments:
-  Str - the token to look for
+ @note:
+   We do a simple string comparison on this function. It is
+   the responsibility of the caller to ensure that the token
+   is not a subset of some other token.
 
-Returns:
-  TRUE - the token is next
-  FALSE - the token is not next
+   The file pointer is advanced past the token in the input file.
+ 
+  @param Str the token to look for
 
-Notes:
-  We do a simple string comparison on this function. It is
-  the responsibility of the caller to ensure that the token
-  is not a subset of some other token.
-
-  The file pointer is advanced past the token in the input file.
-
---*/
+  @retval TRUE the token is next
+  @retval FALSE the token is not next
+**/
+BOOLEAN
+SFPIsToken (
+  CHAR8  *Str
+  )
 {
   UINTN  Len;
   SkipWhiteSpace (&mGlobals.SourceFile);
@@ -286,28 +252,23 @@ Routine Description:
   return FALSE;
 }
 
-BOOLEAN
-SFPIsKeyword (
-  CHAR8  *Str
-  )
-/*++
-
-Routine Description:
+/**
   Check to see if the specified keyword is found at
   the current position in the input file.
 
-Arguments:
-  Str - keyword to look for
+ @note:
+   A keyword is defined as a "special" string that has a non-alphanumeric
+   character following it.
+ 
+  @param Str keyword to look for
 
-Returns:
-  TRUE - the keyword is next
-  FALSE - the keyword is not next
-
-Notes:
-  A keyword is defined as a "special" string that has a non-alphanumeric
-  character following it.
-
---*/
+  @retval TRUE the keyword is next
+  @retval FALSE the keyword is not next
+**/
+BOOLEAN
+SFPIsKeyword (
+  CHAR8  *Str
+  )
 {
   UINTN  Len;
   SkipWhiteSpace (&mGlobals.SourceFile);
@@ -331,30 +292,25 @@ Routine Description:
   return FALSE;
 }
 
+/**
+  Get the next token from the input stream.
+
+ @note:
+   Preceding white space is ignored.
+   The parser's buffer pointer is advanced past the end of the
+   token.
+ 
+  @param Str pointer to a copy of the next token
+  @param Len size of buffer pointed to by Str
+
+  @retval TRUE  next token successfully returned
+  @retval FALSE otherwise
+**/
 BOOLEAN
 SFPGetNextToken (
   CHAR8  *Str,
   UINTN  Len
   )
-/*++
-
-Routine Description:
-  Get the next token from the input stream.
-
-Arguments:
-  Str - pointer to a copy of the next token
-  Len - size of buffer pointed to by Str
-
-Returns:
-  TRUE  - next token successfully returned
-  FALSE - otherwise
-
-Notes:
-  Preceding white space is ignored.
-  The parser's buffer pointer is advanced past the end of the
-  token.
-
---*/
 {
   UINTN  Index;
   CHAR8  TempChar;
@@ -436,25 +392,20 @@ Routine Description:
   return FALSE;
 }
 
+/**
+  Parse a GUID from the input stream. Stop when you discover white space.
+
+  @param Str pointer to a copy of the next token
+  @param Len size of buffer pointed to by Str
+
+  @retval TRUE  GUID string returned successfully
+  @retval FALSE otherwise
+**/
 BOOLEAN
 SFPGetGuidToken (
   CHAR8  *Str,
   UINT32 Len
   )
-/*++
-
-Routine Description:
-  Parse a GUID from the input stream. Stop when you discover white space.
-
-Arguments:
-  Str - pointer to a copy of the next token
-  Len - size of buffer pointed to by Str
-
-Returns:
-  TRUE  - GUID string returned successfully
-  FALSE - otherwise
-
---*/
 {
   UINT32  Index;
   SkipWhiteSpace (&mGlobals.SourceFile);
@@ -505,24 +456,19 @@ SFPSkipToToken (
   return FALSE;
 }
 
-BOOLEAN
-SFPGetNumber (
-  UINTN *Value
-  )
-/*++
-
-Routine Description:
+/**
   Check the token at the current file position for a numeric value.
   May be either decimal or hex.
 
-Arguments:
-  Value  - pointer where to store the value
+  @param Value  pointer where to store the value
 
-Returns:
-  FALSE    - current token is not a number
-  TRUE     - current token is a number
-
---*/
+  @retval FALSE    current token is not a number
+  @retval TRUE     current token is a number
+**/
+BOOLEAN
+SFPGetNumber (
+  UINTN *Value
+  )
 {
   int Val;
 
@@ -561,23 +507,16 @@ Routine Description:
   }
 }
 
-STATUS
-SFPCloseFile (
-  VOID
-  )
-/*++
-
-Routine Description:
+/**
   Close the file being parsed.
 
-Arguments:
-  None.
-
-Returns:
-  STATUS_SUCCESS - the file was closed
-  STATUS_ERROR   - no file is currently open
-
---*/
+  @retval STATUS_SUCCESS the file was closed
+  @retval STATUS_ERROR   no file is currently open
+**/
+STATUS
+SFPCloseFile (
+  VOID
+  )
 {
   if (mGlobals.SourceFile.FileBuffer != NULL) {
     free (mGlobals.SourceFile.FileBuffer);
@@ -588,28 +527,20 @@ Routine Description:
   return STATUS_ERROR;
 }
 
-STATIC
-STATUS
-ProcessIncludeFile (
-  SOURCE_FILE *SourceFile,
-  SOURCE_FILE *ParentSourceFile
-  )
-/*++
-
-Routine Description:
-
+/**
   Given a source file, open the file and parse it
 
-Arguments:
-
-  SourceFile        - name of file to parse
-  ParentSourceFile  - for error reporting purposes, the file that #included SourceFile.
-
-Returns:
-
-  Standard status.
-
---*/
+  @param SourceFile        name of file to parse
+  @param ParentSourceFile  for error reporting purposes, the file that #included SourceFile.
+
+  @return Standard status.
+**/
+STATIC
+STATUS
+ProcessIncludeFile (
+  SOURCE_FILE *SourceFile,
+  SOURCE_FILE *ParentSourceFile
+  )
 {
   STATIC UINTN NestDepth = 0;
   CHAR8               FoundFileName[MAX_PATH];
@@ -657,27 +588,19 @@ Routine Description:
   return Status;
 }
 
-STATIC
-STATUS
-ProcessFile (
-  SOURCE_FILE *SourceFile
-  )
-/*++
-
-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
-
-Returns:
-
-  Standard status.
-
---*/
+  @param SourceFile        structure containing info on the file to process
+
+  @return Standard status.
+**/
+STATIC
+STATUS
+ProcessFile (
+  SOURCE_FILE *SourceFile
+  )
 {
   //
   // Get the file size, and then read the entire thing into memory.
@@ -706,24 +629,17 @@ Routine Description:
   return STATUS_SUCCESS;
 }
 
-STATIC
-VOID
-PreprocessFile (
-  SOURCE_FILE *SourceFile
-  )
-/*++
-
-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.
-
---*/
+  @param SourceFile structure that we use to keep track of an input file.
+**/
+STATIC
+VOID
+PreprocessFile (
+  SOURCE_FILE *SourceFile
+  )
 {
   BOOLEAN InComment;
   BOOLEAN SlashSlashComment;
@@ -812,26 +728,21 @@ Routine Description:
   }
 }
 
+/**
+  Retrieve a quoted-string from the input file.
+
+  @param Str    pointer to a copy of the quoted string parsed
+  @param Length size of buffer pointed to by Str
+
+  @retval TRUE    next token in input stream was a quoted string, and
+                  the string value was returned in Str
+  @retval FALSE   otherwise
+**/
 BOOLEAN
 SFPGetQuotedString (
   CHAR8       *Str,
   INTN         Length
   )
-/*++
-
-Routine Description:
-  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
-
-Returns:
-  TRUE    - next token in input stream was a quoted string, and
-            the string value was returned in Str
-  FALSE   - otherwise
-
---*/
 {
   SkipWhiteSpace (&mGlobals.SourceFile);
   if (EndOfFile (&mGlobals.SourceFile)) {
@@ -866,24 +777,17 @@ Routine Description:
   return FALSE;
 }
 
-BOOLEAN
-SFPIsEOF (
-  VOID
-  )
-/*++
-
-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
-
---*/
+  @retval TRUE    EOF reached
+  @retval FALSE   otherwise
+**/
+BOOLEAN
+SFPIsEOF (
+  VOID
+  )
 {
   SkipWhiteSpace (&mGlobals.SourceFile);
   return EndOfFile (&mGlobals.SourceFile);
@@ -1112,27 +1016,22 @@ SkipWhiteSpace (
   return Count;
 }
 
-STATIC
-UINTN
-t_strcmp (
-  CHAR8  *Buffer,
-  CHAR8  *Str
-  )
-/*++
-
-Routine Description:
+/**
   Compare two strings for equality. The string pointed to by 'Buffer' may or may not be null-terminated,
   so only compare up to the length of Str.
 
-Arguments:
-  Buffer  - pointer to first (possibly not null-terminated) string
-  Str     - pointer to null-terminated string to compare to Buffer
+  @param Buffer  pointer to first (possibly not null-terminated) string
+  @param Str     pointer to null-terminated string to compare to Buffer
 
-Returns:
-  Number of bytes matched if exact match
-  0 if Buffer does not start with Str
-
---*/
+  @retval Number of bytes matched if exact match
+  @retval 0 if Buffer does not start with Str
+**/
+STATIC
+UINTN
+t_strcmp (
+  CHAR8  *Buffer,
+  CHAR8  *Str
+  )
 {
   UINTN  Len;
 
@@ -1245,28 +1144,23 @@ GetHexChars (
   return Len;
 }
 
+/**
+  Parse a GUID from the input stream. Stop when you discover white space.
+
+ GUID styles
+   Style[0] 12345678-1234-5678-AAAA-BBBBCCCCDDDD
+
+  @param GuidStyle Style of the following GUID token
+  @param Value     pointer to EFI_GUID struct for output
+
+  @retval TRUE  GUID string parsed successfully
+  @retval FALSE otherwise
+**/
 BOOLEAN
 SFPGetGuid (
   INTN         GuidStyle,
   EFI_GUID    *Value
   )
-/*++
-
-Routine Description:
-  Parse a GUID from the input stream. Stop when you discover white space.
-
-Arguments:
-  GuidStyle - Style of the following GUID token
-  Value     - pointer to EFI_GUID struct for output
-
-Returns:
-  TRUE  - GUID string parsed successfully
-  FALSE - otherwise
-
-  GUID styles
-    Style[0] 12345678-1234-5678-AAAA-BBBBCCCCDDDD
-
---*/
 {
   INT32         Value32;
   UINT32        Index;
diff --git a/BaseTools/Source/C/Common/StringFuncs.c b/BaseTools/Source/C/Common/StringFuncs.c
index 50573fdf0999..bc85ba012440 100644
--- a/BaseTools/Source/C/Common/StringFuncs.c
+++ b/BaseTools/Source/C/Common/StringFuncs.c
@@ -14,25 +14,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // Functions implementations
 //
 
-CHAR8*
-CloneString (
-  IN CHAR8       *String
-  )
-/*++
-
-Routine Description:
-
+/**
   Allocates a new string and copies 'String' to clone it
 
-Arguments:
-
-  String          The string to clone
-
-Returns:
-
-  CHAR8* - NULL if there are not enough resources
-
---*/
+  @param String          The string to clone
+
+  @return CHAR8* - NULL if there are not enough resources
+**/
+CHAR8*
+CloneString (
+  IN CHAR8       *String
+  )
 {
   CHAR8* NewString;
 
@@ -44,26 +36,17 @@ Routine Description:
   return NewString;
 }
 
-
-EFI_STATUS
-StripInfDscStringInPlace (
-  IN CHAR8       *String
-  )
-/*++
-
-Routine Description:
-
+/**
   Remove all comments, leading and trailing whitespace from the string.
 
-Arguments:
-
-  String          The string to 'strip'
-
-Returns:
-
-  EFI_STATUS
-
---*/
+  @param String          The string to 'strip'
+
+  @return EFI_STATUS
+**/
+EFI_STATUS
+StripInfDscStringInPlace (
+  IN CHAR8       *String
+  )
 {
   CHAR8 *Pos;
 
@@ -110,27 +93,18 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-
-STRING_LIST*
-SplitStringByWhitespace (
-  IN CHAR8       *String
-  )
-/*++
-
-Routine Description:
-
+/**
   Creates and returns a 'split' STRING_LIST by splitting the string
   on whitespace boundaries.
 
-Arguments:
-
-  String          The string to 'split'
-
-Returns:
-
-  EFI_STATUS
-
---*/
+  @param String          The string to 'split'
+
+  @return EFI_STATUS
+**/
+STRING_LIST*
+SplitStringByWhitespace (
+  IN CHAR8       *String
+  )
 {
   CHAR8       *Pos;
   CHAR8       *EndOfSubString;
@@ -172,21 +146,14 @@ Routine Description:
   return Output;
 }
 
-
-STRING_LIST*
-NewStringList (
-  )
-/*++
-
-Routine Description:
-
+/**
   Creates a new STRING_LIST with 0 strings.
 
-Returns:
-
-  STRING_LIST* - Null if there is not enough resources to create the object.
-
---*/
+  @return STRING_LIST* - Null if there is not enough resources to create the object.
+**/
+STRING_LIST*
+NewStringList (
+  )
 {
   STRING_LIST *NewList;
   NewList = AllocateStringListStruct (0);
@@ -196,24 +163,17 @@ Routine Description:
   return NewList;
 }
 
-
-EFI_STATUS
-AppendCopyOfStringToList (
-  IN OUT STRING_LIST **StringList,
-  IN CHAR8       *String
-  )
-/*++
-
-Routine Description:
-
+/**
   Adds String to StringList.  A new copy of String is made before it is
   added to StringList.
 
-Returns:
-
-  EFI_STATUS
-
---*/
+  @return EFI_STATUS
+**/
+EFI_STATUS
+AppendCopyOfStringToList (
+  IN OUT STRING_LIST **StringList,
+  IN CHAR8       *String
+  )
 {
   STRING_LIST *OldList;
   STRING_LIST *NewList;
@@ -245,27 +205,18 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-
-EFI_STATUS
-RemoveLastStringFromList (
-  IN STRING_LIST       *StringList
-  )
-/*++
-
-Routine Description:
-
+/**
   Removes the last string from StringList and frees the memory associated
   with it.
 
-Arguments:
-
-  StringList        The string list to remove the string from
-
-Returns:
-
-  EFI_STATUS
-
---*/
+  @param StringList        The string list to remove the string from
+
+  @return EFI_STATUS
+**/
+EFI_STATUS
+RemoveLastStringFromList (
+  IN STRING_LIST       *StringList
+  )
 {
   if (StringList->Count == 0) {
     return EFI_INVALID_PARAMETER;
@@ -276,49 +227,30 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
+/**
+  Allocates a STRING_LIST structure that can store StringCount strings.
 
+  @param StringCount        The number of strings that need to be stored
+
+  @return EFI_STATUS
+**/
 STRING_LIST*
 AllocateStringListStruct (
   IN UINTN StringCount
   )
-/*++
-
-Routine Description:
-
-  Allocates a STRING_LIST structure that can store StringCount strings.
-
-Arguments:
-
-  StringCount        The number of strings that need to be stored
-
-Returns:
-
-  EFI_STATUS
-
---*/
 {
   return malloc (OFFSET_OF(STRING_LIST, Strings[StringCount + 1]));
 }
 
-
-VOID
-FreeStringList (
-  IN STRING_LIST       *StringList
-  )
-/*++
-
-Routine Description:
-
+/**
   Frees all memory associated with StringList.
 
-Arguments:
-
-  StringList        The string list to free
-
-Returns:
-
-  VOID
---*/
+  @param StringList        The string list to free
+**/
+VOID
+FreeStringList (
+  IN STRING_LIST       *StringList
+  )
 {
   while (StringList->Count > 0) {
     RemoveLastStringFromList (StringList);
@@ -327,27 +259,18 @@ Routine Description:
   free (StringList);
 }
 
-
-CHAR8*
-StringListToString (
-  IN STRING_LIST       *StringList
-  )
-/*++
-
-Routine Description:
-
+/**
   Generates a string that represents the STRING_LIST
 
-Arguments:
+  @param StringList        The string list to convert to a string
 
-  StringList        The string list to convert to a string
-
-Returns:
-
-  CHAR8* - The string list represented with a single string.  The returned
+  @return CHAR8* - The string list represented with a single string.  The returned
            string must be freed by the caller.
-
---*/
+**/
+CHAR8*
+StringListToString (
+  IN STRING_LIST       *StringList
+  )
 {
   UINTN Count;
   UINTN Length;
@@ -381,26 +304,17 @@ Routine Description:
   return NewString;
 }
 
-
-VOID
-PrintStringList (
-  IN STRING_LIST       *StringList
-  )
-/*++
-
-Routine Description:
-
+/**
   Prints out the string list
 
-Arguments:
-
-  StringList        The string list to print
-
-Returns:
-
-  EFI_STATUS
-
---*/
+  @param StringList        The string list to print
+ 
+  @return EFI_STATUS
+**/
+VOID
+PrintStringList (
+  IN STRING_LIST       *StringList
+  )
 {
   CHAR8* String;
   String = StringListToString (StringList);
diff --git a/BaseTools/Source/C/Common/TianoCompress.c b/BaseTools/Source/C/Common/TianoCompress.c
index 030cdca025b8..2f484b9731dc 100644
--- a/BaseTools/Source/C/Common/TianoCompress.c
+++ b/BaseTools/Source/C/Common/TianoCompress.c
@@ -256,6 +256,25 @@ STATIC NODE   mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NU
 //
 // functions
 //
+
+/**
+  The internal implementation of [Efi/Tiano]Compress().
+
+  @param SrcBuffer   The buffer storing the source data
+  @param SrcSize     The size of source data
+  @param DstBuffer   The buffer to store the compressed data
+  @param DstSize     On input, the size of DstBuffer; On output,
+                     the size of the actual compressed data.
+  @param Version     The version of de/compression algorithm.
+                     Version 1 for UEFI 2.0 de/compression algorithm.
+                     Version 2 for Tiano de/compression algorithm.
+
+  @retval EFI_BUFFER_TOO_SMALL  The DstBuffer is too small. In this case,
+                DstSize contains the size needed.
+  @retval EFI_SUCCESS           Compression is successful.
+  @retval EFI_OUT_OF_RESOURCES  No resource to complete function.
+  @retval EFI_INVALID_PARAMETER Parameter supplied is wrong.
+**/
 EFI_STATUS
 TianoCompress (
   IN      UINT8   *SrcBuffer,
@@ -263,32 +282,6 @@ TianoCompress (
   IN      UINT8   *DstBuffer,
   IN OUT  UINT32  *DstSize
   )
-/*++
-
-Routine Description:
-
-  The internal implementation of [Efi/Tiano]Compress().
-
-Arguments:
-
-  SrcBuffer   - The buffer storing the source data
-  SrcSize     - The size of source data
-  DstBuffer   - The buffer to store the compressed data
-  DstSize     - On input, the size of DstBuffer; On output,
-                the size of the actual compressed data.
-  Version     - The version of de/compression algorithm.
-                Version 1 for UEFI 2.0 de/compression algorithm.
-                Version 2 for Tiano de/compression algorithm.
-
-Returns:
-
-  EFI_BUFFER_TOO_SMALL  - The DstBuffer is too small. In this case,
-                DstSize contains the size needed.
-  EFI_SUCCESS           - Compression is successful.
-  EFI_OUT_OF_RESOURCES  - No resource to complete function.
-  EFI_INVALID_PARAMETER - Parameter supplied is wrong.
-
---*/
 {
   EFI_STATUS  Status;
 
@@ -351,24 +344,16 @@ Routine Description:
 
 }
 
-STATIC
-VOID
-PutDword (
-  IN UINT32 Data
-  )
-/*++
-
-Routine Description:
-
+/**
   Put a dword to output stream
 
-Arguments:
-
-  Data    - the dword to put
-
-Returns: (VOID)
-
---*/
+  @param Data    the dword to put
+**/
+STATIC
+VOID
+PutDword (
+  IN UINT32 Data
+  )
 {
   if (mDst < mDstUpperLimit) {
     *mDst++ = (UINT8) (((UINT8) (Data)) & 0xff);
@@ -387,26 +372,17 @@ Returns: (VOID)
   }
 }
 
-STATIC
-EFI_STATUS
-AllocateMemory (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Allocate memory spaces for data structures used in compression process
 
-Arguments:
+  @retval EFI_SUCCESS           Memory is allocated successfully
+  @retval EFI_OUT_OF_RESOURCES  Allocation fails
+**/
+STATIC
+EFI_STATUS
+AllocateMemory (
   VOID
-
-Returns:
-
-  EFI_SUCCESS           - Memory is allocated successfully
-  EFI_OUT_OF_RESOURCES  - Allocation fails
-
---*/
+  )
 {
   UINT32  Index;
 
@@ -445,21 +421,13 @@ Routine Description:
   return EFI_SUCCESS;
 }
 
-VOID
-FreeMemory (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Called when compression is completed to free memory previously allocated.
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+VOID
+FreeMemory (
+  VOID
+  )
 {
   if (mText != NULL) {
     free (mText);
@@ -496,22 +464,14 @@ Returns: (VOID)
   return ;
 }
 
-STATIC
-VOID
-InitSlide (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Initialize String Info Log data structures
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+InitSlide (
+  VOID
+  )
 {
   NODE  Index;
 
@@ -535,28 +495,20 @@ Returns: (VOID)
   }
 }
 
-STATIC
-NODE
-Child (
-  IN NODE  NodeQ,
-  IN UINT8 CharC
-  )
-/*++
-
-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)
-
---*/
+  @param NodeQ       the parent node
+  @param CharC       the edge character
+
+  @return The child node (NIL if not found)
+**/
+STATIC
+NODE
+Child (
+  IN NODE  NodeQ,
+  IN UINT8 CharC
+  )
 {
   NODE  NodeR;
 
@@ -572,6 +524,13 @@ Routine Description:
   return NodeR;
 }
 
+/**
+  Create a new child for a given parent node.
+
+  @param Parent  the parent node
+  @param CharC   the edge character
+  @param Child   the child node
+**/
 STATIC
 VOID
 MakeChild (
@@ -579,21 +538,6 @@ MakeChild (
   IN UINT8 CharC,
   IN NODE  Child
   )
-/*++
-
-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)
-
---*/
 {
   NODE  Node1;
   NODE  Node2;
@@ -608,24 +552,16 @@ Returns: (VOID)
   mChildCount[Parent]++;
 }
 
-STATIC
-VOID
-Split (
-  NODE Old
-  )
-/*++
-
-Routine Description:
-
+/**
   Split a node.
 
-Arguments:
-
-  Old     - the node to split
-
-Returns: (VOID)
-
---*/
+  @param Old     the node to split
+**/
+STATIC
+VOID
+Split (
+  NODE Old
+  )
 {
   NODE  New;
   NODE  TempNode;
@@ -646,22 +582,14 @@ Returns: (VOID)
   MakeChild (New, mText[mPos + mMatchLen], mPos);
 }
 
-STATIC
-VOID
-InsertNode (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Insert string info for current position into the String Info Log
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+InsertNode (
+  VOID
+  )
 {
   NODE  NodeQ;
   NODE  NodeR;
@@ -778,23 +706,15 @@ Returns: (VOID)
 
 }
 
-STATIC
-VOID
-DeleteNode (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Delete outdated string info. (The Usage of PERC_FLAG
   ensures a clean deletion)
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+DeleteNode (
+  VOID
+  )
 {
   NODE  NodeQ;
   NODE  NodeR;
@@ -873,23 +793,15 @@ Returns: (VOID)
   mAvail          = NodeR;
 }
 
-STATIC
-VOID
-GetNextMatch (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Advance the current position (read in new data if needed).
   Delete outdated string info. Find a match string for current position.
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+GetNextMatch (
+  VOID
+  )
 {
   INT32 Number;
 
@@ -906,25 +818,17 @@ Returns: (VOID)
   InsertNode ();
 }
 
-STATIC
-EFI_STATUS
-Encode (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   The main controlling routine for compression process.
 
-Arguments: (VOID)
-
-Returns:
-
-  EFI_SUCCESS           - The compression is successful
-  EFI_OUT_0F_RESOURCES  - Not enough memory for compression process
-
---*/
+  @retval EFI_SUCCESS           The compression is successful
+  @retval EFI_OUT_0F_RESOURCES  Not enough memory for compression process
+**/
+STATIC
+EFI_STATUS
+Encode (
+  VOID
+  )
 {
   EFI_STATUS  Status;
   INT32       LastMatchLen;
@@ -996,22 +900,14 @@ Arguments: (VOID)
   return EFI_SUCCESS;
 }
 
-STATIC
-VOID
-CountTFreq (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Count the frequencies for the Extra Set
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+CountTFreq (
+  VOID
+  )
 {
   INT32 Index;
   INT32 Index3;
@@ -1053,28 +949,20 @@ Returns: (VOID)
   }
 }
 
-STATIC
-VOID
-WritePTLen (
-  IN INT32 Number,
-  IN INT32 nbit,
-  IN INT32 Special
-  )
-/*++
-
-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)
-
---*/
+  @param Number  the number of symbols
+  @param nbit    the number of bits needed to represent 'n'
+  @param Special the special symbol that needs to be take care of
+**/
+STATIC
+VOID
+WritePTLen (
+  IN INT32 Number,
+  IN INT32 nbit,
+  IN INT32 Special
+  )
 {
   INT32 Index;
   INT32 Index3;
@@ -1103,22 +991,14 @@ Returns: (VOID)
   }
 }
 
-STATIC
-VOID
-WriteCLen (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Outputs the code length array for Char&Length Set
-
-Arguments: (VOID)
-
-Returns: (VOID)
-
---*/
+**/
+STATIC
+VOID
+WriteCLen (
+  VOID
+  )
 {
   INT32 Index;
   INT32 Index3;
@@ -1193,24 +1073,14 @@ EncodeP (
   }
 }
 
-STATIC
-VOID
-SendBlock (
-  VOID
-  )
-/*++
-
-Routine Description:
-
+/**
   Huffman code the block and output it.
-
-Arguments:
-  (VOID)
-
-Returns:
-  (VOID)
-
---*/
+**/
+STATIC
+VOID
+SendBlock (
+  VOID
+  )
 {
   UINT32  Index;
   UINT32  Index2;
@@ -1281,26 +1151,18 @@ Routine Description:
   }
 }
 
+/**
+  Outputs an Original Character or a Pointer
+
+  @param CharC   The original character or the 'String Length' element of a Pointer
+  @param Pos     The 'Position' field of a Pointer
+**/
 STATIC
 VOID
 Output (
   IN UINT32 CharC,
   IN UINT32 Pos
   )
-/*++
-
-Routine Description:
-
-  Outputs an Original Character or a Pointer
-
-Arguments:
-
-  CharC     - The original character or the 'String Length' element of a Pointer
-  Pos     - The 'Position' field of a Pointer
-
-Returns: (VOID)
-
---*/
 {
   STATIC UINT32 CPos;
 
@@ -1399,26 +1261,18 @@ MakeCrcTable (
   }
 }
 
-STATIC
-VOID
-PutBits (
-  IN INT32  Number,
-  IN UINT32 Value
-  )
-/*++
-
-Routine Description:
-
+/**
   Outputs rightmost n bits of x
-
-Arguments:
-
-  Number   - the rightmost n bits of the data is used
-  x   - the data
-
-Returns: (VOID)
-
---*/
+ 
+  @param Number the rightmost n bits of the data is used
+  @param x      the data
+**/
+STATIC
+VOID
+PutBits (
+  IN INT32  Number,
+  IN UINT32 Value
+  )
 {
   UINT8 Temp;
 
@@ -1439,28 +1293,20 @@ Returns: (VOID)
   mSubBitBuf |= Value << (mBitCount -= Number);
 }
 
-STATIC
-INT32
-FreadCrc (
-  OUT UINT8 *Pointer,
-  IN  INT32 Number
-  )
-/*++
-
-Routine Description:
-
+/**
   Read in source data
 
-Arguments:
-
-  Pointer   - the buffer to hold the data
-  Number   - number of bytes to read
-
-Returns:
-
-  number of bytes actually read
-
---*/
+  @param Pointer   - the buffer to hold the data
+  @param Number   - number of bytes to read
+
+  @return number of bytes actually read
+**/
+STATIC
+INT32
+FreadCrc (
+  OUT UINT8 *Pointer,
+  IN  INT32 Number
+  )
 {
   INT32 Index;
 
@@ -1491,24 +1337,16 @@ InitPutBits (
   mSubBitBuf  = 0;
 }
 
-STATIC
-VOID
-CountLen (
-  IN INT32 Index
-  )
-/*++
-
-Routine Description:
-
+/**
   Count the number of each code length for a Huffman tree.
 
-Arguments:
-
-  Index   - the top node
-
-Returns: (VOID)
-
---*/
+  @param Index   the top node
+**/
+STATIC
+VOID
+CountLen (
+  IN INT32 Index
+  )
 {
   STATIC INT32  Depth = 0;
 
@@ -1522,26 +1360,16 @@ Returns: (VOID)
   }
 }
 
-STATIC
-VOID
-MakeLen (
-  IN INT32 Root
-  )
-/*++
-
-Routine Description:
-
+/**
   Create code length array for a Huffman tree
 
-Arguments:
-
-  Root   - the root of the tree
-
-Returns:
-
-  VOID
-
---*/
+  @param Root   the root of the tree
+**/
+STATIC
+VOID
+MakeLen (
+  IN INT32 Root
+  )
 {
   INT32   Index;
   INT32   Index3;
@@ -1616,28 +1444,20 @@ DownHeap (
   mHeap[Index] = (INT16) Index3;
 }
 
-STATIC
-VOID
-MakeCode (
-  IN  INT32       Number,
-  IN  UINT8 Len[  ],
-  OUT UINT16 Code[]
-  )
-/*++
-
-Routine Description:
-
+/**
   Assign code to each symbol based on the code length array
 
-Arguments:
-
-  Number     - number of symbols
-  Len   - the code length array
-  Code  - stores codes for each symbol
-
-Returns: (VOID)
-
---*/
+  @param Number number of symbols
+  @param Len    the code length array
+  @param Code   stores codes for each symbol
+**/
+STATIC
+VOID
+MakeCode (
+  IN  INT32       Number,
+  IN  UINT8 Len[  ],
+  OUT UINT16 Code[]
+  )
 {
   INT32   Index;
   UINT16  Start[18];
@@ -1652,32 +1472,24 @@ Returns: (VOID)
   }
 }
 
-STATIC
-INT32
-MakeTree (
-  IN  INT32            NParm,
-  IN  UINT16  FreqParm[],
-  OUT UINT8   LenParm[ ],
-  OUT UINT16  CodeParm[]
-  )
-/*++
-
-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.
-
---*/
+  @param NParm    number of symbols
+  @param FreqParm frequency of each symbol
+  @param LenParm  code length for each symbol
+  @param CodeParm code for each symbol
+
+  @return Root of the Huffman tree.
+**/
+STATIC
+INT32
+MakeTree (
+  IN  INT32            NParm,
+  IN  UINT16  FreqParm[],
+  OUT UINT8   LenParm[ ],
+  OUT UINT16  CodeParm[]
+  )
 {
   INT32 Index;
   INT32 Index2;
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with __PcdGet
  2023-02-25  0:54 [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify Rebecca Cran
  2023-02-25  0:54 ` [PATCH 1/3] BaseTools: Source/C/Common: Fix doc block locations and convert to Doxygen Rebecca Cran
@ 2023-02-25  0:54 ` Rebecca Cran
  2023-03-23 17:06   ` Rebecca Cran
  2023-03-24  4:55   ` 回复: " gaoliming
  2023-02-25  0:54 ` [PATCH 3/3] BaseTools: Run Uncrustify over files in Source/C/Common Rebecca Cran
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 9+ messages in thread
From: Rebecca Cran @ 2023-02-25  0:54 UTC (permalink / raw)
  To: devel, Bob Feng, Liming Gao, Yuwei Chen; +Cc: Rebecca Cran

Replace the duplicate __PcdSet prototype in PcdValueCommon.h
with the prototype for __PcdGet.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 BaseTools/Source/C/Common/PcdValueCommon.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h b/BaseTools/Source/C/Common/PcdValueCommon.h
index 02ef803be479..7dac5bd92dbc 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.h
+++ b/BaseTools/Source/C/Common/PcdValueCommon.h
@@ -78,13 +78,12 @@ __PcdSet (
 
   @return PCD value
 **/
-VOID
-__PcdSet (
-  CHAR8   *SkuName             OPTIONAL,
-  CHAR8   *DefaultValueName    OPTIONAL,
-  CHAR8   *TokenSpaceGuidName,
-  CHAR8   *TokenName,
-  UINT64  Value
+UINT64
+__PcdGet (
+  CHAR8  *SkuName             OPTIONAL,
+  CHAR8  *DefaultValueName    OPTIONAL,
+  CHAR8  *TokenSpaceGuidName,
+  CHAR8  *TokenName
   )
 ;
 
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] BaseTools: Run Uncrustify over files in Source/C/Common
  2023-02-25  0:54 [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify Rebecca Cran
  2023-02-25  0:54 ` [PATCH 1/3] BaseTools: Source/C/Common: Fix doc block locations and convert to Doxygen Rebecca Cran
  2023-02-25  0:54 ` [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with __PcdGet Rebecca Cran
@ 2023-02-25  0:54 ` Rebecca Cran
       [not found] ` <1746EB2C4B4E3528.29542@groups.io>
  2023-03-10  2:57 ` 回复: [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify gaoliming
  4 siblings, 0 replies; 9+ messages in thread
From: Rebecca Cran @ 2023-02-25  0:54 UTC (permalink / raw)
  To: devel, Bob Feng, Liming Gao, Yuwei Chen; +Cc: Rebecca Cran

Reformat the files in Source/C/Common by running Uncrustify
on them.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 BaseTools/Source/C/Common/BinderFuncs.h             |  27 +-
 BaseTools/Source/C/Common/CommonLib.h               | 259 +++---
 BaseTools/Source/C/Common/Crc32.h                   |   6 +-
 BaseTools/Source/C/Common/Decompress.h              |   4 +-
 BaseTools/Source/C/Common/EfiUtilityMsgs.h          |  38 +-
 BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h | 101 ++-
 BaseTools/Source/C/Common/FvLib.h                   |  51 +-
 BaseTools/Source/C/Common/MemoryFile.h              |  16 +-
 BaseTools/Source/C/Common/MyAlloc.h                 |  50 +-
 BaseTools/Source/C/Common/OsPath.h                  |  14 +-
 BaseTools/Source/C/Common/ParseGuidedSectionTools.h |  12 +-
 BaseTools/Source/C/Common/ParseInf.h                |  28 +-
 BaseTools/Source/C/Common/PcdValueCommon.h          |  22 +-
 BaseTools/Source/C/Common/PeCoffLib.h               |  66 +-
 BaseTools/Source/C/Common/SimpleFileParsing.h       |  24 +-
 BaseTools/Source/C/Common/StringFuncs.h             |  42 +-
 BaseTools/Source/C/Common/WinNtInclude.h            |  28 +-
 BaseTools/Source/C/Common/BasePeCoff.c              | 868 ++++++++++----------
 BaseTools/Source/C/Common/BinderFuncs.c             |  31 +-
 BaseTools/Source/C/Common/CommonLib.c               | 584 +++++++------
 BaseTools/Source/C/Common/Crc32.c                   |   8 +-
 BaseTools/Source/C/Common/Decompress.c              | 325 ++++----
 BaseTools/Source/C/Common/EfiCompress.c             | 679 ++++++++-------
 BaseTools/Source/C/Common/EfiUtilityMsgs.c          | 173 ++--
 BaseTools/Source/C/Common/FirmwareVolumeBuffer.c    | 617 +++++++-------
 BaseTools/Source/C/Common/FvLib.c                   | 261 +++---
 BaseTools/Source/C/Common/MemoryFile.c              |  55 +-
 BaseTools/Source/C/Common/MyAlloc.c                 | 110 +--
 BaseTools/Source/C/Common/OsPath.c                  |  91 +-
 BaseTools/Source/C/Common/ParseGuidedSectionTools.c |  54 +-
 BaseTools/Source/C/Common/ParseInf.c                | 184 +++--
 BaseTools/Source/C/Common/PcdValueCommon.c          | 315 +++----
 BaseTools/Source/C/Common/PeCoffLoaderEx.c          | 217 +++--
 BaseTools/Source/C/Common/SimpleFileParsing.c       | 325 ++++----
 BaseTools/Source/C/Common/StringFuncs.c             |  90 +-
 BaseTools/Source/C/Common/TianoCompress.c           | 477 +++++------
 36 files changed, 3269 insertions(+), 2983 deletions(-)

diff --git a/BaseTools/Source/C/Common/BinderFuncs.h b/BaseTools/Source/C/Common/BinderFuncs.h
index ceaa9cd318ff..138356d340df 100644
--- a/BaseTools/Source/C/Common/BinderFuncs.h
+++ b/BaseTools/Source/C/Common/BinderFuncs.h
@@ -22,40 +22,39 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 VOID *
 CommonLibBinderAllocate (
-  IN UINTN Size
+  IN UINTN  Size
   );
 
 VOID
 CommonLibBinderFree (
-  IN VOID *Pointer
+  IN VOID  *Pointer
   );
 
 VOID
 CommonLibBinderCopyMem (
-  IN VOID *Destination,
-  IN VOID *Source,
-  IN UINTN Length
+  IN VOID   *Destination,
+  IN VOID   *Source,
+  IN UINTN  Length
   );
 
 VOID
 CommonLibBinderSetMem (
-  IN VOID *Destination,
-  IN UINTN Length,
-  IN UINT8 Value
+  IN VOID   *Destination,
+  IN UINTN  Length,
+  IN UINT8  Value
   );
 
 INTN
 CommonLibBinderCompareMem (
-  IN VOID *MemOne,
-  IN VOID *MemTwo,
-  IN UINTN Length
+  IN VOID   *MemOne,
+  IN VOID   *MemTwo,
+  IN UINTN  Length
   );
 
 BOOLEAN
 CommonLibBinderCompareGuid (
-  IN EFI_GUID *Guid1,
-  IN EFI_GUID *Guid2
+  IN EFI_GUID  *Guid1,
+  IN EFI_GUID  *Guid2
   );
 
 #endif // #ifndef CommonLibs_h_INCLUDED
-
diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h
index a841029c2aaa..65a3c2ebd783 100644
--- a/BaseTools/Source/C/Common/CommonLib.h
+++ b/BaseTools/Source/C/Common/CommonLib.h
@@ -13,35 +13,35 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Common/BuildVersion.h>
 #include <assert.h>
 #ifndef _WIN32
-#include <limits.h>
+  #include <limits.h>
 #endif
 
 #define PRINTED_GUID_BUFFER_SIZE  37  // including null-termination
 
 #ifdef PATH_MAX
-#define MAX_LONG_FILE_PATH PATH_MAX
+#define MAX_LONG_FILE_PATH  PATH_MAX
 #else
-#define MAX_LONG_FILE_PATH 500
+#define MAX_LONG_FILE_PATH  500
 #endif
 
-#define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)
-#define MAX_UINT32 ((UINT32)0xFFFFFFFF)
+#define MAX_UINT64  ((UINT64)0xFFFFFFFFFFFFFFFFULL)
+#define MAX_UINT32  ((UINT32)0xFFFFFFFF)
 #define MAX_UINT16  ((UINT16)0xFFFF)
 #define MAX_UINT8   ((UINT8)0xFF)
-#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof ((Array)[0]))
-#define ASCII_RSIZE_MAX 1000000
+#define ARRAY_SIZE(Array)  (sizeof (Array) / sizeof ((Array)[0]))
+#define ASCII_RSIZE_MAX  1000000
 #undef RSIZE_MAX
-#define RSIZE_MAX 1000000
+#define RSIZE_MAX  1000000
 
-#define IS_COMMA(a)                ((a) == L',')
-#define IS_HYPHEN(a)               ((a) == L'-')
-#define IS_DOT(a)                  ((a) == L'.')
-#define IS_LEFT_PARENTH(a)         ((a) == L'(')
-#define IS_RIGHT_PARENTH(a)        ((a) == L')')
-#define IS_SLASH(a)                ((a) == L'/')
-#define IS_NULL(a)                 ((a) == L'\0')
+#define IS_COMMA(a)          ((a) == L',')
+#define IS_HYPHEN(a)         ((a) == L'-')
+#define IS_DOT(a)            ((a) == L'.')
+#define IS_LEFT_PARENTH(a)   ((a) == L'(')
+#define IS_RIGHT_PARENTH(a)  ((a) == L')')
+#define IS_SLASH(a)          ((a) == L'/')
+#define IS_NULL(a)           ((a) == L'\0')
 
-#define ASSERT(x) assert(x)
+#define ASSERT(x)  assert(x)
 
 #ifdef __cplusplus
 extern "C" {
@@ -82,8 +82,8 @@ CopyMem (
 
 INTN
 CompareGuid (
-  IN EFI_GUID     *Guid1,
-  IN EFI_GUID     *Guid2
+  IN EFI_GUID  *Guid1,
+  IN EFI_GUID  *Guid2
   )
 ;
 
@@ -117,64 +117,64 @@ Routine Description:
 **/
 EFI_STATUS
 PutFileImage (
-  IN CHAR8    *OutputFileName,
-  IN CHAR8    *OutputFileImage,
-  IN UINT32   BytesToWrite
+  IN CHAR8   *OutputFileName,
+  IN CHAR8   *OutputFileImage,
+  IN UINT32  BytesToWrite
   )
 ;
 
 UINT8
 CalculateChecksum8 (
-  IN UINT8        *Buffer,
-  IN UINTN        Size
+  IN UINT8  *Buffer,
+  IN UINTN  Size
   )
 ;
 
 UINT8
 CalculateSum8 (
-  IN UINT8        *Buffer,
-  IN UINTN        Size
+  IN UINT8  *Buffer,
+  IN UINTN  Size
   )
 ;
 
 UINT16
 CalculateChecksum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
+  IN UINT16  *Buffer,
+  IN UINTN   Size
   )
 ;
 
 UINT16
 CalculateSum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
+  IN UINT16  *Buffer,
+  IN UINTN   Size
   )
 ;
 
 EFI_STATUS
 PrintGuid (
-  IN EFI_GUID                     *Guid
+  IN EFI_GUID  *Guid
   )
 ;
 
 #define PRINTED_GUID_BUFFER_SIZE  37  // including null-termination
 EFI_STATUS
 PrintGuidToBuffer (
-  IN EFI_GUID     *Guid,
-  IN OUT UINT8    *Buffer,
-  IN UINT32       BufferLen,
-  IN BOOLEAN      Uppercase
+  IN EFI_GUID   *Guid,
+  IN OUT UINT8  *Buffer,
+  IN UINT32     BufferLen,
+  IN BOOLEAN    Uppercase
   )
 ;
 
 CHAR8 *
 LongFilePath (
- IN CHAR8 *FileName
-);
+  IN CHAR8  *FileName
+  );
 
 UINTN
 StrLen (
-  CONST CHAR16   *String
+  CONST CHAR16  *String
   );
 
 VOID *
@@ -185,177 +185,178 @@ AllocateCopyPool (
 
 INTN
 StrnCmp (
-  CONST CHAR16              *FirstString,
-  CONST CHAR16              *SecondString,
-  UINTN                     Length
+  CONST CHAR16  *FirstString,
+  CONST CHAR16  *SecondString,
+  UINTN         Length
   );
 
 RETURN_STATUS
 StrToGuid (
-  CONST CHAR16       *String,
-  EFI_GUID               *Guid
+  CONST CHAR16  *String,
+  EFI_GUID      *Guid
   );
 
 RETURN_STATUS
 StrHexToBytes (
-  CONST CHAR16       *String,
-  UINTN              Length,
-  UINT8              *Buffer,
-  UINTN              MaxBufferSize
+  CONST CHAR16  *String,
+  UINTN         Length,
+  UINT8         *Buffer,
+  UINTN         MaxBufferSize
   );
 
 UINTN
 InternalHexCharToUintn (
-  CHAR16                    Char
+  CHAR16  Char
   );
 
 VOID *
 InternalAllocateCopyPool (
-   UINTN            AllocationSize,
-   CONST VOID       *Buffer
+  UINTN       AllocationSize,
+  CONST VOID  *Buffer
   );
 
 BOOLEAN
 InternalIsDecimalDigitCharacter (
-        CHAR16                    Char
+  CHAR16  Char
   );
 
 UINT32
 SwapBytes32 (
-        UINT32                    Value
+  UINT32  Value
   );
 
 UINT16
 SwapBytes16 (
-        UINT16                    Value
+  UINT16  Value
   );
 
 EFI_GUID *
 CopyGuid (
-   EFI_GUID       *DestinationGuid,
-   CONST EFI_GUID  *SourceGuid
+  EFI_GUID        *DestinationGuid,
+  CONST EFI_GUID  *SourceGuid
   );
 
 UINT64
 WriteUnaligned64 (
-   UINT64                    *Buffer,
-   UINT64                    Value
+  UINT64  *Buffer,
+  UINT64  Value
   );
 
 UINT64
 ReadUnaligned64 (
-   CONST UINT64              *Buffer
+  CONST UINT64  *Buffer
   );
 
 UINTN
 StrSize (
-  CONST CHAR16              *String
+  CONST CHAR16  *String
   );
 
 UINT64
 StrHexToUint64 (
-  CONST CHAR16             *String
+  CONST CHAR16  *String
   );
 
 UINT64
 StrDecimalToUint64 (
-  CONST CHAR16              *String
+  CONST CHAR16  *String
   );
 
 RETURN_STATUS
 StrHexToUint64S (
-    CONST CHAR16       *String,
-    CHAR16             **EndPointer,
-    UINT64             *Data
+  CONST CHAR16  *String,
+  CHAR16        **EndPointer,
+  UINT64        *Data
   );
 
 RETURN_STATUS
 StrDecimalToUint64S (
-    CONST CHAR16             *String,
-         CHAR16             **EndPointer,  OPTIONAL
-         UINT64             *Data
+  CONST CHAR16 *String,
+  CHAR16 **EndPointer, OPTIONAL
+  UINT64             *Data
   );
 
 VOID *
 ReallocatePool (
-   UINTN  OldSize,
-   UINTN  NewSize,
-   VOID   *OldBuffer  OPTIONAL
+  UINTN  OldSize,
+  UINTN  NewSize,
+  VOID   *OldBuffer  OPTIONAL
   );
 
 VOID *
 InternalReallocatePool (
-   UINTN            OldSize,
-   UINTN            NewSize,
-   VOID             *OldBuffer  OPTIONAL
+  UINTN  OldSize,
+  UINTN  NewSize,
+  VOID   *OldBuffer  OPTIONAL
   );
 
 VOID *
 InternalAllocateZeroPool (
-   UINTN            AllocationSize
-  ) ;
+  UINTN  AllocationSize
+  );
 
 VOID *
 InternalAllocatePool (
-   UINTN            AllocationSize
+  UINTN  AllocationSize
   );
 
 UINTN
 StrnLenS (
-   CONST CHAR16              *String,
-   UINTN                     MaxSize
+  CONST CHAR16  *String,
+  UINTN         MaxSize
   );
 
 CHAR16
 InternalCharToUpper (
-        CHAR16                    Char
+  CHAR16  Char
   );
 
 INTN
 StrCmp (
-  CONST CHAR16              *FirstString,
-  CONST CHAR16              *SecondString
+  CONST CHAR16  *FirstString,
+  CONST CHAR16  *SecondString
   );
 
 UINT64
 SwapBytes64 (
-  UINT64                    Value
+  UINT64  Value
   );
 
 UINT64
 InternalMathSwapBytes64 (
-  UINT64                    Operand
+  UINT64  Operand
   );
 
 RETURN_STATUS
 StrToIpv4Address (
-  CONST CHAR16       *String,
-  CHAR16             **EndPointer,
-  EFI_IPv4_ADDRESS       *Address,
-  UINT8              *PrefixLength
+  CONST CHAR16      *String,
+  CHAR16            **EndPointer,
+  EFI_IPv4_ADDRESS  *Address,
+  UINT8             *PrefixLength
   );
 
 RETURN_STATUS
 StrToIpv6Address (
-  CONST CHAR16       *String,
-  CHAR16             **EndPointer,
-  EFI_IPv6_ADDRESS       *Address,
-  UINT8              *PrefixLength
+  CONST CHAR16      *String,
+  CHAR16            **EndPointer,
+  EFI_IPv6_ADDRESS  *Address,
+  UINT8             *PrefixLength
   );
 
 RETURN_STATUS
 StrCpyS (
-  CHAR16       *Destination,
-  UINTN        DestMax,
-  CONST CHAR16 *Source
+  CHAR16        *Destination,
+  UINTN         DestMax,
+  CONST CHAR16  *Source
   );
 
 RETURN_STATUS
 UnicodeStrToAsciiStrS (
-  CONST CHAR16              *Source,
-  CHAR8                     *Destination,
-  UINTN                     DestMax
+  CONST CHAR16  *Source,
+  CHAR8         *Destination,
+  UINTN         DestMax
   );
+
 VOID *
 AllocatePool (
   UINTN  AllocationSize
@@ -363,13 +364,13 @@ AllocatePool (
 
 UINT16
 WriteUnaligned16 (
-  UINT16                    *Buffer,
-  UINT16                    Value
+  UINT16  *Buffer,
+  UINT16  Value
   );
 
 UINT16
 ReadUnaligned16 (
-  CONST UINT16              *Buffer
+  CONST UINT16  *Buffer
   );
 
 VOID *
@@ -379,15 +380,15 @@ AllocateZeroPool (
 
 BOOLEAN
 InternalIsHexaDecimalDigitCharacter (
-  CHAR16                    Char
+  CHAR16  Char
   );
 
 BOOLEAN
 InternalSafeStringIsOverlap (
-  IN VOID    *Base1,
-  IN UINTN   Size1,
-  IN VOID    *Base2,
-  IN UINTN   Size2
+  IN VOID   *Base1,
+  IN UINTN  Size1,
+  IN VOID   *Base2,
+  IN UINTN  Size2
   );
 
 BOOLEAN
@@ -400,30 +401,30 @@ InternalSafeStringNoStrOverlap (
 
 BOOLEAN
 IsHexStr (
-   CHAR16   *Str
+  CHAR16  *Str
   );
 
 UINTN
 Strtoi (
-   CHAR16  *Str
+  CHAR16  *Str
   );
 
 VOID
 Strtoi64 (
-    CHAR16  *Str,
-   UINT64  *Data
+  CHAR16  *Str,
+  UINT64  *Data
   );
 
 VOID
 StrToAscii (
-       CHAR16 *Str,
-    CHAR8  **AsciiStr
+  CHAR16  *Str,
+  CHAR8   **AsciiStr
   );
 
 CHAR16 *
 SplitStr (
-    CHAR16 **List,
-       CHAR16 Separator
+  CHAR16  **List,
+  CHAR16  Separator
   );
 
 /*++
@@ -444,26 +445,34 @@ Routine Description:
 #endif
 
 #ifdef __GNUC__
-#include <stdio.h>
-#include <sys/stat.h>
-#define stricmp strcasecmp
-#define _stricmp strcasecmp
-#define strnicmp strncasecmp
-#define strcmpi strcasecmp
-size_t _filelength(int fd);
-#ifndef __CYGWIN__
-char *strlwr(char *s);
-#endif
+  #include <stdio.h>
+  #include <sys/stat.h>
+#define stricmp   strcasecmp
+#define _stricmp  strcasecmp
+#define strnicmp  strncasecmp
+#define strcmpi   strcasecmp
+size_t
+_filelength (
+  int  fd
+  );
+
+  #ifndef __CYGWIN__
+char *
+strlwr (
+  char  *s
+  );
+
+  #endif
 #endif
 
 //
 // On windows, mkdir only has one parameter.
 // On unix, it has two parameters
 //
-#if defined(__GNUC__)
-#define mkdir(dir, perm) mkdir(dir, perm)
+#if defined (__GNUC__)
+#define mkdir(dir, perm)  mkdir(dir, perm)
 #else
-#define mkdir(dir, perm) mkdir(dir)
+#define mkdir(dir, perm)  mkdir(dir)
 #endif
 
 #endif
diff --git a/BaseTools/Source/C/Common/Crc32.h b/BaseTools/Source/C/Common/Crc32.h
index 3f6b5b35fc36..a5946f961d45 100644
--- a/BaseTools/Source/C/Common/Crc32.h
+++ b/BaseTools/Source/C/Common/Crc32.h
@@ -24,9 +24,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 EFI_STATUS
 CalculateCrc32 (
-  IN  UINT8                             *Data,
-  IN  UINTN                             DataSize,
-  IN OUT UINT32                         *CrcOut
+  IN  UINT8      *Data,
+  IN  UINTN      DataSize,
+  IN OUT UINT32  *CrcOut
   )
 ;
 
diff --git a/BaseTools/Source/C/Common/Decompress.h b/BaseTools/Source/C/Common/Decompress.h
index 00a1e31b8c21..81460cf1d6c6 100644
--- a/BaseTools/Source/C/Common/Decompress.h
+++ b/BaseTools/Source/C/Common/Decompress.h
@@ -127,8 +127,8 @@ EFI_STATUS
 Extract (
   IN      VOID    *Source,
   IN      UINT32  SrcSize,
-     OUT  VOID    **Destination,
-     OUT  UINT32  *DstSize,
+  OUT  VOID       **Destination,
+  OUT  UINT32     *DstSize,
   IN      UINTN   Algorithm
   );
 
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.h b/BaseTools/Source/C/Common/EfiUtilityMsgs.h
index 85f018cbad1c..ffdac5bd9e14 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.h
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.h
@@ -14,11 +14,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 // Log message print Level
 //
-#define VERBOSE_LOG_LEVEL    15
-#define WARNING_LOG_LEVEL    15
-#define INFO_LOG_LEVEL       20
-#define KEY_LOG_LEVEL        40
-#define ERROR_LOG_LEVLE      50
+#define VERBOSE_LOG_LEVEL  15
+#define WARNING_LOG_LEVEL  15
+#define INFO_LOG_LEVEL     20
+#define KEY_LOG_LEVEL      40
+#define ERROR_LOG_LEVLE    50
 
 //
 // Status codes returned by EFI utility programs and functions
@@ -26,12 +26,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define STATUS_SUCCESS  0
 #define STATUS_WARNING  1
 #define STATUS_ERROR    2
-#define VOID void
+#define VOID            void
 
 typedef int STATUS;
 
-#define MAX_LINE_LEN               0x200
-#define MAXIMUM_INPUT_FILE_NUM     10
+#define MAX_LINE_LEN            0x200
+#define MAXIMUM_INPUT_FILE_NUM  10
 
 #ifdef __cplusplus
 extern "C" {
@@ -53,19 +53,19 @@ GetUtilityStatus (
 //
 VOID
 SetUtilityName (
-  CHAR8 *ProgramName
+  CHAR8  *ProgramName
   )
 ;
 
 VOID
 PrintMessage (
-  CHAR8   *Type,
-  CHAR8   *FileName,
-  UINT32  LineNumber,
-  UINT32  MessageCode,
-  CHAR8   *Text,
-  CHAR8   *MsgFmt,
-  va_list List
+  CHAR8    *Type,
+  CHAR8    *FileName,
+  UINT32   LineNumber,
+  UINT32   MessageCode,
+  CHAR8    *Text,
+  CHAR8    *MsgFmt,
+  va_list  List
   );
 
 VOID
@@ -103,19 +103,19 @@ DebugMsg (
 
 VOID
 VerboseMsg (
-  CHAR8   *MsgFmt,
+  CHAR8  *MsgFmt,
   ...
   );
 
 VOID
 NormalMsg (
-  CHAR8   *MsgFmt,
+  CHAR8  *MsgFmt,
   ...
   );
 
 VOID
 KeyMsg (
-  CHAR8   *MsgFmt,
+  CHAR8  *MsgFmt,
   ...
   );
 
diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h b/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h
index 6b1caba993dc..c725a6c4145d 100644
--- a/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h
+++ b/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h
@@ -15,149 +15,148 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 EFI_STATUS
 FvBufAddFile (
-  IN OUT VOID *Fv,
-  IN VOID *File
+  IN OUT VOID  *Fv,
+  IN VOID      *File
   );
 
 EFI_STATUS
 FvBufAddFileWithExtend (
-  IN OUT VOID **Fv,
-  IN VOID *File
+  IN OUT VOID  **Fv,
+  IN VOID      *File
   );
 
 EFI_STATUS
 FvBufAddVtfFile (
-  IN OUT VOID *Fv,
-  IN VOID *File
+  IN OUT VOID  *Fv,
+  IN VOID      *File
   );
 
 EFI_STATUS
 FvBufChecksumFile (
-  IN OUT VOID *FfsFile
+  IN OUT VOID  *FfsFile
   );
 
 EFI_STATUS
 FvBufChecksumHeader (
-  IN OUT VOID *Fv
+  IN OUT VOID  *Fv
   );
 
 EFI_STATUS
 FvBufClearAllFiles (
-  IN OUT VOID *Fv
+  IN OUT VOID  *Fv
   );
 
 VOID
 FvBufCompact3ByteSize (
-  OUT VOID* SizeDest,
-  IN UINT32 Size
+  OUT VOID   *SizeDest,
+  IN UINT32  Size
   );
 
 EFI_STATUS
 FvBufCountSections (
-  IN VOID* FfsFile,
-  IN UINTN* Count
+  IN VOID   *FfsFile,
+  IN UINTN  *Count
   );
 
 EFI_STATUS
 FvBufDuplicate (
-  IN VOID *SourceFv,
-  IN OUT VOID **DestinationFv
+  IN VOID      *SourceFv,
+  IN OUT VOID  **DestinationFv
   );
 
 UINT32
 FvBufExpand3ByteSize (
-  IN VOID* Size
+  IN VOID  *Size
   );
 
 UINT32
 FvBufGetFfsFileSize (
-  IN EFI_FFS_FILE_HEADER *Ffs
+  IN EFI_FFS_FILE_HEADER  *Ffs
   );
 
 UINT32
 FvBufGetFfsHeaderSize (
-  IN EFI_FFS_FILE_HEADER *Ffs
+  IN EFI_FFS_FILE_HEADER  *Ffs
   );
 
 EFI_STATUS
 FvBufExtend (
-  IN VOID **Fv,
-  IN UINTN Size
+  IN VOID   **Fv,
+  IN UINTN  Size
   );
 
 EFI_STATUS
 FvBufFindFileByName (
-  IN VOID *Fv,
-  IN EFI_GUID *Name,
-  OUT VOID **File
+  IN VOID      *Fv,
+  IN EFI_GUID  *Name,
+  OUT VOID     **File
   );
 
 EFI_STATUS
 FvBufFindFileByType (
-  IN VOID *Fv,
-  IN EFI_FV_FILETYPE Type,
-  OUT VOID **File
+  IN VOID             *Fv,
+  IN EFI_FV_FILETYPE  Type,
+  OUT VOID            **File
   );
 
 EFI_STATUS
 FvBufFindNextFile (
-  IN VOID *Fv,
-  IN OUT UINTN *Key,
-  OUT VOID **File
+  IN VOID       *Fv,
+  IN OUT UINTN  *Key,
+  OUT VOID      **File
   );
 
 EFI_STATUS
 FvBufFindNextSection (
-  IN VOID *SectionsStart,
-  IN UINTN TotalSectionsSize,
-  IN OUT UINTN *Key,
-  OUT VOID **Section
+  IN VOID       *SectionsStart,
+  IN UINTN      TotalSectionsSize,
+  IN OUT UINTN  *Key,
+  OUT VOID      **Section
   );
 
 EFI_STATUS
 FvBufFindSectionByType (
-  IN VOID *FfsFile,
-  IN UINT8 Type,
-  OUT VOID **Section
+  IN VOID   *FfsFile,
+  IN UINT8  Type,
+  OUT VOID  **Section
   );
 
 EFI_STATUS
 FvBufGetFileRawData (
-  IN  VOID*     FfsFile,
-  OUT VOID**    RawData,
-  OUT UINTN*    RawDataSize
+  IN  VOID   *FfsFile,
+  OUT VOID   **RawData,
+  OUT UINTN  *RawDataSize
   );
 
 EFI_STATUS
 FvBufGetSize (
-  IN VOID *Fv,
-  OUT UINTN *Size
+  IN VOID    *Fv,
+  OUT UINTN  *Size
   );
 
 EFI_STATUS
 FvBufPackageFreeformRawFile (
-  IN EFI_GUID*  Filename,
-  IN VOID*      RawData,
-  IN UINTN      RawDataSize,
-  OUT VOID**    FfsFile
+  IN EFI_GUID  *Filename,
+  IN VOID      *RawData,
+  IN UINTN     RawDataSize,
+  OUT VOID     **FfsFile
   );
 
 EFI_STATUS
 FvBufRemoveFile (
-  IN OUT VOID *Fv,
-  IN EFI_GUID *Name
+  IN OUT VOID  *Fv,
+  IN EFI_GUID  *Name
   );
 
 EFI_STATUS
 FvBufUnifyBlockSizes (
-  IN OUT VOID *Fv,
-  IN UINTN BlockSize
+  IN OUT VOID  *Fv,
+  IN UINTN     BlockSize
   );
 
 EFI_STATUS
 FvBufShrinkWrap (
-  IN VOID *Fv
+  IN VOID  *Fv
   );
 
 #endif // #ifndef FirmwareVolumeBuffer_h_INCLUDED
-
diff --git a/BaseTools/Source/C/Common/FvLib.h b/BaseTools/Source/C/Common/FvLib.h
index 815df6f802c4..f27888a14da0 100644
--- a/BaseTools/Source/C/Common/FvLib.h
+++ b/BaseTools/Source/C/Common/FvLib.h
@@ -20,8 +20,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 EFI_STATUS
 InitializeFvLib (
-  IN VOID                         *Fv,
-  IN UINT32                       FvLength
+  IN VOID    *Fv,
+  IN UINT32  FvLength
   )
 ;
 
@@ -34,71 +34,72 @@ GetFvHeader (
 
 EFI_STATUS
 GetNextFile (
-  IN EFI_FFS_FILE_HEADER          *CurrentFile,
-  OUT EFI_FFS_FILE_HEADER         **NextFile
+  IN EFI_FFS_FILE_HEADER   *CurrentFile,
+  OUT EFI_FFS_FILE_HEADER  **NextFile
   )
 ;
 
 EFI_STATUS
 GetFileByName (
-  IN EFI_GUID                     *FileName,
-  OUT EFI_FFS_FILE_HEADER         **File
+  IN EFI_GUID              *FileName,
+  OUT EFI_FFS_FILE_HEADER  **File
   )
 ;
 
 EFI_STATUS
 GetFileByType (
-  IN EFI_FV_FILETYPE              FileType,
-  IN UINTN                        Instance,
-  OUT EFI_FFS_FILE_HEADER         **File
+  IN EFI_FV_FILETYPE       FileType,
+  IN UINTN                 Instance,
+  OUT EFI_FFS_FILE_HEADER  **File
   )
 ;
 
 EFI_STATUS
 GetSectionByType (
-  IN EFI_FFS_FILE_HEADER          *File,
-  IN EFI_SECTION_TYPE             SectionType,
-  IN UINTN                        Instance,
-  OUT EFI_FILE_SECTION_POINTER    *Section
+  IN EFI_FFS_FILE_HEADER        *File,
+  IN EFI_SECTION_TYPE           SectionType,
+  IN UINTN                      Instance,
+  OUT EFI_FILE_SECTION_POINTER  *Section
   )
 ;
+
 //
 // will not parse compressed sections
 //
 EFI_STATUS
 VerifyFv (
-  IN EFI_FIRMWARE_VOLUME_HEADER   *FvHeader
+  IN EFI_FIRMWARE_VOLUME_HEADER  *FvHeader
   )
 ;
 
 EFI_STATUS
 VerifyFfsFile (
-  IN EFI_FFS_FILE_HEADER          *FfsHeader
+  IN EFI_FFS_FILE_HEADER  *FfsHeader
   )
 ;
 
 UINT32
 GetFfsFileLength (
-  EFI_FFS_FILE_HEADER *FfsHeader
+  EFI_FFS_FILE_HEADER  *FfsHeader
   )
 ;
 
 UINT32
 GetSectionFileLength (
-  EFI_COMMON_SECTION_HEADER *SectionHeader
+  EFI_COMMON_SECTION_HEADER  *SectionHeader
   )
 ;
 
 UINT32
-GetFfsHeaderLength(
-   IN EFI_FFS_FILE_HEADER *FfsHeader
-   )
+GetFfsHeaderLength (
+  IN EFI_FFS_FILE_HEADER  *FfsHeader
+  )
 ;
 
 UINT32
-GetSectionHeaderLength(
-   IN EFI_COMMON_SECTION_HEADER *SectionHeader
-   )
+GetSectionHeaderLength (
+  IN EFI_COMMON_SECTION_HEADER  *SectionHeader
+  )
 ;
 
 /*++
@@ -120,7 +121,7 @@ Routine Description:
 --*/
 UINT32
 GetLength (
-  UINT8                           *ThreeByteLength
+  UINT8  *ThreeByteLength
   )
 ;
 
@@ -141,7 +142,7 @@ Routine Description:
 --*/
 EFI_STATUS
 GetErasePolarity (
-  OUT BOOLEAN   *ErasePolarity
+  OUT BOOLEAN  *ErasePolarity
   )
 ;
 
diff --git a/BaseTools/Source/C/Common/MemoryFile.h b/BaseTools/Source/C/Common/MemoryFile.h
index c84848cf15d6..309aa57ed000 100644
--- a/BaseTools/Source/C/Common/MemoryFile.h
+++ b/BaseTools/Source/C/Common/MemoryFile.h
@@ -17,12 +17,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // Common data structures
 //
 typedef struct {
-  CHAR8 *FileImage;
-  CHAR8 *Eof;
-  CHAR8 *CurrentFilePointer;
+  CHAR8    *FileImage;
+  CHAR8    *Eof;
+  CHAR8    *CurrentFilePointer;
 } MEMORY_FILE;
 
-
 //
 // Functions declarations
 //
@@ -39,8 +38,8 @@ typedef struct {
 **/
 EFI_STATUS
 GetMemoryFile (
-  IN CHAR8       *InputFileName,
-  OUT EFI_HANDLE *OutputMemoryFile
+  IN CHAR8        *InputFileName,
+  OUT EFI_HANDLE  *OutputMemoryFile
   )
 ;
 
@@ -53,7 +52,7 @@ GetMemoryFile (
 **/
 EFI_STATUS
 FreeMemoryFile (
-  IN EFI_HANDLE InputMemoryFile
+  IN EFI_HANDLE  InputMemoryFile
   )
 ;
 
@@ -71,9 +70,8 @@ FreeMemoryFile (
 **/
 CHAR8 *
 ReadMemoryFileLine (
-  IN EFI_HANDLE     InputMemoryFile
+  IN EFI_HANDLE  InputMemoryFile
   )
 ;
 
-
 #endif
diff --git a/BaseTools/Source/C/Common/MyAlloc.h b/BaseTools/Source/C/Common/MyAlloc.h
index de3323d30d97..3bdaeb63d485 100644
--- a/BaseTools/Source/C/Common/MyAlloc.h
+++ b/BaseTools/Source/C/Common/MyAlloc.h
@@ -22,29 +22,29 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // your project.
 //
 #ifndef USE_MYALLOC
-#define USE_MYALLOC 1
+#define USE_MYALLOC  1
 #endif
 
 #if USE_MYALLOC
 //
 // Replace C library allocation routines with MyAlloc routines.
 //
-#define malloc(size)        MyAlloc ((size), __FILE__, __LINE__)
-#define calloc(count, size) MyAlloc ((count) * (size), __FILE__, __LINE__)
-#define realloc(ptr, size)  MyRealloc ((ptr), (size), __FILE__, __LINE__)
-#define free(ptr)           MyFree ((ptr), __FILE__, __LINE__)
-#define alloc_check(final)  MyCheck ((final), __FILE__, __LINE__)
+#define malloc(size)         MyAlloc ((size), __FILE__, __LINE__)
+#define calloc(count, size)  MyAlloc ((count) * (size), __FILE__, __LINE__)
+#define realloc(ptr, size)   MyRealloc ((ptr), (size), __FILE__, __LINE__)
+#define free(ptr)            MyFree ((ptr), __FILE__, __LINE__)
+#define alloc_check(final)   MyCheck ((final), __FILE__, __LINE__)
 
 //
 // Structure for checking/tracking memory allocations.
 //
 typedef struct MyAllocStruct {
-  UINTN                 Cksum;
-  struct MyAllocStruct  *Next;
-  UINTN                 Line;
-  UINTN                 Size;
-  UINT8                 *File;
-  UINT8                 *Buffer;
+  UINTN                   Cksum;
+  struct MyAllocStruct    *Next;
+  UINTN                   Line;
+  UINTN                   Size;
+  UINT8                   *File;
+  UINT8                   *Buffer;
 } MY_ALLOC_STRUCT;
 //
 // Cksum := (UINTN)This + (UINTN)Next + Line + Size + (UINTN)File +
@@ -84,9 +84,9 @@ typedef struct MyAllocStruct {
 **/
 VOID
 MyCheck (
-  BOOLEAN      Final,
-  UINT8        File[],
-  UINTN        Line
+  BOOLEAN  Final,
+  UINT8    File[],
+  UINTN    Line
   )
 ;
 
@@ -105,9 +105,9 @@ MyCheck (
 **/
 VOID  *
 MyAlloc (
-  UINTN      Size,
-  UINT8      File[],
-  UINTN      Line
+  UINTN  Size,
+  UINT8  File[],
+  UINTN  Line
   )
 ;
 
@@ -126,10 +126,10 @@ MyAlloc (
 **/
 VOID  *
 MyRealloc (
-  VOID       *Ptr,
-  UINTN      Size,
-  UINT8      File[],
-  UINTN      Line
+  VOID   *Ptr,
+  UINTN  Size,
+  UINT8  File[],
+  UINTN  Line
   )
 ;
 
@@ -144,9 +144,9 @@ MyRealloc (
 **/
 VOID
 MyFree (
-  VOID       *Ptr,
-  UINT8      File[],
-  UINTN      Line
+  VOID   *Ptr,
+  UINT8  File[],
+  UINTN  Line
   )
 ;
 
diff --git a/BaseTools/Source/C/Common/OsPath.h b/BaseTools/Source/C/Common/OsPath.h
index b1881c4a1ec7..c776901280ac 100644
--- a/BaseTools/Source/C/Common/OsPath.h
+++ b/BaseTools/Source/C/Common/OsPath.h
@@ -33,9 +33,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @return NULL if error
 **/
-CHAR8*
+CHAR8 *
 OsPathDirName (
-  IN CHAR8    *FilePath
+  IN CHAR8  *FilePath
   )
 ;
 
@@ -54,7 +54,7 @@ OsPathDirName (
 **/
 VOID
 OsPathNormPathInPlace (
-  IN CHAR8    *Path
+  IN CHAR8  *Path
   )
 ;
 
@@ -73,10 +73,10 @@ OsPathNormPathInPlace (
 
   @return A CHAR8* string, which must be freed by the caller
 **/
-CHAR8*
+CHAR8 *
 OsPathPeerFilePath (
-  IN CHAR8    *OldPath,
-  IN CHAR8    *Peer
+  IN CHAR8  *OldPath,
+  IN CHAR8  *Peer
   )
 ;
 
@@ -90,7 +90,7 @@ OsPathPeerFilePath (
 **/
 BOOLEAN
 OsPathExists (
-  IN CHAR8    *InputFileName
+  IN CHAR8  *InputFileName
   )
 ;
 
diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.h b/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
index 2180bbd0740f..22fa5948fee4 100644
--- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
+++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
@@ -29,7 +29,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 EFI_HANDLE
 ParseGuidedSectionToolsFile (
-  IN CHAR8    *InputFile
+  IN CHAR8  *InputFile
   )
 ;
 
@@ -47,7 +47,7 @@ ParseGuidedSectionToolsFile (
 **/
 EFI_HANDLE
 ParseGuidedSectionToolsMemoryFile (
-  IN EFI_HANDLE    InputFile
+  IN EFI_HANDLE  InputFile
   )
 ;
 
@@ -62,10 +62,10 @@ ParseGuidedSectionToolsMemoryFile (
   @retval Non-NULL The tool to use to access the section contents.  (The caller
              must free the memory associated with this string.)
 **/
-CHAR8*
+CHAR8 *
 LookupGuidedSectionToolPath (
-  IN EFI_HANDLE ParsedGuidedSectionToolsHandle,
-  IN EFI_GUID   *SectionGuid
+  IN EFI_HANDLE  ParsedGuidedSectionToolsHandle,
+  IN EFI_GUID    *SectionGuid
   )
 ;
 
@@ -80,7 +80,7 @@ LookupGuidedSectionToolPath (
 **/
 EFI_STATUS
 FreeParsedGuidedSectionToolsHandle (
-  IN EFI_HANDLE ParsedGuidedSectionToolsHandle
+  IN EFI_HANDLE  ParsedGuidedSectionToolsHandle
   )
 ;
 
diff --git a/BaseTools/Source/C/Common/ParseInf.h b/BaseTools/Source/C/Common/ParseInf.h
index a0881a5c9ed0..aa612f6fb730 100644
--- a/BaseTools/Source/C/Common/ParseInf.h
+++ b/BaseTools/Source/C/Common/ParseInf.h
@@ -38,9 +38,9 @@ extern "C" {
 **/
 CHAR8 *
 ReadLine (
-  IN MEMORY_FILE    *InputFile,
-  IN OUT CHAR8      *InputBuffer,
-  IN UINTN          MaxLength
+  IN MEMORY_FILE  *InputFile,
+  IN OUT CHAR8    *InputBuffer,
+  IN UINTN        MaxLength
   )
 ;
 
@@ -56,8 +56,8 @@ ReadLine (
 **/
 BOOLEAN
 FindSection (
-  IN MEMORY_FILE    *InputFile,
-  IN CHAR8          *Section
+  IN MEMORY_FILE  *InputFile,
+  IN CHAR8        *Section
   )
 ;
 
@@ -78,11 +78,11 @@ FindSection (
 **/
 EFI_STATUS
 FindToken (
-  IN MEMORY_FILE    *InputFile,
-  IN CHAR8          *Section,
-  IN CHAR8          *Token,
-  IN UINTN          Instance,
-  OUT CHAR8         *Value
+  IN MEMORY_FILE  *InputFile,
+  IN CHAR8        *Section,
+  IN CHAR8        *Token,
+  IN UINTN        Instance,
+  OUT CHAR8       *Value
   )
 ;
 
@@ -98,8 +98,8 @@ FindToken (
 **/
 EFI_STATUS
 StringToGuid (
-  IN CHAR8        *AsciiGuidBuffer,
-  OUT EFI_GUID    *GuidBuffer
+  IN CHAR8      *AsciiGuidBuffer,
+  OUT EFI_GUID  *GuidBuffer
   )
 ;
 
@@ -152,8 +152,8 @@ ReadLineInStream (
 **/
 BOOLEAN
 FindSectionInStream (
-  IN FILE       *InputFile,
-  IN CHAR8      *Section
+  IN FILE   *InputFile,
+  IN CHAR8  *Section
   )
 ;
 
diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h b/BaseTools/Source/C/Common/PcdValueCommon.h
index 7dac5bd92dbc..3f4d35cf8f71 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.h
+++ b/BaseTools/Source/C/Common/PcdValueCommon.h
@@ -12,16 +12,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Common/UefiBaseTypes.h>
 #include <Common/UefiInternalFormRepresentation.h>
 
-#define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field)
-#define __ARRAY_ELEMENT_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field[0])
-#define __OFFSET_OF(TYPE, Field) ((UINT32)(size_t) &(((TYPE *)0)->Field))
-#define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex)   if (__FIELD_SIZE(TYPE, Field) == 0) Size = MAX((__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_SIZE(TYPE, Field) * (MaxIndex)), Size)
-#define __ARRAY_SIZE(Array) (sizeof(Array)/sizeof(Array[0]))
+#define __FIELD_SIZE(TYPE, Field)                     (sizeof((TYPE *)0)->Field)
+#define __ARRAY_ELEMENT_SIZE(TYPE, Field)             (sizeof((TYPE *)0)->Field[0])
+#define __OFFSET_OF(TYPE, Field)                      ((UINT32)(size_t) &(((TYPE *)0)->Field))
+#define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex)  if (__FIELD_SIZE(TYPE, Field) == 0) Size = MAX((__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_SIZE(TYPE, Field) * (MaxIndex)), Size)
+#define __ARRAY_SIZE(Array)                           (sizeof(Array)/sizeof(Array[0]))
 
-#if defined(_MSC_EXTENSIONS)
-#define __STATIC_ASSERT static_assert
+#if defined (_MSC_EXTENSIONS)
+#define __STATIC_ASSERT  static_assert
 #else
-#define __STATIC_ASSERT _Static_assert
+#define __STATIC_ASSERT  _Static_assert
 #endif
 
 /**
@@ -129,9 +129,9 @@ __PcdSetPtr (
   )
 ;
 
-#define PcdGet(A, B, C, D)  __PcdGet(#A, #B, #C, #D)
-#define PcdSet(A, B, C, D, Value)  __PcdSet(#A, #B, #C, #D, Value)
-#define PcdGetPtr(A, B, C, D, Size)  __PcdGetPtr(#A, #B, #C, #D, Size)
+#define PcdGet(A, B, C, D)                  __PcdGet(#A, #B, #C, #D)
+#define PcdSet(A, B, C, D, Value)           __PcdSet(#A, #B, #C, #D, Value)
+#define PcdGetPtr(A, B, C, D, Size)         __PcdGetPtr(#A, #B, #C, #D, Size)
 #define PcdSetPtr(A, B, C, D, Size, Value)  __PcdSetPtr(#A, #B, #C, #D, Size, Value)
 
 #endif
diff --git a/BaseTools/Source/C/Common/PeCoffLib.h b/BaseTools/Source/C/Common/PeCoffLib.h
index dd38f442f952..0da434fc19f6 100644
--- a/BaseTools/Source/C/Common/PeCoffLib.h
+++ b/BaseTools/Source/C/Common/PeCoffLib.h
@@ -29,9 +29,9 @@
 //
 // Macro definitions for RISC-V architecture.
 //
-#define RV_X(x, s, n) (((x) >> (s)) & ((1<<(n))-1))
-#define RISCV_IMM_BITS 12
-#define RISCV_IMM_REACH (1LL<<RISCV_IMM_BITS)
+#define RV_X(x, s, n)  (((x) >> (s)) & ((1<<(n))-1))
+#define RISCV_IMM_BITS   12
+#define RISCV_IMM_REACH  (1LL<<RISCV_IMM_BITS)
 #define RISCV_CONST_HIGH_PART(VALUE) \
   (((VALUE) + (RISCV_IMM_REACH/2)) & ~(RISCV_IMM_REACH-1))
 
@@ -40,7 +40,7 @@
 //
 typedef
 RETURN_STATUS
-(EFIAPI *PE_COFF_LOADER_READ_FILE) (
+(EFIAPI *PE_COFF_LOADER_READ_FILE)(
   IN     VOID   *FileHandle,
   IN     UINTN  FileOffset,
   IN OUT UINTN  *ReadSize,
@@ -51,30 +51,29 @@ RETURN_STATUS
 // Context structure used while PE/COFF image is being loaded and relocated
 //
 typedef struct {
-  PHYSICAL_ADDRESS                  ImageAddress;
-  UINT64                            ImageSize;
-  PHYSICAL_ADDRESS                  DestinationAddress;
-  PHYSICAL_ADDRESS                  EntryPoint;
-  PE_COFF_LOADER_READ_FILE          ImageRead;
-  VOID                              *Handle;
-  VOID                              *FixupData;
-  UINT32                            SectionAlignment;
-  UINT32                            PeCoffHeaderOffset;
-  UINT32                            DebugDirectoryEntryRva;
-  VOID                              *CodeView;
-  CHAR8                             *PdbPointer;
-  UINTN                             SizeOfHeaders;
-  UINT32                            ImageCodeMemoryType;
-  UINT32                            ImageDataMemoryType;
-  UINT32                            ImageError;
-  UINTN                             FixupDataSize;
-  UINT16                            Machine;
-  UINT16                            ImageType;
-  BOOLEAN                           RelocationsStripped;
-  BOOLEAN                           IsTeImage;
+  PHYSICAL_ADDRESS            ImageAddress;
+  UINT64                      ImageSize;
+  PHYSICAL_ADDRESS            DestinationAddress;
+  PHYSICAL_ADDRESS            EntryPoint;
+  PE_COFF_LOADER_READ_FILE    ImageRead;
+  VOID                        *Handle;
+  VOID                        *FixupData;
+  UINT32                      SectionAlignment;
+  UINT32                      PeCoffHeaderOffset;
+  UINT32                      DebugDirectoryEntryRva;
+  VOID                        *CodeView;
+  CHAR8                       *PdbPointer;
+  UINTN                       SizeOfHeaders;
+  UINT32                      ImageCodeMemoryType;
+  UINT32                      ImageDataMemoryType;
+  UINT32                      ImageError;
+  UINTN                       FixupDataSize;
+  UINT16                      Machine;
+  UINT16                      ImageType;
+  BOOLEAN                     RelocationsStripped;
+  BOOLEAN                     IsTeImage;
 } PE_COFF_LOADER_IMAGE_CONTEXT;
 
-
 /**
   Retrieves information on a PE/COFF image
 
@@ -162,7 +161,7 @@ PeCoffLoaderGetEntryPoint (
 UINT16
 EFIAPI
 ThumbMovtImmediateAddress (
-  IN UINT16 *Instruction
+  IN UINT16  *Instruction
   );
 
 /**
@@ -175,11 +174,10 @@ ThumbMovtImmediateAddress (
 VOID
 EFIAPI
 ThumbMovtImmediatePatch (
-  IN OUT UINT16 *Instruction,
-  IN     UINT16 Address
+  IN OUT UINT16  *Instruction,
+  IN     UINT16  Address
   );
 
-
 /**
   Pass in a pointer to an ARM MOVW/MOVT instruction pair and
   return the immediate data encoded in the two` instruction
@@ -192,7 +190,7 @@ ThumbMovtImmediatePatch (
 UINT32
 EFIAPI
 ThumbMovwMovtImmediateAddress (
-  IN UINT16 *Instructions
+  IN UINT16  *Instructions
   );
 
 /**
@@ -204,10 +202,8 @@ ThumbMovwMovtImmediateAddress (
 VOID
 EFIAPI
 ThumbMovwMovtImmediatePatch (
-  IN OUT UINT16 *Instructions,
-  IN     UINT32 Address
+  IN OUT UINT16  *Instructions,
+  IN     UINT32  Address
   );
 
-
-
 #endif
diff --git a/BaseTools/Source/C/Common/SimpleFileParsing.h b/BaseTools/Source/C/Common/SimpleFileParsing.h
index 2fc52a6c016c..de9e14551345 100644
--- a/BaseTools/Source/C/Common/SimpleFileParsing.h
+++ b/BaseTools/Source/C/Common/SimpleFileParsing.h
@@ -19,19 +19,19 @@ SFPInit (
 
 STATUS
 SFPOpenFile (
-  CHAR8    *FileName
+  CHAR8  *FileName
   )
 ;
 
 BOOLEAN
 SFPIsKeyword (
-  CHAR8 *Str
+  CHAR8  *Str
   )
 ;
 
 BOOLEAN
 SFPIsToken (
-  CHAR8 *Str
+  CHAR8  *Str
   )
 ;
 
@@ -44,36 +44,36 @@ SFPGetNextToken (
 
 BOOLEAN
 SFPGetGuidToken (
-  CHAR8 *Str,
-  UINT32 Len
+  CHAR8   *Str,
+  UINT32  Len
   )
 ;
 
-#define PARSE_GUID_STYLE_5_FIELDS 0
+#define PARSE_GUID_STYLE_5_FIELDS  0
 
 BOOLEAN
 SFPGetGuid (
-  INTN        GuidStyle,
-  EFI_GUID    *Value
+  INTN      GuidStyle,
+  EFI_GUID  *Value
   )
 ;
 
 BOOLEAN
 SFPSkipToToken (
-  CHAR8 *Str
+  CHAR8  *Str
   )
 ;
 
 BOOLEAN
 SFPGetNumber (
-  UINTN   *Value
+  UINTN  *Value
   )
 ;
 
 BOOLEAN
 SFPGetQuotedString (
-  CHAR8      *Str,
-  INTN       Length
+  CHAR8  *Str,
+  INTN   Length
   )
 ;
 
diff --git a/BaseTools/Source/C/Common/StringFuncs.h b/BaseTools/Source/C/Common/StringFuncs.h
index 23dce2724448..d9f3099a6fcf 100644
--- a/BaseTools/Source/C/Common/StringFuncs.h
+++ b/BaseTools/Source/C/Common/StringFuncs.h
@@ -17,14 +17,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // Common data structures
 //
 typedef struct {
-  UINTN      Count;
+  UINTN    Count;
   //
   // Actually this array can be 0 or more items (based on Count)
   //
-  CHAR8*     Strings[1];
+  CHAR8    *Strings[1];
 } STRING_LIST;
 
-
 //
 // Functions declarations
 //
@@ -36,9 +35,9 @@ typedef struct {
 
   @return CHAR8* - NULL if there are not enough resources
 **/
-CHAR8*
+CHAR8 *
 CloneString (
-  IN CHAR8       *String
+  IN CHAR8  *String
   )
 ;
 
@@ -51,7 +50,7 @@ CloneString (
 **/
 EFI_STATUS
 StripInfDscStringInPlace (
-  IN CHAR8       *String
+  IN CHAR8  *String
   )
 ;
 
@@ -63,9 +62,9 @@ StripInfDscStringInPlace (
 
   @return EFI_STATUS
 **/
-STRING_LIST*
+STRING_LIST *
 SplitStringByWhitespace (
-  IN CHAR8       *String
+  IN CHAR8  *String
   )
 ;
 
@@ -74,12 +73,11 @@ SplitStringByWhitespace (
 
   @return STRING_LIST* - Null if there is not enough resources to create the object.
 **/
-STRING_LIST*
+STRING_LIST *
 NewStringList (
   )
 ;
 
-
 /**
   Adds String to StringList.  A new copy of String is made before it is
   added to StringList.
@@ -88,8 +86,8 @@ NewStringList (
 **/
 EFI_STATUS
 AppendCopyOfStringToList (
-  IN OUT STRING_LIST **StringList,
-  IN CHAR8       *String
+  IN OUT STRING_LIST  **StringList,
+  IN CHAR8            *String
   )
 ;
 
@@ -103,11 +101,10 @@ AppendCopyOfStringToList (
 **/
 EFI_STATUS
 RemoveLastStringFromList (
-  IN STRING_LIST       *StringList
+  IN STRING_LIST  *StringList
   )
 ;
 
-
 /**
   Allocates a STRING_LIST structure that can store StringCount strings.
 
@@ -115,13 +112,12 @@ RemoveLastStringFromList (
 
   @return EFI_STATUS
 **/
-STRING_LIST*
+STRING_LIST *
 AllocateStringListStruct (
-  IN UINTN StringCount
+  IN UINTN  StringCount
   )
 ;
 
-
 /**
   Frees all memory associated with StringList.
 
@@ -131,11 +127,10 @@ AllocateStringListStruct (
 **/
 VOID
 FreeStringList (
-  IN STRING_LIST       *StringList
+  IN STRING_LIST  *StringList
   )
 ;
 
-
 /**
   Generates a string that represents the STRING_LIST
 
@@ -144,13 +139,12 @@ FreeStringList (
   @return CHAR8* The string list represented with a single string.  The returned
            string must be freed by the caller.
 **/
-CHAR8*
+CHAR8 *
 StringListToString (
-  IN STRING_LIST       *StringList
+  IN STRING_LIST  *StringList
   )
 ;
 
-
 /**
   Prints out the string list
 
@@ -158,10 +152,8 @@ StringListToString (
 **/
 VOID
 PrintStringList (
-  IN STRING_LIST       *StringList
+  IN STRING_LIST  *StringList
   )
 ;
 
-
-
 #endif
diff --git a/BaseTools/Source/C/Common/WinNtInclude.h b/BaseTools/Source/C/Common/WinNtInclude.h
index 181e6ac33370..6e8621d1471c 100644
--- a/BaseTools/Source/C/Common/WinNtInclude.h
+++ b/BaseTools/Source/C/Common/WinNtInclude.h
@@ -9,14 +9,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #ifndef __WIN_NT_INCLUDE_H__
 #define __WIN_NT_INCLUDE_H__
 
-#define GUID  _WINNT_DUP_GUID_____
+#define GUID         _WINNT_DUP_GUID_____
 #define _LIST_ENTRY  _WINNT_DUP_LIST_ENTRY_FORWARD
 #define LIST_ENTRY   _WINNT_DUP_LIST_ENTRY
 
 #if (_MSC_VER < 1800)
-#define InterlockedIncrement _WINNT_DUP_InterlockedIncrement
-#define InterlockedDecrement _WINNT_DUP_InterlockedDecrement
-#define InterlockedCompareExchange64 _WINNT_DUP_InterlockedCompareExchange64
+#define InterlockedIncrement          _WINNT_DUP_InterlockedIncrement
+#define InterlockedDecrement          _WINNT_DUP_InterlockedDecrement
+#define InterlockedCompareExchange64  _WINNT_DUP_InterlockedCompareExchange64
 #endif
 
 #undef UNALIGNED
@@ -24,7 +24,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #undef VOID
 
 #ifndef __GNUC__
-#include "windows.h"
+  #include "windows.h"
 
 //
 // Win32 include files do not compile clean with /W4, so we use the warning
@@ -32,18 +32,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // compile at /W4 (highest warning level) with /WX (warnings cause build
 // errors).
 //
-#pragma warning(disable : 4115)
-#pragma warning(disable : 4201)
-#pragma warning(disable : 4214)
-#pragma warning(disable : 4028)
-#pragma warning(disable : 4133)
+  #pragma warning(disable : 4115)
+  #pragma warning(disable : 4201)
+  #pragma warning(disable : 4214)
+  #pragma warning(disable : 4028)
+  #pragma warning(disable : 4133)
 
 //
 // Set the warnings back on as the EFI code must be /W4.
 //
-#pragma warning(default : 4115)
-#pragma warning(default : 4201)
-#pragma warning(default : 4214)
+  #pragma warning(default : 4115)
+  #pragma warning(default : 4201)
+  #pragma warning(default : 4214)
 
 #endif
 
@@ -55,7 +55,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #undef InterlockedCompareExchange64
 #undef InterlockedCompareExchangePointer
 
-#define VOID void
+#define VOID  void
 
 //
 // Prevent collisions with Windows API name macros that deal with Unicode/Not issues
diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c
index b8bfb7b58b91..ca3f66a0e3c1 100644
--- a/BaseTools/Source/C/Common/BasePeCoff.c
+++ b/BaseTools/Source/C/Common/BasePeCoff.c
@@ -16,25 +16,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "PeCoffLib.h"
 
 typedef union {
-  VOID                         *Header;
-  EFI_IMAGE_OPTIONAL_HEADER32  *Optional32;
-  EFI_IMAGE_OPTIONAL_HEADER64  *Optional64;
+  VOID                           *Header;
+  EFI_IMAGE_OPTIONAL_HEADER32    *Optional32;
+  EFI_IMAGE_OPTIONAL_HEADER64    *Optional64;
 } EFI_IMAGE_OPTIONAL_HEADER_POINTER;
 
 STATIC
 RETURN_STATUS
 PeCoffLoaderGetPeHeader (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,
-  OUT    EFI_IMAGE_OPTIONAL_HEADER_UNION **PeHdr,
-  OUT    EFI_TE_IMAGE_HEADER             **TeHdr
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT     *ImageContext,
+  OUT    EFI_IMAGE_OPTIONAL_HEADER_UNION  **PeHdr,
+  OUT    EFI_TE_IMAGE_HEADER              **TeHdr
   );
 
 STATIC
 RETURN_STATUS
 PeCoffLoaderCheckImageType (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,
-  IN     EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr,
-  IN     EFI_TE_IMAGE_HEADER             *TeHdr
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT     *ImageContext,
+  IN     EFI_IMAGE_OPTIONAL_HEADER_UNION  *PeHdr,
+  IN     EFI_TE_IMAGE_HEADER              *TeHdr
   );
 
 STATIC
@@ -46,35 +46,34 @@ PeCoffLoaderImageAddress (
 
 RETURN_STATUS
 PeCoffLoaderRelocateIa32Image (
-  IN UINT16      *Reloc,
-  IN OUT CHAR8   *Fixup,
-  IN OUT CHAR8   **FixupData,
-  IN UINT64      Adjust
+  IN UINT16     *Reloc,
+  IN OUT CHAR8  *Fixup,
+  IN OUT CHAR8  **FixupData,
+  IN UINT64     Adjust
   );
 
-
 RETURN_STATUS
 PeCoffLoaderRelocateArmImage (
-  IN UINT16      **Reloc,
-  IN OUT CHAR8   *Fixup,
-  IN OUT CHAR8   **FixupData,
-  IN UINT64      Adjust
+  IN UINT16     **Reloc,
+  IN OUT CHAR8  *Fixup,
+  IN OUT CHAR8  **FixupData,
+  IN UINT64     Adjust
   );
 
 RETURN_STATUS
 PeCoffLoaderRelocateRiscVImage (
-  IN UINT16      *Reloc,
-  IN OUT CHAR8   *Fixup,
-  IN OUT CHAR8   **FixupData,
-  IN UINT64      Adjust
+  IN UINT16     *Reloc,
+  IN OUT CHAR8  *Fixup,
+  IN OUT CHAR8  **FixupData,
+  IN UINT64     Adjust
   );
 
 RETURN_STATUS
 PeCoffLoaderRelocateLoongArch64Image (
-  IN UINT16      *Reloc,
-  IN OUT CHAR8   *Fixup,
-  IN OUT CHAR8   **FixupData,
-  IN UINT64      Adjust
+  IN UINT16     *Reloc,
+  IN OUT CHAR8  *Fixup,
+  IN OUT CHAR8  **FixupData,
+  IN UINT64     Adjust
   );
 
 /**
@@ -90,9 +89,9 @@ PeCoffLoaderRelocateLoongArch64Image (
 STATIC
 RETURN_STATUS
 PeCoffLoaderGetPeHeader (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,
-  OUT    EFI_IMAGE_OPTIONAL_HEADER_UNION **PeHdr,
-  OUT    EFI_TE_IMAGE_HEADER             **TeHdr
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT     *ImageContext,
+  OUT    EFI_IMAGE_OPTIONAL_HEADER_UNION  **PeHdr,
+  OUT    EFI_TE_IMAGE_HEADER              **TeHdr
   )
 {
   RETURN_STATUS         Status;
@@ -103,13 +102,13 @@ PeCoffLoaderGetPeHeader (
   //
   // Read the DOS image headers
   //
-  Size = sizeof (EFI_IMAGE_DOS_HEADER);
+  Size   = sizeof (EFI_IMAGE_DOS_HEADER);
   Status = ImageContext->ImageRead (
-                          ImageContext->Handle,
-                          0,
-                          &Size,
-                          &DosHdr
-                          );
+                           ImageContext->Handle,
+                           0,
+                           &Size,
+                           &DosHdr
+                           );
   if (RETURN_ERROR (Status)) {
     ImageContext->ImageError = IMAGE_ERROR_IMAGE_READ;
     return Status;
@@ -122,10 +121,11 @@ PeCoffLoaderGetPeHeader (
     //
     ImageContext->PeCoffHeaderOffset = DosHdr.e_lfanew;
   }
+
   //
   // Get the PE/COFF Header pointer
   //
-  *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
+  *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
   if ((*PeHdr)->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
     //
     // Check the PE/COFF Header Signature. If not, then try to get a TE header
@@ -134,6 +134,7 @@ PeCoffLoaderGetPeHeader (
     if ((*TeHdr)->Signature != EFI_TE_IMAGE_HEADER_SIGNATURE) {
       return RETURN_UNSUPPORTED;
     }
+
     ImageContext->IsTeImage = TRUE;
   }
 
@@ -154,9 +155,9 @@ PeCoffLoaderGetPeHeader (
 STATIC
 RETURN_STATUS
 PeCoffLoaderCheckImageType (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,
-  IN     EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr,
-  IN     EFI_TE_IMAGE_HEADER                   *TeHdr
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT     *ImageContext,
+  IN     EFI_IMAGE_OPTIONAL_HEADER_UNION  *PeHdr,
+  IN     EFI_TE_IMAGE_HEADER              *TeHdr
   )
 {
   //
@@ -169,13 +170,14 @@ PeCoffLoaderCheckImageType (
     ImageContext->Machine = TeHdr->Machine;
   }
 
-  if (ImageContext->Machine != EFI_IMAGE_MACHINE_IA32 && \
-      ImageContext->Machine != EFI_IMAGE_MACHINE_X64  && \
-      ImageContext->Machine != EFI_IMAGE_MACHINE_ARMT && \
-      ImageContext->Machine != EFI_IMAGE_MACHINE_EBC  && \
-      ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64 && \
-      ImageContext->Machine != EFI_IMAGE_MACHINE_RISCV64 && \
-      ImageContext->Machine != EFI_IMAGE_MACHINE_LOONGARCH64) {
+  if ((ImageContext->Machine != EFI_IMAGE_MACHINE_IA32) && \
+      (ImageContext->Machine != EFI_IMAGE_MACHINE_X64) && \
+      (ImageContext->Machine != EFI_IMAGE_MACHINE_ARMT) && \
+      (ImageContext->Machine != EFI_IMAGE_MACHINE_EBC) && \
+      (ImageContext->Machine != EFI_IMAGE_MACHINE_AARCH64) && \
+      (ImageContext->Machine != EFI_IMAGE_MACHINE_RISCV64) && \
+      (ImageContext->Machine != EFI_IMAGE_MACHINE_LOONGARCH64))
+  {
     if (ImageContext->Machine == IMAGE_FILE_MACHINE_ARM) {
       //
       // There are two types of ARM images. Pure ARM and ARM/Thumb.
@@ -188,7 +190,6 @@ PeCoffLoaderCheckImageType (
       } else {
         TeHdr->Machine = ImageContext->Machine;
       }
-
     } else {
       //
       // unsupported PeImage machine type
@@ -204,13 +205,14 @@ PeCoffLoaderCheckImageType (
   if (ImageContext->IsTeImage == FALSE) {
     ImageContext->ImageType = PeHdr->Pe32.OptionalHeader.Subsystem;
   } else {
-    ImageContext->ImageType = (UINT16) (TeHdr->Subsystem);
+    ImageContext->ImageType = (UINT16)(TeHdr->Subsystem);
   }
 
-  if (ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION && \
-      ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER && \
-      ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER && \
-      ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER) {
+  if ((ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) && \
+      (ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) && \
+      (ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) && \
+      (ImageContext->ImageType != EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER))
+  {
     //
     // unsupported PeImage subsystem type
     //
@@ -236,36 +238,37 @@ PeCoffLoaderCheckImageType (
 RETURN_STATUS
 EFIAPI
 PeCoffLoaderGetImageInfo (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT           *ImageContext
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
   )
 {
-  RETURN_STATUS                   Status;
-  EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
-  EFI_TE_IMAGE_HEADER             *TeHdr;
-  EFI_IMAGE_DATA_DIRECTORY        *DebugDirectoryEntry;
-  UINTN                           Size;
-  UINTN                           Index;
-  UINTN                           DebugDirectoryEntryRva;
-  UINTN                           DebugDirectoryEntryFileOffset;
-  UINTN                           SectionHeaderOffset;
-  EFI_IMAGE_SECTION_HEADER        SectionHeader;
-  EFI_IMAGE_DEBUG_DIRECTORY_ENTRY DebugEntry;
-  EFI_IMAGE_OPTIONAL_HEADER_POINTER OptionHeader;
+  RETURN_STATUS                      Status;
+  EFI_IMAGE_OPTIONAL_HEADER_UNION    *PeHdr;
+  EFI_TE_IMAGE_HEADER                *TeHdr;
+  EFI_IMAGE_DATA_DIRECTORY           *DebugDirectoryEntry;
+  UINTN                              Size;
+  UINTN                              Index;
+  UINTN                              DebugDirectoryEntryRva;
+  UINTN                              DebugDirectoryEntryFileOffset;
+  UINTN                              SectionHeaderOffset;
+  EFI_IMAGE_SECTION_HEADER           SectionHeader;
+  EFI_IMAGE_DEBUG_DIRECTORY_ENTRY    DebugEntry;
+  EFI_IMAGE_OPTIONAL_HEADER_POINTER  OptionHeader;
 
-  PeHdr = NULL;
-  TeHdr = NULL;
+  PeHdr                  = NULL;
+  TeHdr                  = NULL;
   DebugDirectoryEntry    = NULL;
   DebugDirectoryEntryRva = 0;
 
   if (NULL == ImageContext) {
     return RETURN_INVALID_PARAMETER;
   }
+
   //
   // Assume success
   //
-  ImageContext->ImageError  = IMAGE_ERROR_SUCCESS;
+  ImageContext->ImageError = IMAGE_ERROR_SUCCESS;
 
-  Status                    = PeCoffLoaderGetPeHeader (ImageContext, &PeHdr, &TeHdr);
+  Status = PeCoffLoaderGetPeHeader (ImageContext, &PeHdr, &TeHdr);
   if (RETURN_ERROR (Status)) {
     return Status;
   }
@@ -277,20 +280,22 @@ PeCoffLoaderGetImageInfo (
   if (RETURN_ERROR (Status)) {
     return Status;
   }
-  OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
+
+  OptionHeader.Header = (VOID *)&(PeHdr->Pe32.OptionalHeader);
 
   //
   // Retrieve the base address of the image
   //
   if (!(ImageContext->IsTeImage)) {
     if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
-      ImageContext->ImageAddress = (PHYSICAL_ADDRESS) OptionHeader.Optional32->ImageBase;
+      ImageContext->ImageAddress = (PHYSICAL_ADDRESS)OptionHeader.Optional32->ImageBase;
     } else {
-      ImageContext->ImageAddress = (PHYSICAL_ADDRESS) OptionHeader.Optional64->ImageBase;
+      ImageContext->ImageAddress = (PHYSICAL_ADDRESS)OptionHeader.Optional64->ImageBase;
     }
   } else {
-    ImageContext->ImageAddress = (PHYSICAL_ADDRESS) (TeHdr->ImageBase + TeHdr->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
+    ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(TeHdr->ImageBase + TeHdr->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
   }
+
   //
   // Initialize the alternate destination address to 0 indicating that it
   // should not be used.
@@ -300,8 +305,8 @@ PeCoffLoaderGetImageInfo (
   //
   // Initialize the codeview pointer.
   //
-  ImageContext->CodeView    = NULL;
-  ImageContext->PdbPointer  = NULL;
+  ImageContext->CodeView   = NULL;
+  ImageContext->PdbPointer = NULL;
 
   //
   // Three cases with regards to relocations:
@@ -323,31 +328,30 @@ PeCoffLoaderGetImageInfo (
   }
 
   if (!(ImageContext->IsTeImage)) {
-
     if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
-      ImageContext->ImageSize         = (UINT64) OptionHeader.Optional32->SizeOfImage;
-      ImageContext->SectionAlignment  = OptionHeader.Optional32->SectionAlignment;
-      ImageContext->SizeOfHeaders     = OptionHeader.Optional32->SizeOfHeaders;
+      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...
       //
       if (OptionHeader.Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
-        DebugDirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+        DebugDirectoryEntry    = (EFI_IMAGE_DATA_DIRECTORY *)&(OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
         DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
       }
     } else {
-      ImageContext->ImageSize         = (UINT64) OptionHeader.Optional64->SizeOfImage;
-      ImageContext->SectionAlignment  = OptionHeader.Optional64->SectionAlignment;
-      ImageContext->SizeOfHeaders     = OptionHeader.Optional64->SizeOfHeaders;
+      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...
       //
       if (OptionHeader.Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
-        DebugDirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+        DebugDirectoryEntry    = (EFI_IMAGE_DATA_DIRECTORY *)&(OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
         DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
       }
     }
@@ -361,17 +365,17 @@ PeCoffLoaderGetImageInfo (
       DebugDirectoryEntryFileOffset = 0;
 
       SectionHeaderOffset = (UINTN)(
-                               ImageContext->PeCoffHeaderOffset +
-                               sizeof (UINT32) +
-                               sizeof (EFI_IMAGE_FILE_HEADER) +
-                               PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
-                               );
+                                    ImageContext->PeCoffHeaderOffset +
+                                    sizeof (UINT32) +
+                                    sizeof (EFI_IMAGE_FILE_HEADER) +
+                                    PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
+                                    );
 
       for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index++) {
         //
         // Read section header from file
         //
-        Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+        Size   = sizeof (EFI_IMAGE_SECTION_HEADER);
         Status = ImageContext->ImageRead (
                                  ImageContext->Handle,
                                  SectionHeaderOffset,
@@ -383,9 +387,10 @@ PeCoffLoaderGetImageInfo (
           return Status;
         }
 
-        if (DebugDirectoryEntryRva >= SectionHeader.VirtualAddress &&
-            DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize) {
-            DebugDirectoryEntryFileOffset =
+        if ((DebugDirectoryEntryRva >= SectionHeader.VirtualAddress) &&
+            (DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize))
+        {
+          DebugDirectoryEntryFileOffset =
             DebugDirectoryEntryRva - SectionHeader.VirtualAddress + SectionHeader.PointerToRawData;
           break;
         }
@@ -398,7 +403,7 @@ PeCoffLoaderGetImageInfo (
           //
           // 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,
@@ -411,8 +416,8 @@ PeCoffLoaderGetImageInfo (
           }
 
           if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
-            ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index);
-            if (DebugEntry.RVA == 0 && DebugEntry.FileOffset != 0) {
+            ImageContext->DebugDirectoryEntryRva = (UINT32)(DebugDirectoryEntryRva + Index);
+            if ((DebugEntry.RVA == 0) && (DebugEntry.FileOffset != 0)) {
               ImageContext->ImageSize += DebugEntry.SizeOfData;
             }
 
@@ -422,21 +427,21 @@ PeCoffLoaderGetImageInfo (
       }
     }
   } else {
-    ImageContext->ImageSize         = 0;
-    ImageContext->SectionAlignment  = 4096;
-    ImageContext->SizeOfHeaders     = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN) TeHdr->BaseOfCode - (UINTN) TeHdr->StrippedSize;
+    ImageContext->ImageSize        = 0;
+    ImageContext->SectionAlignment = 4096;
+    ImageContext->SizeOfHeaders    = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)TeHdr->BaseOfCode - (UINTN)TeHdr->StrippedSize;
 
-    DebugDirectoryEntry             = &TeHdr->DataDirectory[1];
-    DebugDirectoryEntryRva          = DebugDirectoryEntry->VirtualAddress;
-    SectionHeaderOffset             = (UINTN) (sizeof (EFI_TE_IMAGE_HEADER));
+    DebugDirectoryEntry    = &TeHdr->DataDirectory[1];
+    DebugDirectoryEntryRva = DebugDirectoryEntry->VirtualAddress;
+    SectionHeaderOffset    = (UINTN)(sizeof (EFI_TE_IMAGE_HEADER));
 
-    DebugDirectoryEntryFileOffset   = 0;
+    DebugDirectoryEntryFileOffset = 0;
 
     for (Index = 0; Index < TeHdr->NumberOfSections;) {
       //
       // Read section header from file
       //
-      Size = sizeof (EFI_IMAGE_SECTION_HEADER);
+      Size   = sizeof (EFI_IMAGE_SECTION_HEADER);
       Status = ImageContext->ImageRead (
                                ImageContext->Handle,
                                SectionHeaderOffset,
@@ -448,21 +453,22 @@ PeCoffLoaderGetImageInfo (
         return Status;
       }
 
-      if (DebugDirectoryEntryRva >= SectionHeader.VirtualAddress &&
-          DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize) {
+      if ((DebugDirectoryEntryRva >= SectionHeader.VirtualAddress) &&
+          (DebugDirectoryEntryRva < SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize))
+      {
         DebugDirectoryEntryFileOffset = DebugDirectoryEntryRva -
-          SectionHeader.VirtualAddress +
-          SectionHeader.PointerToRawData +
-          sizeof (EFI_TE_IMAGE_HEADER) -
-          TeHdr->StrippedSize;
+                                        SectionHeader.VirtualAddress +
+                                        SectionHeader.PointerToRawData +
+                                        sizeof (EFI_TE_IMAGE_HEADER) -
+                                        TeHdr->StrippedSize;
 
         //
         // File offset of the debug directory was found, if this is not the last
         // section, then skip to the last section for calculating the image size.
         //
-        if (Index < (UINTN) TeHdr->NumberOfSections - 1) {
+        if (Index < (UINTN)TeHdr->NumberOfSections - 1) {
           SectionHeaderOffset += (TeHdr->NumberOfSections - 1 - Index) * sizeof (EFI_IMAGE_SECTION_HEADER);
-          Index = TeHdr->NumberOfSections - 1;
+          Index                = TeHdr->NumberOfSections - 1;
           continue;
         }
       }
@@ -477,7 +483,7 @@ PeCoffLoaderGetImageInfo (
       // by the RVA and the VirtualSize of the last section header in the
       // Section Table.
       //
-      if ((++Index) == (UINTN) TeHdr->NumberOfSections) {
+      if ((++Index) == (UINTN)TeHdr->NumberOfSections) {
         ImageContext->ImageSize = (SectionHeader.VirtualAddress + SectionHeader.Misc.VirtualSize +
                                    ImageContext->SectionAlignment - 1) & ~(ImageContext->SectionAlignment - 1);
       }
@@ -490,7 +496,7 @@ PeCoffLoaderGetImageInfo (
         //
         // 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,
@@ -503,7 +509,7 @@ PeCoffLoaderGetImageInfo (
         }
 
         if (DebugEntry.Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
-          ImageContext->DebugDirectoryEntryRva = (UINT32) (DebugDirectoryEntryRva + Index);
+          ImageContext->DebugDirectoryEntryRva = (UINT32)(DebugDirectoryEntryRva + Index);
           return RETURN_SUCCESS;
         }
       }
@@ -525,8 +531,8 @@ PeCoffLoaderGetImageInfo (
 STATIC
 VOID *
 PeCoffLoaderImageAddress (
-  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,
-  IN     UINTN                                 Address
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext,
+  IN     UINTN                         Address
   )
 {
   if (Address >= ImageContext->ImageSize) {
@@ -534,7 +540,7 @@ PeCoffLoaderImageAddress (
     return NULL;
   }
 
-  return (UINT8 *) ((UINTN) ImageContext->ImageAddress + Address);
+  return (UINT8 *)((UINTN)ImageContext->ImageAddress + Address);
 }
 
 /**
@@ -554,24 +560,24 @@ PeCoffLoaderRelocateImage (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
   )
 {
-  RETURN_STATUS                         Status;
-  EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr;
-  EFI_TE_IMAGE_HEADER                   *TeHdr;
-  EFI_IMAGE_DATA_DIRECTORY              *RelocDir;
-  UINT64                                Adjust;
-  EFI_IMAGE_BASE_RELOCATION             *RelocBase;
-  EFI_IMAGE_BASE_RELOCATION             *RelocBaseEnd;
-  UINT16                                *Reloc;
-  UINT16                                *RelocEnd;
-  CHAR8                                 *Fixup;
-  CHAR8                                 *FixupBase;
-  UINT16                                *F16;
-  UINT32                                *F32;
-  UINT64                                *F64;
-  CHAR8                                 *FixupData;
-  PHYSICAL_ADDRESS                      BaseAddress;
-  UINT16                                MachineType;
-  EFI_IMAGE_OPTIONAL_HEADER_POINTER     OptionHeader;
+  RETURN_STATUS                      Status;
+  EFI_IMAGE_OPTIONAL_HEADER_UNION    *PeHdr;
+  EFI_TE_IMAGE_HEADER                *TeHdr;
+  EFI_IMAGE_DATA_DIRECTORY           *RelocDir;
+  UINT64                             Adjust;
+  EFI_IMAGE_BASE_RELOCATION          *RelocBase;
+  EFI_IMAGE_BASE_RELOCATION          *RelocBaseEnd;
+  UINT16                             *Reloc;
+  UINT16                             *RelocEnd;
+  CHAR8                              *Fixup;
+  CHAR8                              *FixupBase;
+  UINT16                             *F16;
+  UINT32                             *F32;
+  UINT64                             *F64;
+  CHAR8                              *FixupData;
+  PHYSICAL_ADDRESS                   BaseAddress;
+  UINT16                             MachineType;
+  EFI_IMAGE_OPTIONAL_HEADER_POINTER  OptionHeader;
 
   PeHdr = NULL;
   TeHdr = NULL;
@@ -594,12 +600,12 @@ PeCoffLoaderRelocateImage (
 
   if (!(ImageContext->IsTeImage)) {
     PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((UINTN)ImageContext->ImageAddress +
-                                            ImageContext->PeCoffHeaderOffset);
-    OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
+                                                ImageContext->PeCoffHeaderOffset);
+    OptionHeader.Header = (VOID *)&(PeHdr->Pe32.OptionalHeader);
     if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
-      Adjust = (UINT64) BaseAddress - OptionHeader.Optional32->ImageBase;
-      OptionHeader.Optional32->ImageBase = (UINT32) BaseAddress;
-      MachineType = ImageContext->Machine;
+      Adjust                             = (UINT64)BaseAddress - OptionHeader.Optional32->ImageBase;
+      OptionHeader.Optional32->ImageBase = (UINT32)BaseAddress;
+      MachineType                        = ImageContext->Machine;
       //
       // Find the relocation block
       //
@@ -608,14 +614,14 @@ PeCoffLoaderRelocateImage (
       // the optional header to verify a desired directory entry is there.
       //
       if (OptionHeader.Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
-        RelocDir  = &OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+        RelocDir = &OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
         if ((RelocDir != NULL) && (RelocDir->Size > 0)) {
-          RelocBase = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
+          RelocBase    = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
           RelocBaseEnd = PeCoffLoaderImageAddress (
                            ImageContext,
                            RelocDir->VirtualAddress + RelocDir->Size - 1
                            );
-          if (RelocBase == NULL || RelocBaseEnd == NULL || RelocBaseEnd < RelocBase) {
+          if ((RelocBase == NULL) || (RelocBaseEnd == NULL) || (RelocBaseEnd < RelocBase)) {
             ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
             return RETURN_LOAD_ERROR;
           }
@@ -632,9 +638,9 @@ PeCoffLoaderRelocateImage (
         RelocBase = RelocBaseEnd = 0;
       }
     } else {
-      Adjust = (UINT64) BaseAddress - OptionHeader.Optional64->ImageBase;
+      Adjust                             = (UINT64)BaseAddress - OptionHeader.Optional64->ImageBase;
       OptionHeader.Optional64->ImageBase = BaseAddress;
-      MachineType = ImageContext->Machine;
+      MachineType                        = ImageContext->Machine;
       //
       // Find the relocation block
       //
@@ -643,14 +649,14 @@ PeCoffLoaderRelocateImage (
       // the optional header to verify a desired directory entry is there.
       //
       if (OptionHeader.Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
-        RelocDir  = &OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+        RelocDir = &OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
         if ((RelocDir != NULL) && (RelocDir->Size > 0)) {
-          RelocBase = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
+          RelocBase    = PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress);
           RelocBaseEnd = PeCoffLoaderImageAddress (
                            ImageContext,
                            RelocDir->VirtualAddress + RelocDir->Size - 1
-                          );
-          if (RelocBase == NULL || RelocBaseEnd == NULL || RelocBaseEnd < RelocBase) {
+                           );
+          if ((RelocBase == NULL) || (RelocBaseEnd == NULL) || (RelocBaseEnd < RelocBase)) {
             ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
             return RETURN_LOAD_ERROR;
           }
@@ -668,22 +674,22 @@ PeCoffLoaderRelocateImage (
       }
     }
   } else {
-    TeHdr             = (EFI_TE_IMAGE_HEADER *) (UINTN) (ImageContext->ImageAddress);
-    Adjust            = (UINT64) (BaseAddress - TeHdr->ImageBase);
-    TeHdr->ImageBase  = (UINT64) (BaseAddress);
-    MachineType = TeHdr->Machine;
+    TeHdr            = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
+    Adjust           = (UINT64)(BaseAddress - TeHdr->ImageBase);
+    TeHdr->ImageBase = (UINT64)(BaseAddress);
+    MachineType      = TeHdr->Machine;
 
     //
     // Find the relocation block
     //
-    RelocDir = &TeHdr->DataDirectory[0];
+    RelocDir  = &TeHdr->DataDirectory[0];
     RelocBase = (EFI_IMAGE_BASE_RELOCATION *)(UINTN)(
-                                    ImageContext->ImageAddress +
-                                    RelocDir->VirtualAddress +
-                                    sizeof(EFI_TE_IMAGE_HEADER) -
-                                    TeHdr->StrippedSize
-                                    );
-    RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) ((UINTN) RelocBase + (UINTN) RelocDir->Size - 1);
+                                                     ImageContext->ImageAddress +
+                                                     RelocDir->VirtualAddress +
+                                                     sizeof (EFI_TE_IMAGE_HEADER) -
+                                                     TeHdr->StrippedSize
+                                                     );
+    RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *)((UINTN)RelocBase + (UINTN)RelocDir->Size - 1);
   }
 
   //
@@ -691,9 +697,8 @@ PeCoffLoaderRelocateImage (
   //
   FixupData = ImageContext->FixupData;
   while (RelocBase < RelocBaseEnd) {
-
-    Reloc     = (UINT16 *) ((CHAR8 *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
-    RelocEnd  = (UINT16 *) ((CHAR8 *) RelocBase + RelocBase->SizeOfBlock);
+    Reloc    = (UINT16 *)((CHAR8 *)RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
+    RelocEnd = (UINT16 *)((CHAR8 *)RelocBase + RelocBase->SizeOfBlock);
     if (!(ImageContext->IsTeImage)) {
       FixupBase = PeCoffLoaderImageAddress (ImageContext, RelocBase->VirtualAddress);
       if (FixupBase == NULL) {
@@ -702,15 +707,16 @@ PeCoffLoaderRelocateImage (
       }
     } else {
       FixupBase = (CHAR8 *)(UINTN)(ImageContext->ImageAddress +
-                    RelocBase->VirtualAddress +
-                    sizeof(EFI_TE_IMAGE_HEADER) -
-                    TeHdr->StrippedSize
-                    );
+                                   RelocBase->VirtualAddress +
+                                   sizeof (EFI_TE_IMAGE_HEADER) -
+                                   TeHdr->StrippedSize
+                                   );
     }
 
-    if ((CHAR8 *) RelocEnd < (CHAR8 *) ((UINTN) ImageContext->ImageAddress) ||
-        (CHAR8 *) RelocEnd > (CHAR8 *)((UINTN)ImageContext->ImageAddress +
-          (UINTN)ImageContext->ImageSize)) {
+    if (((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;
     }
@@ -719,81 +725,85 @@ PeCoffLoaderRelocateImage (
     // Run this relocation record
     //
     while (Reloc < RelocEnd) {
-
       Fixup = FixupBase + (*Reloc & 0xFFF);
       switch ((*Reloc) >> 12) {
-      case EFI_IMAGE_REL_BASED_ABSOLUTE:
-        break;
+        case EFI_IMAGE_REL_BASED_ABSOLUTE:
+          break;
 
-      case EFI_IMAGE_REL_BASED_HIGH:
-        F16   = (UINT16 *) Fixup;
-        *F16 = (UINT16) (*F16 + ((UINT16) ((UINT32) Adjust >> 16)));
-        if (FixupData != NULL) {
-          *(UINT16 *) FixupData = *F16;
-          FixupData             = FixupData + sizeof (UINT16);
-        }
-        break;
+        case EFI_IMAGE_REL_BASED_HIGH:
+          F16  = (UINT16 *)Fixup;
+          *F16 = (UINT16)(*F16 + ((UINT16)((UINT32)Adjust >> 16)));
+          if (FixupData != NULL) {
+            *(UINT16 *)FixupData = *F16;
+            FixupData            = FixupData + sizeof (UINT16);
+          }
 
-      case EFI_IMAGE_REL_BASED_LOW:
-        F16   = (UINT16 *) Fixup;
-        *F16  = (UINT16) (*F16 + (UINT16) Adjust);
-        if (FixupData != NULL) {
-          *(UINT16 *) FixupData = *F16;
-          FixupData             = FixupData + sizeof (UINT16);
-        }
-        break;
+          break;
 
-      case EFI_IMAGE_REL_BASED_HIGHLOW:
-        F32   = (UINT32 *) Fixup;
-        *F32  = *F32 + (UINT32) Adjust;
-        if (FixupData != NULL) {
-          FixupData             = ALIGN_POINTER (FixupData, sizeof (UINT32));
-          *(UINT32 *) FixupData = *F32;
-          FixupData             = FixupData + sizeof (UINT32);
-        }
-        break;
+        case EFI_IMAGE_REL_BASED_LOW:
+          F16  = (UINT16 *)Fixup;
+          *F16 = (UINT16)(*F16 + (UINT16)Adjust);
+          if (FixupData != NULL) {
+            *(UINT16 *)FixupData = *F16;
+            FixupData            = FixupData + sizeof (UINT16);
+          }
 
-      case EFI_IMAGE_REL_BASED_DIR64:
-        F64   = (UINT64 *) Fixup;
-        *F64  = *F64 + (UINT64) Adjust;
-        if (FixupData != NULL) {
-          FixupData             = ALIGN_POINTER (FixupData, sizeof (UINT64));
-          *(UINT64 *) FixupData = *F64;
-          FixupData             = FixupData + sizeof (UINT64);
-        }
-        break;
+          break;
 
-      case EFI_IMAGE_REL_BASED_HIGHADJ:
-        //
-        // Return the same EFI_UNSUPPORTED return code as
-        // PeCoffLoaderRelocateImageEx() returns if it does not recognize
-        // the relocation type.
-        //
-        ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
-        return RETURN_UNSUPPORTED;
+        case EFI_IMAGE_REL_BASED_HIGHLOW:
+          F32  = (UINT32 *)Fixup;
+          *F32 = *F32 + (UINT32)Adjust;
+          if (FixupData != NULL) {
+            FixupData            = ALIGN_POINTER (FixupData, sizeof (UINT32));
+            *(UINT32 *)FixupData = *F32;
+            FixupData            = FixupData + sizeof (UINT32);
+          }
 
-      default:
-        switch (MachineType) {
-        case EFI_IMAGE_MACHINE_IA32:
-          Status = PeCoffLoaderRelocateIa32Image (Reloc, Fixup, &FixupData, Adjust);
-          break;
-        case EFI_IMAGE_MACHINE_ARMT:
-          Status = PeCoffLoaderRelocateArmImage (&Reloc, Fixup, &FixupData, Adjust);
-          break;
-        case EFI_IMAGE_MACHINE_RISCV64:
-          Status = PeCoffLoaderRelocateRiscVImage (Reloc, Fixup, &FixupData, Adjust);
           break;
-        case EFI_IMAGE_MACHINE_LOONGARCH64:
-          Status = PeCoffLoaderRelocateLoongArch64Image (Reloc, Fixup, &FixupData, Adjust);
-          break;
-        default:
-          Status = RETURN_UNSUPPORTED;
+
+        case EFI_IMAGE_REL_BASED_DIR64:
+          F64  = (UINT64 *)Fixup;
+          *F64 = *F64 + (UINT64)Adjust;
+          if (FixupData != NULL) {
+            FixupData            = ALIGN_POINTER (FixupData, sizeof (UINT64));
+            *(UINT64 *)FixupData = *F64;
+            FixupData            = FixupData + sizeof (UINT64);
+          }
+
           break;
-        }
-        if (RETURN_ERROR (Status)) {
+
+        case EFI_IMAGE_REL_BASED_HIGHADJ:
+          //
+          // Return the same EFI_UNSUPPORTED return code as
+          // PeCoffLoaderRelocateImageEx() returns if it does not recognize
+          // the relocation type.
+          //
           ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
-          return Status;
-        }
+          return RETURN_UNSUPPORTED;
+
+        default:
+          switch (MachineType) {
+            case EFI_IMAGE_MACHINE_IA32:
+              Status = PeCoffLoaderRelocateIa32Image (Reloc, Fixup, &FixupData, Adjust);
+              break;
+            case EFI_IMAGE_MACHINE_ARMT:
+              Status = PeCoffLoaderRelocateArmImage (&Reloc, Fixup, &FixupData, Adjust);
+              break;
+            case EFI_IMAGE_MACHINE_RISCV64:
+              Status = PeCoffLoaderRelocateRiscVImage (Reloc, Fixup, &FixupData, Adjust);
+              break;
+            case EFI_IMAGE_MACHINE_LOONGARCH64:
+              Status = PeCoffLoaderRelocateLoongArch64Image (Reloc, Fixup, &FixupData, Adjust);
+              break;
+            default:
+              Status = RETURN_UNSUPPORTED;
+              break;
+          }
+
+          if (RETURN_ERROR (Status)) {
+            ImageContext->ImageError = IMAGE_ERROR_FAILED_RELOCATION;
+            return Status;
+          }
       }
 
       //
@@ -805,7 +815,7 @@ PeCoffLoaderRelocateImage (
     //
     // Next reloc block
     //
-    RelocBase = (EFI_IMAGE_BASE_RELOCATION *) RelocEnd;
+    RelocBase = (EFI_IMAGE_BASE_RELOCATION *)RelocEnd;
   }
 
   return RETURN_SUCCESS;
@@ -829,25 +839,25 @@ PeCoffLoaderLoadImage (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
   )
 {
-  RETURN_STATUS                         Status;
-  EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr;
-  EFI_TE_IMAGE_HEADER                   *TeHdr;
-  PE_COFF_LOADER_IMAGE_CONTEXT          CheckContext;
-  EFI_IMAGE_SECTION_HEADER              *FirstSection;
-  EFI_IMAGE_SECTION_HEADER              *Section;
-  UINTN                                 NumberOfSections;
-  UINTN                                 Index;
-  CHAR8                                 *Base;
-  CHAR8                                 *End;
-  CHAR8                                 *MaxEnd;
-  EFI_IMAGE_DATA_DIRECTORY              *DirectoryEntry;
-  EFI_IMAGE_DEBUG_DIRECTORY_ENTRY       *DebugEntry;
-  UINTN                                 Size;
-  UINT32                                TempDebugEntryRva;
-  EFI_IMAGE_OPTIONAL_HEADER_POINTER     OptionHeader;
+  RETURN_STATUS                      Status;
+  EFI_IMAGE_OPTIONAL_HEADER_UNION    *PeHdr;
+  EFI_TE_IMAGE_HEADER                *TeHdr;
+  PE_COFF_LOADER_IMAGE_CONTEXT       CheckContext;
+  EFI_IMAGE_SECTION_HEADER           *FirstSection;
+  EFI_IMAGE_SECTION_HEADER           *Section;
+  UINTN                              NumberOfSections;
+  UINTN                              Index;
+  CHAR8                              *Base;
+  CHAR8                              *End;
+  CHAR8                              *MaxEnd;
+  EFI_IMAGE_DATA_DIRECTORY           *DirectoryEntry;
+  EFI_IMAGE_DEBUG_DIRECTORY_ENTRY    *DebugEntry;
+  UINTN                              Size;
+  UINT32                             TempDebugEntryRva;
+  EFI_IMAGE_OPTIONAL_HEADER_POINTER  OptionHeader;
 
-  PeHdr = NULL;
-  TeHdr = NULL;
+  PeHdr               = NULL;
+  TeHdr               = NULL;
   OptionHeader.Header = NULL;
   //
   // Assume success
@@ -887,6 +897,7 @@ PeCoffLoaderLoadImage (
       ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;
       return RETURN_LOAD_ERROR;
     }
+
     //
     // If the image does not contain relocations, and the requested load address
     // is not the linked address, then return an error.
@@ -896,6 +907,7 @@ PeCoffLoaderLoadImage (
       return RETURN_INVALID_PARAMETER;
     }
   }
+
   //
   // Make sure the allocated space has the proper section alignment
   //
@@ -905,46 +917,46 @@ PeCoffLoaderLoadImage (
       return RETURN_INVALID_PARAMETER;
     }
   }
+
   //
   // Read the entire PE/COFF or TE header into memory
   //
   if (!(ImageContext->IsTeImage)) {
     Status = ImageContext->ImageRead (
-                            ImageContext->Handle,
-                            0,
-                            &ImageContext->SizeOfHeaders,
-                            (VOID *) (UINTN) ImageContext->ImageAddress
-                            );
+                             ImageContext->Handle,
+                             0,
+                             &ImageContext->SizeOfHeaders,
+                             (VOID *)(UINTN)ImageContext->ImageAddress
+                             );
 
     PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)
-      ((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
+            ((UINTN)ImageContext->ImageAddress + ImageContext->PeCoffHeaderOffset);
 
-    OptionHeader.Header = (VOID *) &(PeHdr->Pe32.OptionalHeader);
+    OptionHeader.Header = (VOID *)&(PeHdr->Pe32.OptionalHeader);
 
-    FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
-                      (UINTN)ImageContext->ImageAddress +
-                      ImageContext->PeCoffHeaderOffset +
-                      sizeof(UINT32) +
-                      sizeof(EFI_IMAGE_FILE_HEADER) +
-                      PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
-      );
-    NumberOfSections = (UINTN) (PeHdr->Pe32.FileHeader.NumberOfSections);
+    FirstSection = (EFI_IMAGE_SECTION_HEADER *)(
+                                                (UINTN)ImageContext->ImageAddress +
+                                                ImageContext->PeCoffHeaderOffset +
+                                                sizeof (UINT32) +
+                                                sizeof (EFI_IMAGE_FILE_HEADER) +
+                                                PeHdr->Pe32.FileHeader.SizeOfOptionalHeader
+                                                );
+    NumberOfSections = (UINTN)(PeHdr->Pe32.FileHeader.NumberOfSections);
   } else {
     Status = ImageContext->ImageRead (
-                            ImageContext->Handle,
-                            0,
-                            &ImageContext->SizeOfHeaders,
-                            (VOID *) (UINTN) ImageContext->ImageAddress
-                            );
+                             ImageContext->Handle,
+                             0,
+                             &ImageContext->SizeOfHeaders,
+                             (VOID *)(UINTN)ImageContext->ImageAddress
+                             );
 
-    TeHdr             = (EFI_TE_IMAGE_HEADER *) (UINTN) (ImageContext->ImageAddress);
-
-    FirstSection = (EFI_IMAGE_SECTION_HEADER *) (
-          (UINTN)ImageContext->ImageAddress +
-          sizeof(EFI_TE_IMAGE_HEADER)
-          );
-    NumberOfSections  = (UINTN) (TeHdr->NumberOfSections);
+    TeHdr = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
 
+    FirstSection = (EFI_IMAGE_SECTION_HEADER *)(
+                                                (UINTN)ImageContext->ImageAddress +
+                                                sizeof (EFI_TE_IMAGE_HEADER)
+                                                );
+    NumberOfSections = (UINTN)(TeHdr->NumberOfSections);
   }
 
   if (RETURN_ERROR (Status)) {
@@ -957,15 +969,14 @@ PeCoffLoaderLoadImage (
   //
   Section = FirstSection;
   for (Index = 0, MaxEnd = NULL; Index < NumberOfSections; Index++) {
-
     //
     // Compute sections address
     //
     Base = PeCoffLoaderImageAddress (ImageContext, Section->VirtualAddress);
-    End = PeCoffLoaderImageAddress (
-            ImageContext,
-            Section->VirtualAddress + Section->Misc.VirtualSize - 1
-            );
+    End  = PeCoffLoaderImageAddress (
+             ImageContext,
+             Section->VirtualAddress + Section->Misc.VirtualSize - 1
+             );
 
     //
     // If the base start or end address resolved to 0, then fail.
@@ -975,10 +986,9 @@ PeCoffLoaderLoadImage (
       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);
+      Base = (CHAR8 *)((UINTN)Base + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN)TeHdr->StrippedSize);
+      End  = (CHAR8 *)((UINTN)End + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN)TeHdr->StrippedSize);
     }
 
     if (End > MaxEnd) {
@@ -988,26 +998,26 @@ PeCoffLoaderLoadImage (
     //
     // Read the section
     //
-    Size = (UINTN) Section->Misc.VirtualSize;
+    Size = (UINTN)Section->Misc.VirtualSize;
     if ((Size == 0) || (Size > Section->SizeOfRawData)) {
-      Size = (UINTN) Section->SizeOfRawData;
+      Size = (UINTN)Section->SizeOfRawData;
     }
 
     if (Section->SizeOfRawData) {
       if (!(ImageContext->IsTeImage)) {
         Status = ImageContext->ImageRead (
-                                ImageContext->Handle,
-                                Section->PointerToRawData,
-                                &Size,
-                                Base
-                                );
+                                 ImageContext->Handle,
+                                 Section->PointerToRawData,
+                                 &Size,
+                                 Base
+                                 );
       } else {
         Status = ImageContext->ImageRead (
-                                ImageContext->Handle,
-                                Section->PointerToRawData + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN) TeHdr->StrippedSize,
-                                &Size,
-                                Base
-                                );
+                                 ImageContext->Handle,
+                                 Section->PointerToRawData + sizeof (EFI_TE_IMAGE_HEADER) - (UINTN)TeHdr->StrippedSize,
+                                 &Size,
+                                 Base
+                                 );
       }
 
       if (RETURN_ERROR (Status)) {
@@ -1034,15 +1044,15 @@ PeCoffLoaderLoadImage (
   // Get image's entry point
   //
   if (!(ImageContext->IsTeImage)) {
-    ImageContext->EntryPoint = (PHYSICAL_ADDRESS) (UINTN) PeCoffLoaderImageAddress (
-                                                                ImageContext,
-                                                                PeHdr->Pe32.OptionalHeader.AddressOfEntryPoint
-                                                                );
+    ImageContext->EntryPoint = (PHYSICAL_ADDRESS)(UINTN)PeCoffLoaderImageAddress (
+                                                          ImageContext,
+                                                          PeHdr->Pe32.OptionalHeader.AddressOfEntryPoint
+                                                          );
   } else {
     ImageContext->EntryPoint = (UINTN)ImageContext->ImageAddress +
                                (UINTN)TeHdr->AddressOfEntryPoint +
-                               (UINTN)sizeof(EFI_TE_IMAGE_HEADER) -
-                               (UINTN) TeHdr->StrippedSize;
+                               (UINTN)sizeof (EFI_TE_IMAGE_HEADER) -
+                               (UINTN)TeHdr->StrippedSize;
   }
 
   //
@@ -1056,7 +1066,7 @@ PeCoffLoaderLoadImage (
     if (PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
       if (OptionHeader.Optional32->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
         DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)
-          &OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+                         &OptionHeader.Optional32->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
         ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINTN);
       } else {
         ImageContext->FixupDataSize = 0;
@@ -1064,7 +1074,7 @@ PeCoffLoaderLoadImage (
     } else {
       if (OptionHeader.Optional64->NumberOfRvaAndSizes > EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC) {
         DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)
-          &OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
+                         &OptionHeader.Optional64->DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC];
         ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINTN);
       } else {
         ImageContext->FixupDataSize = 0;
@@ -1074,6 +1084,7 @@ PeCoffLoaderLoadImage (
     DirectoryEntry              = &TeHdr->DataDirectory[0];
     ImageContext->FixupDataSize = DirectoryEntry->Size / sizeof (UINT16) * sizeof (UINTN);
   }
+
   //
   // Consumer must allocate a buffer for the relocation fixup log.
   // Only used for runtime drivers.
@@ -1086,23 +1097,23 @@ PeCoffLoaderLoadImage (
   if (ImageContext->DebugDirectoryEntryRva != 0) {
     if (!(ImageContext->IsTeImage)) {
       DebugEntry = PeCoffLoaderImageAddress (
-                    ImageContext,
-                    ImageContext->DebugDirectoryEntryRva
-                    );
+                     ImageContext,
+                     ImageContext->DebugDirectoryEntryRva
+                     );
     } else {
       DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)(UINTN)(
-                                               ImageContext->ImageAddress +
-                                               ImageContext->DebugDirectoryEntryRva +
-                                               sizeof(EFI_TE_IMAGE_HEADER) -
-                                               TeHdr->StrippedSize
-                                               );
+                                                              ImageContext->ImageAddress +
+                                                              ImageContext->DebugDirectoryEntryRva +
+                                                              sizeof (EFI_TE_IMAGE_HEADER) -
+                                                              TeHdr->StrippedSize
+                                                              );
     }
 
     if (DebugEntry != NULL) {
       TempDebugEntryRva = DebugEntry->RVA;
-      if (DebugEntry->RVA == 0 && DebugEntry->FileOffset != 0) {
+      if ((DebugEntry->RVA == 0) && (DebugEntry->FileOffset != 0)) {
         Section--;
-        if ((UINTN) Section->SizeOfRawData < Section->Misc.VirtualSize) {
+        if ((UINTN)Section->SizeOfRawData < Section->Misc.VirtualSize) {
           TempDebugEntryRva = Section->VirtualAddress + Section->Misc.VirtualSize;
         } else {
           TempDebugEntryRva = Section->VirtualAddress + Section->SizeOfRawData;
@@ -1114,11 +1125,11 @@ PeCoffLoaderLoadImage (
           ImageContext->CodeView = PeCoffLoaderImageAddress (ImageContext, TempDebugEntryRva);
         } else {
           ImageContext->CodeView = (VOID *)(
-                      (UINTN)ImageContext->ImageAddress +
-                      (UINTN)TempDebugEntryRva +
-                      (UINTN)sizeof(EFI_TE_IMAGE_HEADER) -
-                (UINTN) TeHdr->StrippedSize
-            );
+                                            (UINTN)ImageContext->ImageAddress +
+                                            (UINTN)TempDebugEntryRva +
+                                            (UINTN)sizeof (EFI_TE_IMAGE_HEADER) -
+                                            (UINTN)TeHdr->StrippedSize
+                                            );
         }
 
         if (ImageContext->CodeView == NULL) {
@@ -1130,18 +1141,18 @@ PeCoffLoaderLoadImage (
           Size = DebugEntry->SizeOfData;
           if (!(ImageContext->IsTeImage)) {
             Status = ImageContext->ImageRead (
-                                    ImageContext->Handle,
-                                    DebugEntry->FileOffset,
-                                    &Size,
-                                    ImageContext->CodeView
-                                    );
+                                     ImageContext->Handle,
+                                     DebugEntry->FileOffset,
+                                     &Size,
+                                     ImageContext->CodeView
+                                     );
           } else {
             Status = ImageContext->ImageRead (
-                                    ImageContext->Handle,
-                                    DebugEntry->FileOffset + sizeof (EFI_TE_IMAGE_HEADER) - TeHdr->StrippedSize,
-                                    &Size,
-                                    ImageContext->CodeView
-                                    );
+                                     ImageContext->Handle,
+                                     DebugEntry->FileOffset + sizeof (EFI_TE_IMAGE_HEADER) - TeHdr->StrippedSize,
+                                     &Size,
+                                     ImageContext->CodeView
+                                     );
             //
             // Should we apply fix up to this field according to the size difference between PE and TE?
             // Because now we maintain TE header fields unfixed, this field will also remain as they are
@@ -1157,20 +1168,20 @@ PeCoffLoaderLoadImage (
           DebugEntry->RVA = TempDebugEntryRva;
         }
 
-        switch (*(UINT32 *) ImageContext->CodeView) {
-        case CODEVIEW_SIGNATURE_NB10:
-          ImageContext->PdbPointer = (CHAR8 *) ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
-          break;
+        switch (*(UINT32 *)ImageContext->CodeView) {
+          case CODEVIEW_SIGNATURE_NB10:
+            ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
+            break;
 
-        case CODEVIEW_SIGNATURE_RSDS:
-          ImageContext->PdbPointer = (CHAR8 *) ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
-          break;
+          case CODEVIEW_SIGNATURE_RSDS:
+            ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
+            break;
 
-        case CODEVIEW_SIGNATURE_MTOC:
-          ImageContext->PdbPointer = (CHAR8 *) ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
+          case CODEVIEW_SIGNATURE_MTOC:
+            ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
 
-        default:
-          break;
+          default:
+            break;
         }
       }
     }
@@ -1204,17 +1215,17 @@ PeCoffLoaderGetPdbPointer (
   IN VOID  *Pe32Data
   )
 {
-  EFI_IMAGE_DOS_HEADER                  *DosHdr;
-  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION   Hdr;
-  EFI_IMAGE_DATA_DIRECTORY              *DirectoryEntry;
-  EFI_IMAGE_DEBUG_DIRECTORY_ENTRY       *DebugEntry;
-  UINTN                                 DirCount;
-  VOID                                  *CodeViewEntryPointer;
-  INTN                                  TEImageAdjust;
-  UINT32                                NumberOfRvaAndSizes;
-  UINT16                                Magic;
-  EFI_IMAGE_SECTION_HEADER              *SectionHeader;
-  UINT32                                Index, Index1;
+  EFI_IMAGE_DOS_HEADER                 *DosHdr;
+  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;
+  EFI_IMAGE_DATA_DIRECTORY             *DirectoryEntry;
+  EFI_IMAGE_DEBUG_DIRECTORY_ENTRY      *DebugEntry;
+  UINTN                                DirCount;
+  VOID                                 *CodeViewEntryPointer;
+  INTN                                 TEImageAdjust;
+  UINT32                               NumberOfRvaAndSizes;
+  UINT16                               Magic;
+  EFI_IMAGE_SECTION_HEADER             *SectionHeader;
+  UINT32                               Index, Index1;
 
   if (Pe32Data == NULL) {
     return NULL;
@@ -1233,7 +1244,7 @@ PeCoffLoaderGetPdbPointer (
     //
     // DOS image header is present, so read the PE header after the DOS image header.
     //
-    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
   } else {
     //
     // DOS image header is not present, so PE header is at the image base.
@@ -1243,22 +1254,23 @@ PeCoffLoaderGetPdbPointer (
 
   if (EFI_TE_IMAGE_HEADER_SIGNATURE == Hdr.Te->Signature) {
     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;
+      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 ++) {
+      SectionHeader = (EFI_IMAGE_SECTION_HEADER *)(Hdr.Te + 1);
+      Index         = Hdr.Te->NumberOfSections;
+      for (Index1 = 0; Index1 < Index; Index1++) {
         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 +
-                        TEImageAdjust);
+            (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 +
+                                                           TEImageAdjust);
           break;
         }
       }
@@ -1270,32 +1282,32 @@ PeCoffLoaderGetPdbPointer (
     //       generate PE32+ image with PE32 Magic.
     //
     switch (Hdr.Pe32->FileHeader.Machine) {
-    case EFI_IMAGE_MACHINE_IA32:
-    case EFI_IMAGE_MACHINE_ARMT:
-      //
-      // Assume PE32 image with IA32 Machine field.
-      //
-      Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
-      break;
-    case EFI_IMAGE_MACHINE_X64:
-      //
-      // Assume PE32+ image with X64 Machine field
-      //
-      Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
-      break;
-    default:
-      //
-      // For unknown Machine field, use Magic in optional Header
-      //
-      Magic = Hdr.Pe32->OptionalHeader.Magic;
+      case EFI_IMAGE_MACHINE_IA32:
+      case EFI_IMAGE_MACHINE_ARMT:
+        //
+        // Assume PE32 image with IA32 Machine field.
+        //
+        Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+        break;
+      case EFI_IMAGE_MACHINE_X64:
+        //
+        // Assume PE32+ image with X64 Machine field
+        //
+        Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+        break;
+      default:
+        //
+        // For unknown Machine field, use Magic in optional Header
+        //
+        Magic = Hdr.Pe32->OptionalHeader.Magic;
     }
 
-    SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
-                       (UINT8 *) Hdr.Pe32 +
-                       sizeof (UINT32) +
-                       sizeof (EFI_IMAGE_FILE_HEADER) +
-                       Hdr.Pe32->FileHeader.SizeOfOptionalHeader
-                       );
+    SectionHeader = (EFI_IMAGE_SECTION_HEADER *)(
+                                                 (UINT8 *)Hdr.Pe32 +
+                                                 sizeof (UINT32) +
+                                                 sizeof (EFI_IMAGE_FILE_HEADER) +
+                                                 Hdr.Pe32->FileHeader.SizeOfOptionalHeader
+                                                 );
     Index = Hdr.Pe32->FileHeader.NumberOfSections;
 
     if (EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC == Magic) {
@@ -1303,30 +1315,31 @@ PeCoffLoaderGetPdbPointer (
       // Use PE32 offset get Debug Directory Entry
       //
       NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
-      DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+      DirectoryEntry      = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
     } else if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
       //
       // Use PE32+ offset get Debug Directory Entry
       //
       NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
-      DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
+      DirectoryEntry      = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
     }
 
-    if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG || DirectoryEntry->VirtualAddress == 0) {
+    if ((NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) || (DirectoryEntry->VirtualAddress == 0)) {
       DirectoryEntry = NULL;
-      DebugEntry = NULL;
+      DebugEntry     = NULL;
     } else {
       //
       // Get the DebugEntry offset in the raw data image.
       //
-      for (Index1 = 0; Index1 < Index; Index1 ++) {
+      for (Index1 = 0; Index1 < Index; Index1++) {
         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 +
-                       SectionHeader[Index1].PointerToRawData);
+            (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize)))
+        {
+          DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)(
+                                                           (UINTN)Pe32Data +
+                                                           DirectoryEntry->VirtualAddress -
+                                                           SectionHeader[Index1].VirtualAddress +
+                                                           SectionHeader[Index1].PointerToRawData);
           break;
         }
       }
@@ -1335,7 +1348,7 @@ PeCoffLoaderGetPdbPointer (
     return NULL;
   }
 
-  if (NULL == DebugEntry || NULL == DirectoryEntry) {
+  if ((NULL == DebugEntry) || (NULL == DirectoryEntry)) {
     return NULL;
   }
 
@@ -1349,33 +1362,36 @@ PeCoffLoaderGetPdbPointer (
         // Get the DebugEntry offset in the raw data image.
         //
         CodeViewEntryPointer = NULL;
-        for (Index1 = 0; Index1 < Index; Index1 ++) {
+        for (Index1 = 0; Index1 < Index; Index1++) {
           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)TEImageAdjust);
+              (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize)))
+          {
+            CodeViewEntryPointer = (VOID *)(
+                                            ((UINTN)Pe32Data) +
+                                            (UINTN)DebugEntry->RVA -
+                                            SectionHeader[Index1].VirtualAddress +
+                                            SectionHeader[Index1].PointerToRawData +
+                                            (UINTN)TEImageAdjust);
             break;
           }
         }
+
         if (Index1 >= Index) {
           //
           // Can't find CodeViewEntryPointer in raw PE/COFF image.
           //
           continue;
         }
-        switch (* (UINT32 *) CodeViewEntryPointer) {
-        case CODEVIEW_SIGNATURE_NB10:
-          return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
-        case CODEVIEW_SIGNATURE_RSDS:
-          return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
-        case CODEVIEW_SIGNATURE_MTOC:
-          return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
-        default:
-          break;
+
+        switch (*(UINT32 *)CodeViewEntryPointer) {
+          case CODEVIEW_SIGNATURE_NB10:
+            return (VOID *)((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
+          case CODEVIEW_SIGNATURE_RSDS:
+            return (VOID *)((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
+          case CODEVIEW_SIGNATURE_MTOC:
+            return (VOID *)((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
+          default:
+            break;
         }
       }
     }
@@ -1384,7 +1400,6 @@ PeCoffLoaderGetPdbPointer (
   return NULL;
 }
 
-
 RETURN_STATUS
 EFIAPI
 PeCoffLoaderGetEntryPoint (
@@ -1393,15 +1408,15 @@ PeCoffLoaderGetEntryPoint (
   OUT VOID  **BaseOfImage
   )
 {
-  EFI_IMAGE_DOS_HEADER                  *DosHdr;
-  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION   Hdr;
+  EFI_IMAGE_DOS_HEADER                 *DosHdr;
+  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;
 
   DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
   if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
     //
     // DOS image header is present, so read the PE header after the DOS image header.
     //
-    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN) Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));
+    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHdr->e_lfanew) & 0x0ffff));
   } else {
     //
     // DOS image header is not present, so PE header is at the image base.
@@ -1415,7 +1430,7 @@ PeCoffLoaderGetEntryPoint (
   //
   if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
     *BaseOfImage = (VOID *)(UINTN)(Hdr.Te->ImageBase + Hdr.Te->StrippedSize - sizeof (EFI_TE_IMAGE_HEADER));
-    *EntryPoint = (VOID *)((UINTN)*BaseOfImage + (Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) + sizeof(EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);
+    *EntryPoint  = (VOID *)((UINTN)*BaseOfImage + (Hdr.Te->AddressOfEntryPoint & 0x0ffffffff) + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);
     return RETURN_SUCCESS;
   } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
     *EntryPoint = (VOID *)(UINTN)Hdr.Pe32->OptionalHeader.AddressOfEntryPoint;
@@ -1424,6 +1439,7 @@ PeCoffLoaderGetEntryPoint (
     } else {
       *BaseOfImage = (VOID *)(UINTN)Hdr.Pe32Plus->OptionalHeader.ImageBase;
     }
+
     *EntryPoint = (VOID *)(UINTN)((UINTN)*EntryPoint + (UINTN)*BaseOfImage);
     return RETURN_SUCCESS;
   }
diff --git a/BaseTools/Source/C/Common/BinderFuncs.c b/BaseTools/Source/C/Common/BinderFuncs.c
index de835287e95c..be256c1fd29a 100644
--- a/BaseTools/Source/C/Common/BinderFuncs.c
+++ b/BaseTools/Source/C/Common/BinderFuncs.c
@@ -17,15 +17,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 VOID *
 CommonLibBinderAllocate (
-  IN UINTN Size
+  IN UINTN  Size
   )
 {
-  return (VOID *) malloc (Size);
+  return (VOID *)malloc (Size);
 }
 
 VOID
 CommonLibBinderFree (
-  IN VOID *Pointer
+  IN VOID  *Pointer
   )
 {
   free (Pointer);
@@ -33,9 +33,9 @@ CommonLibBinderFree (
 
 VOID
 CommonLibBinderCopyMem (
-  IN VOID *Destination,
-  IN VOID *Source,
-  IN UINTN Length
+  IN VOID   *Destination,
+  IN VOID   *Source,
+  IN UINTN  Length
   )
 {
   memmove (Destination, Source, Length);
@@ -43,9 +43,9 @@ CommonLibBinderCopyMem (
 
 VOID
 CommonLibBinderSetMem (
-  IN VOID *Destination,
-  IN UINTN Length,
-  IN UINT8 Value
+  IN VOID   *Destination,
+  IN UINTN  Length,
+  IN UINT8  Value
   )
 {
   memset (Destination, Value, Length);
@@ -53,9 +53,9 @@ CommonLibBinderSetMem (
 
 INTN
 CommonLibBinderCompareMem (
-  IN VOID *MemOne,
-  IN VOID *MemTwo,
-  IN UINTN Length
+  IN VOID   *MemOne,
+  IN VOID   *MemTwo,
+  IN UINTN  Length
   )
 {
   return memcmp (MemOne, MemTwo, Length);
@@ -63,12 +63,9 @@ CommonLibBinderCompareMem (
 
 BOOLEAN
 CommonLibBinderCompareGuid (
-  IN EFI_GUID *Guid1,
-  IN EFI_GUID *Guid2
+  IN EFI_GUID  *Guid1,
+  IN EFI_GUID  *Guid2
   )
 {
   return CompareGuid (Guid1, Guid2) ? FALSE : TRUE;
 }
-
-
-
diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c
index cd270f9a9074..861426dd8d3f 100644
--- a/BaseTools/Source/C/Common/CommonLib.c
+++ b/BaseTools/Source/C/Common/CommonLib.c
@@ -11,9 +11,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <stdlib.h>
 #include <ctype.h>
 #ifdef __GNUC__
-#include <unistd.h>
+  #include <unistd.h>
 #else
-#include <direct.h>
+  #include <direct.h>
 #endif
 #include "CommonLib.h"
 #include "EfiUtilityMsgs.h"
@@ -60,11 +60,11 @@ PeiCopyMem (
   IN UINTN  Length
   )
 {
-  CHAR8 *Destination8;
-  CHAR8 *Source8;
+  CHAR8  *Destination8;
+  CHAR8  *Source8;
 
-  Destination8  = Destination;
-  Source8       = Source;
+  Destination8 = Destination;
+  Source8      = Source;
   while (Length--) {
     *(Destination8++) = *(Source8++);
   }
@@ -100,21 +100,21 @@ CopyMem (
 **/
 INTN
 CompareGuid (
-  IN EFI_GUID     *Guid1,
-  IN EFI_GUID     *Guid2
+  IN EFI_GUID  *Guid1,
+  IN EFI_GUID  *Guid2
   )
 {
-  INT32 *g1;
-  INT32 *g2;
-  INT32 r;
+  INT32  *g1;
+  INT32  *g2;
+  INT32  r;
 
   //
   // Compare 32 bits at a time
   //
-  g1  = (INT32 *) Guid1;
-  g2  = (INT32 *) Guid2;
+  g1 = (INT32 *)Guid1;
+  g2 = (INT32 *)Guid2;
 
-  r   = g1[0] - g2[0];
+  r  = g1[0] - g2[0];
   r |= g1[1] - g2[1];
   r |= g1[2] - g2[2];
   r |= g1[3] - g2[3];
@@ -148,9 +148,10 @@ GetFileImage (
   //
   // Verify input parameters.
   //
-  if (InputFileName == NULL || strlen (InputFileName) == 0 || InputFileImage == NULL) {
+  if ((InputFileName == NULL) || (strlen (InputFileName) == 0) || (InputFileImage == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // Open the file and copy contents into a memory buffer.
   //
@@ -162,6 +163,7 @@ GetFileImage (
     Error (NULL, 0, 0001, "Error opening the input file", InputFileName);
     return EFI_ABORTED;
   }
+
   //
   // Go to the end so that we can determine the file size
   //
@@ -170,6 +172,7 @@ GetFileImage (
     fclose (InputFile);
     return EFI_ABORTED;
   }
+
   //
   // Get the file size
   //
@@ -179,6 +182,7 @@ GetFileImage (
     fclose (InputFile);
     return EFI_ABORTED;
   }
+
   //
   // Allocate a buffer
   //
@@ -187,6 +191,7 @@ GetFileImage (
     fclose (InputFile);
     return EFI_OUT_OF_RESOURCES;
   }
+
   //
   // Reset to the beginning of the file
   //
@@ -197,6 +202,7 @@ GetFileImage (
     *InputFileImage = NULL;
     return EFI_ABORTED;
   }
+
   //
   // Read all of the file contents.
   //
@@ -208,6 +214,7 @@ GetFileImage (
     *InputFileImage = NULL;
     return EFI_ABORTED;
   }
+
   //
   // Close the file
   //
@@ -230,9 +237,9 @@ GetFileImage (
 **/
 EFI_STATUS
 PutFileImage (
-  IN CHAR8    *OutputFileName,
-  IN CHAR8    *OutputFileImage,
-  IN UINT32   BytesToWrite
+  IN CHAR8   *OutputFileName,
+  IN CHAR8   *OutputFileImage,
+  IN UINT32  BytesToWrite
   )
 {
   FILE    *OutputFile;
@@ -241,9 +248,10 @@ PutFileImage (
   //
   // Verify input parameters.
   //
-  if (OutputFileName == NULL || strlen (OutputFileName) == 0 || OutputFileImage == NULL) {
+  if ((OutputFileName == NULL) || (strlen (OutputFileName) == 0) || (OutputFileImage == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // Open the file and copy contents into a memory buffer.
   //
@@ -265,6 +273,7 @@ PutFileImage (
     fclose (OutputFile);
     return EFI_ABORTED;
   }
+
   //
   // Close the file
   //
@@ -283,11 +292,11 @@ PutFileImage (
 **/
 UINT8
 CalculateChecksum8 (
-  IN UINT8        *Buffer,
-  IN UINTN        Size
+  IN UINT8  *Buffer,
+  IN UINTN  Size
   )
 {
-  return (UINT8) (0x100 - CalculateSum8 (Buffer, Size));
+  return (UINT8)(0x100 - CalculateSum8 (Buffer, Size));
 }
 
 /**
@@ -304,8 +313,8 @@ CalculateSum8 (
   IN UINTN  Size
   )
 {
-  UINTN Index;
-  UINT8 Sum;
+  UINTN  Index;
+  UINT8  Sum;
 
   Sum = 0;
 
@@ -313,7 +322,7 @@ CalculateSum8 (
   // Perform the byte sum for buffer
   //
   for (Index = 0; Index < Size; Index++) {
-    Sum = (UINT8) (Sum + Buffer[Index]);
+    Sum = (UINT8)(Sum + Buffer[Index]);
   }
 
   return Sum;
@@ -324,16 +333,16 @@ CalculateSum8 (
 
   @param Buffer      Pointer to buffer containing byte data of component.
   @param Size        Size of the buffer
- 
+
   @return The 16 bit checksum value needed.
 **/
 UINT16
 CalculateChecksum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
+  IN UINT16  *Buffer,
+  IN UINTN   Size
   )
 {
-  return (UINT16) (0x10000 - CalculateSum16 (Buffer, Size));
+  return (UINT16)(0x10000 - CalculateSum16 (Buffer, Size));
 }
 
 /**
@@ -346,8 +355,8 @@ CalculateChecksum16 (
 **/
 UINT16
 CalculateSum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
+  IN UINT16  *Buffer,
+  IN UINTN   Size
   )
 {
   UINTN   Index;
@@ -359,10 +368,10 @@ CalculateSum16 (
   // Perform the word sum for buffer
   //
   for (Index = 0; Index < Size; Index++) {
-    Sum = (UINT16) (Sum + Buffer[Index]);
+    Sum = (UINT16)(Sum + Buffer[Index]);
   }
 
-  return (UINT16) Sum;
+  return (UINT16)Sum;
 }
 
 /**
@@ -375,7 +384,7 @@ CalculateSum16 (
 **/
 EFI_STATUS
 PrintGuid (
-  IN EFI_GUID *Guid
+  IN EFI_GUID  *Guid
   )
 {
   if (Guid == NULL) {
@@ -385,7 +394,7 @@ PrintGuid (
 
   printf (
     "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
-    (unsigned) Guid->Data1,
+    (unsigned)Guid->Data1,
     Guid->Data2,
     Guid->Data3,
     Guid->Data4[0],
@@ -414,10 +423,10 @@ PrintGuid (
 **/
 EFI_STATUS
 PrintGuidToBuffer (
-  IN EFI_GUID     *Guid,
-  IN OUT UINT8    *Buffer,
-  IN UINT32       BufferLen,
-  IN BOOLEAN      Uppercase
+  IN EFI_GUID   *Guid,
+  IN OUT UINT8  *Buffer,
+  IN UINT32     BufferLen,
+  IN BOOLEAN    Uppercase
   )
 {
   if (Guid == NULL) {
@@ -434,7 +443,7 @@ PrintGuidToBuffer (
     sprintf (
       (CHAR8 *)Buffer,
       "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
-      (unsigned) Guid->Data1,
+      (unsigned)Guid->Data1,
       Guid->Data2,
       Guid->Data3,
       Guid->Data4[0],
@@ -450,7 +459,7 @@ PrintGuidToBuffer (
     sprintf (
       (CHAR8 *)Buffer,
       "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-      (unsigned) Guid->Data1,
+      (unsigned)Guid->Data1,
       Guid->Data2,
       Guid->Data3,
       Guid->Data4[0],
@@ -469,32 +478,42 @@ PrintGuidToBuffer (
 
 #ifdef __GNUC__
 
-size_t _filelength(int fd)
+size_t
+_filelength (
+  int  fd
+  )
 {
-  struct stat stat_buf;
-  fstat(fd, &stat_buf);
+  struct stat  stat_buf;
+
+  fstat (fd, &stat_buf);
   return stat_buf.st_size;
 }
 
-#ifndef __CYGWIN__
-char *strlwr(char *s)
+  #ifndef __CYGWIN__
+char *
+strlwr (
+  char  *s
+  )
 {
-  char *p = s;
-  for(;*s;s++) {
-    *s = tolower(*s);
+  char  *p = s;
+
+  for ( ; *s; s++) {
+    *s = tolower (*s);
   }
+
   return p;
 }
-#endif
+
+  #endif
 #endif
 
-#define WINDOWS_EXTENSION_PATH "\\\\?\\"
-#define WINDOWS_UNC_EXTENSION_PATH "\\\\?\\UNC"
+#define WINDOWS_EXTENSION_PATH      "\\\\?\\"
+#define WINDOWS_UNC_EXTENSION_PATH  "\\\\?\\UNC"
 
 //
 // Global data to store full file path. It is not required to be free.
 //
-CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
+CHAR8  mCommonLibFullPath[MAX_LONG_FILE_PATH];
 
 /**
   Convert FileName to the long file path, which can support larger than 260 length.
@@ -505,21 +524,21 @@ CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
 **/
 CHAR8 *
 LongFilePath (
- IN CHAR8 *FileName
- )
+  IN CHAR8  *FileName
+  )
 {
-#ifdef __GNUC__
+ #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.
   //
   return FileName;
-#else
-  CHAR8 *RootPath;
-  CHAR8 *PathPointer;
-  CHAR8 *NextPointer;
+ #else
+  CHAR8  *RootPath;
+  CHAR8  *PathPointer;
+  CHAR8  *NextPointer;
 
-  PathPointer = (CHAR8 *) FileName;
+  PathPointer = (CHAR8 *)FileName;
 
   if (FileName != NULL) {
     //
@@ -528,13 +547,13 @@ LongFilePath (
     mCommonLibFullPath[0] = 0;
     strcpy (mCommonLibFullPath, WINDOWS_EXTENSION_PATH);
 
-    if (strlen (FileName) > 1 && FileName[0] == '\\' && FileName[1] == '\\') {
+    if ((strlen (FileName) > 1) && (FileName[0] == '\\') && (FileName[1] == '\\')) {
       //
       // network path like \\server\share to \\?\UNC\server\share
       //
       strcpy (mCommonLibFullPath, WINDOWS_UNC_EXTENSION_PATH);
-      FileName ++;
-    } else if (strlen (FileName) < 3 || FileName[1] != ':' || (FileName[2] != '\\' && FileName[2] != '/')) {
+      FileName++;
+    } else if ((strlen (FileName) < 3) || (FileName[1] != ':') || ((FileName[2] != '\\') && (FileName[2] != '/'))) {
       //
       // Relative file path. Convert it to absolute path.
       //
@@ -545,18 +564,21 @@ LongFilePath (
           free (RootPath);
           return NULL;
         }
+
         strncat (mCommonLibFullPath, RootPath, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
-        if (FileName[0] != '\\' && FileName[0] != '/') {
+        if ((FileName[0] != '\\') && (FileName[0] != '/')) {
           if (strlen (mCommonLibFullPath) + 1 > MAX_LONG_FILE_PATH - 1) {
             Error (NULL, 0, 2000, "Invalid parameter", "RootPath is too long!");
             free (RootPath);
             return NULL;
           }
+
           //
           // Attach directory separator
           //
           strncat (mCommonLibFullPath, "\\", MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
         }
+
         free (RootPath);
       }
     }
@@ -568,17 +590,18 @@ LongFilePath (
       Error (NULL, 0, 2000, "Invalid parameter", "FileName %s is too long!", FileName);
       return NULL;
     }
+
     strncat (mCommonLibFullPath, FileName, MAX_LONG_FILE_PATH - strlen (mCommonLibFullPath) - 1);
 
     //
     // Convert directory separator '/' to '\\'
     //
-    PathPointer = (CHAR8 *) mCommonLibFullPath;
+    PathPointer = (CHAR8 *)mCommonLibFullPath;
     do {
       if (*PathPointer == '/') {
         *PathPointer = '\\';
       }
-    } while (*PathPointer ++ != '\0');
+    } while (*PathPointer++ != '\0');
 
     //
     // Convert ":\\\\" to ":\\", because it doesn't work with WINDOWS_EXTENSION_PATH.
@@ -610,7 +633,7 @@ LongFilePath (
     while ((PathPointer = strstr (mCommonLibFullPath, "\\..\\")) != NULL) {
       NextPointer = PathPointer + 3;
       do {
-        PathPointer --;
+        PathPointer--;
       } while (PathPointer > mCommonLibFullPath && *PathPointer != ':' && *PathPointer != '\\');
 
       if (*PathPointer == '\\') {
@@ -631,16 +654,16 @@ LongFilePath (
   }
 
   return PathPointer;
-#endif
+ #endif
 }
 
 CHAR16
 InternalCharToUpper (
-        CHAR16                    Char
+  CHAR16  Char
   )
 {
-  if (Char >= L'a' && Char <= L'z') {
-    return (CHAR16) (Char - (L'a' - L'A'));
+  if ((Char >= L'a') && (Char <= L'z')) {
+    return (CHAR16)(Char - (L'a' - L'A'));
   }
 
   return Char;
@@ -648,13 +671,13 @@ InternalCharToUpper (
 
 UINTN
 StrnLenS (
-   CONST CHAR16              *String,
-   UINTN                     MaxSize
+  CONST CHAR16  *String,
+  UINTN         MaxSize
   )
 {
-  UINTN     Length;
+  UINTN  Length;
 
-  ASSERT (((UINTN) String & BIT0) == 0);
+  ASSERT (((UINTN)String & BIT0) == 0);
 
   //
   // If String is a null pointer or MaxSize is 0, then the StrnLenS function returns zero.
@@ -668,47 +691,48 @@ StrnLenS (
     if (Length >= MaxSize - 1) {
       return MaxSize;
     }
+
     Length++;
   }
+
   return Length;
 }
 
-
 VOID *
 InternalAllocatePool (
-   UINTN   AllocationSize
+  UINTN  AllocationSize
   )
 {
-  VOID * Memory;
+  VOID  *Memory;
 
-  Memory = malloc(AllocationSize);
-  ASSERT(Memory != NULL);
+  Memory = malloc (AllocationSize);
+  ASSERT (Memory != NULL);
   return Memory;
 }
 
-
 VOID *
 InternalReallocatePool (
-   UINTN            OldSize,
-   UINTN            NewSize,
-   VOID             *OldBuffer  OPTIONAL
+  UINTN  OldSize,
+  UINTN  NewSize,
+  VOID   *OldBuffer  OPTIONAL
   )
 {
   VOID  *NewBuffer;
 
   NewBuffer = AllocateZeroPool (NewSize);
-  if (NewBuffer != NULL && OldBuffer != NULL) {
+  if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
     memcpy (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
-    free(OldBuffer);
+    free (OldBuffer);
   }
+
   return NewBuffer;
 }
 
 VOID *
 ReallocatePool (
-   UINTN  OldSize,
-   UINTN  NewSize,
-   VOID   *OldBuffer  OPTIONAL
+  UINTN  OldSize,
+  UINTN  NewSize,
+  VOID   *OldBuffer  OPTIONAL
   )
 {
   return InternalReallocatePool (OldSize, NewSize, OldBuffer);
@@ -733,13 +757,13 @@ ReallocatePool (
 **/
 UINTN
 StrLen (
-  CONST CHAR16              *String
+  CONST CHAR16  *String
   )
 {
-  UINTN   Length;
+  UINTN  Length;
 
   ASSERT (String != NULL);
-  ASSERT (((UINTN) String & BIT0) == 0);
+  ASSERT (((UINTN)String & BIT0) == 0);
 
   for (Length = 0; *String != L'\0'; String++, Length++) {
     //
@@ -747,21 +771,24 @@ StrLen (
     // length should not more than PcdMaximumUnicodeStringLength
     //
   }
+
   return Length;
 }
 
 BOOLEAN
 InternalSafeStringIsOverlap (
-  IN VOID    *Base1,
-  IN UINTN   Size1,
-  IN VOID    *Base2,
-  IN UINTN   Size2
+  IN VOID   *Base1,
+  IN UINTN  Size1,
+  IN VOID   *Base2,
+  IN UINTN  Size2
   )
 {
   if ((((UINTN)Base1 >= (UINTN)Base2) && ((UINTN)Base1 < (UINTN)Base2 + Size2)) ||
-      (((UINTN)Base2 >= (UINTN)Base1) && ((UINTN)Base2 < (UINTN)Base1 + Size1))) {
+      (((UINTN)Base2 >= (UINTN)Base1) && ((UINTN)Base2 < (UINTN)Base1 + Size1)))
+  {
     return TRUE;
   }
+
   return FALSE;
 }
 
@@ -773,7 +800,7 @@ InternalSafeStringNoStrOverlap (
   IN UINTN   Size2
   )
 {
-  return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof(CHAR16), Str2, Size2 * sizeof(CHAR16));
+  return !InternalSafeStringIsOverlap (Str1, Size1 * sizeof (CHAR16), Str2, Size2 * sizeof (CHAR16));
 }
 
 /**
@@ -826,12 +853,12 @@ InternalSafeStringNoStrOverlap (
 **/
 RETURN_STATUS
 StrDecimalToUint64S (
-    CONST CHAR16             *String,
-         CHAR16             **EndPointer,  OPTIONAL
-         UINT64             *Data
+  CONST CHAR16 *String,
+  CHAR16 **EndPointer, OPTIONAL
+  UINT64             *Data
   )
 {
-  ASSERT (((UINTN) String & BIT0) == 0);
+  ASSERT (((UINTN)String & BIT0) == 0);
 
   //
   // 1. Neither String nor Data shall be a null pointer.
@@ -847,7 +874,7 @@ StrDecimalToUint64S (
   }
 
   if (EndPointer != NULL) {
-    *EndPointer = (CHAR16 *) String;
+    *EndPointer = (CHAR16 *)String;
   }
 
   //
@@ -875,8 +902,9 @@ StrDecimalToUint64S (
     if (*Data > ((MAX_UINT64 - (*String - L'0'))/10)) {
       *Data = MAX_UINT64;
       if (EndPointer != NULL) {
-        *EndPointer = (CHAR16 *) String;
+        *EndPointer = (CHAR16 *)String;
       }
+
       return RETURN_UNSUPPORTED;
     }
 
@@ -885,8 +913,9 @@ StrDecimalToUint64S (
   }
 
   if (EndPointer != NULL) {
-    *EndPointer = (CHAR16 *) String;
+    *EndPointer = (CHAR16 *)String;
   }
+
   return RETURN_SUCCESS;
 }
 
@@ -945,12 +974,12 @@ StrDecimalToUint64S (
 **/
 RETURN_STATUS
 StrHexToUint64S (
-    CONST CHAR16             *String,
-         CHAR16             **EndPointer,  OPTIONAL
-         UINT64             *Data
+  CONST CHAR16 *String,
+  CHAR16 **EndPointer, OPTIONAL
+  UINT64             *Data
   )
 {
-  ASSERT (((UINTN) String & BIT0) == 0);
+  ASSERT (((UINTN)String & BIT0) == 0);
 
   //
   // 1. Neither String nor Data shall be a null pointer.
@@ -966,7 +995,7 @@ StrHexToUint64S (
   }
 
   if (EndPointer != NULL) {
-    *EndPointer = (CHAR16 *) String;
+    *EndPointer = (CHAR16 *)String;
   }
 
   //
@@ -988,6 +1017,7 @@ StrHexToUint64S (
       *Data = 0;
       return RETURN_SUCCESS;
     }
+
     //
     // Skip the 'X'
     //
@@ -1005,8 +1035,9 @@ StrHexToUint64S (
     if (*Data > ((MAX_UINT64 - InternalHexCharToUintn (*String))>>4)) {
       *Data = MAX_UINT64;
       if (EndPointer != NULL) {
-        *EndPointer = (CHAR16 *) String;
+        *EndPointer = (CHAR16 *)String;
       }
+
       return RETURN_UNSUPPORTED;
     }
 
@@ -1015,46 +1046,45 @@ StrHexToUint64S (
   }
 
   if (EndPointer != NULL) {
-    *EndPointer = (CHAR16 *) String;
+    *EndPointer = (CHAR16 *)String;
   }
+
   return RETURN_SUCCESS;
 }
 
 UINT64
 StrDecimalToUint64 (
-  CONST CHAR16              *String
+  CONST CHAR16  *String
   )
 {
-  UINT64     Result;
+  UINT64  Result;
 
-  StrDecimalToUint64S (String, (CHAR16 **) NULL, &Result);
+  StrDecimalToUint64S (String, (CHAR16 **)NULL, &Result);
   return Result;
 }
 
-
 UINT64
 StrHexToUint64 (
-  CONST CHAR16             *String
+  CONST CHAR16  *String
   )
 {
-  UINT64    Result;
+  UINT64  Result;
 
-  StrHexToUint64S (String, (CHAR16 **) NULL, &Result);
+  StrHexToUint64S (String, (CHAR16 **)NULL, &Result);
   return Result;
 }
 
 UINTN
 StrSize (
-  CONST CHAR16              *String
+  CONST CHAR16  *String
   )
 {
   return (StrLen (String) + 1) * sizeof (*String);
 }
 
-
 UINT64
 ReadUnaligned64 (
-   CONST UINT64              *Buffer
+  CONST UINT64  *Buffer
   )
 {
   ASSERT (Buffer != NULL);
@@ -1064,8 +1094,8 @@ ReadUnaligned64 (
 
 UINT64
 WriteUnaligned64 (
-   UINT64                    *Buffer,
-   UINT64                    Value
+  UINT64  *Buffer,
+  UINT64  Value
   )
 {
   ASSERT (Buffer != NULL);
@@ -1073,58 +1103,56 @@ WriteUnaligned64 (
   return *Buffer = Value;
 }
 
-
 EFI_GUID *
 CopyGuid (
-   EFI_GUID         *DestinationGuid,
-   CONST EFI_GUID  *SourceGuid
+  EFI_GUID        *DestinationGuid,
+  CONST EFI_GUID  *SourceGuid
   )
 {
   WriteUnaligned64 (
-    (UINT64*)DestinationGuid,
-    ReadUnaligned64 ((CONST UINT64*)SourceGuid)
+    (UINT64 *)DestinationGuid,
+    ReadUnaligned64 ((CONST UINT64 *)SourceGuid)
     );
   WriteUnaligned64 (
-    (UINT64*)DestinationGuid + 1,
-    ReadUnaligned64 ((CONST UINT64*)SourceGuid + 1)
+    (UINT64 *)DestinationGuid + 1,
+    ReadUnaligned64 ((CONST UINT64 *)SourceGuid + 1)
     );
   return DestinationGuid;
 }
 
 UINT16
 SwapBytes16 (
-  UINT16                    Value
+  UINT16  Value
   )
 {
-  return (UINT16) ((Value<< 8) | (Value>> 8));
+  return (UINT16)((Value<< 8) | (Value>> 8));
 }
 
-
 UINT32
 SwapBytes32 (
-  UINT32                    Value
+  UINT32  Value
   )
 {
   UINT32  LowerBytes;
   UINT32  HigherBytes;
 
-  LowerBytes  = (UINT32) SwapBytes16 ((UINT16) Value);
-  HigherBytes = (UINT32) SwapBytes16 ((UINT16) (Value >> 16));
+  LowerBytes  = (UINT32)SwapBytes16 ((UINT16)Value);
+  HigherBytes = (UINT32)SwapBytes16 ((UINT16)(Value >> 16));
   return (LowerBytes << 16 | HigherBytes);
 }
 
 BOOLEAN
 InternalIsDecimalDigitCharacter (
-  CHAR16                    Char
+  CHAR16  Char
   )
 {
-  return (BOOLEAN) (Char >= L'0' && Char <= L'9');
+  return (BOOLEAN)(Char >= L'0' && Char <= L'9');
 }
 
 VOID *
 InternalAllocateCopyPool (
-   UINTN            AllocationSize,
-   CONST VOID       *Buffer
+  UINTN       AllocationSize,
+  CONST VOID  *Buffer
   )
 {
   VOID  *Memory;
@@ -1133,25 +1161,25 @@ InternalAllocateCopyPool (
 
   Memory = malloc (AllocationSize);
   if (Memory != NULL) {
-     Memory = memcpy (Memory, Buffer, AllocationSize);
+    Memory = memcpy (Memory, Buffer, AllocationSize);
   }
+
   return Memory;
 }
 
 BOOLEAN
 InternalIsHexaDecimalDigitCharacter (
-  CHAR16                    Char
+  CHAR16  Char
   )
 {
-
-  return (BOOLEAN) (InternalIsDecimalDigitCharacter (Char) ||
-    (Char >= L'A' && Char <= L'F') ||
-    (Char >= L'a' && Char <= L'f'));
+  return (BOOLEAN)(InternalIsDecimalDigitCharacter (Char) ||
+                   (Char >= L'A' && Char <= L'F') ||
+                   (Char >= L'a' && Char <= L'f'));
 }
 
 UINTN
 InternalHexCharToUintn (
-        CHAR16                    Char
+  CHAR16  Char
   )
 {
   if (InternalIsDecimalDigitCharacter (Char)) {
@@ -1161,7 +1189,6 @@ InternalHexCharToUintn (
   return (10 + InternalCharToUpper (Char) - L'A');
 }
 
-
 /**
   Convert a Null-terminated Unicode hexadecimal string to a byte array.
 
@@ -1208,15 +1235,15 @@ InternalHexCharToUintn (
 **/
 RETURN_STATUS
 StrHexToBytes (
-   CONST CHAR16       *String,
-   UINTN              Length,
-   UINT8              *Buffer,
-   UINTN              MaxBufferSize
+  CONST CHAR16  *String,
+  UINTN         Length,
+  UINT8         *Buffer,
+  UINTN         MaxBufferSize
   )
 {
-  UINTN                  Index;
+  UINTN  Index;
 
-  ASSERT (((UINTN) String & BIT0) == 0);
+  ASSERT (((UINTN)String & BIT0) == 0);
 
   //
   // 1. None of String or Buffer shall be a null pointer.
@@ -1249,6 +1276,7 @@ StrHexToBytes (
       break;
     }
   }
+
   if (Index != Length) {
     return RETURN_UNSUPPORTED;
   }
@@ -1256,18 +1284,18 @@ StrHexToBytes (
   //
   // Convert the hex string to bytes.
   //
-  for(Index = 0; Index < Length; Index++) {
-
+  for (Index = 0; Index < Length; Index++) {
     //
     // For even characters, write the upper nibble for each buffer byte,
     // and for even characters, the lower nibble.
     //
     if ((Index & BIT0) == 0) {
-      Buffer[Index / 2]  = (UINT8) InternalHexCharToUintn (String[Index]) << 4;
+      Buffer[Index / 2] = (UINT8)InternalHexCharToUintn (String[Index]) << 4;
     } else {
-      Buffer[Index / 2] |= (UINT8) InternalHexCharToUintn (String[Index]);
+      Buffer[Index / 2] |= (UINT8)InternalHexCharToUintn (String[Index]);
     }
   }
+
   return RETURN_SUCCESS;
 }
 
@@ -1317,14 +1345,14 @@ StrHexToBytes (
 **/
 RETURN_STATUS
 StrToGuid (
-   CONST CHAR16       *String,
-   EFI_GUID           *Guid
+  CONST CHAR16  *String,
+  EFI_GUID      *Guid
   )
 {
-  RETURN_STATUS          Status;
-  EFI_GUID               LocalGuid;
+  RETURN_STATUS  Status;
+  EFI_GUID       LocalGuid;
 
-  ASSERT (((UINTN) String & BIT0) == 0);
+  ASSERT (((UINTN)String & BIT0) == 0);
 
   //
   // 1. None of String or Guid shall be a null pointer.
@@ -1335,49 +1363,53 @@ StrToGuid (
   //
   // Get aabbccdd in big-endian.
   //
-  Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *) &LocalGuid.Data1, sizeof (LocalGuid.Data1));
-  if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data1)] != L'-') {
+  Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data1), (UINT8 *)&LocalGuid.Data1, sizeof (LocalGuid.Data1));
+  if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data1)] != L'-')) {
     return RETURN_UNSUPPORTED;
   }
+
   //
   // Convert big-endian to little-endian.
   //
   LocalGuid.Data1 = SwapBytes32 (LocalGuid.Data1);
-  String += 2 * sizeof (LocalGuid.Data1) + 1;
+  String         += 2 * sizeof (LocalGuid.Data1) + 1;
 
   //
   // Get eeff in big-endian.
   //
-  Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *) &LocalGuid.Data2, sizeof (LocalGuid.Data2));
-  if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data2)] != L'-') {
+  Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data2), (UINT8 *)&LocalGuid.Data2, sizeof (LocalGuid.Data2));
+  if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data2)] != L'-')) {
     return RETURN_UNSUPPORTED;
   }
+
   //
   // Convert big-endian to little-endian.
   //
   LocalGuid.Data2 = SwapBytes16 (LocalGuid.Data2);
-  String += 2 * sizeof (LocalGuid.Data2) + 1;
+  String         += 2 * sizeof (LocalGuid.Data2) + 1;
 
   //
   // Get gghh in big-endian.
   //
-  Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *) &LocalGuid.Data3, sizeof (LocalGuid.Data3));
-  if (RETURN_ERROR (Status) || String[2 * sizeof (LocalGuid.Data3)] != L'-') {
+  Status = StrHexToBytes (String, 2 * sizeof (LocalGuid.Data3), (UINT8 *)&LocalGuid.Data3, sizeof (LocalGuid.Data3));
+  if (RETURN_ERROR (Status) || (String[2 * sizeof (LocalGuid.Data3)] != L'-')) {
     return RETURN_UNSUPPORTED;
   }
+
   //
   // Convert big-endian to little-endian.
   //
   LocalGuid.Data3 = SwapBytes16 (LocalGuid.Data3);
-  String += 2 * sizeof (LocalGuid.Data3) + 1;
+  String         += 2 * sizeof (LocalGuid.Data3) + 1;
 
   //
   // Get iijj.
   //
   Status = StrHexToBytes (String, 2 * 2, &LocalGuid.Data4[0], 2);
-  if (RETURN_ERROR (Status) || String[2 * 2] != L'-') {
+  if (RETURN_ERROR (Status) || (String[2 * 2] != L'-')) {
     return RETURN_UNSUPPORTED;
   }
+
   String += 2 * 2 + 1;
 
   //
@@ -1426,9 +1458,9 @@ StrToGuid (
 **/
 INTN
 StrnCmp (
-        CONST CHAR16              *FirstString,
-        CONST CHAR16              *SecondString,
-        UINTN                     Length
+  CONST CHAR16  *FirstString,
+  CONST CHAR16  *SecondString,
+  UINTN         Length
   )
 {
   if (Length == 0) {
@@ -1445,7 +1477,8 @@ StrnCmp (
   while ((*FirstString != L'\0') &&
          (*SecondString != L'\0') &&
          (*FirstString == *SecondString) &&
-         (Length > 1)) {
+         (Length > 1))
+  {
     FirstString++;
     SecondString++;
     Length--;
@@ -1456,8 +1489,8 @@ StrnCmp (
 
 VOID *
 AllocateCopyPool (
-   UINTN       AllocationSize,
-   CONST VOID  *Buffer
+  UINTN       AllocationSize,
+  CONST VOID  *Buffer
   )
 {
   return InternalAllocateCopyPool (AllocationSize, Buffer);
@@ -1465,8 +1498,8 @@ AllocateCopyPool (
 
 INTN
 StrCmp (
-  CONST CHAR16              *FirstString,
-  CONST CHAR16              *SecondString
+  CONST CHAR16  *FirstString,
+  CONST CHAR16  *SecondString
   )
 {
   //
@@ -1479,12 +1512,13 @@ StrCmp (
     FirstString++;
     SecondString++;
   }
+
   return *FirstString - *SecondString;
 }
 
 UINT64
 SwapBytes64 (
-  UINT64                    Value
+  UINT64  Value
   )
 {
   return InternalMathSwapBytes64 (Value);
@@ -1492,37 +1526,37 @@ SwapBytes64 (
 
 UINT64
 InternalMathSwapBytes64 (
-  UINT64                    Operand
+  UINT64  Operand
   )
 {
   UINT64  LowerBytes;
   UINT64  HigherBytes;
 
-  LowerBytes  = (UINT64) SwapBytes32 ((UINT32) Operand);
-  HigherBytes = (UINT64) SwapBytes32 ((UINT32) (Operand >> 32));
+  LowerBytes  = (UINT64)SwapBytes32 ((UINT32)Operand);
+  HigherBytes = (UINT64)SwapBytes32 ((UINT32)(Operand >> 32));
 
   return (LowerBytes << 32 | HigherBytes);
 }
 
 RETURN_STATUS
 StrToIpv4Address (
-  CONST CHAR16       *String,
-  CHAR16             **EndPointer,
-  EFI_IPv4_ADDRESS       *Address,
-  UINT8              *PrefixLength
+  CONST CHAR16      *String,
+  CHAR16            **EndPointer,
+  EFI_IPv4_ADDRESS  *Address,
+  UINT8             *PrefixLength
   )
 {
-  RETURN_STATUS          Status;
-  UINTN                  AddressIndex;
-  UINT64                 Uint64;
-  EFI_IPv4_ADDRESS       LocalAddress;
-  UINT8                  LocalPrefixLength;
-  CHAR16                 *Pointer;
+  RETURN_STATUS     Status;
+  UINTN             AddressIndex;
+  UINT64            Uint64;
+  EFI_IPv4_ADDRESS  LocalAddress;
+  UINT8             LocalPrefixLength;
+  CHAR16            *Pointer;
 
-  LocalPrefixLength = MAX_UINT8;
+  LocalPrefixLength    = MAX_UINT8;
   LocalAddress.Addr[0] = 0;
 
-  ASSERT (((UINTN) String & BIT0) == 0);
+  ASSERT (((UINTN)String & BIT0) == 0);
 
   //
   // 1. None of String or Guid shall be a null pointer.
@@ -1530,7 +1564,7 @@ StrToIpv4Address (
   SAFE_STRING_CONSTRAINT_CHECK ((String != NULL), RETURN_INVALID_PARAMETER);
   SAFE_STRING_CONSTRAINT_CHECK ((Address != NULL), RETURN_INVALID_PARAMETER);
 
-  for (Pointer = (CHAR16 *) String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
+  for (Pointer = (CHAR16 *)String, AddressIndex = 0; AddressIndex < ARRAY_SIZE (Address->Addr) + 1;) {
     if (!InternalIsDecimalDigitCharacter (*Pointer)) {
       //
       // D or P contains invalid characters.
@@ -1541,10 +1575,11 @@ StrToIpv4Address (
     //
     // Get D or P.
     //
-    Status = StrDecimalToUint64S ((CONST CHAR16 *) Pointer, &Pointer, &Uint64);
+    Status = StrDecimalToUint64S ((CONST CHAR16 *)Pointer, &Pointer, &Uint64);
     if (RETURN_ERROR (Status)) {
       return RETURN_UNSUPPORTED;
     }
+
     if (AddressIndex == ARRAY_SIZE (Address->Addr)) {
       //
       // It's P.
@@ -1552,7 +1587,8 @@ StrToIpv4Address (
       if (Uint64 > 32) {
         return RETURN_UNSUPPORTED;
       }
-      LocalPrefixLength = (UINT8) Uint64;
+
+      LocalPrefixLength = (UINT8)Uint64;
     } else {
       //
       // It's D.
@@ -1560,7 +1596,8 @@ StrToIpv4Address (
       if (Uint64 > MAX_UINT8) {
         return RETURN_UNSUPPORTED;
       }
-      LocalAddress.Addr[AddressIndex] = (UINT8) Uint64;
+
+      LocalAddress.Addr[AddressIndex] = (UINT8)Uint64;
       AddressIndex++;
     }
 
@@ -1600,6 +1637,7 @@ StrToIpv4Address (
   if (PrefixLength != NULL) {
     *PrefixLength = LocalPrefixLength;
   }
+
   if (EndPointer != NULL) {
     *EndPointer = Pointer;
   }
@@ -1609,27 +1647,27 @@ StrToIpv4Address (
 
 RETURN_STATUS
 StrToIpv6Address (
-  CONST CHAR16       *String,
-  CHAR16             **EndPointer,
-  EFI_IPv6_ADDRESS   *Address,
-  UINT8              *PrefixLength
+  CONST CHAR16      *String,
+  CHAR16            **EndPointer,
+  EFI_IPv6_ADDRESS  *Address,
+  UINT8             *PrefixLength
   )
 {
-  RETURN_STATUS          Status;
-  UINTN                  AddressIndex;
-  UINT64                 Uint64;
-  EFI_IPv6_ADDRESS       LocalAddress;
-  UINT8                  LocalPrefixLength;
-  CONST CHAR16           *Pointer;
-  CHAR16                 *End;
-  UINTN                  CompressStart;
-  BOOLEAN                ExpectPrefix;
+  RETURN_STATUS     Status;
+  UINTN             AddressIndex;
+  UINT64            Uint64;
+  EFI_IPv6_ADDRESS  LocalAddress;
+  UINT8             LocalPrefixLength;
+  CONST CHAR16      *Pointer;
+  CHAR16            *End;
+  UINTN             CompressStart;
+  BOOLEAN           ExpectPrefix;
 
   LocalPrefixLength = MAX_UINT8;
   CompressStart     = ARRAY_SIZE (Address->Addr);
   ExpectPrefix      = FALSE;
 
-  ASSERT (((UINTN) String & BIT0) == 0);
+  ASSERT (((UINTN)String & BIT0) == 0);
 
   //
   // 1. None of String or Guid shall be a null pointer.
@@ -1657,7 +1695,7 @@ StrToIpv6Address (
         return RETURN_UNSUPPORTED;
       }
 
-      if (CompressStart != ARRAY_SIZE (Address->Addr) || AddressIndex == ARRAY_SIZE (Address->Addr)) {
+      if ((CompressStart != ARRAY_SIZE (Address->Addr)) || (AddressIndex == ARRAY_SIZE (Address->Addr))) {
         //
         // "::" can only appear once.
         // "::" can only appear when address is not full length.
@@ -1677,6 +1715,7 @@ StrToIpv6Address (
             //
             return RETURN_UNSUPPORTED;
           }
+
           Pointer++;
         }
       }
@@ -1699,33 +1738,35 @@ StrToIpv6Address (
         // Get X.
         //
         Status = StrHexToUint64S (Pointer, &End, &Uint64);
-        if (RETURN_ERROR (Status) || End - Pointer > 4) {
+        if (RETURN_ERROR (Status) || (End - Pointer > 4)) {
           //
           // Number of hexadecimal digit characters is no more than 4.
           //
           return RETURN_UNSUPPORTED;
         }
+
         Pointer = End;
         //
         // Uint64 won't exceed MAX_UINT16 if number of hexadecimal digit characters is no more than 4.
         //
         ASSERT (AddressIndex + 1 < ARRAY_SIZE (Address->Addr));
-        LocalAddress.Addr[AddressIndex] = (UINT8) ((UINT16) Uint64 >> 8);
-        LocalAddress.Addr[AddressIndex + 1] = (UINT8) Uint64;
-        AddressIndex += 2;
+        LocalAddress.Addr[AddressIndex]     = (UINT8)((UINT16)Uint64 >> 8);
+        LocalAddress.Addr[AddressIndex + 1] = (UINT8)Uint64;
+        AddressIndex                       += 2;
       } else {
         //
         // Get P, then exit the loop.
         //
         Status = StrDecimalToUint64S (Pointer, &End, &Uint64);
-        if (RETURN_ERROR (Status) || End == Pointer || Uint64 > 128) {
+        if (RETURN_ERROR (Status) || (End == Pointer) || (Uint64 > 128)) {
           //
           // Prefix length should not exceed 128.
           //
           return RETURN_UNSUPPORTED;
         }
-        LocalPrefixLength = (UINT8) Uint64;
-        Pointer = End;
+
+        LocalPrefixLength = (UINT8)Uint64;
+        Pointer           = End;
         break;
       }
     }
@@ -1748,21 +1789,24 @@ StrToIpv6Address (
       //
       break;
     }
+
     Pointer++;
   }
 
-  if ((AddressIndex == ARRAY_SIZE (Address->Addr) && CompressStart != ARRAY_SIZE (Address->Addr)) ||
-    (AddressIndex != ARRAY_SIZE (Address->Addr) && CompressStart == ARRAY_SIZE (Address->Addr))
-      ) {
+  if (((AddressIndex == ARRAY_SIZE (Address->Addr)) && (CompressStart != ARRAY_SIZE (Address->Addr))) ||
+      ((AddressIndex != ARRAY_SIZE (Address->Addr)) && (CompressStart == ARRAY_SIZE (Address->Addr)))
+      )
+  {
     //
     // Full length of address shall not have compressing zeros.
     // Non-full length of address shall have compressing zeros.
     //
     return RETURN_UNSUPPORTED;
   }
+
   memcpy (&Address->Addr[0], &LocalAddress.Addr[0], CompressStart);
   if (AddressIndex > CompressStart) {
-    memset (&Address->Addr[CompressStart], 0,  ARRAY_SIZE (Address->Addr) - AddressIndex);
+    memset (&Address->Addr[CompressStart], 0, ARRAY_SIZE (Address->Addr) - AddressIndex);
     memcpy (
       &Address->Addr[CompressStart + ARRAY_SIZE (Address->Addr) - AddressIndex],
       &LocalAddress.Addr[CompressStart],
@@ -1773,24 +1817,24 @@ StrToIpv6Address (
   if (PrefixLength != NULL) {
     *PrefixLength = LocalPrefixLength;
   }
+
   if (EndPointer != NULL) {
-    *EndPointer = (CHAR16 *) Pointer;
+    *EndPointer = (CHAR16 *)Pointer;
   }
 
   return RETURN_SUCCESS;
 }
 
-
 RETURN_STATUS
 UnicodeStrToAsciiStrS (
-  CONST CHAR16              *Source,
-  CHAR8                     *Destination,
-  UINTN                     DestMax
+  CONST CHAR16  *Source,
+  CHAR8         *Destination,
+  UINTN         DestMax
   )
 {
-  UINTN            SourceLen;
+  UINTN  SourceLen;
 
-  ASSERT (((UINTN) Source & BIT0) == 0);
+  ASSERT (((UINTN)Source & BIT0) == 0);
 
   //
   // 1. Neither Destination nor Source shall be a null pointer.
@@ -1804,6 +1848,7 @@ UnicodeStrToAsciiStrS (
   if (ASCII_RSIZE_MAX != 0) {
     SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= ASCII_RSIZE_MAX), RETURN_INVALID_PARAMETER);
   }
+
   if (RSIZE_MAX != 0) {
     SAFE_STRING_CONSTRAINT_CHECK ((DestMax <= RSIZE_MAX), RETURN_INVALID_PARAMETER);
   }
@@ -1822,7 +1867,7 @@ UnicodeStrToAsciiStrS (
   //
   // 5. Copying shall not take place between objects that overlap.
   //
-  SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof(CHAR16)), RETURN_ACCESS_DENIED);
+  SAFE_STRING_CONSTRAINT_CHECK (!InternalSafeStringIsOverlap (Destination, DestMax, (VOID *)Source, (SourceLen + 1) * sizeof (CHAR16)), RETURN_ACCESS_DENIED);
 
   //
   // convert string
@@ -1833,8 +1878,9 @@ UnicodeStrToAsciiStrS (
     // non-zero value in the upper 8 bits, then ASSERT().
     //
     ASSERT (*Source < 0x100);
-    *(Destination++) = (CHAR8) *(Source++);
+    *(Destination++) = (CHAR8)*(Source++);
   }
+
   *Destination = '\0';
 
   return RETURN_SUCCESS;
@@ -1842,15 +1888,15 @@ UnicodeStrToAsciiStrS (
 
 RETURN_STATUS
 StrCpyS (
-  CHAR16       *Destination,
-  UINTN        DestMax,
-  CONST CHAR16 *Source
+  CHAR16        *Destination,
+  UINTN         DestMax,
+  CONST CHAR16  *Source
   )
 {
-  UINTN            SourceLen;
+  UINTN  SourceLen;
 
-  ASSERT (((UINTN) Destination & BIT0) == 0);
-  ASSERT (((UINTN) Source & BIT0) == 0);
+  ASSERT (((UINTN)Destination & BIT0) == 0);
+  ASSERT (((UINTN)Source & BIT0) == 0);
 
   //
   // 1. Neither Destination nor Source shall be a null pointer.
@@ -1888,6 +1934,7 @@ StrCpyS (
   while (*Source != 0) {
     *(Destination++) = *(Source++);
   }
+
   *Destination = 0;
 
   return RETURN_SUCCESS;
@@ -1898,13 +1945,15 @@ AllocateZeroPool (
   UINTN  AllocationSize
   )
 {
-  VOID * Memory;
-  Memory = malloc(AllocationSize);
+  VOID  *Memory;
+
+  Memory = malloc (AllocationSize);
   ASSERT (Memory != NULL);
   if (Memory == NULL) {
-    fprintf(stderr, "Not memory for malloc\n");
+    fprintf (stderr, "Not memory for malloc\n");
   }
-  memset(Memory, 0, AllocationSize);
+
+  memset (Memory, 0, AllocationSize);
   return Memory;
 }
 
@@ -1918,8 +1967,8 @@ AllocatePool (
 
 UINT16
 WriteUnaligned16 (
-  UINT16                    *Buffer,
-  UINT16                    Value
+  UINT16  *Buffer,
+  UINT16  Value
   )
 {
   ASSERT (Buffer != NULL);
@@ -1929,13 +1978,14 @@ WriteUnaligned16 (
 
 UINT16
 ReadUnaligned16 (
-  CONST UINT16              *Buffer
+  CONST UINT16  *Buffer
   )
 {
   ASSERT (Buffer != NULL);
 
   return *Buffer;
 }
+
 /**
   Return whether the integer string is a hex string.
 
@@ -1947,23 +1997,24 @@ ReadUnaligned16 (
 **/
 BOOLEAN
 IsHexStr (
-   CHAR16   *Str
+  CHAR16  *Str
   )
 {
   //
   // skip preceding white space
   //
   while ((*Str != 0) && *Str == L' ') {
-    Str ++;
+    Str++;
   }
+
   //
   // skip preceding zeros
   //
   while ((*Str != 0) && *Str == L'0') {
-    Str ++;
+    Str++;
   }
 
-  return (BOOLEAN) (*Str == L'x' || *Str == L'X');
+  return (BOOLEAN)(*Str == L'x' || *Str == L'X');
 }
 
 /**
@@ -1977,7 +2028,7 @@ IsHexStr (
 **/
 UINTN
 Strtoi (
-   CHAR16  *Str
+  CHAR16  *Str
   )
 {
   if (IsHexStr (Str)) {
@@ -1997,8 +2048,8 @@ Strtoi (
 **/
 VOID
 Strtoi64 (
-    CHAR16  *Str,
-   UINT64  *Data
+  CHAR16  *Str,
+  UINT64  *Data
   )
 {
   if (IsHexStr (Str)) {
@@ -2018,16 +2069,17 @@ Strtoi64 (
 **/
 VOID
 StrToAscii (
-       CHAR16 *Str,
-    CHAR8  **AsciiStr
+  CHAR16  *Str,
+  CHAR8   **AsciiStr
   )
 {
-  CHAR8 *Dest;
+  CHAR8  *Dest;
 
   Dest = *AsciiStr;
   while (!IS_NULL (*Str)) {
-    *(Dest++) = (CHAR8) *(Str++);
+    *(Dest++) = (CHAR8)*(Str++);
   }
+
   *Dest = 0;
 
   //
@@ -2050,14 +2102,14 @@ StrToAscii (
 **/
 CHAR16 *
 SplitStr (
-    CHAR16 **List,
-       CHAR16 Separator
+  CHAR16  **List,
+  CHAR16  Separator
   )
 {
   CHAR16  *Str;
   CHAR16  *ReturnStr;
 
-  Str = *List;
+  Str       = *List;
   ReturnStr = Str;
 
   if (IS_NULL (*Str)) {
@@ -2071,6 +2123,7 @@ SplitStr (
     if (*Str == Separator) {
       break;
     }
+
     Str++;
   }
 
@@ -2088,4 +2141,3 @@ SplitStr (
   *List = Str;
   return ReturnStr;
 }
-
diff --git a/BaseTools/Source/C/Common/Crc32.c b/BaseTools/Source/C/Common/Crc32.c
index 00cae948985d..1a702cab86ed 100644
--- a/BaseTools/Source/C/Common/Crc32.c
+++ b/BaseTools/Source/C/Common/Crc32.c
@@ -281,9 +281,9 @@ UINT32  mCrcTable[256] = {
 **/
 EFI_STATUS
 CalculateCrc32 (
-  IN  UINT8                             *Data,
-  IN  UINTN                             DataSize,
-  IN OUT UINT32                         *CrcOut
+  IN  UINT8      *Data,
+  IN  UINTN      DataSize,
+  IN OUT UINT32  *CrcOut
   )
 {
   UINT32  Crc;
@@ -296,7 +296,7 @@ CalculateCrc32 (
 
   Crc = 0xffffffff;
   for (Index = 0, Ptr = Data; Index < DataSize; Index++, Ptr++) {
-    Crc = (Crc >> 8) ^ mCrcTable[(UINT8) Crc ^ *Ptr];
+    Crc = (Crc >> 8) ^ mCrcTable[(UINT8)Crc ^ *Ptr];
   }
 
   *CrcOut = Crc ^ 0xffffffff;
diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c
index a0f54c08342b..68745e8a0bd7 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -15,52 +15,52 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 // Decompression algorithm begins here
 //
-#define BITBUFSIZ 32
-#define MAXMATCH  256
-#define THRESHOLD 3
-#define CODE_BIT  16
-#define BAD_TABLE - 1
+#define BITBUFSIZ  32
+#define MAXMATCH   256
+#define THRESHOLD  3
+#define CODE_BIT   16
+#define BAD_TABLE  - 1
 
 //
 // C: Char&Len Set; P: Position Set; T: exTra Set
 //
-#define NC      (0xff + MAXMATCH + 2 - THRESHOLD)
-#define CBIT    9
-#define EFIPBIT 4
-#define MAXPBIT 5
-#define TBIT    5
-#define MAXNP ((1U << MAXPBIT) - 1)
-#define NT    (CODE_BIT + 3)
+#define NC       (0xff + MAXMATCH + 2 - THRESHOLD)
+#define CBIT     9
+#define EFIPBIT  4
+#define MAXPBIT  5
+#define TBIT     5
+#define MAXNP    ((1U << MAXPBIT) - 1)
+#define NT       (CODE_BIT + 3)
 #if NT > MAXNP
-#define NPT NT
+#define NPT  NT
 #else
-#define NPT MAXNP
+#define NPT  MAXNP
 #endif
 
 typedef struct {
-  UINT8   *mSrcBase;  // Starting address of compressed data
-  UINT8   *mDstBase;  // Starting address of decompressed data
-  UINT32  mOutBuf;
-  UINT32  mInBuf;
+  UINT8     *mSrcBase; // Starting address of compressed data
+  UINT8     *mDstBase; // Starting address of decompressed data
+  UINT32    mOutBuf;
+  UINT32    mInBuf;
 
-  UINT16  mBitCount;
-  UINT32  mBitBuf;
-  UINT32  mSubBitBuf;
-  UINT16  mBlockSize;
-  UINT32  mCompSize;
-  UINT32  mOrigSize;
+  UINT16    mBitCount;
+  UINT32    mBitBuf;
+  UINT32    mSubBitBuf;
+  UINT16    mBlockSize;
+  UINT32    mCompSize;
+  UINT32    mOrigSize;
 
-  UINT16  mBadTableFlag;
+  UINT16    mBadTableFlag;
 
-  UINT16  mLeft[2 * NC - 1];
-  UINT16  mRight[2 * NC - 1];
-  UINT8   mCLen[NC];
-  UINT8   mPTLen[NPT];
-  UINT16  mCTable[4096];
-  UINT16  mPTTable[256];
+  UINT16    mLeft[2 * NC - 1];
+  UINT16    mRight[2 * NC - 1];
+  UINT8     mCLen[NC];
+  UINT8     mPTLen[NPT];
+  UINT16    mCTable[4096];
+  UINT16    mPTTable[256];
 } SCRATCH_DATA;
 
-STATIC UINT16 mPbit = EFIPBIT;
+STATIC UINT16  mPbit = EFIPBIT;
 
 /**
   Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
@@ -75,33 +75,30 @@ FillBuf (
   IN  UINT16        NumOfBits
   )
 {
-  Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
+  Sd->mBitBuf = (UINT32)(((UINT64)Sd->mBitBuf) << NumOfBits);
 
   while (NumOfBits > Sd->mBitCount) {
-
-    Sd->mBitBuf |= (UINT32) (((UINT64)Sd->mSubBitBuf) << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
+    Sd->mBitBuf |= (UINT32)(((UINT64)Sd->mSubBitBuf) << (NumOfBits = (UINT16)(NumOfBits - Sd->mBitCount)));
 
     if (Sd->mCompSize > 0) {
       //
       // Get 1 byte into SubBitBuf
       //
       Sd->mCompSize--;
-      Sd->mSubBitBuf  = 0;
-      Sd->mSubBitBuf  = Sd->mSrcBase[Sd->mInBuf++];
-      Sd->mBitCount   = 8;
-
+      Sd->mSubBitBuf = 0;
+      Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
+      Sd->mBitCount  = 8;
     } else {
       //
       // No more bits from the source, just pad zero bit.
       //
-      Sd->mSubBitBuf  = 0;
-      Sd->mBitCount   = 8;
-
+      Sd->mSubBitBuf = 0;
+      Sd->mBitCount  = 8;
     }
   }
 
-  Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
-  Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
+  Sd->mBitCount = (UINT16)(Sd->mBitCount - NumOfBits);
+  Sd->mBitBuf  |= Sd->mSubBitBuf >> Sd->mBitCount;
 }
 
 /**
@@ -123,7 +120,7 @@ GetBits (
 {
   UINT32  OutBits;
 
-  OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
+  OutBits = (UINT32)(Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
 
   FillBuf (Sd, NumOfBits);
 
@@ -172,76 +169,73 @@ MakeTable (
 
   for (Index = 0; Index < NumOfChar; Index++) {
     if (BitLen[Index] > 16) {
-      return (UINT16) BAD_TABLE;
+      return (UINT16)BAD_TABLE;
     }
+
     Count[BitLen[Index]]++;
   }
 
   Start[1] = 0;
 
   for (Index = 1; Index <= 16; Index++) {
-    Start[Index + 1] = (UINT16) (Start[Index] + (Count[Index] << (16 - Index)));
+    Start[Index + 1] = (UINT16)(Start[Index] + (Count[Index] << (16 - Index)));
   }
 
   if (Start[17] != 0) {
     /*(1U << 16)*/
-    return (UINT16) BAD_TABLE;
+    return (UINT16)BAD_TABLE;
   }
 
-  JuBits = (UINT16) (16 - TableBits);
+  JuBits = (UINT16)(16 - TableBits);
 
   for (Index = 1; Index <= TableBits; Index++) {
     Start[Index] >>= JuBits;
-    Weight[Index] = (UINT16) (1U << (TableBits - Index));
+    Weight[Index]  = (UINT16)(1U << (TableBits - Index));
   }
 
   while (Index <= 16) {
-    Weight[Index] = (UINT16) (1U << (16 - Index));
+    Weight[Index] = (UINT16)(1U << (16 - Index));
     Index++;
   }
 
-  Index = (UINT16) (Start[TableBits + 1] >> JuBits);
+  Index = (UINT16)(Start[TableBits + 1] >> JuBits);
 
   if (Index != 0) {
-    Index3 = (UINT16) (1U << TableBits);
+    Index3 = (UINT16)(1U << TableBits);
     while (Index != Index3) {
       Table[Index++] = 0;
     }
   }
 
-  Avail = NumOfChar;
-  Mask  = (UINT16) (1U << (15 - TableBits));
-  MaxTableLength = (UINT16) (1U << TableBits);
+  Avail          = NumOfChar;
+  Mask           = (UINT16)(1U << (15 - TableBits));
+  MaxTableLength = (UINT16)(1U << TableBits);
 
   for (Char = 0; Char < NumOfChar; Char++) {
-
     Len = BitLen[Char];
-    if (Len == 0 || Len >= 17) {
+    if ((Len == 0) || (Len >= 17)) {
       continue;
     }
 
-    NextCode = (UINT16) (Start[Len] + Weight[Len]);
+    NextCode = (UINT16)(Start[Len] + Weight[Len]);
 
     if (Len <= TableBits) {
-
-      if (Start[Len] >= NextCode || NextCode > MaxTableLength){
-        return (UINT16) BAD_TABLE;
+      if ((Start[Len] >= NextCode) || (NextCode > MaxTableLength)) {
+        return (UINT16)BAD_TABLE;
       }
 
       for (Index = Start[Len]; Index < NextCode; Index++) {
         Table[Index] = Char;
       }
-
     } else {
-
       Index3  = Start[Len];
       Pointer = &Table[Index3 >> JuBits];
-      Index   = (UINT16) (Len - TableBits);
+      Index   = (UINT16)(Len - TableBits);
 
       while (Index != 0) {
         if (*Pointer == 0) {
-          Sd->mRight[Avail]                     = Sd->mLeft[Avail] = 0;
-          *Pointer = Avail++;
+          Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
+          *Pointer          = Avail++;
         }
 
         if (Index3 & Mask) {
@@ -255,11 +249,11 @@ MakeTable (
       }
 
       *Pointer = Char;
-
     }
 
     Start[Len] = NextCode;
   }
+
   //
   // Succeeds
   //
@@ -289,7 +283,6 @@ DecodeP (
     Mask = 1U << (BITBUFSIZ - 1 - 8);
 
     do {
-
       if (Sd->mBitBuf & Mask) {
         Val = Sd->mRight[Val];
       } else {
@@ -299,6 +292,7 @@ DecodeP (
       Mask >>= 1;
     } while (Val >= MAXNP);
   }
+
   //
   // Advance what we have read
   //
@@ -306,7 +300,7 @@ DecodeP (
 
   Pos = Val;
   if (Val > 1) {
-    Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1)));
+    Pos = (UINT32)((1U << (Val - 1)) + GetBits (Sd, (UINT16)(Val - 1)));
   }
 
   return Pos;
@@ -339,10 +333,10 @@ ReadPTLen (
 
   assert (nn <= NPT);
 
-  Number = (UINT16) GetBits (Sd, nbit);
+  Number = (UINT16)GetBits (Sd, nbit);
 
   if (Number == 0) {
-    CharC = (UINT16) GetBits (Sd, nbit);
+    CharC = (UINT16)GetBits (Sd, nbit);
 
     for (Index = 0; Index < 256; Index++) {
       Sd->mPTTable[Index] = CharC;
@@ -358,8 +352,7 @@ ReadPTLen (
   Index = 0;
 
   while (Index < Number && Index < NPT) {
-
-    CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
+    CharC = (UINT16)(Sd->mBitBuf >> (BITBUFSIZ - 3));
 
     if (CharC == 7) {
       Mask = 1U << (BITBUFSIZ - 1 - 3);
@@ -369,14 +362,14 @@ ReadPTLen (
       }
     }
 
-    FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3));
+    FillBuf (Sd, (UINT16)((CharC < 7) ? 3 : CharC - 3));
 
-    Sd->mPTLen[Index++] = (UINT8) CharC;
+    Sd->mPTLen[Index++] = (UINT8)CharC;
 
     if (Index == Special) {
-      CharC = (UINT16) GetBits (Sd, 2);
+      CharC = (UINT16)GetBits (Sd, 2);
       CharC--;
-      while ((INT16) (CharC) >= 0 && Index < NPT) {
+      while ((INT16)(CharC) >= 0 && Index < NPT) {
         Sd->mPTLen[Index++] = 0;
         CharC--;
       }
@@ -406,10 +399,10 @@ ReadCLen (
   UINT16  Index;
   UINT32  Mask;
 
-  Number = (UINT16) GetBits (Sd, CBIT);
+  Number = (UINT16)GetBits (Sd, CBIT);
 
   if (Number == 0) {
-    CharC = (UINT16) GetBits (Sd, CBIT);
+    CharC = (UINT16)GetBits (Sd, CBIT);
 
     for (Index = 0; Index < NC; Index++) {
       Sd->mCLen[Index] = 0;
@@ -419,18 +412,16 @@ ReadCLen (
       Sd->mCTable[Index] = CharC;
     }
 
-    return ;
+    return;
   }
 
   Index = 0;
   while (Index < Number) {
-
     CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
     if (CharC >= NT) {
       Mask = 1U << (BITBUFSIZ - 1 - 8);
 
       do {
-
         if (Mask & Sd->mBitBuf) {
           CharC = Sd->mRight[CharC];
         } else {
@@ -438,34 +429,30 @@ ReadCLen (
         }
 
         Mask >>= 1;
-
       } while (CharC >= NT);
     }
+
     //
     // Advance what we have read
     //
     FillBuf (Sd, Sd->mPTLen[CharC]);
 
     if (CharC <= 2) {
-
       if (CharC == 0) {
         CharC = 1;
       } else if (CharC == 1) {
-        CharC = (UINT16) (GetBits (Sd, 4) + 3);
+        CharC = (UINT16)(GetBits (Sd, 4) + 3);
       } else if (CharC == 2) {
-        CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
+        CharC = (UINT16)(GetBits (Sd, CBIT) + 20);
       }
 
       CharC--;
-      while ((INT16) (CharC) >= 0) {
+      while ((INT16)(CharC) >= 0) {
         Sd->mCLen[Index++] = 0;
         CharC--;
       }
-
     } else {
-
-      Sd->mCLen[Index++] = (UINT8) (CharC - 2);
-
+      Sd->mCLen[Index++] = (UINT8)(CharC - 2);
     }
   }
 
@@ -475,7 +462,7 @@ ReadCLen (
 
   MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
 
-  return ;
+  return;
 }
 
 /**
@@ -498,7 +485,7 @@ DecodeC (
     //
     // Starting a new block
     //
-    Sd->mBlockSize    = (UINT16) GetBits (Sd, 16);
+    Sd->mBlockSize    = (UINT16)GetBits (Sd, 16);
     Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
     if (Sd->mBadTableFlag != 0) {
       return 0;
@@ -506,7 +493,7 @@ DecodeC (
 
     ReadCLen (Sd);
 
-    Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, mPbit, (UINT16) (-1));
+    Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, mPbit, (UINT16)(-1));
     if (Sd->mBadTableFlag != 0) {
       return 0;
     }
@@ -528,6 +515,7 @@ DecodeC (
       Mask >>= 1;
     } while (Index2 >= NC);
   }
+
   //
   // Advance what we have read
   //
@@ -551,58 +539,60 @@ Decode (
   UINT32  DataIdx;
   UINT16  CharC;
 
-  BytesRemain = (UINT16) (-1);
+  BytesRemain = (UINT16)(-1);
 
-  DataIdx     = 0;
+  DataIdx = 0;
 
-  for (;;) {
+  for ( ; ;) {
     CharC = DecodeC (Sd);
     if (Sd->mBadTableFlag != 0) {
-      return ;
+      return;
     }
 
     if (CharC < 256) {
       //
       // Process an Original character
       //
-      Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
+      Sd->mDstBase[Sd->mOutBuf++] = (UINT8)CharC;
       if (Sd->mOutBuf >= Sd->mOrigSize) {
-        return ;
+        return;
       }
-
     } else {
       //
       // Process a Pointer
       //
-      CharC       = (UINT16) (CharC - (UINT8_MAX + 1 - THRESHOLD));
+      CharC = (UINT16)(CharC - (UINT8_MAX + 1 - THRESHOLD));
 
       BytesRemain = CharC;
 
-      DataIdx     = Sd->mOutBuf - DecodeP (Sd) - 1;
+      DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
 
       BytesRemain--;
-      while ((INT16) (BytesRemain) >= 0) {
+      while ((INT16)(BytesRemain) >= 0) {
         if (Sd->mOutBuf >= Sd->mOrigSize) {
-          return ;
+          return;
         }
+
         if (DataIdx >= Sd->mOrigSize) {
-          Sd->mBadTableFlag = (UINT16) BAD_TABLE;
-          return ;
+          Sd->mBadTableFlag = (UINT16)BAD_TABLE;
+          return;
         }
+
         Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
 
         BytesRemain--;
       }
+
       //
       // Once mOutBuf is fully filled, directly return
       //
       if (Sd->mOutBuf >= Sd->mOrigSize) {
-        return ;
+        return;
       }
     }
   }
 
-  return ;
+  return;
 }
 
 /**
@@ -624,12 +614,12 @@ GetInfo (
   OUT     UINT32  *ScratchSize
   )
 {
-  UINT8 *Src;
-  UINT32 CompSize;
+  UINT8   *Src;
+  UINT32  CompSize;
 
-  *ScratchSize  = sizeof (SCRATCH_DATA);
+  *ScratchSize = sizeof (SCRATCH_DATA);
 
-  Src           = Source;
+  Src = Source;
   if (SrcSize < 8) {
     return EFI_INVALID_PARAMETER;
   }
@@ -637,7 +627,7 @@ GetInfo (
   CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
   *DstSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
 
-  if (SrcSize < CompSize + 8 || (CompSize + 8) < 8) {
+  if ((SrcSize < CompSize + 8) || ((CompSize + 8) < 8)) {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -675,24 +665,24 @@ Decompress (
   UINT8         *Src;
   UINT8         *Dst;
 
-  Status  = EFI_SUCCESS;
-  Src     = Source;
-  Dst     = Destination;
+  Status = EFI_SUCCESS;
+  Src    = Source;
+  Dst    = Destination;
 
   if (ScratchSize < sizeof (SCRATCH_DATA)) {
     return EFI_INVALID_PARAMETER;
   }
 
-  Sd = (SCRATCH_DATA *) Scratch;
+  Sd = (SCRATCH_DATA *)Scratch;
 
   if (SrcSize < 8) {
     return EFI_INVALID_PARAMETER;
   }
 
-  CompSize  = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
-  OrigSize  = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+  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 (SrcSize < CompSize + 8 || (CompSize + 8) < 8) {
+  if ((SrcSize < CompSize + 8) || ((CompSize + 8) < 8)) {
     return EFI_INVALID_PARAMETER;
   }
 
@@ -703,7 +693,7 @@ Decompress (
   Src = Src + 8;
 
   for (Index = 0; Index < sizeof (SCRATCH_DATA); Index++) {
-    ((UINT8 *) Sd)[Index] = 0;
+    ((UINT8 *)Sd)[Index] = 0;
   }
 
   Sd->mSrcBase  = Src;
@@ -833,63 +823,66 @@ EFI_STATUS
 Extract (
   IN      VOID    *Source,
   IN      UINT32  SrcSize,
-     OUT  VOID    **Destination,
-     OUT  UINT32  *DstSize,
+  OUT  VOID       **Destination,
+  OUT  UINT32     *DstSize,
   IN      UINTN   Algorithm
   )
 {
-  VOID          *Scratch;
-  UINT32        ScratchSize;
-  EFI_STATUS    Status;
+  VOID        *Scratch;
+  UINT32      ScratchSize;
+  EFI_STATUS  Status;
 
   Scratch = NULL;
   Status  = EFI_SUCCESS;
 
   switch (Algorithm) {
-  case 0:
-    *Destination = (VOID *)malloc(SrcSize);
-    if (*Destination != NULL) {
-      memcpy(*Destination, Source, SrcSize);
-    } else {
-      Status = EFI_OUT_OF_RESOURCES;
-    }
-    break;
-  case 1:
-    Status = EfiGetInfo(Source, SrcSize, DstSize, &ScratchSize);
-    if (Status == EFI_SUCCESS) {
-      Scratch = (VOID *)malloc(ScratchSize);
-      if (Scratch == NULL) {
-        return EFI_OUT_OF_RESOURCES;
+    case 0:
+      *Destination = (VOID *)malloc (SrcSize);
+      if (*Destination != NULL) {
+        memcpy (*Destination, Source, SrcSize);
+      } else {
+        Status = EFI_OUT_OF_RESOURCES;
       }
 
-      *Destination = (VOID *)malloc(*DstSize);
-      if (*Destination == NULL) {
-        free (Scratch);
-        return EFI_OUT_OF_RESOURCES;
-      }
+      break;
+    case 1:
+      Status = EfiGetInfo (Source, SrcSize, DstSize, &ScratchSize);
+      if (Status == EFI_SUCCESS) {
+        Scratch = (VOID *)malloc (ScratchSize);
+        if (Scratch == NULL) {
+          return EFI_OUT_OF_RESOURCES;
+        }
+
+        *Destination = (VOID *)malloc (*DstSize);
+        if (*Destination == NULL) {
+          free (Scratch);
+          return EFI_OUT_OF_RESOURCES;
+        }
 
-      Status = EfiDecompress(Source, SrcSize, *Destination, *DstSize, Scratch, ScratchSize);
-    }
-    break;
-  case 2:
-    Status = TianoGetInfo(Source, SrcSize, DstSize, &ScratchSize);
-    if (Status == EFI_SUCCESS) {
-      Scratch = (VOID *)malloc(ScratchSize);
-      if (Scratch == NULL) {
-        return EFI_OUT_OF_RESOURCES;
+        Status = EfiDecompress (Source, SrcSize, *Destination, *DstSize, Scratch, ScratchSize);
       }
 
-      *Destination = (VOID *)malloc(*DstSize);
-      if (*Destination == NULL) {
-        free (Scratch);
-        return EFI_OUT_OF_RESOURCES;
+      break;
+    case 2:
+      Status = TianoGetInfo (Source, SrcSize, DstSize, &ScratchSize);
+      if (Status == EFI_SUCCESS) {
+        Scratch = (VOID *)malloc (ScratchSize);
+        if (Scratch == NULL) {
+          return EFI_OUT_OF_RESOURCES;
+        }
+
+        *Destination = (VOID *)malloc (*DstSize);
+        if (*Destination == NULL) {
+          free (Scratch);
+          return EFI_OUT_OF_RESOURCES;
+        }
+
+        Status = TianoDecompress (Source, SrcSize, *Destination, *DstSize, Scratch, ScratchSize);
       }
 
-      Status = TianoDecompress(Source, SrcSize, *Destination, *DstSize, Scratch, ScratchSize);
-    }
-    break;
-  default:
-    Status = EFI_INVALID_PARAMETER;
+      break;
+    default:
+      Status = EFI_INVALID_PARAMETER;
   }
 
   if (Scratch != NULL) {
@@ -898,5 +891,3 @@ Extract (
 
   return Status;
 }
-
-
diff --git a/BaseTools/Source/C/Common/EfiCompress.c b/BaseTools/Source/C/Common/EfiCompress.c
index 0db958b8535a..badcc4d83972 100644
--- a/BaseTools/Source/C/Common/EfiCompress.c
+++ b/BaseTools/Source/C/Common/EfiCompress.c
@@ -11,42 +11,41 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "Compress.h"
 
-
 //
 // Macro Definitions
 //
 
 #undef UINT8_MAX
-typedef INT16             NODE;
-#define UINT8_MAX         0xff
-#define UINT8_BIT         8
-#define THRESHOLD         3
-#define INIT_CRC          0
-#define WNDBIT            13
-#define WNDSIZ            (1U << WNDBIT)
-#define MAXMATCH          256
-#define PERC_FLAG         0x8000U
-#define CODE_BIT          16
-#define NIL               0
-#define MAX_HASH_VAL      (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)
-#define HASH(p, c)        ((p) + ((c) << (WNDBIT - 9)) + WNDSIZ * 2)
-#define CRCPOLY           0xA001
-#define UPDATE_CRC(c)     mCrc = mCrcTable[(mCrc ^ (c)) & 0xFF] ^ (mCrc >> UINT8_BIT)
+typedef INT16 NODE;
+#define UINT8_MAX     0xff
+#define UINT8_BIT     8
+#define THRESHOLD     3
+#define INIT_CRC      0
+#define WNDBIT        13
+#define WNDSIZ        (1U << WNDBIT)
+#define MAXMATCH      256
+#define PERC_FLAG     0x8000U
+#define CODE_BIT      16
+#define NIL           0
+#define MAX_HASH_VAL  (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)
+#define HASH(p, c)  ((p) + ((c) << (WNDBIT - 9)) + WNDSIZ * 2)
+#define CRCPOLY  0xA001
+#define UPDATE_CRC(c)  mCrc = mCrcTable[(mCrc ^ (c)) & 0xFF] ^ (mCrc >> UINT8_BIT)
 
 //
 // C: the Char&Len Set; P: the Position Set; T: the exTra Set
 //
 
-#define NC                (UINT8_MAX + MAXMATCH + 2 - THRESHOLD)
-#define CBIT              9
-#define NP                (WNDBIT + 1)
-#define PBIT              4
-#define NT                (CODE_BIT + 3)
-#define TBIT              5
+#define NC    (UINT8_MAX + MAXMATCH + 2 - THRESHOLD)
+#define CBIT  9
+#define NP    (WNDBIT + 1)
+#define PBIT  4
+#define NT    (CODE_BIT + 3)
+#define TBIT  5
 #if NT > NP
-  #define                 NPT NT
+#define                 NPT  NT
 #else
-  #define                 NPT NP
+#define                 NPT  NP
 #endif
 
 //
@@ -55,8 +54,8 @@ typedef INT16             NODE;
 
 STATIC
 VOID
-PutDword(
-  IN UINT32 Data
+PutDword (
+  IN UINT32  Data
   );
 
 STATIC
@@ -77,22 +76,22 @@ InitSlide (
 STATIC
 NODE
 Child (
-  IN NODE q,
-  IN UINT8 c
+  IN NODE   q,
+  IN UINT8  c
   );
 
 STATIC
 VOID
 MakeChild (
-  IN NODE q,
-  IN UINT8 c,
-  IN NODE r
+  IN NODE   q,
+  IN UINT8  c,
+  IN NODE   r
   );
 
 STATIC
 VOID
 Split (
-  IN NODE Old
+  IN NODE  Old
   );
 
 STATIC
@@ -123,9 +122,9 @@ CountTFreq (
 STATIC
 VOID
 WritePTLen (
-  IN INT32 n,
-  IN INT32 nbit,
-  IN INT32 Special
+  IN INT32  n,
+  IN INT32  nbit,
+  IN INT32  Special
   );
 
 STATIC
@@ -136,13 +135,13 @@ WriteCLen (
 STATIC
 VOID
 EncodeC (
-  IN INT32 c
+  IN INT32  c
   );
 
 STATIC
 VOID
 EncodeP (
-  IN UINT32 p
+  IN UINT32  p
   );
 
 STATIC
@@ -153,8 +152,8 @@ SendBlock (
 STATIC
 VOID
 Output (
-  IN UINT32 c,
-  IN UINT32 p
+  IN UINT32  c,
+  IN UINT32  p
   );
 
 STATIC
@@ -175,15 +174,15 @@ MakeCrcTable (
 STATIC
 VOID
 PutBits (
-  IN INT32 n,
-  IN UINT32 x
+  IN INT32   n,
+  IN UINT32  x
   );
 
 STATIC
 INT32
 FreadCrc (
-  OUT UINT8 *p,
-  IN  INT32 n
+  OUT UINT8  *p,
+  IN  INT32  n
   );
 
 STATIC
@@ -194,27 +193,27 @@ InitPutBits (
 STATIC
 VOID
 CountLen (
-  IN INT32 i
+  IN INT32  i
   );
 
 STATIC
 VOID
 MakeLen (
-  IN INT32 Root
+  IN INT32  Root
   );
 
 STATIC
 VOID
 DownHeap (
-  IN INT32 i
+  IN INT32  i
   );
 
 STATIC
 VOID
 MakeCode (
-  IN  INT32 n,
-  IN  UINT8 Len[],
-  OUT UINT16 Code[]
+  IN  INT32   n,
+  IN  UINT8   Len[],
+  OUT UINT16  Code[]
   );
 
 STATIC
@@ -226,25 +225,23 @@ MakeTree (
   OUT UINT16  CodeParm[]
   );
 
-
 //
 //  Global Variables
 //
 
 STATIC UINT8  *mSrc, *mDst, *mSrcUpperLimit, *mDstUpperLimit;
 
-STATIC UINT8  *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;
-STATIC INT16  mHeap[NC + 1];
-STATIC INT32  mRemainder, mMatchLen, mBitCount, mHeapSize, mN;
-STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;
-STATIC UINT32 mCompSize, mOrigSize;
+STATIC UINT8   *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;
+STATIC INT16   mHeap[NC + 1];
+STATIC INT32   mRemainder, mMatchLen, mBitCount, mHeapSize, mN;
+STATIC UINT32  mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;
+STATIC UINT32  mCompSize, mOrigSize;
 
-STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1],
-              mCrcTable[UINT8_MAX + 1], mCFreq[2 * NC - 1],mCCode[NC],
-              mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
-
-STATIC NODE   mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
+STATIC UINT16  *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1],
+               mCrcTable[UINT8_MAX + 1], mCFreq[2 * NC - 1], mCCode[NC],
+               mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
 
+STATIC NODE  mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
 
 //
 // functions
@@ -272,13 +269,13 @@ EfiCompress (
   IN OUT  UINT32  *DstSize
   )
 {
-  EFI_STATUS Status = EFI_SUCCESS;
+  EFI_STATUS  Status = EFI_SUCCESS;
 
   //
   // Initializations
   //
-  mBufSiz = 0;
-  mBuf = NULL;
+  mBufSiz     = 0;
+  mBuf        = NULL;
   mText       = NULL;
   mLevel      = NULL;
   mChildCount = NULL;
@@ -287,25 +284,24 @@ EfiCompress (
   mPrev       = NULL;
   mNext       = NULL;
 
-
-  mSrc = SrcBuffer;
+  mSrc           = SrcBuffer;
   mSrcUpperLimit = mSrc + SrcSize;
-  mDst = DstBuffer;
+  mDst           = DstBuffer;
   mDstUpperLimit = mDst + *DstSize;
 
-  PutDword(0L);
-  PutDword(0L);
+  PutDword (0L);
+  PutDword (0L);
 
   MakeCrcTable ();
 
   mOrigSize = mCompSize = 0;
-  mCrc = INIT_CRC;
+  mCrc      = INIT_CRC;
 
   //
   // Compress it
   //
 
-  Status = Encode();
+  Status = Encode ();
   if (EFI_ERROR (Status)) {
     return EFI_OUT_OF_RESOURCES;
   }
@@ -321,8 +317,8 @@ EfiCompress (
   // Fill in compressed size and original size
   //
   mDst = DstBuffer;
-  PutDword(mCompSize+1);
-  PutDword(mOrigSize);
+  PutDword (mCompSize+1);
+  PutDword (mOrigSize);
 
   //
   // Return
@@ -335,7 +331,6 @@ EfiCompress (
     *DstSize = mCompSize + 1 + 8;
     return EFI_SUCCESS;
   }
-
 }
 
 /**
@@ -345,12 +340,12 @@ EfiCompress (
 **/
 STATIC
 VOID
-PutDword(
-  IN UINT32 Data
+PutDword (
+  IN UINT32  Data
   )
 {
   if (mDst < mDstUpperLimit) {
-    *mDst++ = (UINT8)(((UINT8)(Data        )) & 0xff);
+    *mDst++ = (UINT8)(((UINT8)(Data)) & 0xff);
   }
 
   if (mDst < mDstUpperLimit) {
@@ -374,36 +369,40 @@ PutDword(
 **/
 STATIC
 EFI_STATUS
-AllocateMemory ()
+AllocateMemory (
+  )
 {
-  UINT32      i;
+  UINT32  i;
 
-  mText       = malloc (WNDSIZ * 2 + MAXMATCH);
+  mText = malloc (WNDSIZ * 2 + MAXMATCH);
   if (mText == NULL) {
     return EFI_OUT_OF_RESOURCES;
   }
-  for (i = 0 ; i < WNDSIZ * 2 + MAXMATCH; i ++) {
+
+  for (i = 0; i < WNDSIZ * 2 + MAXMATCH; i++) {
     mText[i] = 0;
   }
 
-  mLevel      = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mLevel));
-  mChildCount = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mChildCount));
-  mPosition   = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof(*mPosition));
-  mParent     = malloc (WNDSIZ * 2 * sizeof(*mParent));
-  mPrev       = malloc (WNDSIZ * 2 * sizeof(*mPrev));
-  mNext       = malloc ((MAX_HASH_VAL + 1) * sizeof(*mNext));
-  if (mLevel == NULL || mChildCount == NULL || mPosition == NULL ||
-    mParent == NULL || mPrev == NULL || mNext == NULL) {
+  mLevel      = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mLevel));
+  mChildCount = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mChildCount));
+  mPosition   = malloc ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mPosition));
+  mParent     = malloc (WNDSIZ * 2 * sizeof (*mParent));
+  mPrev       = malloc (WNDSIZ * 2 * sizeof (*mPrev));
+  mNext       = malloc ((MAX_HASH_VAL + 1) * sizeof (*mNext));
+  if ((mLevel == NULL) || (mChildCount == NULL) || (mPosition == NULL) ||
+      (mParent == NULL) || (mPrev == NULL) || (mNext == NULL))
+  {
     return EFI_OUT_OF_RESOURCES;
   }
 
   mBufSiz = 16 * 1024U;
-  while ((mBuf = malloc(mBufSiz)) == NULL) {
+  while ((mBuf = malloc (mBufSiz)) == NULL) {
     mBufSiz = (mBufSiz / 10U) * 9U;
     if (mBufSiz < 4 * 1024U) {
       return EFI_OUT_OF_RESOURCES;
     }
   }
+
   mBuf[0] = 0;
 
   return EFI_SUCCESS;
@@ -413,7 +412,8 @@ AllocateMemory ()
   Called when compression is completed to free memory previously allocated.
 **/
 VOID
-FreeMemory ()
+FreeMemory (
+  )
 {
   if (mText) {
     free (mText);
@@ -455,17 +455,20 @@ FreeMemory ()
 **/
 STATIC
 VOID
-InitSlide ()
+InitSlide (
+  )
 {
-  NODE i;
+  NODE  i;
 
   for (i = WNDSIZ; i <= WNDSIZ + UINT8_MAX; i++) {
-    mLevel[i] = 1;
+    mLevel[i]    = 1;
     mPosition[i] = NIL;  /* sentinel */
   }
+
   for (i = WNDSIZ; i < WNDSIZ * 2; i++) {
     mParent[i] = NIL;
   }
+
   mAvail = 1;
   for (i = 1; i < WNDSIZ - 1; i++) {
     mNext[i] = (NODE)(i + 1);
@@ -488,13 +491,13 @@ InitSlide ()
 STATIC
 NODE
 Child (
-  IN NODE q,
-  IN UINT8 c
+  IN NODE   q,
+  IN UINT8  c
   )
 {
-  NODE r;
+  NODE  r;
 
-  r = mNext[HASH(q, c)];
+  r            = mNext[HASH (q, c)];
   mParent[NIL] = q;  /* sentinel */
   while (mParent[r] != q) {
     r = mNext[r];
@@ -513,19 +516,19 @@ Child (
 STATIC
 VOID
 MakeChild (
-  IN NODE q,
-  IN UINT8 c,
-  IN NODE r
+  IN NODE   q,
+  IN UINT8  c,
+  IN NODE   r
   )
 {
-  NODE h, t;
+  NODE  h, t;
 
-  h = (NODE)HASH(q, c);
-  t = mNext[h];
-  mNext[h] = r;
-  mNext[r] = t;
-  mPrev[t] = r;
-  mPrev[r] = h;
+  h          = (NODE)HASH (q, c);
+  t          = mNext[h];
+  mNext[h]   = r;
+  mNext[r]   = t;
+  mPrev[t]   = r;
+  mPrev[r]   = h;
   mParent[r] = q;
   mChildCount[q]++;
 }
@@ -538,25 +541,25 @@ MakeChild (
 STATIC
 VOID
 Split (
-  NODE Old
+  NODE  Old
   )
 {
-  NODE New, t;
+  NODE  New, t;
 
-  New = mAvail;
-  mAvail = mNext[New];
+  New              = mAvail;
+  mAvail           = mNext[New];
   mChildCount[New] = 0;
-  t = mPrev[Old];
-  mPrev[New] = t;
-  mNext[t] = New;
-  t = mNext[Old];
-  mNext[New] = t;
-  mPrev[t] = New;
-  mParent[New] = mParent[Old];
-  mLevel[New] = (UINT8)mMatchLen;
-  mPosition[New] = mPos;
-  MakeChild(New, mText[mMatchPos + mMatchLen], Old);
-  MakeChild(New, mText[mPos + mMatchLen], mPos);
+  t                = mPrev[Old];
+  mPrev[New]       = t;
+  mNext[t]         = New;
+  t                = mNext[Old];
+  mNext[New]       = t;
+  mPrev[t]         = New;
+  mParent[New]     = mParent[Old];
+  mLevel[New]      = (UINT8)mMatchLen;
+  mPosition[New]   = mPos;
+  MakeChild (New, mText[mMatchPos + mMatchLen], Old);
+  MakeChild (New, mText[mPos + mMatchLen], mPos);
 }
 
 /**
@@ -564,13 +567,13 @@ Split (
 **/
 STATIC
 VOID
-InsertNode ()
+InsertNode (
+  )
 {
-  NODE q, r, j, t;
-  UINT8 c, *t1, *t2;
+  NODE   q, r, j, t;
+  UINT8  c, *t1, *t2;
 
   if (mMatchLen >= 4) {
-
     //
     // We have just got a long match, the target tree
     // can be located by MatchPos + 1. Traverse the tree
@@ -584,30 +587,34 @@ InsertNode ()
     while ((q = mParent[r]) == NIL) {
       r = mNext[r];
     }
+
     while (mLevel[q] >= mMatchLen) {
-      r = q;  q = mParent[q];
+      r = q;
+      q = mParent[q];
     }
+
     t = q;
     while (mPosition[t] < 0) {
       mPosition[t] = mPos;
-      t = mParent[t];
+      t            = mParent[t];
     }
+
     if (t < WNDSIZ) {
       mPosition[t] = (NODE)(mPos | PERC_FLAG);
     }
   } else {
-
     //
     // Locate the target tree
     //
 
     q = (INT16)(mText[mPos] + WNDSIZ);
     c = mText[mPos + 1];
-    if ((r = Child(q, c)) == NIL) {
-      MakeChild(q, c, mPos);
+    if ((r = Child (q, c)) == NIL) {
+      MakeChild (q, c, mPos);
       mMatchLen = 1;
       return;
     }
+
     mMatchLen = 2;
   }
 
@@ -619,51 +626,57 @@ InsertNode ()
 
   for ( ; ; ) {
     if (r >= WNDSIZ) {
-      j = MAXMATCH;
+      j         = MAXMATCH;
       mMatchPos = r;
     } else {
-      j = mLevel[r];
+      j         = mLevel[r];
       mMatchPos = (NODE)(mPosition[r] & ~PERC_FLAG);
     }
+
     if (mMatchPos >= mPos) {
       mMatchPos -= WNDSIZ;
     }
+
     t1 = &mText[mPos + mMatchLen];
     t2 = &mText[mMatchPos + mMatchLen];
     while (mMatchLen < j) {
       if (*t1 != *t2) {
-        Split(r);
+        Split (r);
         return;
       }
+
       mMatchLen++;
       t1++;
       t2++;
     }
+
     if (mMatchLen >= MAXMATCH) {
       break;
     }
+
     mPosition[r] = mPos;
-    q = r;
-    if ((r = Child(q, *t1)) == NIL) {
-      MakeChild(q, *t1, mPos);
+    q            = r;
+    if ((r = Child (q, *t1)) == NIL) {
+      MakeChild (q, *t1, mPos);
       return;
     }
+
     mMatchLen++;
   }
-  t = mPrev[r];
-  mPrev[mPos] = t;
-  mNext[t] = mPos;
-  t = mNext[r];
-  mNext[mPos] = t;
-  mPrev[t] = mPos;
+
+  t             = mPrev[r];
+  mPrev[mPos]   = t;
+  mNext[t]      = mPos;
+  t             = mNext[r];
+  mNext[mPos]   = t;
+  mPrev[t]      = mPos;
   mParent[mPos] = q;
-  mParent[r] = NIL;
+  mParent[r]    = NIL;
 
   //
   // Special usage of 'next'
   //
   mNext[r] = mPos;
-
 }
 
 /**
@@ -672,27 +685,30 @@ InsertNode ()
 **/
 STATIC
 VOID
-DeleteNode ()
+DeleteNode (
+  )
 {
-  NODE q, r, s, t, u;
+  NODE  q, r, s, t, u;
 
   if (mParent[mPos] == NIL) {
     return;
   }
 
-  r = mPrev[mPos];
-  s = mNext[mPos];
-  mNext[r] = s;
-  mPrev[s] = r;
-  r = mParent[mPos];
+  r             = mPrev[mPos];
+  s             = mNext[mPos];
+  mNext[r]      = s;
+  mPrev[s]      = r;
+  r             = mParent[mPos];
   mParent[mPos] = NIL;
-  if (r >= WNDSIZ || --mChildCount[r] > 1) {
+  if ((r >= WNDSIZ) || (--mChildCount[r] > 1)) {
     return;
   }
+
   t = (NODE)(mPosition[r] & ~PERC_FLAG);
   if (t >= mPos) {
     t -= WNDSIZ;
   }
+
   s = t;
   q = mParent[r];
   while ((u = mPosition[q]) & PERC_FLAG) {
@@ -700,36 +716,42 @@ DeleteNode ()
     if (u >= mPos) {
       u -= WNDSIZ;
     }
+
     if (u > s) {
       s = u;
     }
+
     mPosition[q] = (INT16)(s | WNDSIZ);
-    q = mParent[q];
+    q            = mParent[q];
   }
+
   if (q < WNDSIZ) {
     if (u >= mPos) {
       u -= WNDSIZ;
     }
+
     if (u > s) {
       s = u;
     }
+
     mPosition[q] = (INT16)(s | WNDSIZ | PERC_FLAG);
   }
-  s = Child(r, mText[t + mLevel[r]]);
-  t = mPrev[s];
-  u = mNext[s];
-  mNext[t] = u;
-  mPrev[u] = t;
-  t = mPrev[r];
-  mNext[t] = s;
-  mPrev[s] = t;
-  t = mNext[r];
-  mPrev[t] = s;
-  mNext[s] = t;
+
+  s          = Child (r, mText[t + mLevel[r]]);
+  t          = mPrev[s];
+  u          = mNext[s];
+  mNext[t]   = u;
+  mPrev[u]   = t;
+  t          = mPrev[r];
+  mNext[t]   = s;
+  mPrev[s]   = t;
+  t          = mNext[r];
+  mPrev[t]   = s;
+  mNext[s]   = t;
   mParent[s] = mParent[r];
   mParent[r] = NIL;
-  mNext[r] = mAvail;
-  mAvail = r;
+  mNext[r]   = mAvail;
+  mAvail     = r;
 }
 
 /**
@@ -738,19 +760,21 @@ DeleteNode ()
 **/
 STATIC
 VOID
-GetNextMatch ()
+GetNextMatch (
+  )
 {
-  INT32 n;
+  INT32  n;
 
   mRemainder--;
   if (++mPos == WNDSIZ * 2) {
-    memmove(&mText[0], &mText[WNDSIZ], WNDSIZ + MAXMATCH);
-    n = FreadCrc(&mText[WNDSIZ + MAXMATCH], WNDSIZ);
+    memmove (&mText[0], &mText[WNDSIZ], WNDSIZ + MAXMATCH);
+    n           = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ);
     mRemainder += n;
-    mPos = WNDSIZ;
+    mPos        = WNDSIZ;
   }
-  DeleteNode();
-  InsertNode();
+
+  DeleteNode ();
+  InsertNode ();
 }
 
 /**
@@ -761,65 +785,68 @@ GetNextMatch ()
 **/
 STATIC
 EFI_STATUS
-Encode ()
+Encode (
+  )
 {
   EFI_STATUS  Status;
   INT32       LastMatchLen;
   NODE        LastMatchPos;
 
-  Status = AllocateMemory();
-  if (EFI_ERROR(Status)) {
-    FreeMemory();
+  Status = AllocateMemory ();
+  if (EFI_ERROR (Status)) {
+    FreeMemory ();
     return Status;
   }
 
-  InitSlide();
+  InitSlide ();
 
-  HufEncodeStart();
+  HufEncodeStart ();
 
-  mRemainder = FreadCrc(&mText[WNDSIZ], WNDSIZ + MAXMATCH);
+  mRemainder = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH);
 
   mMatchLen = 0;
-  mPos = WNDSIZ;
-  InsertNode();
+  mPos      = WNDSIZ;
+  InsertNode ();
   if (mMatchLen > mRemainder) {
     mMatchLen = mRemainder;
   }
+
   while (mRemainder > 0) {
     LastMatchLen = mMatchLen;
     LastMatchPos = mMatchPos;
-    GetNextMatch();
+    GetNextMatch ();
     if (mMatchLen > mRemainder) {
       mMatchLen = mRemainder;
     }
 
-    if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {
-
+    if ((mMatchLen > LastMatchLen) || (LastMatchLen < THRESHOLD)) {
       //
       // Not enough benefits are gained by outputting a pointer,
       // so just output the original character
       //
 
-      Output(mText[mPos - 1], 0);
+      Output (mText[mPos - 1], 0);
     } else {
-
       //
       // Outputting a pointer is beneficial enough, do it.
       //
 
-      Output(LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
-             (mPos - LastMatchPos - 2) & (WNDSIZ - 1));
+      Output (
+        LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),
+        (mPos - LastMatchPos - 2) & (WNDSIZ - 1)
+        );
       while (--LastMatchLen > 0) {
-        GetNextMatch();
+        GetNextMatch ();
       }
+
       if (mMatchLen > mRemainder) {
         mMatchLen = mRemainder;
       }
     }
   }
 
-  HufEncodeEnd();
-  FreeMemory();
+  HufEncodeEnd ();
+  FreeMemory ();
   return EFI_SUCCESS;
 }
 
@@ -828,17 +855,20 @@ Encode ()
 **/
 STATIC
 VOID
-CountTFreq ()
+CountTFreq (
+  )
 {
-  INT32 i, k, n, Count;
+  INT32  i, k, n, Count;
 
   for (i = 0; i < NT; i++) {
     mTFreq[i] = 0;
   }
+
   n = NC;
   while (n > 0 && mCLen[n - 1] == 0) {
     n--;
   }
+
   i = 0;
   while (i < n) {
     k = mCLen[i++];
@@ -848,6 +878,7 @@ CountTFreq ()
         i++;
         Count++;
       }
+
       if (Count <= 2) {
         mTFreq[0] = (UINT16)(mTFreq[0] + Count);
       } else if (Count <= 18) {
@@ -874,30 +905,33 @@ CountTFreq ()
 STATIC
 VOID
 WritePTLen (
-  IN INT32 n,
-  IN INT32 nbit,
-  IN INT32 Special
+  IN INT32  n,
+  IN INT32  nbit,
+  IN INT32  Special
   )
 {
-  INT32 i, k;
+  INT32  i, k;
 
   while (n > 0 && mPTLen[n - 1] == 0) {
     n--;
   }
-  PutBits(nbit, n);
+
+  PutBits (nbit, n);
   i = 0;
   while (i < n) {
     k = mPTLen[i++];
     if (k <= 6) {
-      PutBits(3, k);
+      PutBits (3, k);
     } else {
-      PutBits(k - 3, (1U << (k - 3)) - 2);
+      PutBits (k - 3, (1U << (k - 3)) - 2);
     }
+
     if (i == Special) {
       while (i < 6 && mPTLen[i] == 0) {
         i++;
       }
-      PutBits(2, (i - 3) & 3);
+
+      PutBits (2, (i - 3) & 3);
     }
   }
 }
@@ -907,15 +941,17 @@ WritePTLen (
 **/
 STATIC
 VOID
-WriteCLen ()
+WriteCLen (
+  )
 {
-  INT32 i, k, n, Count;
+  INT32  i, k, n, Count;
 
   n = NC;
   while (n > 0 && mCLen[n - 1] == 0) {
     n--;
   }
-  PutBits(CBIT, n);
+
+  PutBits (CBIT, n);
   i = 0;
   while (i < n) {
     k = mCLen[i++];
@@ -925,23 +961,24 @@ WriteCLen ()
         i++;
         Count++;
       }
+
       if (Count <= 2) {
         for (k = 0; k < Count; k++) {
-          PutBits(mPTLen[0], mPTCode[0]);
+          PutBits (mPTLen[0], mPTCode[0]);
         }
       } else if (Count <= 18) {
-        PutBits(mPTLen[1], mPTCode[1]);
-        PutBits(4, Count - 3);
+        PutBits (mPTLen[1], mPTCode[1]);
+        PutBits (4, Count - 3);
       } else if (Count == 19) {
-        PutBits(mPTLen[0], mPTCode[0]);
-        PutBits(mPTLen[1], mPTCode[1]);
-        PutBits(4, 15);
+        PutBits (mPTLen[0], mPTCode[0]);
+        PutBits (mPTLen[1], mPTCode[1]);
+        PutBits (4, 15);
       } else {
-        PutBits(mPTLen[2], mPTCode[2]);
-        PutBits(CBIT, Count - 20);
+        PutBits (mPTLen[2], mPTCode[2]);
+        PutBits (CBIT, Count - 20);
       }
     } else {
-      PutBits(mPTLen[k + 2], mPTCode[k + 2]);
+      PutBits (mPTLen[k + 2], mPTCode[k + 2]);
     }
   }
 }
@@ -949,19 +986,19 @@ WriteCLen ()
 STATIC
 VOID
 EncodeC (
-  IN INT32 c
+  IN INT32  c
   )
 {
-  PutBits(mCLen[c], mCCode[c]);
+  PutBits (mCLen[c], mCCode[c]);
 }
 
 STATIC
 VOID
 EncodeP (
-  IN UINT32 p
+  IN UINT32  p
   )
 {
-  UINT32 c, q;
+  UINT32  c, q;
 
   c = 0;
   q = p;
@@ -969,9 +1006,10 @@ EncodeP (
     q >>= 1;
     c++;
   }
-  PutBits(mPTLen[c], mPTCode[c]);
+
+  PutBits (mPTLen[c], mPTCode[c]);
   if (c > 1) {
-    PutBits(c - 1, p & (0xFFFFU >> (17 - c)));
+    PutBits (c - 1, p & (0xFFFFU >> (17 - c)));
   }
 }
 
@@ -980,37 +1018,42 @@ EncodeP (
 **/
 STATIC
 VOID
-SendBlock ()
+SendBlock (
+  )
 {
-  UINT32 i, k, Flags, Root, Pos, Size;
+  UINT32  i, k, Flags, Root, Pos, Size;
+
   Flags = 0;
 
-  Root = MakeTree(NC, mCFreq, mCLen, mCCode);
+  Root = MakeTree (NC, mCFreq, mCLen, mCCode);
   Size = mCFreq[Root];
-  PutBits(16, Size);
+  PutBits (16, Size);
   if (Root >= NC) {
-    CountTFreq();
-    Root = MakeTree(NT, mTFreq, mPTLen, mPTCode);
+    CountTFreq ();
+    Root = MakeTree (NT, mTFreq, mPTLen, mPTCode);
     if (Root >= NT) {
-      WritePTLen(NT, TBIT, 3);
+      WritePTLen (NT, TBIT, 3);
     } else {
-      PutBits(TBIT, 0);
-      PutBits(TBIT, Root);
+      PutBits (TBIT, 0);
+      PutBits (TBIT, Root);
     }
-    WriteCLen();
+
+    WriteCLen ();
   } else {
-    PutBits(TBIT, 0);
-    PutBits(TBIT, 0);
-    PutBits(CBIT, 0);
-    PutBits(CBIT, Root);
+    PutBits (TBIT, 0);
+    PutBits (TBIT, 0);
+    PutBits (CBIT, 0);
+    PutBits (CBIT, Root);
   }
-  Root = MakeTree(NP, mPFreq, mPTLen, mPTCode);
+
+  Root = MakeTree (NP, mPFreq, mPTLen, mPTCode);
   if (Root >= NP) {
-    WritePTLen(NP, PBIT, -1);
+    WritePTLen (NP, PBIT, -1);
   } else {
-    PutBits(PBIT, 0);
-    PutBits(PBIT, Root);
+    PutBits (PBIT, 0);
+    PutBits (PBIT, Root);
   }
+
   Pos = 0;
   for (i = 0; i < Size; i++) {
     if (i % UINT8_BIT == 0) {
@@ -1018,18 +1061,21 @@ SendBlock ()
     } else {
       Flags <<= 1;
     }
+
     if (Flags & (1U << (UINT8_BIT - 1))) {
-      EncodeC(mBuf[Pos++] + (1U << UINT8_BIT));
-      k = mBuf[Pos++] << UINT8_BIT;
+      EncodeC (mBuf[Pos++] + (1U << UINT8_BIT));
+      k  = mBuf[Pos++] << UINT8_BIT;
       k += mBuf[Pos++];
-      EncodeP(k);
+      EncodeP (k);
     } else {
-      EncodeC(mBuf[Pos++]);
+      EncodeC (mBuf[Pos++]);
     }
   }
+
   for (i = 0; i < NC; i++) {
     mCFreq[i] = 0;
   }
+
   for (i = 0; i < NP; i++) {
     mPFreq[i] = 0;
   }
@@ -1044,73 +1090,80 @@ SendBlock ()
 STATIC
 VOID
 Output (
-  IN UINT32 c,
-  IN UINT32 p
+  IN UINT32  c,
+  IN UINT32  p
   )
 {
-  STATIC UINT32 CPos;
+  STATIC UINT32  CPos;
 
   if ((mOutputMask >>= 1) == 0) {
     mOutputMask = 1U << (UINT8_BIT - 1);
     if (mOutputPos >= mBufSiz - 3 * UINT8_BIT) {
-      SendBlock();
+      SendBlock ();
       mOutputPos = 0;
     }
-    CPos = mOutputPos++;
+
+    CPos       = mOutputPos++;
     mBuf[CPos] = 0;
   }
-  mBuf[mOutputPos++] = (UINT8) c;
+
+  mBuf[mOutputPos++] = (UINT8)c;
   mCFreq[c]++;
   if (c >= (1U << UINT8_BIT)) {
-    mBuf[CPos] |= mOutputMask;
+    mBuf[CPos]        |= mOutputMask;
     mBuf[mOutputPos++] = (UINT8)(p >> UINT8_BIT);
-    mBuf[mOutputPos++] = (UINT8) p;
-    c = 0;
+    mBuf[mOutputPos++] = (UINT8)p;
+    c                  = 0;
     while (p) {
       p >>= 1;
       c++;
     }
+
     mPFreq[c]++;
   }
 }
 
 STATIC
 VOID
-HufEncodeStart ()
+HufEncodeStart (
+  )
 {
-  INT32 i;
+  INT32  i;
 
   for (i = 0; i < NC; i++) {
     mCFreq[i] = 0;
   }
+
   for (i = 0; i < NP; i++) {
     mPFreq[i] = 0;
   }
+
   mOutputPos = mOutputMask = 0;
-  InitPutBits();
+  InitPutBits ();
   return;
 }
 
 STATIC
 VOID
-HufEncodeEnd ()
+HufEncodeEnd (
+  )
 {
-  SendBlock();
+  SendBlock ();
 
   //
   // Flush remaining bits
   //
-  PutBits(UINT8_BIT - 1, 0);
+  PutBits (UINT8_BIT - 1, 0);
 
   return;
 }
 
-
 STATIC
 VOID
-MakeCrcTable ()
+MakeCrcTable (
+  )
 {
-  UINT32 i, j, r;
+  UINT32  i, j, r;
 
   for (i = 0; i <= UINT8_MAX; i++) {
     r = i;
@@ -1121,6 +1174,7 @@ MakeCrcTable ()
         r >>= 1;
       }
     }
+
     mCrcTable[i] = (UINT16)r;
   }
 }
@@ -1134,30 +1188,30 @@ MakeCrcTable ()
 STATIC
 VOID
 PutBits (
-  IN INT32 n,
-  IN UINT32 x
+  IN INT32   n,
+  IN UINT32  x
   )
 {
-  UINT8 Temp;
+  UINT8  Temp;
 
   if (n < mBitCount) {
     mSubBitBuf |= x << (mBitCount -= n);
   } else {
-
     Temp = (UINT8)(mSubBitBuf | (x >> (n -= mBitCount)));
     if (mDst < mDstUpperLimit) {
       *mDst++ = Temp;
     }
+
     mCompSize++;
 
     if (n < UINT8_BIT) {
       mSubBitBuf = x << (mBitCount = UINT8_BIT - n);
     } else {
-
       Temp = (UINT8)(x >> (n - UINT8_BIT));
       if (mDst < mDstUpperLimit) {
         *mDst++ = Temp;
       }
+
       mCompSize++;
 
       mSubBitBuf = x << (mBitCount = 2 * UINT8_BIT - n);
@@ -1176,31 +1230,33 @@ PutBits (
 STATIC
 INT32
 FreadCrc (
-  OUT UINT8 *p,
-  IN  INT32 n
+  OUT UINT8  *p,
+  IN  INT32  n
   )
 {
-  INT32 i;
+  INT32  i;
 
   for (i = 0; mSrc < mSrcUpperLimit && i < n; i++) {
     *p++ = *mSrc++;
   }
+
   n = i;
 
-  p -= n;
+  p         -= n;
   mOrigSize += n;
   while (--i >= 0) {
-    UPDATE_CRC(*p++);
+    UPDATE_CRC (*p++);
   }
+
   return n;
 }
 
-
 STATIC
 VOID
-InitPutBits ()
+InitPutBits (
+  )
 {
-  mBitCount = UINT8_BIT;
+  mBitCount  = UINT8_BIT;
   mSubBitBuf = 0;
 }
 
@@ -1212,17 +1268,17 @@ InitPutBits ()
 STATIC
 VOID
 CountLen (
-  IN INT32 i
+  IN INT32  i
   )
 {
-  STATIC INT32 Depth = 0;
+  STATIC INT32  Depth = 0;
 
   if (i < mN) {
     mLenCnt[(Depth < 16) ? Depth : 16]++;
   } else {
     Depth++;
-    CountLen(mLeft [i]);
-    CountLen(mRight[i]);
+    CountLen (mLeft[i]);
+    CountLen (mRight[i]);
     Depth--;
   }
 }
@@ -1235,16 +1291,17 @@ CountLen (
 STATIC
 VOID
 MakeLen (
-  IN INT32 Root
+  IN INT32  Root
   )
 {
-  INT32 i, k;
-  UINT32 Cum;
+  INT32   i, k;
+  UINT32  Cum;
 
   for (i = 0; i <= 16; i++) {
     mLenCnt[i] = 0;
   }
-  CountLen(Root);
+
+  CountLen (Root);
 
   //
   // Adjust the length count array so that
@@ -1255,6 +1312,7 @@ MakeLen (
   for (i = 16; i > 0; i--) {
     Cum += mLenCnt[i] << (16 - i);
   }
+
   while (Cum != (1U << 16)) {
     mLenCnt[16]--;
     for (i = 15; i > 0; i--) {
@@ -1264,8 +1322,10 @@ MakeLen (
         break;
       }
     }
+
     Cum--;
   }
+
   for (i = 16; i > 0; i--) {
     k = mLenCnt[i];
     while (--k >= 0) {
@@ -1277,10 +1337,10 @@ MakeLen (
 STATIC
 VOID
 DownHeap (
-  IN INT32 i
+  IN INT32  i
   )
 {
-  INT32 j, k;
+  INT32  j, k;
 
   //
   // priority queue: send i-th entry down heap
@@ -1288,15 +1348,18 @@ DownHeap (
 
   k = mHeap[i];
   while ((j = 2 * i) <= mHeapSize) {
-    if (j < mHeapSize && mFreq[mHeap[j]] > mFreq[mHeap[j + 1]]) {
+    if ((j < mHeapSize) && (mFreq[mHeap[j]] > mFreq[mHeap[j + 1]])) {
       j++;
     }
+
     if (mFreq[k] <= mFreq[mHeap[j]]) {
       break;
     }
+
     mHeap[i] = mHeap[j];
-    i = j;
+    i        = j;
   }
+
   mHeap[i] = (INT16)k;
 }
 
@@ -1310,18 +1373,19 @@ DownHeap (
 STATIC
 VOID
 MakeCode (
-  IN  INT32 n,
-  IN  UINT8 Len[],
-  OUT UINT16 Code[]
+  IN  INT32   n,
+  IN  UINT8   Len[],
+  OUT UINT16  Code[]
   )
 {
-  INT32    i;
-  UINT16   Start[18];
+  INT32   i;
+  UINT16  Start[18];
 
   Start[1] = 0;
   for (i = 1; i <= 16; i++) {
     Start[i + 1] = (UINT16)((Start[i] + mLenCnt[i]) << 1);
   }
+
   for (i = 0; i < n; i++) {
     Code[i] = Start[Len[i]]++;
   }
@@ -1346,62 +1410,65 @@ MakeTree (
   OUT UINT16  CodeParm[]
   )
 {
-  INT32 i, j, k, Avail;
+  INT32  i, j, k, Avail;
 
   //
   // make tree, calculate len[], return root
   //
 
-  mN = NParm;
-  mFreq = FreqParm;
-  mLen = LenParm;
-  Avail = mN;
+  mN        = NParm;
+  mFreq     = FreqParm;
+  mLen      = LenParm;
+  Avail     = mN;
   mHeapSize = 0;
-  mHeap[1] = 0;
+  mHeap[1]  = 0;
   for (i = 0; i < mN; i++) {
     mLen[i] = 0;
     if (mFreq[i]) {
       mHeap[++mHeapSize] = (INT16)i;
     }
   }
+
   if (mHeapSize < 2) {
     CodeParm[mHeap[1]] = 0;
     return mHeap[1];
   }
+
   for (i = mHeapSize / 2; i >= 1; i--) {
-
     //
     // make priority queue
     //
-    DownHeap(i);
+    DownHeap (i);
   }
+
   mSortPtr = CodeParm;
   do {
     i = mHeap[1];
     if (i < mN) {
       *mSortPtr++ = (UINT16)i;
     }
+
     mHeap[1] = mHeap[mHeapSize--];
-    DownHeap(1);
+    DownHeap (1);
     j = mHeap[1];
     if (j < mN) {
       *mSortPtr++ = (UINT16)j;
     }
-    k = Avail++;
+
+    k        = Avail++;
     mFreq[k] = (UINT16)(mFreq[i] + mFreq[j]);
     mHeap[1] = (INT16)k;
-    DownHeap(1);
-    mLeft[k] = (UINT16)i;
+    DownHeap (1);
+    mLeft[k]  = (UINT16)i;
     mRight[k] = (UINT16)j;
   } while (mHeapSize > 1);
 
   mSortPtr = CodeParm;
-  MakeLen(k);
-  MakeCode(NParm, LenParm, CodeParm);
+  MakeLen (k);
+  MakeCode (NParm, LenParm, CodeParm);
 
   //
   // return root
   //
   return k;
 }
-
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.c b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
index 89524550884a..fa4c5ded0dce 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.c
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
@@ -18,17 +18,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 // Declare module globals for keeping track of the utility's
 // name and other settings.
 //
-STATIC STATUS mStatus                 = STATUS_SUCCESS;
-STATIC CHAR8  mUtilityName[50]        = { 0 };
-STATIC UINT64 mPrintLogLevel          = INFO_LOG_LEVEL;
-STATIC CHAR8  *mSourceFileName        = NULL;
-STATIC UINT32 mSourceFileLineNum      = 0;
-STATIC UINT32 mErrorCount             = 0;
-STATIC UINT32 mWarningCount           = 0;
-STATIC UINT32 mMaxErrors              = 0;
-STATIC UINT32 mMaxWarnings            = 0;
-STATIC UINT32 mMaxWarningsPlusErrors  = 0;
-STATIC INT8   mPrintLimitsSet         = 0;
+STATIC STATUS  mStatus                = STATUS_SUCCESS;
+STATIC CHAR8   mUtilityName[50]       = { 0 };
+STATIC UINT64  mPrintLogLevel         = INFO_LOG_LEVEL;
+STATIC CHAR8   *mSourceFileName       = NULL;
+STATIC UINT32  mSourceFileLineNum     = 0;
+STATIC UINT32  mErrorCount            = 0;
+STATIC UINT32  mWarningCount          = 0;
+STATIC UINT32  mMaxErrors             = 0;
+STATIC UINT32  mMaxWarnings           = 0;
+STATIC UINT32  mMaxWarningsPlusErrors = 0;
+STATIC INT8    mPrintLimitsSet        = 0;
 
 STATIC
 VOID
@@ -41,7 +41,7 @@ PrintLimitExceeded (
 
   All arguments are optional, though the printed message may be useless if
   at least something valid is not specified.
- 
+
  @note:
    We print the following (similar to the Warn() and Debug()
    W
@@ -90,7 +90,8 @@ Error (
   ...
   )
 {
-  va_list List;
+  va_list  List;
+
   //
   // If limits have been set, then check that we have not exceeded them
   //
@@ -101,16 +102,17 @@ Error (
     if (mMaxWarningsPlusErrors != 0) {
       if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
         PrintLimitExceeded ();
-        return ;
+        return;
       }
     }
+
     //
     // See if we've exceeded our error count
     //
     if (mMaxErrors != 0) {
       if (mErrorCount > mMaxErrors) {
         PrintLimitExceeded ();
-        return ;
+        return;
       }
     }
   }
@@ -137,7 +139,8 @@ ParserError (
   ...
   )
 {
-  va_list List;
+  va_list  List;
+
   //
   // If limits have been set, then check them
   //
@@ -148,16 +151,17 @@ ParserError (
     if (mMaxWarningsPlusErrors != 0) {
       if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
         PrintLimitExceeded ();
-        return ;
+        return;
       }
     }
+
     //
     // See if we've exceeded our error count
     //
     if (mMaxErrors != 0) {
       if (mErrorCount > mMaxErrors) {
         PrintLimitExceeded ();
-        return ;
+        return;
       }
     }
   }
@@ -184,7 +188,8 @@ ParserWarning (
   ...
   )
 {
-  va_list List;
+  va_list  List;
+
   //
   // If limits have been set, then check them
   //
@@ -195,16 +200,17 @@ ParserWarning (
     if (mMaxWarningsPlusErrors != 0) {
       if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
         PrintLimitExceeded ();
-        return ;
+        return;
       }
     }
+
     //
     // See if we've exceeded our warning count
     //
     if (mMaxWarnings != 0) {
       if (mWarningCount > mMaxWarnings) {
         PrintLimitExceeded ();
-        return ;
+        return;
       }
     }
   }
@@ -244,7 +250,7 @@ Warning (
   ...
   )
 {
-  va_list List;
+  va_list  List;
 
   //
   // Current Print Level not output warning information.
@@ -252,6 +258,7 @@ Warning (
   if (WARNING_LOG_LEVEL < mPrintLogLevel) {
     return;
   }
+
   //
   // If limits have been set, then check them
   //
@@ -262,16 +269,17 @@ Warning (
     if (mMaxWarningsPlusErrors != 0) {
       if (mErrorCount + mWarningCount > mMaxWarningsPlusErrors) {
         PrintLimitExceeded ();
-        return ;
+        return;
       }
     }
+
     //
     // See if we've exceeded our warning count
     //
     if (mMaxWarnings != 0) {
       if (mWarningCount > mMaxWarnings) {
         PrintLimitExceeded ();
-        return ;
+        return;
       }
     }
   }
@@ -284,7 +292,7 @@ Warning (
 
 /**
   Print a Debug message.
- 
+
   @param FileName    typically the name of the utility printing the debug message, but
                      can be the name of a file being parsed.
   @param LineNumber  the line number in FileName (parsers)
@@ -304,12 +312,13 @@ DebugMsg (
   ...
   )
 {
-  va_list List;
+  va_list  List;
+
   //
   // If the debug level is less than current print level, then do nothing.
   //
   if (MsgLevel < mPrintLogLevel) {
-    return ;
+    return;
   }
 
   va_start (List, MsgFmt);
@@ -321,7 +330,7 @@ DebugMsg (
   Worker routine for all the utility printing services. Prints the message in
   a format that Visual Studio will find when scanning build outputs for
   errors or warnings.
- 
+
  @note:
    If FileName == NULL then this utility will use the string passed into SetUtilityName().
 
@@ -355,25 +364,25 @@ DebugMsg (
 **/
 VOID
 PrintMessage (
-  CHAR8   *Type,
-  CHAR8   *FileName,
-  UINT32  LineNumber,
-  UINT32  MessageCode,
-  CHAR8   *Text,
-  CHAR8   *MsgFmt,
-  va_list List
+  CHAR8    *Type,
+  CHAR8    *FileName,
+  UINT32   LineNumber,
+  UINT32   MessageCode,
+  CHAR8    *Text,
+  CHAR8    *MsgFmt,
+  va_list  List
   )
 {
-  CHAR8       Line[MAX_LINE_LEN];
-  CHAR8       Line2[MAX_LINE_LEN];
-  CHAR8       *Cptr;
-  struct tm   *NewTime;
-  time_t      CurrentTime;
+  CHAR8      Line[MAX_LINE_LEN];
+  CHAR8      Line2[MAX_LINE_LEN];
+  CHAR8      *Cptr;
+  struct tm  *NewTime;
+  time_t     CurrentTime;
 
   //
   // init local variable
   //
-  Line[0] = '\0';
+  Line[0]  = '\0';
   Line2[0] = '\0';
 
   //
@@ -393,20 +402,23 @@ PrintMessage (
     time (&CurrentTime);
     NewTime = localtime (&CurrentTime);
     if (NewTime != NULL) {
-      fprintf (stdout, "%04d-%02d-%02d %02d:%02d:%02d",
-                       NewTime->tm_year + 1900,
-                       NewTime->tm_mon + 1,
-                       NewTime->tm_mday,
-                       NewTime->tm_hour,
-                       NewTime->tm_min,
-                       NewTime->tm_sec
-                       );
+      fprintf (
+        stdout,
+        "%04d-%02d-%02d %02d:%02d:%02d",
+        NewTime->tm_year + 1900,
+        NewTime->tm_mon + 1,
+        NewTime->tm_mday,
+        NewTime->tm_hour,
+        NewTime->tm_min,
+        NewTime->tm_sec
+        );
     }
+
     if (Cptr != NULL) {
       strcpy (Line, ": ");
       strncat (Line, Cptr, MAX_LINE_LEN - strlen (Line) - 1);
       if (LineNumber != 0) {
-        sprintf (Line2, "(%u)", (unsigned) LineNumber);
+        sprintf (Line2, "(%u)", (unsigned)LineNumber);
         strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
       }
     }
@@ -418,10 +430,11 @@ PrintMessage (
       if (mUtilityName[0] != '\0') {
         fprintf (stdout, "%s...\n", mUtilityName);
       }
+
       strncpy (Line, Cptr, MAX_LINE_LEN - 1);
       Line[MAX_LINE_LEN - 1] = 0;
       if (LineNumber != 0) {
-        sprintf (Line2, "(%u)", (unsigned) LineNumber);
+        sprintf (Line2, "(%u)", (unsigned)LineNumber);
         strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
       }
     } else {
@@ -448,9 +461,10 @@ PrintMessage (
   strncat (Line, ": ", MAX_LINE_LEN - strlen (Line) - 1);
   strncat (Line, Type, MAX_LINE_LEN - strlen (Line) - 1);
   if (MessageCode != 0) {
-    sprintf (Line2, " %04u", (unsigned) MessageCode);
+    sprintf (Line2, " %04u", (unsigned)MessageCode);
     strncat (Line, Line2, MAX_LINE_LEN - strlen (Line) - 1);
   }
+
   fprintf (stdout, "%s", Line);
   //
   // If offending text was provided, then print it
@@ -458,6 +472,7 @@ PrintMessage (
   if (Text != NULL) {
     fprintf (stdout, ": %s", Text);
   }
+
   fprintf (stdout, "\n");
 
   //
@@ -467,7 +482,6 @@ PrintMessage (
     vsprintf (Line2, MsgFmt, List);
     fprintf (stdout, "  %s\n", Line2);
   }
-
 }
 
 /**
@@ -480,11 +494,12 @@ PrintMessage (
 STATIC
 VOID
 PrintSimpleMessage (
-  CHAR8   *MsgFmt,
-  va_list List
+  CHAR8    *MsgFmt,
+  va_list  List
   )
 {
-  CHAR8       Line[MAX_LINE_LEN];
+  CHAR8  Line[MAX_LINE_LEN];
+
   //
   // Print formatted message if provided
   //
@@ -507,8 +522,8 @@ ParserSetPosition (
   UINT32  LineNum
   )
 {
-  mSourceFileName     = SourceFileName;
-  mSourceFileLineNum  = LineNum;
+  mSourceFileName    = SourceFileName;
+  mSourceFileLineNum = LineNum;
 }
 
 /**
@@ -523,7 +538,7 @@ ParserSetPosition (
 **/
 VOID
 SetUtilityName (
-  CHAR8   *UtilityName
+  CHAR8  *UtilityName
   )
 {
   //
@@ -534,6 +549,7 @@ SetUtilityName (
     if (strlen (UtilityName) >= sizeof (mUtilityName)) {
       Error (UtilityName, 0, 0, "application error", "utility name length exceeds internal buffer size");
     }
+
     strncpy (mUtilityName, UtilityName, sizeof (mUtilityName) - 1);
     mUtilityName[sizeof (mUtilityName) - 1] = 0;
   } else {
@@ -580,16 +596,17 @@ SetPrintLevel (
 **/
 VOID
 VerboseMsg (
-  CHAR8   *MsgFmt,
+  CHAR8  *MsgFmt,
   ...
   )
 {
-  va_list List;
+  va_list  List;
+
   //
   // If the debug level is less than current print level, then do nothing.
   //
   if (VERBOSE_LOG_LEVEL < mPrintLogLevel) {
-    return ;
+    return;
   }
 
   va_start (List, MsgFmt);
@@ -606,16 +623,17 @@ VerboseMsg (
 **/
 VOID
 NormalMsg (
-  CHAR8   *MsgFmt,
+  CHAR8  *MsgFmt,
   ...
   )
 {
-  va_list List;
+  va_list  List;
+
   //
   // If the debug level is less than current print level, then do nothing.
   //
   if (INFO_LOG_LEVEL < mPrintLogLevel) {
-    return ;
+    return;
   }
 
   va_start (List, MsgFmt);
@@ -632,16 +650,17 @@ NormalMsg (
 **/
 VOID
 KeyMsg (
-  CHAR8   *MsgFmt,
+  CHAR8  *MsgFmt,
   ...
   )
 {
-  va_list List;
+  va_list  List;
+
   //
   // If the debug level is less than current print level, then do nothing.
   //
   if (KEY_LOG_LEVEL < mPrintLogLevel) {
-    return ;
+    return;
   }
 
   va_start (List, MsgFmt);
@@ -665,10 +684,10 @@ SetPrintLimits (
   UINT32  MaxWarningsPlusErrors
   )
 {
-  mMaxErrors              = MaxErrors;
-  mMaxWarnings            = MaxWarnings;
-  mMaxWarningsPlusErrors  = MaxWarningsPlusErrors;
-  mPrintLimitsSet         = 1;
+  mMaxErrors             = MaxErrors;
+  mMaxWarnings           = MaxWarnings;
+  mMaxWarningsPlusErrors = MaxWarningsPlusErrors;
+  mPrintLimitsSet        = 1;
 }
 
 STATIC
@@ -677,7 +696,8 @@ PrintLimitExceeded (
   VOID
   )
 {
-  STATIC INT8 mPrintLimitExceeded = 0;
+  STATIC INT8  mPrintLimitExceeded = 0;
+
   //
   // If we've already printed the message, do nothing. Otherwise
   // temporarily increase our print limits so we can pass one
@@ -701,10 +721,10 @@ TestUtilityMessages (
   VOID
   )
 {
-  CHAR8 *ArgStr = "ArgString";
-  int   ArgInt;
+  CHAR8  *ArgStr = "ArgString";
+  int    ArgInt;
 
-  ArgInt  = 0x12345678;
+  ArgInt = 0x12345678;
   //
   // Test without setting utility name
   //
@@ -785,4 +805,5 @@ TestUtilityMessages (
   ParserSetPosition (__FILE__, __LINE__ + 1);
   ParserWarning (4321, "Text1", "Text2 %s 0x%X", ArgStr, ArgInt);
 }
+
 #endif
diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
index 3fae6f901da0..9a94461e4e57 100644
--- a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
+++ b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
@@ -19,40 +19,44 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
         ) \
     )
 
-
 //
 // Local prototypes
 //
 
 STATIC
 UINT32
-FvBufGetSecHdrLen(
-   IN EFI_COMMON_SECTION_HEADER *SectionHeader
-   )
+FvBufGetSecHdrLen (
+  IN EFI_COMMON_SECTION_HEADER  *SectionHeader
+  )
 {
   if (SectionHeader == NULL) {
     return 0;
   }
-  if (FvBufExpand3ByteSize(SectionHeader->Size) == 0xffffff) {
-    return sizeof(EFI_COMMON_SECTION_HEADER2);
+
+  if (FvBufExpand3ByteSize (SectionHeader->Size) == 0xffffff) {
+    return sizeof (EFI_COMMON_SECTION_HEADER2);
   }
-  return sizeof(EFI_COMMON_SECTION_HEADER);
+
+  return sizeof (EFI_COMMON_SECTION_HEADER);
 }
 
 STATIC
 UINT32
 FvBufGetSecFileLen (
-  IN EFI_COMMON_SECTION_HEADER *SectionHeader
+  IN EFI_COMMON_SECTION_HEADER  *SectionHeader
   )
 {
-  UINT32 Length;
+  UINT32  Length;
+
   if (SectionHeader == NULL) {
     return 0;
   }
-  Length = FvBufExpand3ByteSize(SectionHeader->Size);
+
+  Length = FvBufExpand3ByteSize (SectionHeader->Size);
   if (Length == 0xffffff) {
     Length = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
   }
+
   return Length;
 }
 
@@ -63,15 +67,15 @@ FvBufGetSecFileLen (
 STATIC
 UINT16
 FvBufCalculateChecksum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
+  IN UINT16  *Buffer,
+  IN UINTN   Size
   );
 
 STATIC
 UINT8
 FvBufCalculateChecksum8 (
-  IN UINT8        *Buffer,
-  IN UINTN        Size
+  IN UINT8  *Buffer,
+  IN UINTN  Size
   );
 
 //
@@ -90,19 +94,19 @@ FvBufCalculateChecksum8 (
 **/
 EFI_STATUS
 FvBufRemoveFileNew (
-  IN OUT VOID *Fv,
-  IN EFI_GUID *Name
+  IN OUT VOID  *Fv,
+  IN EFI_GUID  *Name
   )
 {
-  EFI_STATUS                  Status;
-  EFI_FFS_FILE_HEADER*        FileToRm;
-  UINTN                       FileToRmLength;
+  EFI_STATUS           Status;
+  EFI_FFS_FILE_HEADER  *FileToRm;
+  UINTN                FileToRmLength;
 
-  Status = FvBufFindFileByName(
-    Fv,
-    Name,
-    (VOID **)&FileToRm
-    );
+  Status = FvBufFindFileByName (
+             Fv,
+             Name,
+             (VOID **)&FileToRm
+             );
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -112,7 +116,7 @@ FvBufRemoveFileNew (
   CommonLibBinderSetMem (
     FileToRm,
     FileToRmLength,
-    (((EFI_FIRMWARE_VOLUME_HEADER*)Fv)->Attributes & EFI_FVB2_ERASE_POLARITY)
+    (((EFI_FIRMWARE_VOLUME_HEADER *)Fv)->Attributes & EFI_FVB2_ERASE_POLARITY)
       ? 0xFF : 0
     );
 
@@ -131,21 +135,21 @@ FvBufRemoveFileNew (
 **/
 EFI_STATUS
 FvBufRemoveFile (
-  IN OUT VOID *Fv,
-  IN EFI_GUID *Name
+  IN OUT VOID  *Fv,
+  IN EFI_GUID  *Name
   )
 {
   EFI_STATUS                  Status;
-  EFI_FFS_FILE_HEADER        *NextFile;
-  EFI_FIRMWARE_VOLUME_HEADER *TempFv;
+  EFI_FFS_FILE_HEADER         *NextFile;
+  EFI_FIRMWARE_VOLUME_HEADER  *TempFv;
   UINTN                       FileKey;
   UINTN                       FvLength;
 
-  Status = FvBufFindFileByName(
-    Fv,
-    Name,
-    NULL
-    );
+  Status = FvBufFindFileByName (
+             Fv,
+             Name,
+             NULL
+             );
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -172,7 +176,6 @@ FvBufRemoveFile (
 
   FileKey = 0;
   while (TRUE) {
-
     Status = FvBufFindNextFile (Fv, &FileKey, (VOID **)&NextFile);
     if (Status == EFI_NOT_FOUND) {
       break;
@@ -183,8 +186,7 @@ FvBufRemoveFile (
 
     if (CommonLibBinderCompareGuid (Name, &NextFile->Name)) {
       continue;
-    }
-    else {
+    } else {
       Status = FvBufAddFile (TempFv, NextFile);
       if (EFI_ERROR (Status)) {
         CommonLibBinderFree (TempFv);
@@ -209,12 +211,12 @@ FvBufRemoveFile (
 **/
 EFI_STATUS
 FvBufChecksumFile (
-  IN OUT VOID *FfsFile
+  IN OUT VOID  *FfsFile
   )
 {
-  EFI_FFS_FILE_HEADER* File = (EFI_FFS_FILE_HEADER*)FfsFile;
-  EFI_FFS_FILE_STATE StateBackup;
-  UINT32 FileSize;
+  EFI_FFS_FILE_HEADER  *File = (EFI_FFS_FILE_HEADER *)FfsFile;
+  EFI_FFS_FILE_STATE   StateBackup;
+  UINT32               FileSize;
 
   FileSize = FvBufGetFfsFileSize (File);
 
@@ -222,21 +224,21 @@ FvBufChecksumFile (
   // Fill in checksums and state, they must be 0 for checksumming.
   //
   File->IntegrityCheck.Checksum.Header = 0;
-  File->IntegrityCheck.Checksum.File = 0;
-  StateBackup = File->State;
-  File->State = 0;
+  File->IntegrityCheck.Checksum.File   = 0;
+  StateBackup                          = File->State;
+  File->State                          = 0;
 
   File->IntegrityCheck.Checksum.Header =
     FvBufCalculateChecksum8 (
-      (UINT8 *) File,
+      (UINT8 *)File,
       FvBufGetFfsHeaderSize (File)
       );
 
   if (File->Attributes & FFS_ATTRIB_CHECKSUM) {
     File->IntegrityCheck.Checksum.File = FvBufCalculateChecksum8 (
-                                                (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File)),
-                                                FileSize - FvBufGetFfsHeaderSize (File)
-                                                );
+                                           (VOID *)((UINT8 *)File + FvBufGetFfsHeaderSize (File)),
+                                           FileSize - FvBufGetFfsHeaderSize (File)
+                                           );
   } else {
     File->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
   }
@@ -258,15 +260,15 @@ FvBufChecksumFile (
 **/
 EFI_STATUS
 FvBufChecksumHeader (
-  IN OUT VOID *Fv
+  IN OUT VOID  *Fv
   )
 {
-  EFI_FIRMWARE_VOLUME_HEADER* FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+  EFI_FIRMWARE_VOLUME_HEADER  *FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
 
   FvHeader->Checksum = 0;
   FvHeader->Checksum =
     FvBufCalculateChecksum16 (
-      (UINT16*) FvHeader,
+      (UINT16 *)FvHeader,
       FvHeader->HeaderLength / sizeof (UINT16)
       );
 
@@ -286,12 +288,12 @@ FvBufChecksumHeader (
 **/
 EFI_STATUS
 FvBufDuplicate (
-  IN VOID *SourceFv,
-  IN OUT VOID **DestinationFv
+  IN VOID      *SourceFv,
+  IN OUT VOID  **DestinationFv
   )
 {
-  EFI_STATUS Status;
-  UINTN size;
+  EFI_STATUS  Status;
+  UINTN       size;
 
   if (DestinationFv == NULL) {
     return EFI_INVALID_PARAMETER;
@@ -331,18 +333,18 @@ FvBufDuplicate (
 **/
 EFI_STATUS
 FvBufExtend (
-  IN VOID **Fv,
-  IN UINTN Size
+  IN VOID   **Fv,
+  IN UINTN  Size
   )
 {
-  EFI_STATUS Status;
-  UINTN OldSize;
-  UINTN NewSize;
-  UINTN BlockCount;
-  VOID* NewFv;
+  EFI_STATUS  Status;
+  UINTN       OldSize;
+  UINTN       NewSize;
+  UINTN       BlockCount;
+  VOID        *NewFv;
 
-  EFI_FIRMWARE_VOLUME_HEADER* hdr;
-  EFI_FV_BLOCK_MAP_ENTRY*     blk;
+  EFI_FIRMWARE_VOLUME_HEADER  *hdr;
+  EFI_FV_BLOCK_MAP_ENTRY      *blk;
 
   Status = FvBufGetSize (*Fv, &OldSize);
   if (EFI_ERROR (Status)) {
@@ -352,7 +354,7 @@ FvBufExtend (
   //
   // Locate the block map in the fv header
   //
-  hdr = (EFI_FIRMWARE_VOLUME_HEADER*)*Fv;
+  hdr = (EFI_FIRMWARE_VOLUME_HEADER *)*Fv;
   blk = hdr->BlockMap;
 
   //
@@ -384,9 +386,9 @@ FvBufExtend (
   //
   // Locate the block map in the new fv header
   //
-  hdr = (EFI_FIRMWARE_VOLUME_HEADER*)NewFv;
+  hdr           = (EFI_FIRMWARE_VOLUME_HEADER *)NewFv;
   hdr->FvLength = NewSize;
-  blk = hdr->BlockMap;
+  blk           = hdr->BlockMap;
 
   //
   // Update the block map for the new fv
@@ -402,7 +404,7 @@ FvBufExtend (
   // Clear out the new area of the FV
   //
   CommonLibBinderSetMem (
-    (UINT8*)NewFv + OldSize,
+    (UINT8 *)NewFv + OldSize,
     (NewSize - OldSize),
     (hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0
     );
@@ -413,7 +415,6 @@ FvBufExtend (
   *Fv = NewFv;
 
   return EFI_SUCCESS;
-
 }
 
 /**
@@ -425,20 +426,20 @@ FvBufExtend (
 **/
 EFI_STATUS
 FvBufClearAllFiles (
-  IN OUT VOID *Fv
+  IN OUT VOID  *Fv
   )
 {
-  EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
-  EFI_STATUS Status;
-  UINTN size = 0;
+  EFI_FIRMWARE_VOLUME_HEADER  *hdr = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
+  EFI_STATUS                  Status;
+  UINTN                       size = 0;
 
   Status = FvBufGetSize (Fv, &size);
   if (EFI_ERROR (Status)) {
     return Status;
   }
 
-  CommonLibBinderSetMem(
-    (UINT8*)hdr + hdr->HeaderLength,
+  CommonLibBinderSetMem (
+    (UINT8 *)hdr + hdr->HeaderLength,
     size - hdr->HeaderLength,
     (hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0
     );
@@ -455,12 +456,12 @@ FvBufClearAllFiles (
 **/
 EFI_STATUS
 FvBufGetSize (
-  IN VOID *Fv,
-  OUT UINTN *Size
+  IN VOID    *Fv,
+  OUT UINTN  *Size
   )
 {
-  EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
-  EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
+  EFI_FIRMWARE_VOLUME_HEADER  *hdr = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
+  EFI_FV_BLOCK_MAP_ENTRY      *blk = hdr->BlockMap;
 
   *Size = 0;
 
@@ -470,6 +471,7 @@ FvBufGetSize (
       // If size is greater than 1GB, then assume it is corrupted
       return EFI_VOLUME_CORRUPTED;
     }
+
     blk++;
   }
 
@@ -491,21 +493,21 @@ FvBufGetSize (
 **/
 EFI_STATUS
 FvBufAddFile (
-  IN OUT VOID *Fv,
-  IN VOID *File
+  IN OUT VOID  *Fv,
+  IN VOID      *File
   )
 {
-  EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+  EFI_FIRMWARE_VOLUME_HEADER  *hdr = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
 
-  EFI_FFS_FILE_HEADER *fhdr = NULL;
-  EFI_FVB_ATTRIBUTES_2 FvbAttributes;
-  UINTN offset;
-  UINTN fsize;
-  UINTN newSize;
-  UINTN clearLoop;
+  EFI_FFS_FILE_HEADER   *fhdr = NULL;
+  EFI_FVB_ATTRIBUTES_2  FvbAttributes;
+  UINTN                 offset;
+  UINTN                 fsize;
+  UINTN                 newSize;
+  UINTN                 clearLoop;
 
-  EFI_STATUS Status;
-  UINTN fvSize;
+  EFI_STATUS  Status;
+  UINTN       fvSize;
 
   Status = FvBufGetSize (Fv, &fvSize);
   if (EFI_ERROR (Status)) {
@@ -513,27 +515,28 @@ FvBufAddFile (
   }
 
   FvbAttributes = hdr->Attributes;
-  newSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
+  newSize       = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER *)File);
 
-  for(
-      offset = (UINTN)ALIGN_POINTER (hdr->HeaderLength, 8);
-      offset + newSize <= fvSize;
-      offset = (UINTN)ALIGN_POINTER (offset, 8)
-    ) {
+  for (
+       offset = (UINTN)ALIGN_POINTER (hdr->HeaderLength, 8);
+       offset + newSize <= fvSize;
+       offset = (UINTN)ALIGN_POINTER (offset, 8)
+       )
+  {
+    fhdr = (EFI_FFS_FILE_HEADER *)((UINT8 *)hdr + offset);
 
-    fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + offset);
-
-    if (EFI_TEST_FFS_ATTRIBUTES_BIT(
+    if (EFI_TEST_FFS_ATTRIBUTES_BIT (
           FvbAttributes,
           fhdr->State,
           EFI_FILE_HEADER_VALID
+          )
         )
-      ) {
+    {
       // BUGBUG: Need to make sure that the new file does not already
       // exist.
 
       fsize = FvBufGetFfsFileSize (fhdr);
-      if (fsize == 0 || (offset + fsize > fvSize)) {
+      if ((fsize == 0) || (offset + fsize > fvSize)) {
         return EFI_VOLUME_CORRUPTED;
       }
 
@@ -543,10 +546,11 @@ FvBufAddFile (
 
     clearLoop = 0;
     while ((clearLoop < newSize) &&
-           (((UINT8*)fhdr)[clearLoop] ==
-             (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0)
+           (((UINT8 *)fhdr)[clearLoop] ==
+            (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0)
            )
-          ) {
+           )
+    {
       clearLoop++;
     }
 
@@ -584,14 +588,14 @@ FvBufAddFile (
 **/
 EFI_STATUS
 FvBufAddFileWithExtend (
-  IN OUT VOID **Fv,
-  IN VOID *File
+  IN OUT VOID  **Fv,
+  IN VOID      *File
   )
 {
-  EFI_STATUS Status;
-  EFI_FFS_FILE_HEADER* NewFile;
+  EFI_STATUS           Status;
+  EFI_FFS_FILE_HEADER  *NewFile;
 
-  NewFile = (EFI_FFS_FILE_HEADER*)File;
+  NewFile = (EFI_FFS_FILE_HEADER *)File;
 
   //
   // Try to add to the capsule volume
@@ -626,25 +630,25 @@ FvBufAddFileWithExtend (
 **/
 EFI_STATUS
 FvBufAddVtfFile (
-  IN OUT VOID *Fv,
-  IN VOID *File
+  IN OUT VOID  *Fv,
+  IN VOID      *File
   )
 {
-  EFI_STATUS Status;
+  EFI_STATUS  Status;
 
-  EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+  EFI_FIRMWARE_VOLUME_HEADER  *hdr = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
 
-  EFI_FFS_FILE_HEADER* NewFile;
+  EFI_FFS_FILE_HEADER  *NewFile;
   UINTN                NewFileSize;
 
-  UINT8 erasedUint8;
-  UINTN clearLoop;
+  UINT8  erasedUint8;
+  UINTN  clearLoop;
 
-  EFI_FFS_FILE_HEADER *LastFile;
-  UINTN LastFileSize;
+  EFI_FFS_FILE_HEADER  *LastFile;
+  UINTN                LastFileSize;
 
-  UINTN fvSize;
-  UINTN Key;
+  UINTN  fvSize;
+  UINTN  Key;
 
   Status = FvBufGetSize (Fv, &fvSize);
   if (EFI_ERROR (Status)) {
@@ -652,7 +656,7 @@ FvBufAddVtfFile (
   }
 
   erasedUint8 = (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0);
-  NewFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
+  NewFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER *)File);
 
   if (NewFileSize != (UINTN)ALIGN_POINTER (NewFileSize, 8)) {
     return EFI_INVALID_PARAMETER;
@@ -661,31 +665,31 @@ FvBufAddVtfFile (
   //
   // Find the last file in the FV
   //
-  Key = 0;
-  LastFile = NULL;
+  Key          = 0;
+  LastFile     = NULL;
   LastFileSize = 0;
   do {
-    Status = FvBufFindNextFile (Fv, &Key, (VOID **)&LastFile);
-    LastFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
+    Status       = FvBufFindNextFile (Fv, &Key, (VOID **)&LastFile);
+    LastFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER *)File);
   } while (!EFI_ERROR (Status));
 
   //
   // If no files were found, then we start at the beginning of the FV
   //
   if (LastFile == NULL) {
-    LastFile = (EFI_FFS_FILE_HEADER*)((UINT8*)hdr + hdr->HeaderLength);
+    LastFile = (EFI_FFS_FILE_HEADER *)((UINT8 *)hdr + hdr->HeaderLength);
   }
 
   //
   // We want to put the new file (VTF) at the end of the FV
   //
-  NewFile = (EFI_FFS_FILE_HEADER*)((UINT8*)hdr + (fvSize - NewFileSize));
+  NewFile = (EFI_FFS_FILE_HEADER *)((UINT8 *)hdr + (fvSize - NewFileSize));
 
   //
   // Check to see if there is enough room for the VTF after the last file
   // found in the FV
   //
-  if ((UINT8*)NewFile < ((UINT8*)LastFile + LastFileSize)) {
+  if ((UINT8 *)NewFile < ((UINT8 *)LastFile + LastFileSize)) {
     return EFI_OUT_OF_RESOURCES;
   }
 
@@ -694,8 +698,9 @@ FvBufAddVtfFile (
   //
   clearLoop = 0;
   while ((clearLoop < NewFileSize) &&
-         (((UINT8*)NewFile)[clearLoop] == erasedUint8)
-        ) {
+         (((UINT8 *)NewFile)[clearLoop] == erasedUint8)
+         )
+  {
     clearLoop++;
   }
 
@@ -720,13 +725,13 @@ FvBufAddVtfFile (
 **/
 VOID
 FvBufCompact3ByteSize (
-  OUT VOID* SizeDest,
-  IN UINT32 Size
+  OUT VOID   *SizeDest,
+  IN UINT32  Size
   )
 {
-  ((UINT8*)SizeDest)[0] = (UINT8)Size;
-  ((UINT8*)SizeDest)[1] = (UINT8)(Size >> 8);
-  ((UINT8*)SizeDest)[2] = (UINT8)(Size >> 16);
+  ((UINT8 *)SizeDest)[0] = (UINT8)Size;
+  ((UINT8 *)SizeDest)[1] = (UINT8)(Size >> 8);
+  ((UINT8 *)SizeDest)[2] = (UINT8)(Size >> 16);
 }
 
 /**
@@ -738,16 +743,18 @@ FvBufCompact3ByteSize (
 **/
 UINT32
 FvBufGetFfsFileSize (
-  IN EFI_FFS_FILE_HEADER *Ffs
+  IN EFI_FFS_FILE_HEADER  *Ffs
   )
 {
   if (Ffs == NULL) {
     return 0;
   }
+
   if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
-    return (UINT32) ((EFI_FFS_FILE_HEADER2 *)Ffs)->ExtendedSize;
+    return (UINT32)((EFI_FFS_FILE_HEADER2 *)Ffs)->ExtendedSize;
   }
-  return FvBufExpand3ByteSize(Ffs->Size);
+
+  return FvBufExpand3ByteSize (Ffs->Size);
 }
 
 /**
@@ -759,16 +766,18 @@ FvBufGetFfsFileSize (
 **/
 UINT32
 FvBufGetFfsHeaderSize (
-  IN EFI_FFS_FILE_HEADER *Ffs
+  IN EFI_FFS_FILE_HEADER  *Ffs
   )
 {
   if (Ffs == NULL) {
     return 0;
   }
+
   if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
-    return sizeof(EFI_FFS_FILE_HEADER2);
+    return sizeof (EFI_FFS_FILE_HEADER2);
   }
-  return sizeof(EFI_FFS_FILE_HEADER);
+
+  return sizeof (EFI_FFS_FILE_HEADER);
 }
 
 /**
@@ -780,12 +789,12 @@ FvBufGetFfsHeaderSize (
 **/
 UINT32
 FvBufExpand3ByteSize (
-  IN VOID* Size
+  IN VOID  *Size
   )
 {
-  return (((UINT8*)Size)[2] << 16) +
-         (((UINT8*)Size)[1] << 8) +
-         ((UINT8*)Size)[0];
+  return (((UINT8 *)Size)[2] << 16) +
+         (((UINT8 *)Size)[1] << 8) +
+         ((UINT8 *)Size)[0];
 }
 
 /**
@@ -805,19 +814,19 @@ FvBufExpand3ByteSize (
 **/
 EFI_STATUS
 FvBufFindNextFile (
-  IN VOID *Fv,
-  IN OUT UINTN *Key,
-  OUT VOID **File
+  IN VOID       *Fv,
+  IN OUT UINTN  *Key,
+  OUT VOID      **File
   )
 {
-  EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+  EFI_FIRMWARE_VOLUME_HEADER  *hdr = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
 
-  EFI_FFS_FILE_HEADER *fhdr = NULL;
-  EFI_FVB_ATTRIBUTES_2 FvbAttributes;
-  UINTN fsize;
+  EFI_FFS_FILE_HEADER   *fhdr = NULL;
+  EFI_FVB_ATTRIBUTES_2  FvbAttributes;
+  UINTN                 fsize;
 
-  EFI_STATUS Status;
-  UINTN fvSize;
+  EFI_STATUS  Status;
+  UINTN       fvSize;
 
   if (Fv == NULL) {
     return EFI_INVALID_PARAMETER;
@@ -834,50 +843,53 @@ FvBufFindNextFile (
 
   FvbAttributes = hdr->Attributes;
 
-  for(
-      *Key = (UINTN)ALIGN_POINTER (*Key, 8);
-      (*Key + sizeof (*fhdr)) < fvSize;
-      *Key = (UINTN)ALIGN_POINTER (*Key, 8)
-    ) {
-
-    fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
+  for (
+       *Key = (UINTN)ALIGN_POINTER (*Key, 8);
+       (*Key + sizeof (*fhdr)) < fvSize;
+       *Key = (UINTN)ALIGN_POINTER (*Key, 8)
+       )
+  {
+    fhdr  = (EFI_FFS_FILE_HEADER *)((UINT8 *)hdr + *Key);
     fsize = FvBufGetFfsFileSize (fhdr);
 
-    if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
-          FvbAttributes,
-          fhdr->State,
-          EFI_FILE_HEADER_VALID
-        ) ||
-        EFI_TEST_FFS_ATTRIBUTES_BIT(
+    if (!EFI_TEST_FFS_ATTRIBUTES_BIT (
+           FvbAttributes,
+           fhdr->State,
+           EFI_FILE_HEADER_VALID
+           ) ||
+        EFI_TEST_FFS_ATTRIBUTES_BIT (
           FvbAttributes,
           fhdr->State,
           EFI_FILE_HEADER_INVALID
+          )
         )
-      ) {
+    {
       *Key = *Key + 1; // Make some forward progress
       continue;
-    } else if(
-        EFI_TEST_FFS_ATTRIBUTES_BIT(
-          FvbAttributes,
-          fhdr->State,
-          EFI_FILE_MARKED_FOR_UPDATE
-        ) ||
-        EFI_TEST_FFS_ATTRIBUTES_BIT(
-          FvbAttributes,
-          fhdr->State,
-          EFI_FILE_DELETED
-        )
-      ) {
+    } else if (
+               EFI_TEST_FFS_ATTRIBUTES_BIT (
+                 FvbAttributes,
+                 fhdr->State,
+                 EFI_FILE_MARKED_FOR_UPDATE
+                 ) ||
+               EFI_TEST_FFS_ATTRIBUTES_BIT (
+                 FvbAttributes,
+                 fhdr->State,
+                 EFI_FILE_DELETED
+                 )
+               )
+    {
       *Key = *Key + fsize;
       continue;
-    } else if (EFI_TEST_FFS_ATTRIBUTES_BIT(
-          FvbAttributes,
-          fhdr->State,
-          EFI_FILE_DATA_VALID
-        )
-      ) {
-      *File = (UINT8*)hdr + *Key;
-      *Key = *Key + fsize;
+    } else if (EFI_TEST_FFS_ATTRIBUTES_BIT (
+                 FvbAttributes,
+                 fhdr->State,
+                 EFI_FILE_DATA_VALID
+                 )
+               )
+    {
+      *File = (UINT8 *)hdr + *Key;
+      *Key  = *Key + fsize;
       return EFI_SUCCESS;
     }
 
@@ -903,14 +915,14 @@ FvBufFindNextFile (
 **/
 EFI_STATUS
 FvBufFindFileByName (
-  IN VOID *Fv,
-  IN EFI_GUID *Name,
-  OUT VOID **File
+  IN VOID      *Fv,
+  IN EFI_GUID  *Name,
+  OUT VOID     **File
   )
 {
-  EFI_STATUS Status;
-  UINTN Key;
-  EFI_FFS_FILE_HEADER *NextFile;
+  EFI_STATUS           Status;
+  UINTN                Key;
+  EFI_FFS_FILE_HEADER  *NextFile;
 
   Key = 0;
   while (TRUE) {
@@ -923,6 +935,7 @@ FvBufFindFileByName (
       if (File != NULL) {
         *File = NextFile;
       }
+
       return EFI_SUCCESS;
     }
   }
@@ -946,14 +959,14 @@ FvBufFindFileByName (
 **/
 EFI_STATUS
 FvBufFindFileByType (
-  IN VOID *Fv,
-  IN EFI_FV_FILETYPE Type,
-  OUT VOID **File
+  IN VOID             *Fv,
+  IN EFI_FV_FILETYPE  Type,
+  OUT VOID            **File
   )
 {
-  EFI_STATUS Status;
-  UINTN Key;
-  EFI_FFS_FILE_HEADER *NextFile;
+  EFI_STATUS           Status;
+  UINTN                Key;
+  EFI_FFS_FILE_HEADER  *NextFile;
 
   Key = 0;
   while (TRUE) {
@@ -966,6 +979,7 @@ FvBufFindFileByType (
       if (File != NULL) {
         *File = NextFile;
       }
+
       return EFI_SUCCESS;
     }
   }
@@ -988,16 +1002,16 @@ FvBufFindFileByType (
 **/
 EFI_STATUS
 FvBufGetFileRawData (
-  IN  VOID*     FfsFile,
-  OUT VOID**    RawData,
-  OUT UINTN*    RawDataSize
+  IN  VOID   *FfsFile,
+  OUT VOID   **RawData,
+  OUT UINTN  *RawDataSize
   )
 {
-  EFI_STATUS Status;
-  EFI_FFS_FILE_HEADER* File;
-  EFI_RAW_SECTION* Section;
+  EFI_STATUS           Status;
+  EFI_FFS_FILE_HEADER  *File;
+  EFI_RAW_SECTION      *Section;
 
-  File = (EFI_FFS_FILE_HEADER*)FfsFile;
+  File = (EFI_FFS_FILE_HEADER *)FfsFile;
 
   //
   // Is the file type == EFI_FV_FILETYPE_RAW?
@@ -1006,7 +1020,7 @@ FvBufGetFileRawData (
     //
     // Raw filetypes don't have sections, so we just return the raw data
     //
-    *RawData = (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File));
+    *RawData     = (VOID *)((UINT8 *)File + FvBufGetFfsHeaderSize (File));
     *RawDataSize = FvBufGetFfsFileSize (File) - FvBufGetFfsHeaderSize (File);
     return EFI_SUCCESS;
   }
@@ -1019,12 +1033,11 @@ FvBufGetFileRawData (
     return Status;
   }
 
-  *RawData = (VOID*)((UINT8 *)Section + FvBufGetSecHdrLen(Section));
+  *RawData     = (VOID *)((UINT8 *)Section + FvBufGetSecHdrLen (Section));
   *RawDataSize =
-    FvBufGetSecFileLen (Section) - FvBufGetSecHdrLen(Section);
+    FvBufGetSecFileLen (Section) - FvBufGetSecHdrLen (Section);
 
   return EFI_SUCCESS;
-
 }
 
 /**
@@ -1042,37 +1055,37 @@ FvBufGetFileRawData (
 **/
 EFI_STATUS
 FvBufPackageFreeformRawFile (
-  IN EFI_GUID*  Filename,
-  IN VOID*      RawData,
-  IN UINTN      RawDataSize,
-  OUT VOID**    FfsFile
+  IN EFI_GUID  *Filename,
+  IN VOID      *RawData,
+  IN UINTN     RawDataSize,
+  OUT VOID     **FfsFile
   )
 {
-  EFI_FFS_FILE_HEADER* NewFile;
-  UINT32 NewFileSize;
-  EFI_RAW_SECTION* NewSection;
-  UINT32 NewSectionSize;
-  UINT32 FfsHdrLen;
-  UINT32 SecHdrLen;
+  EFI_FFS_FILE_HEADER  *NewFile;
+  UINT32               NewFileSize;
+  EFI_RAW_SECTION      *NewSection;
+  UINT32               NewSectionSize;
+  UINT32               FfsHdrLen;
+  UINT32               SecHdrLen;
 
   //
   // The section size is the DataSize + the size of the section header
   //
   NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION) + (UINT32)RawDataSize;
-  SecHdrLen = sizeof (EFI_RAW_SECTION);
+  SecHdrLen      = sizeof (EFI_RAW_SECTION);
   if (NewSectionSize >= MAX_SECTION_SIZE) {
     NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION2) + (UINT32)RawDataSize;
-    SecHdrLen = sizeof (EFI_RAW_SECTION2);
+    SecHdrLen      = sizeof (EFI_RAW_SECTION2);
   }
 
   //
   // The file size is the size of the file header + the section size
   //
   NewFileSize = sizeof (EFI_FFS_FILE_HEADER) + NewSectionSize;
-  FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER);
+  FfsHdrLen   = sizeof (EFI_FFS_FILE_HEADER);
   if (NewFileSize >= MAX_FFS_SIZE) {
     NewFileSize = sizeof (EFI_FFS_FILE_HEADER2) + NewSectionSize;
-    FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER2);
+    FfsHdrLen   = sizeof (EFI_FFS_FILE_HEADER2);
   }
 
   //
@@ -1082,18 +1095,20 @@ FvBufPackageFreeformRawFile (
   if (NewFile == NULL) {
     return EFI_OUT_OF_RESOURCES;
   }
+
   CommonLibBinderSetMem (NewFile, NewFileSize, 0);
 
   //
   // The NewSection follow right after the FFS file header
   //
-  NewSection = (EFI_RAW_SECTION*)((UINT8*)NewFile + FfsHdrLen);
+  NewSection = (EFI_RAW_SECTION *)((UINT8 *)NewFile + FfsHdrLen);
   if (NewSectionSize >= MAX_SECTION_SIZE) {
     FvBufCompact3ByteSize (NewSection->Size, 0xffffff);
     ((EFI_RAW_SECTION2 *)NewSection)->ExtendedSize = NewSectionSize;
   } else {
     FvBufCompact3ByteSize (NewSection->Size, NewSectionSize);
   }
+
   NewSection->Type = EFI_SECTION_RAW;
 
   //
@@ -1109,18 +1124,19 @@ FvBufPackageFreeformRawFile (
   if (NewFileSize >= MAX_FFS_SIZE) {
     FvBufCompact3ByteSize (NewFile->Size, 0x0);
     ((EFI_FFS_FILE_HEADER2 *)NewFile)->ExtendedSize = NewFileSize;
-    NewFile->Attributes |= FFS_ATTRIB_LARGE_FILE;
+    NewFile->Attributes                            |= FFS_ATTRIB_LARGE_FILE;
   } else {
     FvBufCompact3ByteSize (NewFile->Size, NewFileSize);
   }
-  NewFile->Type = EFI_FV_FILETYPE_FREEFORM;
+
+  NewFile->Type                           = EFI_FV_FILETYPE_FREEFORM;
   NewFile->IntegrityCheck.Checksum.Header =
-    FvBufCalculateChecksum8 ((UINT8*)NewFile, FfsHdrLen);
+    FvBufCalculateChecksum8 ((UINT8 *)NewFile, FfsHdrLen);
   NewFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
-  NewFile->State = (UINT8)~( EFI_FILE_HEADER_CONSTRUCTION |
-                             EFI_FILE_HEADER_VALID |
-                             EFI_FILE_DATA_VALID
-                           );
+  NewFile->State                        = (UINT8) ~(EFI_FILE_HEADER_CONSTRUCTION |
+                                                    EFI_FILE_HEADER_VALID |
+                                                    EFI_FILE_DATA_VALID
+                                                    );
 
   *FfsFile = NewFile;
 
@@ -1145,14 +1161,14 @@ FvBufPackageFreeformRawFile (
 **/
 EFI_STATUS
 FvBufFindNextSection (
-  IN VOID *SectionsStart,
-  IN UINTN TotalSectionsSize,
-  IN OUT UINTN *Key,
-  OUT VOID **Section
+  IN VOID       *SectionsStart,
+  IN UINTN      TotalSectionsSize,
+  IN OUT UINTN  *Key,
+  OUT VOID      **Section
   )
 {
-  EFI_COMMON_SECTION_HEADER *sectionHdr;
-  UINTN sectionSize;
+  EFI_COMMON_SECTION_HEADER  *sectionHdr;
+  UINTN                      sectionSize;
 
   *Key = (UINTN)ALIGN_POINTER (*Key, 4); // Sections are DWORD aligned
 
@@ -1160,7 +1176,7 @@ FvBufFindNextSection (
     return EFI_NOT_FOUND;
   }
 
-  sectionHdr = (EFI_COMMON_SECTION_HEADER*)((UINT8*)SectionsStart + *Key);
+  sectionHdr  = (EFI_COMMON_SECTION_HEADER *)((UINT8 *)SectionsStart + *Key);
   sectionSize = FvBufGetSecFileLen (sectionHdr);
 
   if (sectionSize < sizeof (EFI_COMMON_SECTION_HEADER)) {
@@ -1171,10 +1187,9 @@ FvBufFindNextSection (
     return EFI_NOT_FOUND;
   }
 
-  *Section = (UINT8*)sectionHdr;
-  *Key = *Key + sectionSize;
+  *Section = (UINT8 *)sectionHdr;
+  *Key     = *Key + sectionSize;
   return EFI_SUCCESS;
-
 }
 
 /**
@@ -1190,21 +1205,21 @@ FvBufFindNextSection (
 **/
 EFI_STATUS
 FvBufCountSections (
-  IN VOID* FfsFile,
-  IN UINTN* Count
+  IN VOID   *FfsFile,
+  IN UINTN  *Count
   )
 {
   EFI_STATUS                 Status;
   UINTN                      Key;
-  VOID*                      SectionStart;
+  VOID                       *SectionStart;
   UINTN                      TotalSectionsSize;
-  EFI_COMMON_SECTION_HEADER* NextSection;
+  EFI_COMMON_SECTION_HEADER  *NextSection;
 
-  SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
+  SectionStart      = (VOID *)((UINTN)FfsFile + FvBufGetFfsHeaderSize (FfsFile));
   TotalSectionsSize =
-    FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
-    FvBufGetFfsHeaderSize(FfsFile);
-  Key = 0;
+    FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER *)FfsFile) -
+    FvBufGetFfsHeaderSize (FfsFile);
+  Key    = 0;
   *Count = 0;
   while (TRUE) {
     Status = FvBufFindNextSection (
@@ -1223,7 +1238,6 @@ FvBufCountSections (
     // Increment the section counter
     //
     *Count += 1;
-
   }
 
   return EFI_NOT_FOUND;
@@ -1245,21 +1259,21 @@ FvBufCountSections (
 **/
 EFI_STATUS
 FvBufFindSectionByType (
-  IN VOID *FfsFile,
-  IN UINT8 Type,
-  OUT VOID **Section
+  IN VOID   *FfsFile,
+  IN UINT8  Type,
+  OUT VOID  **Section
   )
 {
-  EFI_STATUS Status;
-  UINTN Key;
-  VOID*                      SectionStart;
+  EFI_STATUS                 Status;
+  UINTN                      Key;
+  VOID                       *SectionStart;
   UINTN                      TotalSectionsSize;
-  EFI_COMMON_SECTION_HEADER* NextSection;
+  EFI_COMMON_SECTION_HEADER  *NextSection;
 
-  SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
+  SectionStart      = (VOID *)((UINTN)FfsFile + FvBufGetFfsHeaderSize (FfsFile));
   TotalSectionsSize =
-    FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
-    FvBufGetFfsHeaderSize(FfsFile);
+    FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER *)FfsFile) -
+    FvBufGetFfsHeaderSize (FfsFile);
   Key = 0;
   while (TRUE) {
     Status = FvBufFindNextSection (
@@ -1276,6 +1290,7 @@ FvBufFindSectionByType (
       if (Section != NULL) {
         *Section = NextSection;
       }
+
       return EFI_SUCCESS;
     }
   }
@@ -1291,23 +1306,23 @@ FvBufFindSectionByType (
           end of the extended FV.
 
   @param Fv Firmware volume.
-  
+
  @retval EFI_SUCCESS
 **/
 EFI_STATUS
 FvBufShrinkWrap (
-  IN VOID *Fv
+  IN VOID  *Fv
   )
 {
-  EFI_STATUS Status;
-  UINTN OldSize;
-  UINT32 BlockCount;
-  UINT32 NewBlockSize = 128;
-  UINTN Key;
-  EFI_FFS_FILE_HEADER* FileIt;
-  VOID* EndOfLastFile;
+  EFI_STATUS           Status;
+  UINTN                OldSize;
+  UINT32               BlockCount;
+  UINT32               NewBlockSize = 128;
+  UINTN                Key;
+  EFI_FFS_FILE_HEADER  *FileIt;
+  VOID                 *EndOfLastFile;
 
-  EFI_FIRMWARE_VOLUME_HEADER* FvHdr;
+  EFI_FIRMWARE_VOLUME_HEADER  *FvHdr;
 
   Status = FvBufGetSize (Fv, &OldSize);
   if (EFI_ERROR (Status)) {
@@ -1322,16 +1337,16 @@ FvBufShrinkWrap (
   //
   // Locate the block map in the fv header
   //
-  FvHdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
+  FvHdr = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
 
   //
   // Find the end of the last file
   //
-  Key = 0;
-  EndOfLastFile = (UINT8*)FvHdr + FvHdr->FvLength;
+  Key           = 0;
+  EndOfLastFile = (UINT8 *)FvHdr + FvHdr->FvLength;
   while (!EFI_ERROR (FvBufFindNextFile (Fv, &Key, (VOID **)&FileIt))) {
     EndOfLastFile =
-      (VOID*)((UINT8*)FileIt + FvBufGetFfsFileSize (FileIt));
+      (VOID *)((UINT8 *)FileIt + FvBufGetFfsFileSize (FileIt));
   }
 
   //
@@ -1345,7 +1360,7 @@ FvBufShrinkWrap (
   // Adjust the block count to shrink the Fv in place.
   //
   FvHdr->BlockMap[0].NumBlocks = BlockCount;
-  FvHdr->FvLength = BlockCount * NewBlockSize;
+  FvHdr->FvLength              = BlockCount * NewBlockSize;
 
   //
   // Update the FV header checksum
@@ -1353,7 +1368,6 @@ FvBufShrinkWrap (
   FvBufChecksumHeader (Fv);
 
   return EFI_SUCCESS;
-
 }
 
 /**
@@ -1370,13 +1384,13 @@ FvBufShrinkWrap (
 **/
 EFI_STATUS
 FvBufUnifyBlockSizes (
-  IN OUT VOID *Fv,
-  IN UINTN BlockSize
+  IN OUT VOID  *Fv,
+  IN UINTN     BlockSize
   )
 {
-  EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
-  EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
-  UINT32 Size;
+  EFI_FIRMWARE_VOLUME_HEADER  *hdr = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
+  EFI_FV_BLOCK_MAP_ENTRY      *blk = hdr->BlockMap;
+  UINT32                      Size;
 
   Size = 0;
 
@@ -1384,12 +1398,13 @@ FvBufUnifyBlockSizes (
   // Scan through the block map list, performing error checking, and adding
   // up the total Fv size.
   //
-  while( blk->Length != 0 ||
-         blk->NumBlocks != 0
-       ) {
+  while ( blk->Length != 0 ||
+          blk->NumBlocks != 0
+          )
+  {
     Size = Size + (blk->Length * blk->NumBlocks);
     blk++;
-    if ((UINT8*)blk > ((UINT8*)hdr + hdr->HeaderLength)) {
+    if ((UINT8 *)blk > ((UINT8 *)hdr + hdr->HeaderLength)) {
       return EFI_VOLUME_CORRUPTED;
     }
   }
@@ -1413,7 +1428,7 @@ FvBufUnifyBlockSizes (
   //
   // Write out the single block map entry.
   //
-  hdr->BlockMap[0].Length = (UINT32)BlockSize;
+  hdr->BlockMap[0].Length    = (UINT32)BlockSize;
   hdr->BlockMap[0].NumBlocks = Size / (UINT32)BlockSize;
 
   return EFI_SUCCESS;
@@ -1430,8 +1445,8 @@ FvBufUnifyBlockSizes (
 STATIC
 UINT16
 FvBufCalculateSum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
+  IN UINT16  *Buffer,
+  IN UINTN   Size
   )
 {
   UINTN   Index;
@@ -1443,10 +1458,10 @@ FvBufCalculateSum16 (
   // Perform the word sum for buffer
   //
   for (Index = 0; Index < Size; Index++) {
-    Sum = (UINT16) (Sum + Buffer[Index]);
+    Sum = (UINT16)(Sum + Buffer[Index]);
   }
 
-  return (UINT16) Sum;
+  return (UINT16)Sum;
 }
 
 /**
@@ -1460,8 +1475,8 @@ FvBufCalculateSum16 (
 STATIC
 UINT16
 FvBufCalculateChecksum16 (
-  IN UINT16       *Buffer,
-  IN UINTN        Size
+  IN UINT16  *Buffer,
+  IN UINTN   Size
   )
 {
   return (UINT16)(0x10000 - FvBufCalculateSum16 (Buffer, Size));
@@ -1472,7 +1487,7 @@ FvBufCalculateChecksum16 (
 
   @param Buffer      Pointer to buffer containing byte data of component.
   @param Size        Size of the buffer
- 
+
   @return The 8 bit checksum value needed.
 **/
 STATIC
@@ -1482,8 +1497,8 @@ FvBufCalculateSum8 (
   IN UINTN  Size
   )
 {
-  UINTN   Index;
-  UINT8   Sum;
+  UINTN  Index;
+  UINT8  Sum;
 
   Sum = 0;
 
@@ -1491,7 +1506,7 @@ FvBufCalculateSum8 (
   // Perform the byte sum for buffer
   //
   for (Index = 0; Index < Size; Index++) {
-    Sum = (UINT8) (Sum + Buffer[Index]);
+    Sum = (UINT8)(Sum + Buffer[Index]);
   }
 
   return Sum;
@@ -1508,11 +1523,9 @@ FvBufCalculateSum8 (
 STATIC
 UINT8
 FvBufCalculateChecksum8 (
-  IN UINT8        *Buffer,
-  IN UINTN        Size
+  IN UINT8  *Buffer,
+  IN UINTN  Size
   )
 {
   return (UINT8)(0x100 - FvBufCalculateSum8 (Buffer, Size));
 }
-
-
diff --git a/BaseTools/Source/C/Common/FvLib.c b/BaseTools/Source/C/Common/FvLib.c
index 37631f470f2a..f617ebdfde6d 100644
--- a/BaseTools/Source/C/Common/FvLib.c
+++ b/BaseTools/Source/C/Common/FvLib.c
@@ -16,8 +16,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 // Module global variables
 //
-EFI_FIRMWARE_VOLUME_HEADER  *mFvHeader  = NULL;
-UINT32                      mFvLength   = 0;
+EFI_FIRMWARE_VOLUME_HEADER  *mFvHeader = NULL;
+UINT32                      mFvLength  = 0;
 
 //
 // External function implementations
@@ -35,8 +35,8 @@ UINT32                      mFvLength   = 0;
 **/
 EFI_STATUS
 InitializeFvLib (
-  IN VOID                         *Fv,
-  IN UINT32                       FvLength
+  IN VOID    *Fv,
+  IN UINT32  FvLength
   )
 {
   //
@@ -46,7 +46,7 @@ InitializeFvLib (
     return EFI_INVALID_PARAMETER;
   }
 
-  mFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) Fv;
+  mFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)Fv;
   mFvLength = FvLength;
 
   return EFI_SUCCESS;
@@ -71,9 +71,10 @@ GetFvHeader (
   //
   // Verify library has been initialized.
   //
-  if (mFvHeader == NULL || mFvLength == 0) {
+  if ((mFvHeader == NULL) || (mFvLength == 0)) {
     return EFI_ABORTED;
   }
+
   //
   // Verify input arguments
   //
@@ -100,8 +101,8 @@ GetFvHeader (
 **/
 EFI_STATUS
 GetNextFile (
-  IN EFI_FFS_FILE_HEADER          *CurrentFile,
-  OUT EFI_FFS_FILE_HEADER         **NextFile
+  IN EFI_FFS_FILE_HEADER   *CurrentFile,
+  OUT EFI_FFS_FILE_HEADER  **NextFile
   )
 {
   EFI_STATUS  Status;
@@ -109,15 +110,17 @@ GetNextFile (
   //
   // Verify library has been initialized.
   //
-  if (mFvHeader == NULL || mFvLength == 0) {
+  if ((mFvHeader == NULL) || (mFvLength == 0)) {
     return EFI_ABORTED;
   }
+
   //
   // Verify input arguments
   //
   if (NextFile == NULL) {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // Verify FV header
   //
@@ -125,11 +128,12 @@ GetNextFile (
   if (EFI_ERROR (Status)) {
     return EFI_ABORTED;
   }
+
   //
   // Get first file
   //
   if (CurrentFile == NULL) {
-    CurrentFile = (EFI_FFS_FILE_HEADER *) ((UINTN) mFvHeader + mFvHeader->HeaderLength);
+    CurrentFile = (EFI_FFS_FILE_HEADER *)((UINTN)mFvHeader + mFvHeader->HeaderLength);
 
     //
     // Verify file is valid
@@ -145,7 +149,7 @@ GetNextFile (
       //
       // Verify file is in this FV.
       //
-      if ((UINTN) CurrentFile + GetFfsFileLength(CurrentFile) > (UINTN) mFvHeader + mFvLength) {
+      if ((UINTN)CurrentFile + GetFfsFileLength (CurrentFile) > (UINTN)mFvHeader + mFvLength) {
         *NextFile = NULL;
         return EFI_SUCCESS;
       }
@@ -154,28 +158,33 @@ GetNextFile (
       return EFI_SUCCESS;
     }
   }
+
   //
   // Verify current file is in range
   //
-  if (((UINTN) CurrentFile < (UINTN) mFvHeader + mFvHeader->HeaderLength) ||
-      ((UINTN) CurrentFile + GetFfsFileLength(CurrentFile) > (UINTN) mFvHeader + mFvLength)
-     ) {
+  if (((UINTN)CurrentFile < (UINTN)mFvHeader + mFvHeader->HeaderLength) ||
+      ((UINTN)CurrentFile + GetFfsFileLength (CurrentFile) > (UINTN)mFvHeader + mFvLength)
+      )
+  {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // Get next file, compensate for 8 byte alignment if necessary.
   //
-  *NextFile = (EFI_FFS_FILE_HEADER *) ((((UINTN) CurrentFile - (UINTN) mFvHeader + GetFfsFileLength(CurrentFile) + 0x07) & (~(UINTN) 7)) + (UINT8 *) mFvHeader);
+  *NextFile = (EFI_FFS_FILE_HEADER *)((((UINTN)CurrentFile - (UINTN)mFvHeader + GetFfsFileLength (CurrentFile) + 0x07) & (~(UINTN)7)) + (UINT8 *)mFvHeader);
 
   //
   // Verify file is in this FV.
   //
-  if (((UINTN) *NextFile + GetFfsHeaderLength(*NextFile) >= (UINTN) mFvHeader + mFvLength) ||
-      ((UINTN) *NextFile + GetFfsFileLength (*NextFile) > (UINTN) mFvHeader + mFvLength)
-     ) {
+  if (((UINTN)*NextFile + GetFfsHeaderLength (*NextFile) >= (UINTN)mFvHeader + mFvLength) ||
+      ((UINTN)*NextFile + GetFfsFileLength (*NextFile) > (UINTN)mFvHeader + mFvLength)
+      )
+  {
     *NextFile = NULL;
     return EFI_SUCCESS;
   }
+
   //
   // Verify file is valid
   //
@@ -203,26 +212,28 @@ GetNextFile (
 **/
 EFI_STATUS
 GetFileByName (
-  IN EFI_GUID                     *FileName,
-  OUT EFI_FFS_FILE_HEADER         **File
+  IN EFI_GUID              *FileName,
+  OUT EFI_FFS_FILE_HEADER  **File
   )
 {
-  EFI_FFS_FILE_HEADER *CurrentFile;
-  EFI_STATUS          Status;
-  CHAR8               FileGuidString[80];
+  EFI_FFS_FILE_HEADER  *CurrentFile;
+  EFI_STATUS           Status;
+  CHAR8                FileGuidString[80];
 
   //
   // Verify library has been initialized.
   //
-  if (mFvHeader == NULL || mFvLength == 0) {
+  if ((mFvHeader == NULL) || (mFvLength == 0)) {
     return EFI_ABORTED;
   }
+
   //
   // Verify input parameters
   //
-  if (FileName == NULL || File == NULL) {
+  if ((FileName == NULL) || (File == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // File Guid String Name
   //
@@ -234,6 +245,7 @@ GetFileByName (
   if (EFI_ERROR (Status)) {
     return EFI_ABORTED;
   }
+
   //
   // Get the first file
   //
@@ -242,6 +254,7 @@ GetFileByName (
     Error (NULL, 0, 0003, "error parsing FV image", "FFS file with Guid %s can't be found", FileGuidString);
     return EFI_ABORTED;
   }
+
   //
   // Loop as long as we have a valid file
   //
@@ -257,6 +270,7 @@ GetFileByName (
       return EFI_ABORTED;
     }
   }
+
   //
   // File not found in this FV.
   //
@@ -279,27 +293,29 @@ GetFileByName (
 **/
 EFI_STATUS
 GetFileByType (
-  IN EFI_FV_FILETYPE              FileType,
-  IN UINTN                        Instance,
-  OUT EFI_FFS_FILE_HEADER         **File
+  IN EFI_FV_FILETYPE       FileType,
+  IN UINTN                 Instance,
+  OUT EFI_FFS_FILE_HEADER  **File
   )
 {
-  EFI_FFS_FILE_HEADER *CurrentFile;
-  EFI_STATUS          Status;
-  UINTN               FileCount;
+  EFI_FFS_FILE_HEADER  *CurrentFile;
+  EFI_STATUS           Status;
+  UINTN                FileCount;
 
   //
   // Verify library has been initialized.
   //
-  if (mFvHeader == NULL || mFvLength == 0) {
+  if ((mFvHeader == NULL) || (mFvLength == 0)) {
     return EFI_ABORTED;
   }
+
   //
   // Verify input parameters
   //
   if (File == NULL) {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // Verify FV header
   //
@@ -307,6 +323,7 @@ GetFileByType (
   if (EFI_ERROR (Status)) {
     return EFI_ABORTED;
   }
+
   //
   // Initialize the number of matching files found.
   //
@@ -320,11 +337,12 @@ GetFileByType (
     Error (NULL, 0, 0003, "error parsing FV image", "FFS file with FileType 0x%x can't be found", FileType);
     return EFI_ABORTED;
   }
+
   //
   // Loop as long as we have a valid file
   //
   while (CurrentFile) {
-    if (FileType == EFI_FV_FILETYPE_ALL || CurrentFile->Type == FileType) {
+    if ((FileType == EFI_FV_FILETYPE_ALL) || (CurrentFile->Type == FileType)) {
       FileCount++;
     }
 
@@ -363,12 +381,12 @@ GetFileByType (
 **/
 EFI_STATUS
 SearchSectionByType (
-  IN EFI_FILE_SECTION_POINTER  FirstSection,
-  IN UINT8                     *SearchEnd,
-  IN EFI_SECTION_TYPE          SectionType,
-  IN OUT UINTN                 *StartIndex,
-  IN UINTN                     Instance,
-  OUT EFI_FILE_SECTION_POINTER *Section
+  IN EFI_FILE_SECTION_POINTER   FirstSection,
+  IN UINT8                      *SearchEnd,
+  IN EFI_SECTION_TYPE           SectionType,
+  IN OUT UINTN                  *StartIndex,
+  IN UINTN                      Instance,
+  OUT EFI_FILE_SECTION_POINTER  *Section
   )
 {
   EFI_FILE_SECTION_POINTER  CurrentSection;
@@ -378,11 +396,11 @@ SearchSectionByType (
   UINT16                    GuidSecAttr;
   UINT16                    GuidDataOffset;
 
-  GuidSecAttr = 0;
+  GuidSecAttr    = 0;
   GuidDataOffset = 0;
   CurrentSection = FirstSection;
 
-  while ((UINTN) CurrentSection.CommonHeader < (UINTN) SearchEnd) {
+  while ((UINTN)CurrentSection.CommonHeader < (UINTN)SearchEnd) {
     if (CurrentSection.CommonHeader->Type == SectionType) {
       (*StartIndex)++;
     }
@@ -391,6 +409,7 @@ SearchSectionByType (
       *Section = CurrentSection;
       return EFI_SUCCESS;
     }
+
     //
     // If the requesting section is not GUID-defined and
     // we find a GUID-defined section that doesn't need
@@ -398,36 +417,39 @@ SearchSectionByType (
     // section inside the GUID-defined section.
     //
     if (CurrentSection.CommonHeader->Type == EFI_SECTION_GUID_DEFINED) {
-      if (GetLength(CurrentSection.CommonHeader->Size) == 0xffffff) {
-        GuidSecAttr = CurrentSection.GuidDefinedSection2->Attributes;
+      if (GetLength (CurrentSection.CommonHeader->Size) == 0xffffff) {
+        GuidSecAttr    = CurrentSection.GuidDefinedSection2->Attributes;
         GuidDataOffset = CurrentSection.GuidDefinedSection2->DataOffset;
       } else {
-        GuidSecAttr = CurrentSection.GuidDefinedSection->Attributes;
+        GuidSecAttr    = CurrentSection.GuidDefinedSection->Attributes;
         GuidDataOffset = CurrentSection.GuidDefinedSection->DataOffset;
       }
     }
-    if (SectionType != EFI_SECTION_GUID_DEFINED &&
-        CurrentSection.CommonHeader->Type == EFI_SECTION_GUID_DEFINED &&
-        !(GuidSecAttr & EFI_GUIDED_SECTION_PROCESSING_REQUIRED)) {
+
+    if ((SectionType != EFI_SECTION_GUID_DEFINED) &&
+        (CurrentSection.CommonHeader->Type == EFI_SECTION_GUID_DEFINED) &&
+        !(GuidSecAttr & EFI_GUIDED_SECTION_PROCESSING_REQUIRED))
+    {
       InnerSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *)
-        ((UINTN) CurrentSection.CommonHeader + GuidDataOffset);
-      SectionSize = GetSectionFileLength(CurrentSection.CommonHeader);
-      Status = SearchSectionByType (
-                 InnerSection,
-                 (UINT8 *) ((UINTN) CurrentSection.CommonHeader + SectionSize),
-                 SectionType,
-                 StartIndex,
-                 Instance,
-                 Section
-                 );
+                                  ((UINTN)CurrentSection.CommonHeader + GuidDataOffset);
+      SectionSize = GetSectionFileLength (CurrentSection.CommonHeader);
+      Status      = SearchSectionByType (
+                      InnerSection,
+                      (UINT8 *)((UINTN)CurrentSection.CommonHeader + SectionSize),
+                      SectionType,
+                      StartIndex,
+                      Instance,
+                      Section
+                      );
       if (!EFI_ERROR (Status)) {
         return EFI_SUCCESS;
       }
     }
+
     //
     // Find next section (including compensating for alignment issues.
     //
-    CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((((UINTN) CurrentSection.CommonHeader) + GetSectionFileLength(CurrentSection.CommonHeader) + 0x03) & (~(UINTN) 3));
+    CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *)((((UINTN)CurrentSection.CommonHeader) + GetSectionFileLength (CurrentSection.CommonHeader) + 0x03) & (~(UINTN)3));
   }
 
   return EFI_NOT_FOUND;
@@ -451,10 +473,10 @@ SearchSectionByType (
 **/
 EFI_STATUS
 GetSectionByType (
-  IN EFI_FFS_FILE_HEADER          *File,
-  IN EFI_SECTION_TYPE             SectionType,
-  IN UINTN                        Instance,
-  OUT EFI_FILE_SECTION_POINTER    *Section
+  IN EFI_FFS_FILE_HEADER        *File,
+  IN EFI_SECTION_TYPE           SectionType,
+  IN UINTN                      Instance,
+  OUT EFI_FILE_SECTION_POINTER  *Section
   )
 {
   EFI_FILE_SECTION_POINTER  CurrentSection;
@@ -464,9 +486,10 @@ GetSectionByType (
   //
   // Verify input parameters
   //
-  if (File == NULL || Instance == 0) {
+  if ((File == NULL) || (Instance == 0)) {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // Verify FFS header
   //
@@ -475,6 +498,7 @@ GetSectionByType (
     Error (NULL, 0, 0006, "invalid FFS file", NULL);
     return EFI_ABORTED;
   }
+
   //
   // Initialize the number of matching sections found.
   //
@@ -483,14 +507,14 @@ GetSectionByType (
   //
   // Get the first section
   //
-  CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) File + GetFfsHeaderLength(File));
+  CurrentSection.CommonHeader = (EFI_COMMON_SECTION_HEADER *)((UINTN)File + GetFfsHeaderLength (File));
 
   //
   // Depth-first manner to find section file.
   //
   Status = SearchSectionByType (
              CurrentSection,
-             (UINT8 *) ((UINTN) File + GetFfsFileLength (File)),
+             (UINT8 *)((UINTN)File + GetFfsFileLength (File)),
              SectionType,
              &SectionCount,
              Instance,
@@ -524,7 +548,7 @@ GetSectionByType (
 **/
 EFI_STATUS
 VerifyFv (
-  IN EFI_FIRMWARE_VOLUME_HEADER   *FvHeader
+  IN EFI_FIRMWARE_VOLUME_HEADER  *FvHeader
   )
 {
   UINT16  Checksum;
@@ -540,10 +564,11 @@ VerifyFv (
     Error (NULL, 0, 0006, "invalid FV header signature", NULL);
     return EFI_VOLUME_CORRUPTED;
   }
+
   //
   // Verify header checksum
   //
-  Checksum = CalculateSum16 ((UINT16 *) FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
+  Checksum = CalculateSum16 ((UINT16 *)FvHeader, FvHeader->HeaderLength / sizeof (UINT16));
 
   if (Checksum != 0) {
     Error (NULL, 0, 0006, "invalid FV header checksum", NULL);
@@ -568,22 +593,23 @@ VerifyFfsFile (
   IN EFI_FFS_FILE_HEADER  *FfsHeader
   )
 {
-  BOOLEAN             ErasePolarity;
-  EFI_STATUS          Status;
-  EFI_FFS_FILE_HEADER2 BlankHeader;
-  UINT8               Checksum;
-  UINT32              FileLength;
-  UINT8               SavedChecksum;
-  UINT8               SavedState;
-  UINT8               FileGuidString[80];
-  UINT32              FfsHeaderSize;
+  BOOLEAN               ErasePolarity;
+  EFI_STATUS            Status;
+  EFI_FFS_FILE_HEADER2  BlankHeader;
+  UINT8                 Checksum;
+  UINT32                FileLength;
+  UINT8                 SavedChecksum;
+  UINT8                 SavedState;
+  UINT8                 FileGuidString[80];
+  UINT32                FfsHeaderSize;
 
   //
   // Verify library has been initialized.
   //
-  if (mFvHeader == NULL || mFvLength == 0) {
+  if ((mFvHeader == NULL) || (mFvLength == 0)) {
     return EFI_ABORTED;
   }
+
   //
   // Verify FV header
   //
@@ -591,6 +617,7 @@ VerifyFfsFile (
   if (EFI_ERROR (Status)) {
     return EFI_ABORTED;
   }
+
   //
   // Get the erase polarity.
   //
@@ -599,7 +626,7 @@ VerifyFfsFile (
     return EFI_ABORTED;
   }
 
-  FfsHeaderSize = GetFfsHeaderLength(FfsHeader);
+  FfsHeaderSize = GetFfsHeaderLength (FfsHeader);
   //
   // Check if we have free space
   //
@@ -612,6 +639,7 @@ VerifyFfsFile (
   if (memcmp (&BlankHeader, FfsHeader, FfsHeaderSize) == 0) {
     return EFI_NOT_FOUND;
   }
+
   //
   // Convert the GUID to a string so we can at least report which file
   // if we find an error.
@@ -620,17 +648,18 @@ VerifyFfsFile (
   //
   // Verify file header checksum
   //
-  SavedState = FfsHeader->State;
-  FfsHeader->State = 0;
-  SavedChecksum = FfsHeader->IntegrityCheck.Checksum.File;
+  SavedState                              = FfsHeader->State;
+  FfsHeader->State                        = 0;
+  SavedChecksum                           = FfsHeader->IntegrityCheck.Checksum.File;
   FfsHeader->IntegrityCheck.Checksum.File = 0;
-  Checksum = CalculateSum8 ((UINT8 *) FfsHeader, FfsHeaderSize);
-  FfsHeader->State = SavedState;
+  Checksum                                = CalculateSum8 ((UINT8 *)FfsHeader, FfsHeaderSize);
+  FfsHeader->State                        = SavedState;
   FfsHeader->IntegrityCheck.Checksum.File = SavedChecksum;
   if (Checksum != 0) {
     Error (NULL, 0, 0006, "invalid FFS file header checksum", "Ffs file with Guid %s", FileGuidString);
     return EFI_ABORTED;
   }
+
   //
   // Verify file checksum
   //
@@ -638,9 +667,9 @@ VerifyFfsFile (
     //
     // Verify file data checksum
     //
-    FileLength          = GetFfsFileLength (FfsHeader);
-    Checksum            = CalculateSum8 ((UINT8 *) ((UINT8 *)FfsHeader + FfsHeaderSize), FileLength - FfsHeaderSize);
-    Checksum            = Checksum + FfsHeader->IntegrityCheck.Checksum.File;
+    FileLength = GetFfsFileLength (FfsHeader);
+    Checksum   = CalculateSum8 ((UINT8 *)((UINT8 *)FfsHeader + FfsHeaderSize), FileLength - FfsHeaderSize);
+    Checksum   = Checksum + FfsHeader->IntegrityCheck.Checksum.File;
     if (Checksum != 0) {
       Error (NULL, 0, 0006, "invalid FFS file checksum", "Ffs file with Guid %s", FileGuidString);
       return EFI_ABORTED;
@@ -660,31 +689,35 @@ VerifyFfsFile (
 }
 
 UINT32
-GetFfsHeaderLength(
-   IN EFI_FFS_FILE_HEADER *FfsHeader
-   )
+GetFfsHeaderLength (
+  IN EFI_FFS_FILE_HEADER  *FfsHeader
+  )
 {
   if (FfsHeader == NULL) {
     return 0;
   }
+
   if (FfsHeader->Attributes & FFS_ATTRIB_LARGE_FILE) {
-    return sizeof(EFI_FFS_FILE_HEADER2);
+    return sizeof (EFI_FFS_FILE_HEADER2);
   }
-  return sizeof(EFI_FFS_FILE_HEADER);
+
+  return sizeof (EFI_FFS_FILE_HEADER);
 }
 
 UINT32
-GetSectionHeaderLength(
-   IN EFI_COMMON_SECTION_HEADER *SectionHeader
-   )
+GetSectionHeaderLength (
+  IN EFI_COMMON_SECTION_HEADER  *SectionHeader
+  )
 {
   if (SectionHeader == NULL) {
     return 0;
   }
-  if (GetLength(SectionHeader->Size) == 0xffffff) {
-    return sizeof(EFI_COMMON_SECTION_HEADER2);
+
+  if (GetLength (SectionHeader->Size) == 0xffffff) {
+    return sizeof (EFI_COMMON_SECTION_HEADER2);
   }
-  return sizeof(EFI_COMMON_SECTION_HEADER);
+
+  return sizeof (EFI_COMMON_SECTION_HEADER);
 }
 
 /**
@@ -696,32 +729,36 @@ GetSectionHeaderLength(
 **/
 UINT32
 GetFfsFileLength (
-  EFI_FFS_FILE_HEADER *FfsHeader
+  EFI_FFS_FILE_HEADER  *FfsHeader
   )
 {
   if (FfsHeader == NULL) {
     return 0;
   }
+
   if (FfsHeader->Attributes & FFS_ATTRIB_LARGE_FILE) {
-    return (UINT32) ((EFI_FFS_FILE_HEADER2 *)FfsHeader)->ExtendedSize;
+    return (UINT32)((EFI_FFS_FILE_HEADER2 *)FfsHeader)->ExtendedSize;
   } else {
-    return GetLength(FfsHeader->Size);
+    return GetLength (FfsHeader->Size);
   }
 }
 
 UINT32
 GetSectionFileLength (
-  EFI_COMMON_SECTION_HEADER *SectionHeader
+  EFI_COMMON_SECTION_HEADER  *SectionHeader
   )
 {
-  UINT32 Length;
+  UINT32  Length;
+
   if (SectionHeader == NULL) {
     return 0;
   }
-  Length = GetLength(SectionHeader->Size);
+
+  Length = GetLength (SectionHeader->Size);
   if (Length == 0xffffff) {
     Length = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
   }
+
   return Length;
 }
 
@@ -734,7 +771,7 @@ GetSectionFileLength (
 **/
 UINT32
 GetLength (
-  UINT8     *ThreeByteLength
+  UINT8  *ThreeByteLength
   )
 {
   UINT32  Length;
@@ -743,8 +780,8 @@ GetLength (
     return 0;
   }
 
-  Length  = *((UINT32 *) ThreeByteLength);
-  Length  = Length & 0x00FFFFFF;
+  Length = *((UINT32 *)ThreeByteLength);
+  Length = Length & 0x00FFFFFF;
 
   return Length;
 }
@@ -761,7 +798,7 @@ GetLength (
 **/
 EFI_STATUS
 GetErasePolarity (
-  OUT BOOLEAN   *ErasePolarity
+  OUT BOOLEAN  *ErasePolarity
   )
 {
   EFI_STATUS  Status;
@@ -769,9 +806,10 @@ GetErasePolarity (
   //
   // Verify library has been initialized.
   //
-  if (mFvHeader == NULL || mFvLength == 0) {
+  if ((mFvHeader == NULL) || (mFvLength == 0)) {
     return EFI_ABORTED;
   }
+
   //
   // Verify FV header
   //
@@ -779,6 +817,7 @@ GetErasePolarity (
   if (EFI_ERROR (Status)) {
     return EFI_ABORTED;
   }
+
   //
   // Verify input parameters.
   //
@@ -810,13 +849,13 @@ GetFileState (
   IN EFI_FFS_FILE_HEADER  *FfsHeader
   )
 {
-  UINT8 FileState;
-  UINT8 HighestBit;
+  UINT8  FileState;
+  UINT8  HighestBit;
 
   FileState = FfsHeader->State;
 
   if (ErasePolarity) {
-    FileState = (UINT8)~FileState;
+    FileState = (UINT8) ~FileState;
   }
 
   HighestBit = 0x80;
diff --git a/BaseTools/Source/C/Common/MemoryFile.c b/BaseTools/Source/C/Common/MemoryFile.c
index 47481326833e..a96aa7ab8d44 100644
--- a/BaseTools/Source/C/Common/MemoryFile.c
+++ b/BaseTools/Source/C/Common/MemoryFile.c
@@ -13,14 +13,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "CommonLib.h"
 #include "MemoryFile.h"
 
-
 //
 // Local (static) function prototypes
 //
 STATIC
 VOID
 CheckMemoryFileState (
-  IN EFI_HANDLE InputMemoryFile
+  IN EFI_HANDLE  InputMemoryFile
   );
 
 //
@@ -39,14 +38,14 @@ CheckMemoryFileState (
 **/
 EFI_STATUS
 GetMemoryFile (
-  IN CHAR8       *InputFileName,
-  OUT EFI_HANDLE *OutputMemoryFile
+  IN CHAR8        *InputFileName,
+  OUT EFI_HANDLE  *OutputMemoryFile
   )
 {
-  EFI_STATUS  Status;
-  CHAR8       *InputFileImage;
-  UINT32      BytesRead;
-  MEMORY_FILE *NewMemoryFile;
+  EFI_STATUS   Status;
+  CHAR8        *InputFileImage;
+  UINT32       BytesRead;
+  MEMORY_FILE  *NewMemoryFile;
 
   Status = GetFileImage (InputFileName, &InputFileImage, &BytesRead);
   if (EFI_ERROR (Status)) {
@@ -59,9 +58,9 @@ GetMemoryFile (
     return EFI_OUT_OF_RESOURCES;
   }
 
-  NewMemoryFile->FileImage           = InputFileImage;
-  NewMemoryFile->CurrentFilePointer  = InputFileImage;
-  NewMemoryFile->Eof                 = InputFileImage + BytesRead;
+  NewMemoryFile->FileImage          = InputFileImage;
+  NewMemoryFile->CurrentFilePointer = InputFileImage;
+  NewMemoryFile->Eof                = InputFileImage + BytesRead;
 
   *OutputMemoryFile = (EFI_HANDLE)NewMemoryFile;
 
@@ -79,14 +78,14 @@ GetMemoryFile (
 **/
 EFI_STATUS
 FreeMemoryFile (
-  IN EFI_HANDLE InputMemoryFile
+  IN EFI_HANDLE  InputMemoryFile
   )
 {
-  MEMORY_FILE *MemoryFile;
+  MEMORY_FILE  *MemoryFile;
 
   CheckMemoryFileState (InputMemoryFile);
 
-  MemoryFile = (MEMORY_FILE*)InputMemoryFile;
+  MemoryFile = (MEMORY_FILE *)InputMemoryFile;
 
   free (MemoryFile->FileImage);
 
@@ -115,21 +114,21 @@ FreeMemoryFile (
 **/
 CHAR8 *
 ReadMemoryFileLine (
-  IN EFI_HANDLE     InputMemoryFile
+  IN EFI_HANDLE  InputMemoryFile
   )
 {
-  CHAR8       *EndOfLine;
-  UINTN       CharsToCopy;
-  MEMORY_FILE *InputFile;
-  UINTN       BytesToEof;
-  CHAR8       *OutputString;
+  CHAR8        *EndOfLine;
+  UINTN        CharsToCopy;
+  MEMORY_FILE  *InputFile;
+  UINTN        BytesToEof;
+  CHAR8        *OutputString;
 
   //
   // Verify input parameters are not null
   //
   CheckMemoryFileState (InputMemoryFile);
 
-  InputFile = (MEMORY_FILE*)InputMemoryFile;
+  InputFile = (MEMORY_FILE *)InputMemoryFile;
 
   //
   // Check for end of file condition
@@ -177,13 +176,9 @@ ReadMemoryFileLine (
   // Add the null termination over the 0x0D
   //
   if (OutputString[CharsToCopy - 1] == '\r') {
-
     OutputString[CharsToCopy - 1] = '\0';
-
   } else {
-
     OutputString[CharsToCopy] = '\0';
-
   }
 
   //
@@ -193,6 +188,7 @@ ReadMemoryFileLine (
   if (InputFile->CurrentFilePointer > InputFile->Eof) {
     InputFile->CurrentFilePointer = InputFile->Eof;
   }
+
   CheckMemoryFileState (InputMemoryFile);
 
   //
@@ -201,18 +197,17 @@ ReadMemoryFileLine (
   return OutputString;
 }
 
-
 STATIC
 VOID
 CheckMemoryFileState (
-  IN EFI_HANDLE InputMemoryFile
+  IN EFI_HANDLE  InputMemoryFile
   )
 {
-  MEMORY_FILE *MemoryFile;
+  MEMORY_FILE  *MemoryFile;
 
   assert (InputMemoryFile != NULL);
 
-  MemoryFile = (MEMORY_FILE*)InputMemoryFile;
+  MemoryFile = (MEMORY_FILE *)InputMemoryFile;
 
   assert (MemoryFile->FileImage != NULL);
   assert (MemoryFile->CurrentFilePointer != NULL);
@@ -221,5 +216,3 @@ CheckMemoryFileState (
   assert (MemoryFile->CurrentFilePointer >= MemoryFile->FileImage);
   assert (MemoryFile->CurrentFilePointer <= MemoryFile->Eof);
 }
-
-
diff --git a/BaseTools/Source/C/Common/MyAlloc.c b/BaseTools/Source/C/Common/MyAlloc.c
index 17ff5cfbbd3e..2677f76c55cb 100644
--- a/BaseTools/Source/C/Common/MyAlloc.c
+++ b/BaseTools/Source/C/Common/MyAlloc.c
@@ -12,10 +12,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 // Get back to original alloc/free calls.
 //
-#undef malloc
-#undef calloc
-#undef realloc
-#undef free
+  #undef malloc
+  #undef calloc
+  #undef realloc
+  #undef free
 //
 // Start of allocation list.
 //
@@ -24,8 +24,8 @@ STATIC MY_ALLOC_STRUCT  *MyAllocData = NULL;
 //
 //
 //
-STATIC UINT32           MyAllocHeadMagik  = MYALLOC_HEAD_MAGIK;
-STATIC UINT32           MyAllocTailMagik  = MYALLOC_TAIL_MAGIK;
+STATIC UINT32  MyAllocHeadMagik = MYALLOC_HEAD_MAGIK;
+STATIC UINT32  MyAllocTailMagik = MYALLOC_TAIL_MAGIK;
 
 /**
   Check for corruptions in the allocated memory chain.  If a corruption
@@ -40,12 +40,12 @@ STATIC UINT32           MyAllocTailMagik  = MYALLOC_TAIL_MAGIK;
 **/
 VOID
 MyCheck (
-  BOOLEAN      Final,
-  UINT8        File[],
-  UINTN        Line
+  BOOLEAN  Final,
+  UINT8    File[],
+  UINTN    Line
   )
 {
-  MY_ALLOC_STRUCT *Tmp;
+  MY_ALLOC_STRUCT  *Tmp;
 
   //
   // Check parameters.
@@ -84,34 +84,38 @@ MyCheck (
 
     exit (1);
   }
+
   //
   // Check structure contents.
   //
   for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {
-    if (memcmp(Tmp->Buffer, &MyAllocHeadMagik, sizeof MyAllocHeadMagik) ||
-        memcmp(&Tmp->Buffer[Tmp->Size + sizeof(UINT32)], &MyAllocTailMagik, sizeof MyAllocTailMagik)) {
+    if (memcmp (Tmp->Buffer, &MyAllocHeadMagik, sizeof MyAllocHeadMagik) ||
+        memcmp (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)], &MyAllocTailMagik, sizeof MyAllocTailMagik))
+    {
       break;
     }
   }
+
   //
   // If Tmp is not NULL, the structure is corrupt.
   //
   if (Tmp != NULL) {
     printf (
-      "\nMyCheck(Final=%u, File=%s, Line=%u)""\nStructure corrupted!"
-      "\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
+      "\nMyCheck(Final=%u, File=%s, Line=%u)" "\nStructure corrupted!"
+                                              "\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
       Final,
       File,
       (unsigned)Line,
       Tmp->File,
-      (unsigned) Tmp->Line,
-      (unsigned) Tmp->Size,
-      (unsigned) *(UINT32 *) (Tmp->Buffer),
-      (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
+      (unsigned)Tmp->Line,
+      (unsigned)Tmp->Size,
+      (unsigned)*(UINT32 *)(Tmp->Buffer),
+      (unsigned)*(UINT32 *)(&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
       );
 
     exit (1);
   }
+
   //
   // If Final is TRUE, display the state of the structure chain.
   //
@@ -129,10 +133,10 @@ MyCheck (
         printf (
           "File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
           Tmp->File,
-          (unsigned) Tmp->Line,
-          (unsigned) Tmp->Size,
-          (unsigned) *(UINT32 *) (Tmp->Buffer),
-          (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
+          (unsigned)Tmp->Line,
+          (unsigned)Tmp->Size,
+          (unsigned)*(UINT32 *)(Tmp->Buffer),
+          (unsigned)*(UINT32 *)(&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
           );
       }
     }
@@ -154,13 +158,13 @@ MyCheck (
 **/
 VOID *
 MyAlloc (
-  UINTN      Size,
-  UINT8 File[],
-  UINTN      Line
+  UINTN  Size,
+  UINT8  File[],
+  UINTN  Line
   )
 {
-  MY_ALLOC_STRUCT *Tmp;
-  UINTN           Len;
+  MY_ALLOC_STRUCT  *Tmp;
+  UINTN            Len;
 
   //
   // Check for invalid parameters.
@@ -176,7 +180,7 @@ MyAlloc (
     exit (1);
   }
 
-  if (Size == 0 || Line == 0) {
+  if ((Size == 0) || (Line == 0)) {
     printf (
       "\nMyAlloc(Size=%u, File=%s, Line=%u)"
       "\nInvalid parameter(s).\n",
@@ -200,6 +204,7 @@ MyAlloc (
 
     exit (1);
   }
+
   //
   // Check the allocation list for corruption.
   //
@@ -224,14 +229,15 @@ MyAlloc (
 
     exit (1);
   }
+
   //
   // Fill in the new entry.
   //
-  Tmp->File = ((UINT8 *) Tmp) + sizeof (MY_ALLOC_STRUCT);
+  Tmp->File = ((UINT8 *)Tmp) + sizeof (MY_ALLOC_STRUCT);
   strcpy ((CHAR8 *)Tmp->File, (CHAR8 *)File);
   Tmp->Line   = Line;
   Tmp->Size   = Size;
-  Tmp->Buffer = (UINT8 *) (((UINTN) Tmp + Len + 9) &~7);
+  Tmp->Buffer = (UINT8 *)(((UINTN)Tmp + Len + 9) &~7);
 
   memcpy (Tmp->Buffer, &MyAllocHeadMagik, sizeof MyAllocHeadMagik);
 
@@ -241,8 +247,8 @@ MyAlloc (
     sizeof MyAllocTailMagik
     );
 
-  Tmp->Next   = MyAllocData;
-  Tmp->Cksum  = (UINTN) Tmp + (UINTN) (Tmp->Next) + Tmp->Line + Tmp->Size + (UINTN) (Tmp->File) + (UINTN) (Tmp->Buffer);
+  Tmp->Next  = MyAllocData;
+  Tmp->Cksum = (UINTN)Tmp + (UINTN)(Tmp->Next) + Tmp->Line + Tmp->Size + (UINTN)(Tmp->File) + (UINTN)(Tmp->Buffer);
 
   MyAllocData = Tmp;
 
@@ -263,14 +269,14 @@ MyAlloc (
 **/
 VOID *
 MyRealloc (
-  VOID       *Ptr,
-  UINTN      Size,
-  UINT8 File[],
-  UINTN      Line
+  VOID   *Ptr,
+  UINTN  Size,
+  UINT8  File[],
+  UINTN  Line
   )
 {
-  MY_ALLOC_STRUCT *Tmp;
-  VOID            *Buffer;
+  MY_ALLOC_STRUCT  *Tmp;
+  VOID             *Buffer;
 
   //
   // Check for invalid parameter(s).
@@ -287,7 +293,7 @@ MyRealloc (
     exit (1);
   }
 
-  if (Size == 0 || Line == 0) {
+  if ((Size == 0) || (Line == 0)) {
     printf (
       "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
       "\nInvalid parameter(s).\n",
@@ -312,6 +318,7 @@ MyRealloc (
 
     exit (1);
   }
+
   //
   // Find existing buffer in allocation list.
   //
@@ -320,7 +327,7 @@ MyRealloc (
   } else if (&MyAllocData->Buffer[sizeof (UINT32)] == Ptr) {
     Tmp = MyAllocData;
   } else {
-    for (Tmp = MyAllocData;; Tmp = Tmp->Next) {
+    for (Tmp = MyAllocData; ; Tmp = Tmp->Next) {
       if (Tmp->Next == NULL) {
         printf (
           "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
@@ -337,12 +344,13 @@ MyRealloc (
       Tmp = Tmp->Next;
     }
   }
+
   //
   // Allocate new buffer, copy old data, free old buffer.
   //
   Buffer = MyAlloc (Size, File, Line);
 
-  if (Buffer != NULL && Tmp != NULL) {
+  if ((Buffer != NULL) && (Tmp != NULL)) {
     memcpy (
       Buffer,
       &Tmp->Buffer[sizeof (UINT32)],
@@ -366,13 +374,13 @@ MyRealloc (
 **/
 VOID
 MyFree (
-  VOID       *Ptr,
-  UINT8 File[],
-  UINTN      Line
+  VOID   *Ptr,
+  UINT8  File[],
+  UINTN  Line
   )
 {
-  MY_ALLOC_STRUCT *Tmp;
-  MY_ALLOC_STRUCT *Tmp2;
+  MY_ALLOC_STRUCT  *Tmp;
+  MY_ALLOC_STRUCT  *Tmp2;
 
   //
   // Check for invalid parameter(s).
@@ -411,12 +419,14 @@ MyFree (
 
     exit (1);
   }
+
   //
   // Freeing NULL is always valid.
   //
   if (Ptr == NULL) {
-    return ;
+    return;
   }
+
   //
   // Fail if nothing is allocated.
   //
@@ -431,6 +441,7 @@ MyFree (
 
     exit (1);
   }
+
   //
   // Check for corrupted allocation list.
   //
@@ -449,7 +460,7 @@ MyFree (
     //
     // Walk list looking for matching item.
     //
-    for (Tmp = MyAllocData;; Tmp = Tmp->Next) {
+    for (Tmp = MyAllocData; ; Tmp = Tmp->Next) {
       //
       // Fail if end of list is reached.
       //
@@ -464,6 +475,7 @@ MyFree (
 
         exit (1);
       }
+
       //
       // Leave loop when match is found.
       //
@@ -471,6 +483,7 @@ MyFree (
         break;
       }
     }
+
     //
     // Unlink item from list.
     //
@@ -478,6 +491,7 @@ MyFree (
     Tmp->Next = Tmp->Next->Next;
     Tmp       = Tmp2;
   }
+
   //
   // Release item.
   //
diff --git a/BaseTools/Source/C/Common/OsPath.c b/BaseTools/Source/C/Common/OsPath.c
index 9901f686c98f..8e7614e24f5c 100644
--- a/BaseTools/Source/C/Common/OsPath.c
+++ b/BaseTools/Source/C/Common/OsPath.c
@@ -17,9 +17,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 
 #if 0
-  //
-  // BUGBUG: Not fully implemented yet.
-  //
+//
+// BUGBUG: Not fully implemented yet.
+//
 
 /**
   This function returns the directory path which contains the particular path.
@@ -38,17 +38,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @return NULL if error
 **/
-CHAR8*
+CHAR8 *
 OsPathDirName (
-  IN CHAR8    *FilePath
+  IN CHAR8  *FilePath
   )
 
 {
-  CHAR8 *Return;
-  CHAR8 *Pos;
-  CHAR8 Char;
-  UINTN Length;
-  INTN  Offset;
+  CHAR8  *Return;
+  CHAR8  *Pos;
+  CHAR8  Char;
+  UINTN  Length;
+  INTN   Offset;
 
   Length = strlen (FilePath);
 
@@ -60,9 +60,10 @@ OsPathDirName (
   // Check for the root directory case
   //
   if (
-    (Length == 3 && isalpha (FilePath[0]) && (strcmp(FilePath + 1, ":\\") == 0)) ||
-    (strcmp(FilePath, "/") == 0)
-    ) {
+      ((Length == 3) && isalpha (FilePath[0]) && (strcmp (FilePath + 1, ":\\") == 0)) ||
+      (strcmp (FilePath, "/") == 0)
+      )
+  {
     return NULL;
   }
 
@@ -70,7 +71,7 @@ OsPathDirName (
   // If the path ends with a path separator, then just append ".."
   //
   Char = FilePath[Length - 1];
-  if (Char == '/' || Char == '\\') {
+  if ((Char == '/') || (Char == '\\')) {
     return OsPathJoin (FilePath, "..");
   }
 
@@ -84,13 +85,13 @@ OsPathDirName (
     }
   }
 }
+
 #endif
 
-
 #if 0
-  //
-  // BUGBUG: Not fully implemented yet.
-  //
+//
+// BUGBUG: Not fully implemented yet.
+//
 
 /**
   This function returns the directory path which contains the particular path.
@@ -107,19 +108,19 @@ OsPathDirName (
 **/
 VOID
 OsPathNormPathInPlace (
-  IN CHAR8    *Path
+  IN CHAR8  *Path
   )
 {
-  CHAR8   *Pos;
-  INTN    Offset;
-  BOOLEAN TryAgain;
-  UINTN   Length;
-  UINTN   Remaining;
-  UINTN   SubLength;
+  CHAR8    *Pos;
+  INTN     Offset;
+  BOOLEAN  TryAgain;
+  UINTN    Length;
+  UINTN    Remaining;
+  UINTN    SubLength;
 
   do {
     TryAgain = FALSE;
-    Length = strlen (Path);
+    Length   = strlen (Path);
 
     for (Offset = 0; Offset < Length; Offset++) {
       Remaining = Length - Offset;
@@ -131,7 +132,8 @@ OsPathNormPathInPlace (
           (Remaining >= 2) &&
           ((Offset > 0) || (Path[0] != '\\')) &&
           IsDirSep (Path[Offset]) && IsDirSep (Path[Offset + 1])
-         ) {
+          )
+      {
         memmove (&Path[Offset], &Path[Offset + 1], Remaining);
         TryAgain = TRUE;
         break;
@@ -141,8 +143,9 @@ OsPathNormPathInPlace (
       // Collapse '/./' -> '/'
       //
       if ((Remaining >= 3) && IsDirSep (Path[Offset]) &&
-           (Path[Offset + 1] == '.') && IsDirSep (Path[Offset + 2])
-         ) {
+          (Path[Offset + 1] == '.') && IsDirSep (Path[Offset + 2])
+          )
+      {
         memmove (&Path[Offset], &Path[Offset + 1], Remaining);
         TryAgain = TRUE;
         break;
@@ -152,9 +155,7 @@ OsPathNormPathInPlace (
       // Collapse 'a/../b' -> 'b'
       //
       // BUGBUG: Not implemented yet
-
     }
-
   } while (TryAgain);
 
   Return = CloneString (FilePath);
@@ -168,9 +169,10 @@ OsPathNormPathInPlace (
   // Check for the root directory case
   //
   if (
-    (Length == 3 && isalpha (Return[0]) && (strcmp(Return + 1, ":\\") == 0)) ||
-    (strcmp(Return, "/") == 0)
-    ) {
+      ((Length == 3) && isalpha (Return[0]) && (strcmp (Return + 1, ":\\") == 0)) ||
+      (strcmp (Return, "/") == 0)
+      )
+  {
     free (Return);
     return NULL;
   }
@@ -185,6 +187,7 @@ OsPathNormPathInPlace (
     }
   }
 }
+
 #endif
 
 /**
@@ -202,16 +205,16 @@ OsPathNormPathInPlace (
 
   @return A CHAR8* string, which must be freed by the caller
 **/
-CHAR8*
+CHAR8 *
 OsPathPeerFilePath (
-  IN CHAR8    *OldPath,
-  IN CHAR8    *Peer
+  IN CHAR8  *OldPath,
+  IN CHAR8  *Peer
   )
 {
-  CHAR8 *Result;
-  INTN    Offset;
+  CHAR8  *Result;
+  INTN   Offset;
 
-  Result = (CHAR8 *) malloc (strlen (OldPath) + strlen (Peer) + 1);
+  Result = (CHAR8 *)malloc (strlen (OldPath) + strlen (Peer) + 1);
   if (Result == NULL) {
     return NULL;
   }
@@ -247,10 +250,11 @@ OsPathPeerFilePath (
 **/
 BOOLEAN
 OsPathExists (
-  IN CHAR8    *InputFileName
+  IN CHAR8  *InputFileName
   )
 {
-  FILE    *InputFile;
+  FILE  *InputFile;
+
   InputFile = fopen (LongFilePath (InputFileName), "rb");
   if (InputFile == NULL) {
     return FALSE;
@@ -259,6 +263,3 @@ OsPathExists (
     return TRUE;
   }
 }
-
-
-
diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
index e1e9a97e7bf6..566a22fe9036 100644
--- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
+++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
@@ -17,16 +17,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "ParseGuidedSectionTools.h"
 #include "StringFuncs.h"
 
-
 //
 // Local types / structures
 //
 
 typedef struct _GUID_SEC_TOOL_ENTRY {
-  EFI_GUID   Guid;
-  CHAR8*     Name;
-  CHAR8*     Path;
-  struct _GUID_SEC_TOOL_ENTRY *Next;
+  EFI_GUID                       Guid;
+  CHAR8                          *Name;
+  CHAR8                          *Path;
+  struct _GUID_SEC_TOOL_ENTRY    *Next;
 } GUID_SEC_TOOL_ENTRY;
 
 //
@@ -47,12 +46,12 @@ typedef struct _GUID_SEC_TOOL_ENTRY {
 **/
 EFI_HANDLE
 ParseGuidedSectionToolsFile (
-  IN CHAR8    *InputFile
+  IN CHAR8  *InputFile
   )
 {
-  EFI_STATUS Status;
-  EFI_HANDLE MemoryFile;
-  EFI_HANDLE ParsedGuidedSectionTools;
+  EFI_STATUS  Status;
+  EFI_HANDLE  MemoryFile;
+  EFI_HANDLE  ParsedGuidedSectionTools;
 
   Status = GetMemoryFile (InputFile, &MemoryFile);
   if (EFI_ERROR (Status)) {
@@ -80,16 +79,16 @@ ParseGuidedSectionToolsFile (
 **/
 EFI_HANDLE
 ParseGuidedSectionToolsMemoryFile (
-  IN EFI_HANDLE    InputFile
+  IN EFI_HANDLE  InputFile
   )
 {
-  EFI_STATUS  Status;
-  CHAR8       *NextLine;
-  STRING_LIST *Tool;
-  EFI_GUID    Guid;
-  GUID_SEC_TOOL_ENTRY *FirstGuidTool;
-  GUID_SEC_TOOL_ENTRY *LastGuidTool;
-  GUID_SEC_TOOL_ENTRY *NewGuidTool;
+  EFI_STATUS           Status;
+  CHAR8                *NextLine;
+  STRING_LIST          *Tool;
+  EFI_GUID             Guid;
+  GUID_SEC_TOOL_ENTRY  *FirstGuidTool;
+  GUID_SEC_TOOL_ENTRY  *LastGuidTool;
+  GUID_SEC_TOOL_ENTRY  *NewGuidTool;
 
   FirstGuidTool = NULL;
   LastGuidTool  = NULL;
@@ -114,14 +113,15 @@ ParseGuidedSectionToolsMemoryFile (
     Tool = SplitStringByWhitespace (NextLine);
     if ((Tool != NULL) &&
         (Tool->Count == 3)
-       ) {
+        )
+    {
       Status = StringToGuid (Tool->Strings[0], &Guid);
       if (!EFI_ERROR (Status)) {
         NewGuidTool = malloc (sizeof (GUID_SEC_TOOL_ENTRY));
         if (NewGuidTool != NULL) {
           memcpy (&(NewGuidTool->Guid), &Guid, sizeof (Guid));
-          NewGuidTool->Name = CloneString(Tool->Strings[1]);
-          NewGuidTool->Path = CloneString(Tool->Strings[2]);
+          NewGuidTool->Name = CloneString (Tool->Strings[1]);
+          NewGuidTool->Path = CloneString (Tool->Strings[2]);
           NewGuidTool->Next = NULL;
 
           if (FirstGuidTool == NULL) {
@@ -129,6 +129,7 @@ ParseGuidedSectionToolsMemoryFile (
           } else {
             LastGuidTool->Next = NewGuidTool;
           }
+
           LastGuidTool = NewGuidTool;
         }
       }
@@ -137,6 +138,7 @@ ParseGuidedSectionToolsMemoryFile (
     if (Tool != NULL) {
       FreeStringList (Tool);
     }
+
     free (NextLine);
   }
 
@@ -154,15 +156,15 @@ ParseGuidedSectionToolsMemoryFile (
   @retval Non-NULL The tool to use to access the section contents.  (The caller
              must free the memory associated with this string.)
 **/
-CHAR8*
+CHAR8 *
 LookupGuidedSectionToolPath (
-  IN EFI_HANDLE ParsedGuidedSectionToolsHandle,
-  IN EFI_GUID   *SectionGuid
+  IN EFI_HANDLE  ParsedGuidedSectionToolsHandle,
+  IN EFI_GUID    *SectionGuid
   )
 {
-  GUID_SEC_TOOL_ENTRY *GuidTool;
+  GUID_SEC_TOOL_ENTRY  *GuidTool;
 
-  GuidTool = (GUID_SEC_TOOL_ENTRY*)ParsedGuidedSectionToolsHandle;
+  GuidTool = (GUID_SEC_TOOL_ENTRY *)ParsedGuidedSectionToolsHandle;
   if (GuidTool == NULL) {
     return NULL;
   }
@@ -175,5 +177,3 @@ LookupGuidedSectionToolPath (
 
   return NULL;
 }
-
-
diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c
index 63da3d647cb7..c8b4c07c3b05 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -31,15 +31,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 CHAR8 *
 ReadLine (
-  IN MEMORY_FILE    *InputFile,
-  IN OUT CHAR8      *InputBuffer,
-  IN UINTN          MaxLength
+  IN MEMORY_FILE  *InputFile,
+  IN OUT CHAR8    *InputBuffer,
+  IN UINTN        MaxLength
   )
 
 {
-  CHAR8 *CharPtr;
-  CHAR8 *EndOfLine;
-  UINTN CharsToCopy;
+  CHAR8  *CharPtr;
+  CHAR8  *EndOfLine;
+  UINTN  CharsToCopy;
 
   //
   // Verify input parameters are not null
@@ -55,6 +55,7 @@ ReadLine (
   if (InputFile->CurrentFilePointer >= InputFile->Eof) {
     return NULL;
   }
+
   //
   // Find the next newline char
   //
@@ -79,6 +80,7 @@ ReadLine (
     //
     CharsToCopy = EndOfLine - InputFile->CurrentFilePointer;
   }
+
   //
   // If the end of line is too big for the current buffer, set it to the max
   // size of the buffer (leaving room for the \0.
@@ -86,6 +88,7 @@ ReadLine (
   if (CharsToCopy > MaxLength - 1) {
     CharsToCopy = MaxLength - 1;
   }
+
   //
   // Copy the line.
   //
@@ -95,13 +98,9 @@ ReadLine (
   // Add the null termination over the 0x0D
   //
   if (InputBuffer[CharsToCopy - 1] == '\r') {
-
     InputBuffer[CharsToCopy - 1] = '\0';
-
   } else {
-
     InputBuffer[CharsToCopy] = '\0';
-
   }
 
   //
@@ -116,6 +115,7 @@ ReadLine (
   if (CharPtr != 0) {
     CharPtr[0] = 0;
   }
+
   //
   // Return the string
   //
@@ -134,12 +134,12 @@ ReadLine (
 **/
 BOOLEAN
 FindSection (
-  IN MEMORY_FILE    *InputFile,
-  IN CHAR8          *Section
+  IN MEMORY_FILE  *InputFile,
+  IN CHAR8        *Section
   )
 {
-  CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
-  CHAR8 *CurrentToken;
+  CHAR8  InputBuffer[MAX_LONG_FILE_PATH];
+  CHAR8  *CurrentToken;
 
   //
   // Verify input is not NULL
@@ -192,39 +192,41 @@ FindSection (
 **/
 EFI_STATUS
 FindToken (
-  IN MEMORY_FILE    *InputFile,
-  IN CHAR8          *Section,
-  IN CHAR8          *Token,
-  IN UINTN          Instance,
-  OUT CHAR8         *Value
+  IN MEMORY_FILE  *InputFile,
+  IN CHAR8        *Section,
+  IN CHAR8        *Token,
+  IN UINTN        Instance,
+  OUT CHAR8       *Value
   )
 {
-  CHAR8   InputBuffer[MAX_LONG_FILE_PATH];
-  CHAR8   *CurrentToken;
-  CHAR8   *Delimiter;
-  BOOLEAN ParseError;
-  BOOLEAN ReadError;
-  UINTN   Occurrence;
+  CHAR8    InputBuffer[MAX_LONG_FILE_PATH];
+  CHAR8    *CurrentToken;
+  CHAR8    *Delimiter;
+  BOOLEAN  ParseError;
+  BOOLEAN  ReadError;
+  UINTN    Occurrence;
 
   //
   // Check input parameters
   //
-  if (InputFile->FileImage == NULL ||
-      InputFile->Eof == NULL ||
-      InputFile->CurrentFilePointer == NULL ||
-      Section == NULL ||
-      strlen (Section) == 0 ||
-      Token == NULL ||
-      strlen (Token) == 0 ||
-      Value == NULL
-      ) {
+  if ((InputFile->FileImage == NULL) ||
+      (InputFile->Eof == NULL) ||
+      (InputFile->CurrentFilePointer == NULL) ||
+      (Section == NULL) ||
+      (strlen (Section) == 0) ||
+      (Token == NULL) ||
+      (strlen (Token) == 0) ||
+      (Value == NULL)
+      )
+  {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // Initialize error codes
   //
-  ParseError  = FALSE;
-  ReadError   = FALSE;
+  ParseError = FALSE;
+  ReadError  = FALSE;
 
   //
   // Initialize our instance counter for the search token
@@ -246,6 +248,7 @@ FindToken (
         ReadError = TRUE;
         break;
       }
+
       //
       // Get the first non-whitespace string
       //
@@ -255,19 +258,21 @@ FindToken (
       }
 
       CurrentToken = strtok (InputBuffer, " \t\n");
-      if (CurrentToken == NULL || Delimiter == NULL) {
+      if ((CurrentToken == NULL) || (Delimiter == NULL)) {
         //
         // Whitespace line found (or comment) so continue
         //
         CurrentToken = InputBuffer;
         continue;
       }
+
       //
       // Make sure we have not reached the end of the current section
       //
       if (CurrentToken[0] == '[') {
         break;
       }
+
       //
       // Compare the current token with the desired token
       //
@@ -295,6 +300,7 @@ FindToken (
             while (*CurrentToken == ' ' || *CurrentToken == '\t') {
               CurrentToken++;
             }
+
             //
             // Copy the current token to the output value
             //
@@ -302,9 +308,10 @@ FindToken (
             //
             // Strip trailing white space
             //
-            while (strlen(Value) > 0 && (*(Value + strlen(Value) - 1) == ' ' || *(Value + strlen(Value) - 1) == '\t')) {
-              *(Value + strlen(Value) - 1) = 0;
+            while (strlen (Value) > 0 && (*(Value + strlen (Value) - 1) == ' ' || *(Value + strlen (Value) - 1) == '\t')) {
+              *(Value + strlen (Value) - 1) = 0;
             }
+
             return EFI_SUCCESS;
           }
         } else {
@@ -315,13 +322,14 @@ FindToken (
         }
       }
     } while (
-      !ParseError &&
-      !ReadError &&
-      InputFile->CurrentFilePointer < InputFile->Eof &&
-      CurrentToken[0] != '[' &&
-      Occurrence <= Instance
-    );
+             !ParseError &&
+             !ReadError &&
+             InputFile->CurrentFilePointer < InputFile->Eof &&
+             CurrentToken[0] != '[' &&
+             Occurrence <= Instance
+             );
   }
+
   //
   // Distinguish between read errors and INF file format errors.
   //
@@ -353,27 +361,29 @@ StringToGuid (
   OUT EFI_GUID  *GuidBuffer
   )
 {
-  INT32 Index;
-  int   Data1;
-  int   Data2;
-  int   Data3;
-  int   Data4[8];
+  INT32  Index;
+  int    Data1;
+  int    Data2;
+  int    Data3;
+  int    Data4[8];
 
-  if (AsciiGuidBuffer == NULL || GuidBuffer == NULL) {
+  if ((AsciiGuidBuffer == NULL) || (GuidBuffer == NULL)) {
     return EFI_INVALID_PARAMETER;
   }
+
   //
   // Check Guid Format strictly xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
   //
-  for (Index = 0; AsciiGuidBuffer[Index] != '\0' && Index < 37; Index ++) {
-    if (Index == 8 || Index == 13 || Index == 18 || Index == 23) {
+  for (Index = 0; AsciiGuidBuffer[Index] != '\0' && Index < 37; Index++) {
+    if ((Index == 8) || (Index == 13) || (Index == 18) || (Index == 23)) {
       if (AsciiGuidBuffer[Index] != '-') {
         break;
       }
     } else {
       if (((AsciiGuidBuffer[Index] >= '0') && (AsciiGuidBuffer[Index] <= '9')) ||
-         ((AsciiGuidBuffer[Index] >= 'a') && (AsciiGuidBuffer[Index] <= 'f')) ||
-         ((AsciiGuidBuffer[Index] >= 'A') && (AsciiGuidBuffer[Index] <= 'F'))) {
+          ((AsciiGuidBuffer[Index] >= 'a') && (AsciiGuidBuffer[Index] <= 'f')) ||
+          ((AsciiGuidBuffer[Index] >= 'A') && (AsciiGuidBuffer[Index] <= 'F')))
+      {
         continue;
       } else {
         break;
@@ -381,7 +391,7 @@ StringToGuid (
     }
   }
 
-  if (Index < 36 || AsciiGuidBuffer[36] != '\0') {
+  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;
   }
@@ -412,20 +422,21 @@ StringToGuid (
     Error (NULL, 0, 1003, "Invalid option value", "Incorrect GUID \"%s\"\n  Correct Format \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"", AsciiGuidBuffer);
     return EFI_ABORTED;
   }
+
   //
   // Copy the data into our GUID.
   //
-  GuidBuffer->Data1     = (UINT32) Data1;
-  GuidBuffer->Data2     = (UINT16) Data2;
-  GuidBuffer->Data3     = (UINT16) Data3;
-  GuidBuffer->Data4[0]  = (UINT8) Data4[0];
-  GuidBuffer->Data4[1]  = (UINT8) Data4[1];
-  GuidBuffer->Data4[2]  = (UINT8) Data4[2];
-  GuidBuffer->Data4[3]  = (UINT8) Data4[3];
-  GuidBuffer->Data4[4]  = (UINT8) Data4[4];
-  GuidBuffer->Data4[5]  = (UINT8) Data4[5];
-  GuidBuffer->Data4[6]  = (UINT8) Data4[6];
-  GuidBuffer->Data4[7]  = (UINT8) Data4[7];
+  GuidBuffer->Data1    = (UINT32)Data1;
+  GuidBuffer->Data2    = (UINT16)Data2;
+  GuidBuffer->Data3    = (UINT16)Data3;
+  GuidBuffer->Data4[0] = (UINT8)Data4[0];
+  GuidBuffer->Data4[1] = (UINT8)Data4[1];
+  GuidBuffer->Data4[2] = (UINT8)Data4[2];
+  GuidBuffer->Data4[3] = (UINT8)Data4[3];
+  GuidBuffer->Data4[4] = (UINT8)Data4[4];
+  GuidBuffer->Data4[5] = (UINT8)Data4[5];
+  GuidBuffer->Data4[6] = (UINT8)Data4[6];
+  GuidBuffer->Data4[7] = (UINT8)Data4[7];
 
   return EFI_SUCCESS;
 }
@@ -463,11 +474,12 @@ AsciiStringToUint64 (
   //
   // Check input parameter
   //
-  if (AsciiString == NULL || ReturnValue == NULL || strlen(AsciiString) > 0xFF) {
+  if ((AsciiString == NULL) || (ReturnValue == NULL) || (strlen (AsciiString) > 0xFF)) {
     return EFI_INVALID_PARAMETER;
   }
+
   while (AsciiString[Index] == ' ') {
-    Index ++;
+    Index++;
   }
 
   //
@@ -477,34 +489,37 @@ AsciiStringToUint64 (
   //
   // Skip first two chars only if the string starts with '0x' or '0X'
   //
-  if (AsciiString[Index] == '0' && (AsciiString[Index + 1] == 'x' || AsciiString[Index + 1] == 'X')) {
-    IsHex = TRUE;
+  if ((AsciiString[Index] == '0') && ((AsciiString[Index + 1] == 'x') || (AsciiString[Index + 1] == 'X'))) {
+    IsHex  = TRUE;
     Index += 2;
   }
+
   if (IsHex) {
     //
     // Convert the hex string.
     //
-    for (; AsciiString[Index] != '\0'; Index++) {
+    for ( ; AsciiString[Index] != '\0'; Index++) {
       CurrentChar = AsciiString[Index];
       if (CurrentChar == ' ') {
         break;
       }
+
       //
       // Verify Hex string
       //
       if (isxdigit ((int)CurrentChar) == 0) {
         return EFI_ABORTED;
       }
+
       //
       // Add hex value
       //
       Value *= 16;
-      if (CurrentChar >= '0' && CurrentChar <= '9') {
+      if ((CurrentChar >= '0') && (CurrentChar <= '9')) {
         Value += CurrentChar - '0';
-      } else if (CurrentChar >= 'a' && CurrentChar <= 'f') {
+      } else if ((CurrentChar >= 'a') && (CurrentChar <= 'f')) {
         Value += CurrentChar - 'a' + 10;
-      } else if (CurrentChar >= 'A' && CurrentChar <= 'F') {
+      } else if ((CurrentChar >= 'A') && (CurrentChar <= 'F')) {
         Value += CurrentChar - 'A' + 10;
       }
     }
@@ -514,21 +529,23 @@ AsciiStringToUint64 (
     //
     // Convert dec string is a number
     //
-    for (; Index < strlen (AsciiString); Index++) {
+    for ( ; Index < strlen (AsciiString); Index++) {
       CurrentChar = AsciiString[Index];
       if (CurrentChar == ' ') {
         break;
       }
+
       //
       // Verify Dec string
       //
       if (isdigit ((int)CurrentChar) == 0) {
         return EFI_ABORTED;
       }
+
       //
       // Add dec value
       //
-      Value = Value * 10;
+      Value  = Value * 10;
       Value += CurrentChar - '0';
     }
 
@@ -554,7 +571,7 @@ ReadLineInStream (
   IN OUT CHAR8  *InputBuffer
   )
 {
-  CHAR8 *CharPtr;
+  CHAR8  *CharPtr;
 
   //
   // Verify input parameters are not null
@@ -568,6 +585,7 @@ ReadLineInStream (
   if (fgets (InputBuffer, MAX_LONG_FILE_PATH, InputFile) == NULL) {
     return NULL;
   }
+
   //
   // Strip any comments
   //
@@ -580,6 +598,7 @@ ReadLineInStream (
   if (CharPtr != 0) {
     CharPtr[0] = 0;
   }
+
   //
   // Return the string
   //
@@ -599,12 +618,12 @@ ReadLineInStream (
 **/
 BOOLEAN
 FindSectionInStream (
-  IN FILE       *InputFile,
-  IN CHAR8      *Section
+  IN FILE   *InputFile,
+  IN CHAR8  *Section
   )
 {
-  CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
-  CHAR8 *CurrentToken;
+  CHAR8  InputBuffer[MAX_LONG_FILE_PATH];
+  CHAR8  *CurrentToken;
 
   //
   // Verify input is not NULL
@@ -618,6 +637,7 @@ FindSectionInStream (
   if (fseek (InputFile, 0, SEEK_SET) != 0) {
     return FALSE;
   }
+
   //
   // Read lines until the section is found
   //
diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/C/Common/PcdValueCommon.c
index 591a7787828c..d93924132e68 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.c
+++ b/BaseTools/Source/C/Common/PcdValueCommon.c
@@ -23,13 +23,13 @@ typedef enum {
 } PCD_DATA_TYPE;
 
 typedef struct {
-  CHAR8          *SkuName;
-  CHAR8          *DefaultValueName;
-  CHAR8          *TokenSpaceGuidName;
-  CHAR8          *TokenName;
-  CHAR8          *DataType;
-  CHAR8          *Value;
-  PCD_DATA_TYPE  PcdDataType;
+  CHAR8            *SkuName;
+  CHAR8            *DefaultValueName;
+  CHAR8            *TokenSpaceGuidName;
+  CHAR8            *TokenName;
+  CHAR8            *DataType;
+  CHAR8            *Value;
+  PCD_DATA_TYPE    PcdDataType;
 } PCD_ENTRY;
 
 PCD_ENTRY  *PcdList;
@@ -61,43 +61,45 @@ RecordToken (
   if (Token == NULL) {
     return;
   }
+
   memcpy (Token, &FileBuffer[TokenStart], TokenEnd - TokenStart);
   Token[TokenEnd - TokenStart] = 0;
   switch (TokenIndex) {
-  case 0:
-    PcdList[PcdIndex].SkuName = Token;
-    break;
-  case 1:
-    PcdList[PcdIndex].DefaultValueName = Token;
-    break;
-  case 2:
-    PcdList[PcdIndex].TokenSpaceGuidName = Token;
-    break;
-  case 3:
-    PcdList[PcdIndex].TokenName = Token;
-    break;
-  case 4:
-    PcdList[PcdIndex].DataType = Token;
-    if (strcmp (Token, "BOOLEAN") == 0) {
-      PcdList[PcdIndex].PcdDataType = PcdDataTypeBoolean;
-    } else if (strcmp (Token, "UINT8") == 0) {
-      PcdList[PcdIndex].PcdDataType = PcdDataTypeUint8;
-    } else if (strcmp (Token, "UINT16") == 0) {
-      PcdList[PcdIndex].PcdDataType = PcdDataTypeUint16;
-    } else if (strcmp (Token, "UINT32") == 0) {
-      PcdList[PcdIndex].PcdDataType = PcdDataTypeUint32;
-    } else if (strcmp (Token, "UINT64") == 0) {
-      PcdList[PcdIndex].PcdDataType = PcdDataTypeUint64;
-    } else {
-      PcdList[PcdIndex].PcdDataType = PcdDataTypePointer;
-    }
-    break;
-  case 5:
-    PcdList[PcdIndex].Value = Token;
-    break;
-  default:
-    free (Token);
-    break;
+    case 0:
+      PcdList[PcdIndex].SkuName = Token;
+      break;
+    case 1:
+      PcdList[PcdIndex].DefaultValueName = Token;
+      break;
+    case 2:
+      PcdList[PcdIndex].TokenSpaceGuidName = Token;
+      break;
+    case 3:
+      PcdList[PcdIndex].TokenName = Token;
+      break;
+    case 4:
+      PcdList[PcdIndex].DataType = Token;
+      if (strcmp (Token, "BOOLEAN") == 0) {
+        PcdList[PcdIndex].PcdDataType = PcdDataTypeBoolean;
+      } else if (strcmp (Token, "UINT8") == 0) {
+        PcdList[PcdIndex].PcdDataType = PcdDataTypeUint8;
+      } else if (strcmp (Token, "UINT16") == 0) {
+        PcdList[PcdIndex].PcdDataType = PcdDataTypeUint16;
+      } else if (strcmp (Token, "UINT32") == 0) {
+        PcdList[PcdIndex].PcdDataType = PcdDataTypeUint32;
+      } else if (strcmp (Token, "UINT64") == 0) {
+        PcdList[PcdIndex].PcdDataType = PcdDataTypeUint64;
+      } else {
+        PcdList[PcdIndex].PcdDataType = PcdDataTypePointer;
+      }
+
+      break;
+    case 5:
+      PcdList[PcdIndex].Value = Token;
+      break;
+    default:
+      free (Token);
+      break;
   }
 }
 
@@ -125,24 +127,31 @@ LookupPcdIndex (
   if (SkuName == NULL) {
     SkuName = "DEFAULT";
   }
+
   if (DefaultValueName == NULL) {
     DefaultValueName = "DEFAULT";
   }
+
   for (Index = 0; Index < PcdListLength; Index++) {
-    if (strcmp(PcdList[Index].TokenSpaceGuidName, TokenSpaceGuidName) != 0) {
+    if (strcmp (PcdList[Index].TokenSpaceGuidName, TokenSpaceGuidName) != 0) {
       continue;
     }
-    if (strcmp(PcdList[Index].TokenName, TokenName) != 0) {
+
+    if (strcmp (PcdList[Index].TokenName, TokenName) != 0) {
       continue;
     }
-    if (strcmp(PcdList[Index].SkuName, SkuName) != 0) {
+
+    if (strcmp (PcdList[Index].SkuName, SkuName) != 0) {
       continue;
     }
-    if (strcmp(PcdList[Index].DefaultValueName, DefaultValueName) != 0) {
+
+    if (strcmp (PcdList[Index].DefaultValueName, DefaultValueName) != 0) {
       continue;
     }
+
     return Index;
   }
+
   return -1;
 }
 
@@ -172,21 +181,23 @@ __PcdGet (
     fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
     exit (EXIT_FAILURE);
   }
+
   switch (PcdList[Index].PcdDataType) {
-  case PcdDataTypeBoolean:
-  case PcdDataTypeUint8:
-  case PcdDataTypeUint16:
-  case PcdDataTypeUint32:
-    return (UINT64)strtoul(PcdList[Index].Value, &End, 16);
-    break;
-  case PcdDataTypeUint64:
-    return (UINT64)strtoul(PcdList[Index].Value, &End, 16);
-    break;
-  case PcdDataTypePointer:
-    fprintf (stderr, "PCD %s.%s.%s.%s is structure.  Use PcdGetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
-    exit (EXIT_FAILURE);
-    break;
+    case PcdDataTypeBoolean:
+    case PcdDataTypeUint8:
+    case PcdDataTypeUint16:
+    case PcdDataTypeUint32:
+      return (UINT64)strtoul (PcdList[Index].Value, &End, 16);
+      break;
+    case PcdDataTypeUint64:
+      return (UINT64)strtoul (PcdList[Index].Value, &End, 16);
+      break;
+    case PcdDataTypePointer:
+      fprintf (stderr, "PCD %s.%s.%s.%s is structure.  Use PcdGetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+      exit (EXIT_FAILURE);
+      break;
   }
+
   return 0;
 }
 
@@ -208,39 +219,41 @@ __PcdSet (
   UINT64  Value
   )
 {
-  int    Index;
+  int  Index;
 
   Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
   if (Index < 0) {
     fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
     exit (EXIT_FAILURE);
   }
-  free(PcdList[Index].Value);
-  PcdList[Index].Value = malloc(20);
+
+  free (PcdList[Index].Value);
+  PcdList[Index].Value = malloc (20);
   switch (PcdList[Index].PcdDataType) {
-  case PcdDataTypeBoolean:
-    if (Value == 0) {
-      strcpy (PcdList[Index].Value, "0x00");
-    } else {
-      strcpy (PcdList[Index].Value, "0x01");
-    }
-    break;
-  case PcdDataTypeUint8:
-    sprintf(PcdList[Index].Value, "0x%02x", (UINT8)(Value & 0xff));
-    break;
-  case PcdDataTypeUint16:
-    sprintf(PcdList[Index].Value, "0x%04x", (UINT16)(Value & 0xffff));
-    break;
-  case PcdDataTypeUint32:
-    sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));
-    break;
-  case PcdDataTypeUint64:
-    sprintf(PcdList[Index].Value, "0x%016llx", (unsigned long long)Value);
-    break;
-  case PcdDataTypePointer:
-    fprintf (stderr, "PCD %s.%s.%s.%s is structure.  Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
-    exit (EXIT_FAILURE);
-    break;
+    case PcdDataTypeBoolean:
+      if (Value == 0) {
+        strcpy (PcdList[Index].Value, "0x00");
+      } else {
+        strcpy (PcdList[Index].Value, "0x01");
+      }
+
+      break;
+    case PcdDataTypeUint8:
+      sprintf (PcdList[Index].Value, "0x%02x", (UINT8)(Value & 0xff));
+      break;
+    case PcdDataTypeUint16:
+      sprintf (PcdList[Index].Value, "0x%04x", (UINT16)(Value & 0xffff));
+      break;
+    case PcdDataTypeUint32:
+      sprintf (PcdList[Index].Value, "0x%08x", (UINT32)(Value & 0xffffffff));
+      break;
+    case PcdDataTypeUint64:
+      sprintf (PcdList[Index].Value, "0x%016llx", (unsigned long long)Value);
+      break;
+    case PcdDataTypePointer:
+      fprintf (stderr, "PCD %s.%s.%s.%s is structure.  Use PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+      exit (EXIT_FAILURE);
+      break;
   }
 }
 
@@ -252,7 +265,7 @@ __PcdSet (
   @param TokenSpaceGuidName    TokenSpaceGuidName String
   @param TokenName             TokenName String
   @param Size                  Size of PCD value buffer
- 
+
   @return PCD value buffer
 **/
 VOID *
@@ -265,40 +278,45 @@ __PcdGetPtr (
   )
 {
   int    Index;
-  CHAR8   *Value;
-  UINT8   *Buffer;
-  CHAR8   *End;
+  CHAR8  *Value;
+  UINT8  *Buffer;
+  CHAR8  *End;
 
   Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
   if (Index < 0) {
     fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
     exit (EXIT_FAILURE);
   }
+
   switch (PcdList[Index].PcdDataType) {
-  case PcdDataTypeBoolean:
-  case PcdDataTypeUint8:
-  case PcdDataTypeUint16:
-  case PcdDataTypeUint32:
-  case PcdDataTypeUint64:
-    fprintf (stderr, "PCD %s.%s.%s.%s is a value.  Use PcdGet()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
-    exit (EXIT_FAILURE);
-    break;
-  case PcdDataTypePointer:
-    Value = &PcdList[Index].Value[1];
-    for (*Size = 0, strtoul(Value, &End, 16); Value != End; strtoul(Value, &End, 16), *Size = *Size + 1) {
-      Value = End + 1;
-    }
-    Buffer = malloc(*Size + 1);
-    if (Buffer == NULL) {
-      *Size = 0;
-      return NULL;
-    }
-    Value = &PcdList[Index].Value[1];
-    for (*Size = 0, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16); Value != End; *Size = *Size + 1, Buffer[*Size] = (UINT8) strtoul(Value, &End, 16)) {
-      Value = End + 1;
-    }
-    return Buffer;
+    case PcdDataTypeBoolean:
+    case PcdDataTypeUint8:
+    case PcdDataTypeUint16:
+    case PcdDataTypeUint32:
+    case PcdDataTypeUint64:
+      fprintf (stderr, "PCD %s.%s.%s.%s is a value.  Use PcdGet()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+      exit (EXIT_FAILURE);
+      break;
+    case PcdDataTypePointer:
+      Value = &PcdList[Index].Value[1];
+      for (*Size = 0, strtoul (Value, &End, 16); Value != End; strtoul (Value, &End, 16), *Size = *Size + 1) {
+        Value = End + 1;
+      }
+
+      Buffer = malloc (*Size + 1);
+      if (Buffer == NULL) {
+        *Size = 0;
+        return NULL;
+      }
+
+      Value = &PcdList[Index].Value[1];
+      for (*Size = 0, Buffer[*Size] = (UINT8)strtoul (Value, &End, 16); Value != End; *Size = *Size + 1, Buffer[*Size] = (UINT8)strtoul (Value, &End, 16)) {
+        Value = End + 1;
+      }
+
+      return Buffer;
   }
+
   *Size = 0;
   return 0;
 }
@@ -323,7 +341,7 @@ __PcdSetPtr (
   UINT8   *Value
   )
 {
-  int    Index;
+  int     Index;
   UINT32  ValueIndex;
 
   Index = LookupPcdIndex (SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
@@ -331,31 +349,33 @@ __PcdSetPtr (
     fprintf (stderr, "PCD %s.%s.%s.%s is not in database\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
     exit (EXIT_FAILURE);
   }
+
   switch (PcdList[Index].PcdDataType) {
-  case PcdDataTypeBoolean:
-  case PcdDataTypeUint8:
-  case PcdDataTypeUint16:
-  case PcdDataTypeUint32:
-  case PcdDataTypeUint64:
-    fprintf (stderr, "PCD %s.%s.%s.%s is a value.  Use PcdGet()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
-    exit (EXIT_FAILURE);
-    break;
-  case PcdDataTypePointer:
-    free(PcdList[Index].Value);
-    PcdList[Index].Value = malloc(Size * 5 + 3);
-    PcdList[Index].Value[0] = '{';
-    for (ValueIndex = 0; ValueIndex < Size; ValueIndex++) {
-      sprintf(&PcdList[Index].Value[1 + ValueIndex * 5], "0x%02x,", Value[ValueIndex]);
-    }
-    PcdList[Index].Value[1 + Size * 5 - 1] = '}';
-    PcdList[Index].Value[1 + Size * 5    ] = 0;
-    break;
+    case PcdDataTypeBoolean:
+    case PcdDataTypeUint8:
+    case PcdDataTypeUint16:
+    case PcdDataTypeUint32:
+    case PcdDataTypeUint64:
+      fprintf (stderr, "PCD %s.%s.%s.%s is a value.  Use PcdGet()\n", SkuName, DefaultValueName, TokenSpaceGuidName, TokenName);
+      exit (EXIT_FAILURE);
+      break;
+    case PcdDataTypePointer:
+      free (PcdList[Index].Value);
+      PcdList[Index].Value    = malloc (Size * 5 + 3);
+      PcdList[Index].Value[0] = '{';
+      for (ValueIndex = 0; ValueIndex < Size; ValueIndex++) {
+        sprintf (&PcdList[Index].Value[1 + ValueIndex * 5], "0x%02x,", Value[ValueIndex]);
+      }
+
+      PcdList[Index].Value[1 + Size * 5 - 1] = '}';
+      PcdList[Index].Value[1 + Size * 5]     = 0;
+      break;
   }
 }
 
 /**
   Read the file buffer from the input file.
- 
+
   @param InputFileName Point to the input file name.
   @param FileBuffer    Point to the input file buffer.
   @param FileSize      Size of the file buffer.
@@ -459,15 +479,17 @@ ParseFile (
       NumLines++;
     }
   }
-  PcdList = malloc((NumLines + 1) * sizeof(PcdList[0]));
+
+  PcdList = malloc ((NumLines + 1) * sizeof (PcdList[0]));
 
   for (Index = 0, TokenIndex = 0, PcdListLength = 0, TokenStart = 0; Index < FileSize; Index++) {
     if (FileBuffer[Index] == ' ') {
       continue;
     }
-    if (FileBuffer[Index] == '|' || FileBuffer[Index] == '.' || FileBuffer[Index] == '\n' || FileBuffer[Index] == '\r') {
+
+    if ((FileBuffer[Index] == '|') || (FileBuffer[Index] == '.') || (FileBuffer[Index] == '\n') || (FileBuffer[Index] == '\r')) {
       RecordToken (FileBuffer, PcdListLength, TokenIndex, TokenStart, Index);
-      if (FileBuffer[Index] == '\n' || FileBuffer[Index] == '\r') {
+      if ((FileBuffer[Index] == '\n') || (FileBuffer[Index] == '\r')) {
         if (TokenIndex != 0) {
           PcdListLength++;
           TokenIndex = 0;
@@ -475,10 +497,12 @@ ParseFile (
       } else {
         TokenIndex++;
       }
+
       TokenStart = Index + 1;
       continue;
     }
   }
+
   if (Index > TokenStart) {
     RecordToken (FileBuffer, PcdListLength, TokenIndex, TokenStart, Index);
     if (TokenIndex != 0) {
@@ -495,7 +519,7 @@ ParseFile (
 VOID
 STATIC
 WriteOutputFile (
-  CHAR8   *OutputFileName
+  CHAR8  *OutputFileName
   )
 {
   FILE    *OutputFile;
@@ -584,24 +608,26 @@ ParseArguments (
 
   while (argc > 0) {
     if ((stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--input") == 0)) {
-      if (argv[1] == NULL || argv[1][0] == '-') {
+      if ((argv[1] == NULL) || (argv[1][0] == '-')) {
         fprintf (stderr, "Invalid option value.  Input File name is missing for -i option\n");
         exit (EXIT_FAILURE);
       }
+
       *InputFileName = argv[1];
-      argc -= 2;
-      argv += 2;
+      argc          -= 2;
+      argv          += 2;
       continue;
     }
 
     if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {
-      if (argv[1] == NULL || argv[1][0] == '-') {
+      if ((argv[1] == NULL) || (argv[1][0] == '-')) {
         fprintf (stderr, "Invalid option value.  Output File name is missing for -i option\n");
         exit (EXIT_FAILURE);
       }
+
       *OutputFileName = argv[1];
-      argc -= 2;
-      argv += 2;
+      argc           -= 2;
+      argv           += 2;
       continue;
     }
 
@@ -609,8 +635,9 @@ ParseArguments (
       fprintf (stderr, "Unknown option %s\n", argv[0]);
       exit (EXIT_FAILURE);
     }
-    argc --;
-    argv ++;
+
+    argc--;
+    argv++;
   }
 
   //
@@ -646,7 +673,7 @@ PcdValueMain (
   UINT8   *FileBuffer;
   UINT32  FileSize;
 
-  InputFileName = NULL;
+  InputFileName  = NULL;
   OutputFileName = NULL;
 
   //
diff --git a/BaseTools/Source/C/Common/PeCoffLoaderEx.c b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
index 181192035ef1..5865b825357c 100644
--- a/BaseTools/Source/C/Common/PeCoffLoaderEx.c
+++ b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
@@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "CommonLib.h"
 #include "EfiUtilityMsgs.h"
 
-
 #define EXT_IMM64(Value, Address, Size, InstPos, ValPos)  \
     Value |= (((UINT64)((*(Address) >> InstPos) & (((UINT64)1 << Size) - 1))) << ValPos)
 
@@ -23,47 +22,47 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
     *(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
-
-UINT32 *RiscVHi20Fixup = NULL;
+#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
+
+UINT32  *RiscVHi20Fixup = NULL;
 
 /**
   Performs an IA-32 specific relocation fixup
@@ -77,10 +76,10 @@ UINT32 *RiscVHi20Fixup = NULL;
 **/
 RETURN_STATUS
 PeCoffLoaderRelocateIa32Image (
-  IN UINT16      *Reloc,
-  IN OUT CHAR8   *Fixup,
-  IN OUT CHAR8   **FixupData,
-  IN UINT64      Adjust
+  IN UINT16     *Reloc,
+  IN OUT CHAR8  *Fixup,
+  IN OUT CHAR8  **FixupData,
+  IN UINT64     Adjust
   )
 {
   return RETURN_UNSUPPORTED;
@@ -98,61 +97,65 @@ PeCoffLoaderRelocateIa32Image (
 **/
 RETURN_STATUS
 PeCoffLoaderRelocateRiscVImage (
-  IN UINT16      *Reloc,
-  IN OUT CHAR8   *Fixup,
-  IN OUT CHAR8   **FixupData,
-  IN UINT64      Adjust
+  IN UINT16     *Reloc,
+  IN OUT CHAR8  *Fixup,
+  IN OUT CHAR8  **FixupData,
+  IN UINT64     Adjust
   )
 {
-  UINT32 Value;
-  UINT32 Value2;
+  UINT32  Value;
+  UINT32  Value2;
 
   switch ((*Reloc) >> 12) {
-  case EFI_IMAGE_REL_BASED_RISCV_HI20:
-      RiscVHi20Fixup = (UINT32 *) Fixup;
+    case EFI_IMAGE_REL_BASED_RISCV_HI20:
+      RiscVHi20Fixup = (UINT32 *)Fixup;
       break;
 
-  case EFI_IMAGE_REL_BASED_RISCV_LOW12I:
+    case EFI_IMAGE_REL_BASED_RISCV_LOW12I:
       if (RiscVHi20Fixup != NULL) {
-        Value = (UINT32)(RV_X(*RiscVHi20Fixup, 12, 20) << 12);
-        Value2 = (UINT32)(RV_X(*(UINT32 *)Fixup, 20, 12));
+        Value  = (UINT32)(RV_X (*RiscVHi20Fixup, 12, 20) << 12);
+        Value2 = (UINT32)(RV_X (*(UINT32 *)Fixup, 20, 12));
         if (Value2 & (RISCV_IMM_REACH/2)) {
           Value2 |= ~(RISCV_IMM_REACH-1);
         }
-        Value += Value2;
-        Value += (UINT32)Adjust;
-        Value2 = RISCV_CONST_HIGH_PART (Value);
+
+        Value                    += Value2;
+        Value                    += (UINT32)Adjust;
+        Value2                    = RISCV_CONST_HIGH_PART (Value);
         *(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) | \
-                                           (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
+                                    (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
         *(UINT32 *)Fixup = (RV_X (Value, 0, 12) << 20) | \
                            (RV_X (*(UINT32 *)Fixup, 0, 20));
       }
+
       RiscVHi20Fixup = NULL;
       break;
 
-  case EFI_IMAGE_REL_BASED_RISCV_LOW12S:
+    case EFI_IMAGE_REL_BASED_RISCV_LOW12S:
       if (RiscVHi20Fixup != NULL) {
-        Value = (UINT32)(RV_X(*RiscVHi20Fixup, 12, 20) << 12);
-        Value2 = (UINT32)(RV_X(*(UINT32 *)Fixup, 7, 5) | (RV_X(*(UINT32 *)Fixup, 25, 7) << 5));
+        Value  = (UINT32)(RV_X (*RiscVHi20Fixup, 12, 20) << 12);
+        Value2 = (UINT32)(RV_X (*(UINT32 *)Fixup, 7, 5) | (RV_X (*(UINT32 *)Fixup, 25, 7) << 5));
         if (Value2 & (RISCV_IMM_REACH/2)) {
           Value2 |= ~(RISCV_IMM_REACH-1);
         }
-        Value += Value2;
-        Value += (UINT32)Adjust;
-        Value2 = RISCV_CONST_HIGH_PART (Value);
+
+        Value                    += Value2;
+        Value                    += (UINT32)Adjust;
+        Value2                    = RISCV_CONST_HIGH_PART (Value);
         *(UINT32 *)RiscVHi20Fixup = (RV_X (Value2, 12, 20) << 12) | \
-                                           (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
-        Value2 = *(UINT32 *)Fixup & 0x01fff07f;
-        Value &= RISCV_IMM_REACH - 1;
-        *(UINT32 *)Fixup = Value2 | (UINT32)(((RV_X(Value, 0, 5) << 7) | (RV_X(Value, 5, 7) << 25)));
+                                    (RV_X (*(UINT32 *)RiscVHi20Fixup, 0, 12));
+        Value2           = *(UINT32 *)Fixup & 0x01fff07f;
+        Value           &= RISCV_IMM_REACH - 1;
+        *(UINT32 *)Fixup = Value2 | (UINT32)(((RV_X (Value, 0, 5) << 7) | (RV_X (Value, 5, 7) << 25)));
       }
+
       RiscVHi20Fixup = NULL;
       break;
 
-  default:
+    default:
       return EFI_UNSUPPORTED;
-
   }
+
   return RETURN_SUCCESS;
 }
 
@@ -167,7 +170,7 @@ PeCoffLoaderRelocateRiscVImage (
 **/
 UINT16
 ThumbMovtImmediateAddress (
-  IN UINT16 *Instruction
+  IN UINT16  *Instruction
   )
 {
   UINT32  Movt;
@@ -188,7 +191,6 @@ ThumbMovtImmediateAddress (
   return Address;
 }
 
-
 /**
   Update an ARM MOVT or MOVW immediate instruction immediate data.
 
@@ -197,15 +199,15 @@ ThumbMovtImmediateAddress (
 **/
 VOID
 ThumbMovtImmediatePatch (
-  IN OUT UINT16 *Instruction,
-  IN     UINT16 Address
+  IN OUT UINT16  *Instruction,
+  IN     UINT16  Address
   )
 {
   UINT16  Patch;
 
   // First 16-bit chunk of instruction
-  Patch  = ((Address >> 12) & 0x000f);             // imm4
-  Patch |= (((Address & BIT11) != 0) ? BIT10 : 0); // i
+  Patch        = ((Address >> 12) & 0x000f);             // imm4
+  Patch       |= (((Address & BIT11) != 0) ? BIT10 : 0); // i
   *Instruction = (*Instruction & ~0x040f) | Patch;
 
   // Second 16-bit chunk of instruction
@@ -227,7 +229,7 @@ ThumbMovtImmediatePatch (
 UINT32
 EFIAPI
 ThumbMovwMovtImmediateAddress (
-  IN UINT16 *Instructions
+  IN UINT16  *Instructions
   )
 {
   UINT16  *Word;
@@ -239,7 +241,6 @@ ThumbMovwMovtImmediateAddress (
   return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word);
 }
 
-
 /**
   Update an ARM MOVW/MOVT immediate instruction instruction pair.
 
@@ -249,8 +250,8 @@ ThumbMovwMovtImmediateAddress (
 VOID
 EFIAPI
 ThumbMovwMovtImmediatePatch (
-  IN OUT UINT16 *Instructions,
-  IN     UINT32 Address
+  IN OUT UINT16  *Instructions,
+  IN     UINT32  Address
   )
 {
   UINT16  *Word;
@@ -263,7 +264,6 @@ ThumbMovwMovtImmediatePatch (
   ThumbMovtImmediatePatch (Top, (UINT16)(Address >> 16));
 }
 
-
 /**
   Performs an ARM-based specific relocation fixup and is a no-op on other
   instruction sets.
@@ -278,35 +278,34 @@ ThumbMovwMovtImmediatePatch (
 **/
 RETURN_STATUS
 PeCoffLoaderRelocateArmImage (
-  IN UINT16      **Reloc,
-  IN OUT CHAR8   *Fixup,
-  IN OUT CHAR8   **FixupData,
-  IN UINT64      Adjust
+  IN UINT16     **Reloc,
+  IN OUT CHAR8  *Fixup,
+  IN OUT CHAR8  **FixupData,
+  IN UINT64     Adjust
   )
 {
-  UINT16      *Fixup16;
-  UINT32      FixupVal;
+  UINT16  *Fixup16;
+  UINT32  FixupVal;
 
-  Fixup16   = (UINT16 *) Fixup;
+  Fixup16 = (UINT16 *)Fixup;
 
   switch ((**Reloc) >> 12) {
+    case EFI_IMAGE_REL_BASED_ARM_MOV32T:
+      FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
+      ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
 
-  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;
 
-    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:
-    return RETURN_UNSUPPORTED;
+    case EFI_IMAGE_REL_BASED_ARM_MOV32A:
+    // break omitted - ARM instruction encoding not implemented
+    default:
+      return RETURN_UNSUPPORTED;
   }
 
   return RETURN_SUCCESS;
@@ -330,10 +329,10 @@ PeCoffLoaderRelocateLoongArch64Image (
   IN UINT64     Adjust
   )
 {
-  UINT8  RelocType;
-  UINT64 Value;
-  UINT64 Tmp1;
-  UINT64 Tmp2;
+  UINT8   RelocType;
+  UINT64  Value;
+  UINT64  Tmp1;
+  UINT64  Tmp2;
 
   RelocType = ((*Reloc) >> 12);
   Value     = 0;
diff --git a/BaseTools/Source/C/Common/SimpleFileParsing.c b/BaseTools/Source/C/Common/SimpleFileParsing.c
index 51d59cf4a765..cec82b540569 100644
--- a/BaseTools/Source/C/Common/SimpleFileParsing.c
+++ b/BaseTools/Source/C/Common/SimpleFileParsing.c
@@ -27,46 +27,46 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 #define MAX_STRING_IDENTIFIER_NAME  100
 
-#define T_CHAR_SPACE                ' '
-#define T_CHAR_NULL                 0
-#define T_CHAR_CR                   '\r'
-#define T_CHAR_TAB                  '\t'
-#define T_CHAR_LF                   '\n'
-#define T_CHAR_SLASH                '/'
-#define T_CHAR_BACKSLASH            '\\'
-#define T_CHAR_DOUBLE_QUOTE         '"'
-#define T_CHAR_LC_X                 'x'
-#define T_CHAR_0                    '0'
-#define T_CHAR_STAR                 '*'
+#define T_CHAR_SPACE         ' '
+#define T_CHAR_NULL          0
+#define T_CHAR_CR            '\r'
+#define T_CHAR_TAB           '\t'
+#define T_CHAR_LF            '\n'
+#define T_CHAR_SLASH         '/'
+#define T_CHAR_BACKSLASH     '\\'
+#define T_CHAR_DOUBLE_QUOTE  '"'
+#define T_CHAR_LC_X          'x'
+#define T_CHAR_0             '0'
+#define T_CHAR_STAR          '*'
 
 //
 // We keep a linked list of these for the source files we process
 //
 typedef struct _SOURCE_FILE {
-  FILE                *Fptr;
-  CHAR8               *FileBuffer;
-  CHAR8               *FileBufferPtr;
-  UINTN               FileSize;
-  CHAR8               FileName[MAX_PATH];
-  UINTN               LineNum;
-  BOOLEAN             EndOfFile;
-  BOOLEAN             SkipToHash;
-  struct _SOURCE_FILE *Previous;
-  struct _SOURCE_FILE *Next;
-  CHAR8               ControlCharacter;
+  FILE                   *Fptr;
+  CHAR8                  *FileBuffer;
+  CHAR8                  *FileBufferPtr;
+  UINTN                  FileSize;
+  CHAR8                  FileName[MAX_PATH];
+  UINTN                  LineNum;
+  BOOLEAN                EndOfFile;
+  BOOLEAN                SkipToHash;
+  struct _SOURCE_FILE    *Previous;
+  struct _SOURCE_FILE    *Next;
+  CHAR8                  ControlCharacter;
 } SOURCE_FILE;
 
 typedef struct {
-  CHAR8   *FileBufferPtr;
+  CHAR8    *FileBufferPtr;
 } FILE_POSITION;
 
 //
 // Keep all our module globals in this structure
 //
 STATIC struct {
-  SOURCE_FILE SourceFile;
-  BOOLEAN     VerboseFile;
-  BOOLEAN     VerboseToken;
+  SOURCE_FILE    SourceFile;
+  BOOLEAN        VerboseFile;
+  BOOLEAN        VerboseToken;
 } mGlobals;
 
 STATIC
@@ -81,7 +81,7 @@ UINTN
 t_strncmp (
   CHAR8  *Str1,
   CHAR8  *Str2,
-  INTN    Len
+  INTN   Len
   );
 
 STATIC
@@ -93,31 +93,31 @@ t_strlen (
 STATIC
 VOID
 RewindFile (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   );
 
 STATIC
 BOOLEAN
 IsWhiteSpace (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   );
 
 STATIC
 UINTN
 SkipWhiteSpace (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   );
 
 STATIC
 BOOLEAN
 EndOfFile (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   );
 
 STATIC
 VOID
 PreprocessFile (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   );
 
 STATIC
@@ -130,26 +130,26 @@ t_strcpy (
 STATIC
 STATUS
 ProcessIncludeFile (
-  SOURCE_FILE *SourceFile,
-  SOURCE_FILE *ParentSourceFile
+  SOURCE_FILE  *SourceFile,
+  SOURCE_FILE  *ParentSourceFile
   );
 
 STATIC
 STATUS
 ProcessFile (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   );
 
 STATIC
 STATUS
 GetFilePosition (
-  FILE_POSITION *Fpos
+  FILE_POSITION  *Fpos
   );
 
 STATIC
 STATUS
 SetFilePosition (
-  FILE_POSITION *Fpos
+  FILE_POSITION  *Fpos
   );
 
 /**
@@ -160,7 +160,7 @@ SFPInit (
   VOID
   )
 {
-  memset ((VOID *) &mGlobals, 0, sizeof (mGlobals));
+  memset ((VOID *)&mGlobals, 0, sizeof (mGlobals));
   return STATUS_SUCCESS;
 }
 
@@ -204,10 +204,11 @@ SFPGetFileName (
 **/
 STATUS
 SFPOpenFile (
-  CHAR8      *FileName
+  CHAR8  *FileName
   )
 {
   STATUS  Status;
+
   t_strcpy (mGlobals.SourceFile.FileName, FileName);
   Status = ProcessIncludeFile (&mGlobals.SourceFile, NULL);
   return Status;
@@ -223,7 +224,7 @@ SFPOpenFile (
    is not a subset of some other token.
 
    The file pointer is advanced past the token in the input file.
- 
+
   @param Str the token to look for
 
   @retval TRUE the token is next
@@ -235,6 +236,7 @@ SFPIsToken (
   )
 {
   UINTN  Len;
+
   SkipWhiteSpace (&mGlobals.SourceFile);
   if (EndOfFile (&mGlobals.SourceFile)) {
     return FALSE;
@@ -259,7 +261,7 @@ SFPIsToken (
  @note:
    A keyword is defined as a "special" string that has a non-alphanumeric
    character following it.
- 
+
   @param Str keyword to look for
 
   @retval TRUE the keyword is next
@@ -271,6 +273,7 @@ SFPIsKeyword (
   )
 {
   UINTN  Len;
+
   SkipWhiteSpace (&mGlobals.SourceFile);
   if (EndOfFile (&mGlobals.SourceFile)) {
     return FALSE;
@@ -299,7 +302,7 @@ SFPIsKeyword (
    Preceding white space is ignored.
    The parser's buffer pointer is advanced past the end of the
    token.
- 
+
   @param Str pointer to a copy of the next token
   @param Len size of buffer pointed to by Str
 
@@ -319,12 +322,14 @@ SFPGetNextToken (
   if (EndOfFile (&mGlobals.SourceFile)) {
     return FALSE;
   }
+
   //
   // Have to have enough string for at least one char and a null-terminator
   //
   if (Len < 2) {
     return FALSE;
   }
+
   //
   // Look at the first character. If it's an identifier, then treat it
   // as such
@@ -340,7 +345,8 @@ SFPGetNextToken (
           ((TempChar >= 'A') && (TempChar <= 'Z')) ||
           ((TempChar >= '0') && (TempChar <= '9')) ||
           (TempChar == '_')
-          ) {
+          )
+      {
         Str[Index] = mGlobals.SourceFile.FileBufferPtr[0];
         mGlobals.SourceFile.FileBufferPtr++;
         Index++;
@@ -351,6 +357,7 @@ SFPGetNextToken (
         break;
       }
     }
+
     //
     // Null terminate and return success
     //
@@ -380,6 +387,7 @@ SFPGetNextToken (
         Index++;
       }
     }
+
     //
     // See if we just ran out of file contents, but did find a token
     //
@@ -403,11 +411,12 @@ SFPGetNextToken (
 **/
 BOOLEAN
 SFPGetGuidToken (
-  CHAR8  *Str,
-  UINT32 Len
+  CHAR8   *Str,
+  UINT32  Len
   )
 {
   UINT32  Index;
+
   SkipWhiteSpace (&mGlobals.SourceFile);
   if (EndOfFile (&mGlobals.SourceFile)) {
     return FALSE;
@@ -438,7 +447,8 @@ SFPSkipToToken (
   )
 {
   UINTN  Len;
-  CHAR8         *SavePos;
+  CHAR8  *SavePos;
+
   Len     = t_strlen (Str);
   SavePos = mGlobals.SourceFile.FileBufferPtr;
   SkipWhiteSpace (&mGlobals.SourceFile);
@@ -467,10 +477,10 @@ SFPSkipToToken (
 **/
 BOOLEAN
 SFPGetNumber (
-  UINTN *Value
+  UINTN  *Value
   )
 {
-  int Val;
+  int  Val;
 
   SkipWhiteSpace (&mGlobals.SourceFile);
   if (EndOfFile (&mGlobals.SourceFile)) {
@@ -488,7 +498,7 @@ SFPGetNumber (
 
       mGlobals.SourceFile.FileBufferPtr += 2;
       sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", &Val);
-      *Value = (UINT32) Val;
+      *Value = (UINT32)Val;
       while (isxdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {
         mGlobals.SourceFile.FileBufferPtr++;
       }
@@ -538,13 +548,13 @@ SFPCloseFile (
 STATIC
 STATUS
 ProcessIncludeFile (
-  SOURCE_FILE *SourceFile,
-  SOURCE_FILE *ParentSourceFile
+  SOURCE_FILE  *SourceFile,
+  SOURCE_FILE  *ParentSourceFile
   )
 {
-  STATIC UINTN NestDepth = 0;
-  CHAR8               FoundFileName[MAX_PATH];
-  STATUS              Status;
+  STATIC UINTN  NestDepth = 0;
+  CHAR8         FoundFileName[MAX_PATH];
+  STATUS        Status;
 
   Status = STATUS_SUCCESS;
   NestDepth++;
@@ -561,10 +571,11 @@ ProcessIncludeFile (
   // Make sure we didn't exceed our maximum nesting depth
   //
   if (NestDepth > MAX_NEST_DEPTH) {
-    Error (NULL, 0, 3001, "Not Supported", "%s exceeds max nesting depth (%u)", SourceFile->FileName, (unsigned) NestDepth);
+    Error (NULL, 0, 3001, "Not Supported", "%s exceeds max nesting depth (%u)", SourceFile->FileName, (unsigned)NestDepth);
     Status = STATUS_ERROR;
     goto Finish;
   }
+
   //
   // Try to open the file locally, and if that fails try along our include paths.
   //
@@ -572,6 +583,7 @@ ProcessIncludeFile (
   if ((SourceFile->Fptr = fopen (LongFilePath (FoundFileName), "rb")) == NULL) {
     return STATUS_ERROR;
   }
+
   //
   // Process the file found
   //
@@ -599,7 +611,7 @@ ProcessIncludeFile (
 STATIC
 STATUS
 ProcessFile (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   )
 {
   //
@@ -609,18 +621,18 @@ ProcessFile (
   fseek (SourceFile->Fptr, 0, SEEK_END);
   SourceFile->FileSize = ftell (SourceFile->Fptr);
   if (mGlobals.VerboseFile) {
-    printf ("FileSize = %u (0x%X)\n", (unsigned) SourceFile->FileSize, (unsigned) SourceFile->FileSize);
+    printf ("FileSize = %u (0x%X)\n", (unsigned)SourceFile->FileSize, (unsigned)SourceFile->FileSize);
   }
 
   fseek (SourceFile->Fptr, 0, SEEK_SET);
-  SourceFile->FileBuffer = (CHAR8  *) malloc (SourceFile->FileSize + sizeof (CHAR8 ));
+  SourceFile->FileBuffer = (CHAR8  *)malloc (SourceFile->FileSize + sizeof (CHAR8));
   if (SourceFile->FileBuffer == NULL) {
     Error (NULL, 0, 4001, "Resource: memory cannot be allocated", NULL);
     return STATUS_ERROR;
   }
 
-  fread ((VOID *) SourceFile->FileBuffer, SourceFile->FileSize, 1, SourceFile->Fptr);
-  SourceFile->FileBuffer[(SourceFile->FileSize / sizeof (CHAR8 ))] = T_CHAR_NULL;
+  fread ((VOID *)SourceFile->FileBuffer, SourceFile->FileSize, 1, SourceFile->Fptr);
+  SourceFile->FileBuffer[(SourceFile->FileSize / sizeof (CHAR8))] = T_CHAR_NULL;
   //
   // Pre-process the file to replace comments with spaces
   //
@@ -638,12 +650,12 @@ ProcessFile (
 STATIC
 VOID
 PreprocessFile (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   )
 {
-  BOOLEAN InComment;
-  BOOLEAN SlashSlashComment;
-  int     LineNum;
+  BOOLEAN  InComment;
+  BOOLEAN  SlashSlashComment;
+  int      LineNum;
 
   RewindFile (SourceFile);
   InComment         = FALSE;
@@ -669,10 +681,11 @@ PreprocessFile (
       // Check for */ comment end
       //
     } else if (InComment &&
-             !SlashSlashComment &&
-             (SourceFile->FileBufferPtr[0] == T_CHAR_STAR) &&
-             (SourceFile->FileBufferPtr[1] == T_CHAR_SLASH)
-            ) {
+               !SlashSlashComment &&
+               (SourceFile->FileBufferPtr[0] == T_CHAR_STAR) &&
+               (SourceFile->FileBufferPtr[1] == T_CHAR_SLASH)
+               )
+    {
       SourceFile->FileBufferPtr[0] = T_CHAR_SPACE;
       SourceFile->FileBufferPtr++;
       SourceFile->FileBufferPtr[0] = T_CHAR_SPACE;
@@ -701,6 +714,7 @@ PreprocessFile (
       SourceFile->FileBufferPtr++;
     }
   }
+
   //
   // Could check for end-of-file and still in a comment, but
   // should not be necessary. So just restore the file pointers.
@@ -740,8 +754,8 @@ PreprocessFile (
 **/
 BOOLEAN
 SFPGetQuotedString (
-  CHAR8       *Str,
-  INTN         Length
+  CHAR8  *Str,
+  INTN   Length
   )
 {
   SkipWhiteSpace (&mGlobals.SourceFile);
@@ -755,6 +769,7 @@ SFPGetQuotedString (
       if (EndOfFile (&mGlobals.SourceFile)) {
         return FALSE;
       }
+
       //
       // Check for closing quote
       //
@@ -770,6 +785,7 @@ SFPGetQuotedString (
       mGlobals.SourceFile.FileBufferPtr++;
     }
   }
+
   //
   // First character was not a quote, or the input string length was
   // insufficient to contain the quoted string, so return failure code.
@@ -797,15 +813,15 @@ SFPIsEOF (
 STATIC
 CHAR8  *
 GetQuotedString (
-  SOURCE_FILE *SourceFile,
-  BOOLEAN     Optional
+  SOURCE_FILE  *SourceFile,
+  BOOLEAN      Optional
   )
 {
-  CHAR8         *String;
-  CHAR8         *Start;
-  CHAR8         *Ptr;
-  UINTN         Len;
-  BOOLEAN       PreviousBackslash;
+  CHAR8    *String;
+  CHAR8    *Start;
+  CHAR8    *Ptr;
+  UINTN    Len;
+  BOOLEAN  PreviousBackslash;
 
   if (SourceFile->FileBufferPtr[0] != T_CHAR_DOUBLE_QUOTE) {
     if (Optional == FALSE) {
@@ -840,14 +856,16 @@ GetQuotedString (
   } else {
     SourceFile->FileBufferPtr++;
   }
+
   //
   // Now allocate memory for the string and save it off
   //
-  String = (CHAR8  *) malloc ((Len + 1) * sizeof (CHAR8 ));
+  String = (CHAR8  *)malloc ((Len + 1) * sizeof (CHAR8));
   if (String == NULL) {
     Error (NULL, 0, 4001, "Resource: memory cannot be allocated", NULL);
     return NULL;
   }
+
   //
   // Copy the string from the file buffer to the local copy.
   // We do no reformatting of it whatsoever at this point.
@@ -863,18 +881,19 @@ GetQuotedString (
   *Ptr = 0;
   return String;
 }
+
 #endif
 STATIC
 BOOLEAN
 EndOfFile (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   )
 {
   //
   // The file buffer pointer will typically get updated before the End-of-file flag in the
   // source file structure, so check it first.
   //
-  if (SourceFile->FileBufferPtr >= SourceFile->FileBuffer + SourceFile->FileSize / sizeof (CHAR8 )) {
+  if (SourceFile->FileBufferPtr >= SourceFile->FileBuffer + SourceFile->FileSize / sizeof (CHAR8)) {
     SourceFile->EndOfFile = TRUE;
     return TRUE;
   }
@@ -890,19 +909,20 @@ EndOfFile (
 STATIC
 VOID
 ProcessTokenInclude (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   )
 {
-  CHAR8          IncludeFileName[MAX_PATH];
-  CHAR8          *To;
-  UINTN  Len;
-  BOOLEAN       ReportedError;
-  SOURCE_FILE   IncludedSourceFile;
+  CHAR8        IncludeFileName[MAX_PATH];
+  CHAR8        *To;
+  UINTN        Len;
+  BOOLEAN      ReportedError;
+  SOURCE_FILE  IncludedSourceFile;
 
   ReportedError = FALSE;
   if (SkipWhiteSpace (SourceFile) == 0) {
     Warning (SourceFile->FileName, SourceFile->LineNum, 0, "expected whitespace following #include keyword", NULL);
   }
+
   //
   // Should be quoted file name
   //
@@ -927,6 +947,7 @@ ProcessTokenInclude (
       SourceFile->FileBufferPtr++;
       break;
     }
+
     //
     // If too long, then report the error once and process until the closing quote
     //
@@ -937,7 +958,7 @@ ProcessTokenInclude (
     }
 
     if (!ReportedError) {
-      *To = (CHAR8 ) SourceFile->FileBufferPtr[0];
+      *To = (CHAR8)SourceFile->FileBufferPtr[0];
       To++;
     }
 
@@ -946,65 +967,67 @@ ProcessTokenInclude (
 
   if (!ReportedError) {
     *To = 0;
-    memset ((CHAR8 *) &IncludedSourceFile, 0, sizeof (SOURCE_FILE));
+    memset ((CHAR8 *)&IncludedSourceFile, 0, sizeof (SOURCE_FILE));
     strcpy (IncludedSourceFile.FileName, IncludeFileName);
     ProcessIncludeFile (&IncludedSourceFile, SourceFile);
   }
 
-  return ;
+  return;
 FailDone:
   //
   // Error recovery -- skip to next #
   //
   SourceFile->SkipToHash = TRUE;
 }
+
 #endif
 STATIC
 BOOLEAN
 IsWhiteSpace (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   )
 {
   switch (*SourceFile->FileBufferPtr) {
-  case T_CHAR_NULL:
-  case T_CHAR_CR:
-  case T_CHAR_SPACE:
-  case T_CHAR_TAB:
-  case T_CHAR_LF:
-    return TRUE;
-
-  default:
-    return FALSE;
-  }
-}
-
-UINTN
-SkipWhiteSpace (
-  SOURCE_FILE *SourceFile
-  )
-{
-  UINTN  Count;
-
-  Count = 0;
-  while (!EndOfFile (SourceFile)) {
-    Count++;
-    switch (*SourceFile->FileBufferPtr) {
     case T_CHAR_NULL:
     case T_CHAR_CR:
     case T_CHAR_SPACE:
     case T_CHAR_TAB:
-      SourceFile->FileBufferPtr++;
-      break;
-
     case T_CHAR_LF:
-      SourceFile->FileBufferPtr++;
-      SourceFile->LineNum++;
-      break;
+      return TRUE;
 
     default:
-      return Count - 1;
+      return FALSE;
+  }
+}
+
+UINTN
+SkipWhiteSpace (
+  SOURCE_FILE  *SourceFile
+  )
+{
+  UINTN  Count;
+
+  Count = 0;
+  while (!EndOfFile (SourceFile)) {
+    Count++;
+    switch (*SourceFile->FileBufferPtr) {
+      case T_CHAR_NULL:
+      case T_CHAR_CR:
+      case T_CHAR_SPACE:
+      case T_CHAR_TAB:
+        SourceFile->FileBufferPtr++;
+        break;
+
+      case T_CHAR_LF:
+        SourceFile->FileBufferPtr++;
+        SourceFile->LineNum++;
+        break;
+
+      default:
+        return Count - 1;
     }
   }
+
   //
   // Some tokens require trailing whitespace. If we're at the end of the
   // file, then we count that as well.
@@ -1056,6 +1079,7 @@ t_strlen (
   )
 {
   UINTN  Len;
+
   Len = 0;
   while (*Str) {
     Len++;
@@ -1070,7 +1094,7 @@ UINTN
 t_strncmp (
   CHAR8  *Str1,
   CHAR8  *Str2,
-  INTN    Len
+  INTN   Len
   )
 {
   while (Len > 0) {
@@ -1093,7 +1117,8 @@ t_strcpy (
   CHAR8  *Src
   )
 {
-  CHAR8   *SaveDest;
+  CHAR8  *SaveDest;
+
   SaveDest = Dest;
   while (*Src) {
     *Dest = *Src;
@@ -1108,7 +1133,7 @@ t_strcpy (
 STATIC
 VOID
 RewindFile (
-  SOURCE_FILE *SourceFile
+  SOURCE_FILE  *SourceFile
   )
 {
   SourceFile->LineNum       = 1;
@@ -1119,11 +1144,12 @@ RewindFile (
 STATIC
 UINT32
 GetHexChars (
-  CHAR8       *Buffer,
-  UINT32      BufferLen
+  CHAR8   *Buffer,
+  UINT32  BufferLen
   )
 {
   UINT32  Len;
+
   Len = 0;
   while (!EndOfFile (&mGlobals.SourceFile) && (Len < BufferLen)) {
     if (isxdigit ((int)mGlobals.SourceFile.FileBufferPtr[0])) {
@@ -1134,6 +1160,7 @@ GetHexChars (
       break;
     }
   }
+
   //
   // Null terminate if we can
   //
@@ -1158,19 +1185,19 @@ GetHexChars (
 **/
 BOOLEAN
 SFPGetGuid (
-  INTN         GuidStyle,
-  EFI_GUID    *Value
+  INTN      GuidStyle,
+  EFI_GUID  *Value
   )
 {
-  INT32         Value32;
-  UINT32        Index;
-  FILE_POSITION FPos;
-  CHAR8         TempString[20];
-  CHAR8         TempString2[3];
-  CHAR8         *From;
-  CHAR8         *To;
-  UINT32        Len;
-  BOOLEAN       Status;
+  INT32          Value32;
+  UINT32         Index;
+  FILE_POSITION  FPos;
+  CHAR8          TempString[20];
+  CHAR8          TempString2[3];
+  CHAR8          *From;
+  CHAR8          *To;
+  UINT32         Len;
+  BOOLEAN        Status;
 
   Status = FALSE;
   //
@@ -1207,7 +1234,7 @@ SFPGetGuid (
     }
 
     sscanf (TempString, "%x", &Value32);
-    Value->Data2 = (UINT16) Value32;
+    Value->Data2 = (UINT16)Value32;
 
     if (mGlobals.SourceFile.FileBufferPtr[0] != '-') {
       goto Done;
@@ -1220,7 +1247,7 @@ SFPGetGuid (
     }
 
     sscanf (TempString, "%x", &Value32);
-    Value->Data3 = (UINT16) Value32;
+    Value->Data3 = (UINT16)Value32;
     //
     // Parse the "AAAA" as two bytes
     //
@@ -1235,8 +1262,8 @@ SFPGetGuid (
     }
 
     sscanf (TempString, "%x", &Value32);
-    Value->Data4[0] = (UINT8) (Value32 >> 8);
-    Value->Data4[1] = (UINT8) Value32;
+    Value->Data4[0] = (UINT8)(Value32 >> 8);
+    Value->Data4[1] = (UINT8)Value32;
     if (mGlobals.SourceFile.FileBufferPtr[0] != '-') {
       goto Done;
     }
@@ -1250,13 +1277,14 @@ SFPGetGuid (
     if ((Len == 0) || (Len > 12)) {
       goto Done;
     }
+
     //
     // Insert leading 0's to make life easier
     //
     if (Len != 12) {
-      From            = TempString + Len - 1;
-      To              = TempString + 11;
-      TempString[12]  = 0;
+      From           = TempString + Len - 1;
+      To             = TempString + 11;
+      TempString[12] = 0;
       while (From >= TempString) {
         *To = *From;
         To--;
@@ -1268,6 +1296,7 @@ SFPGetGuid (
         To--;
       }
     }
+
     //
     // Now parse each byte
     //
@@ -1277,10 +1306,10 @@ SFPGetGuid (
       // Copy the two characters from the input string to something
       // we can parse.
       //
-      TempString2[0]  = TempString[Index * 2];
-      TempString2[1]  = TempString[Index * 2 + 1];
+      TempString2[0] = TempString[Index * 2];
+      TempString2[1] = TempString[Index * 2 + 1];
       sscanf (TempString2, "%x", &Value32);
-      Value->Data4[Index + 2] = (UINT8) Value32;
+      Value->Data4[Index + 2] = (UINT8)Value32;
     }
 
     Status = TRUE;
@@ -1302,7 +1331,7 @@ SFPGetGuid (
 STATIC
 STATUS
 GetFilePosition (
-  FILE_POSITION *Fpos
+  FILE_POSITION  *Fpos
   )
 {
   Fpos->FileBufferPtr = mGlobals.SourceFile.FileBufferPtr;
@@ -1312,7 +1341,7 @@ GetFilePosition (
 STATIC
 STATUS
 SetFilePosition (
-  FILE_POSITION *Fpos
+  FILE_POSITION  *Fpos
   )
 {
   //
diff --git a/BaseTools/Source/C/Common/StringFuncs.c b/BaseTools/Source/C/Common/StringFuncs.c
index bc85ba012440..b39b907a9571 100644
--- a/BaseTools/Source/C/Common/StringFuncs.c
+++ b/BaseTools/Source/C/Common/StringFuncs.c
@@ -21,12 +21,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @return CHAR8* - NULL if there are not enough resources
 **/
-CHAR8*
+CHAR8 *
 CloneString (
-  IN CHAR8       *String
+  IN CHAR8  *String
   )
 {
-  CHAR8* NewString;
+  CHAR8  *NewString;
 
   NewString = malloc (strlen (String) + 1);
   if (NewString != NULL) {
@@ -45,10 +45,10 @@ CloneString (
 **/
 EFI_STATUS
 StripInfDscStringInPlace (
-  IN CHAR8       *String
+  IN CHAR8  *String
   )
 {
-  CHAR8 *Pos;
+  CHAR8  *Pos;
 
   if (String == NULL) {
     return EFI_INVALID_PARAMETER;
@@ -59,6 +59,7 @@ StripInfDscStringInPlace (
   //
   for (Pos = String; isspace ((int)*Pos); Pos++) {
   }
+
   if (Pos != String) {
     memmove (String, Pos, strlen (Pos) + 1);
   }
@@ -70,12 +71,12 @@ StripInfDscStringInPlace (
   // What about multiline comments?
   //
 
-  Pos = (CHAR8 *) strstr (String,  "//");
+  Pos = (CHAR8 *)strstr (String, "//");
   if (Pos != NULL) {
     *Pos = '\0';
   }
 
-  Pos = (CHAR8 *) strchr (String, '#');
+  Pos = (CHAR8 *)strchr (String, '#');
   if (Pos != NULL) {
     *Pos = '\0';
   }
@@ -86,8 +87,10 @@ StripInfDscStringInPlace (
   for (Pos = String + strlen (String);
        ((Pos - 1) >= String) && (isspace ((int)*(Pos - 1)));
        Pos--
-      ) {
+       )
+  {
   }
+
   *Pos = '\0';
 
   return EFI_SUCCESS;
@@ -101,21 +104,22 @@ StripInfDscStringInPlace (
 
   @return EFI_STATUS
 **/
-STRING_LIST*
+STRING_LIST *
 SplitStringByWhitespace (
-  IN CHAR8       *String
+  IN CHAR8  *String
   )
 {
-  CHAR8       *Pos;
-  CHAR8       *EndOfSubString;
-  CHAR8       *EndOfString;
-  STRING_LIST *Output;
-  UINTN       Item;
+  CHAR8        *Pos;
+  CHAR8        *EndOfSubString;
+  CHAR8        *EndOfString;
+  STRING_LIST  *Output;
+  UINTN        Item;
 
   String = CloneString (String);
   if (String == NULL) {
     return NULL;
   }
+
   EndOfString = String + strlen (String);
 
   Output = NewStringList ();
@@ -125,10 +129,11 @@ SplitStringByWhitespace (
       Pos++;
     }
 
-    for (EndOfSubString=Pos;
+    for (EndOfSubString = Pos;
          (*EndOfSubString != '\0') && !isspace ((int)*EndOfSubString);
          EndOfSubString++
-         ) {
+         )
+    {
     }
 
     if (EndOfSubString == Pos) {
@@ -151,15 +156,17 @@ SplitStringByWhitespace (
 
   @return STRING_LIST* - Null if there is not enough resources to create the object.
 **/
-STRING_LIST*
+STRING_LIST *
 NewStringList (
   )
 {
-  STRING_LIST *NewList;
+  STRING_LIST  *NewList;
+
   NewList = AllocateStringListStruct (0);
   if (NewList != NULL) {
     NewList->Count = 0;
   }
+
   return NewList;
 }
 
@@ -171,13 +178,13 @@ NewStringList (
 **/
 EFI_STATUS
 AppendCopyOfStringToList (
-  IN OUT STRING_LIST **StringList,
-  IN CHAR8       *String
+  IN OUT STRING_LIST  **StringList,
+  IN CHAR8            *String
   )
 {
-  STRING_LIST *OldList;
-  STRING_LIST *NewList;
-  CHAR8       *NewString;
+  STRING_LIST  *OldList;
+  STRING_LIST  *NewList;
+  CHAR8        *NewString;
 
   OldList = *StringList;
   NewList = AllocateStringListStruct (OldList->Count + 1);
@@ -196,7 +203,7 @@ AppendCopyOfStringToList (
     OldList->Strings,
     sizeof (OldList->Strings[0]) * OldList->Count
     );
-  NewList->Count = OldList->Count + 1;
+  NewList->Count                   = OldList->Count + 1;
   NewList->Strings[OldList->Count] = NewString;
 
   *StringList = NewList;
@@ -215,7 +222,7 @@ AppendCopyOfStringToList (
 **/
 EFI_STATUS
 RemoveLastStringFromList (
-  IN STRING_LIST       *StringList
+  IN STRING_LIST  *StringList
   )
 {
   if (StringList->Count == 0) {
@@ -234,12 +241,12 @@ RemoveLastStringFromList (
 
   @return EFI_STATUS
 **/
-STRING_LIST*
+STRING_LIST *
 AllocateStringListStruct (
-  IN UINTN StringCount
+  IN UINTN  StringCount
   )
 {
-  return malloc (OFFSET_OF(STRING_LIST, Strings[StringCount + 1]));
+  return malloc (OFFSET_OF (STRING_LIST, Strings[StringCount + 1]));
 }
 
 /**
@@ -249,7 +256,7 @@ AllocateStringListStruct (
 **/
 VOID
 FreeStringList (
-  IN STRING_LIST       *StringList
+  IN STRING_LIST  *StringList
   )
 {
   while (StringList->Count > 0) {
@@ -267,20 +274,21 @@ FreeStringList (
   @return CHAR8* - The string list represented with a single string.  The returned
            string must be freed by the caller.
 **/
-CHAR8*
+CHAR8 *
 StringListToString (
-  IN STRING_LIST       *StringList
+  IN STRING_LIST  *StringList
   )
 {
-  UINTN Count;
-  UINTN Length;
-  CHAR8 *NewString;
+  UINTN  Count;
+  UINTN  Length;
+  CHAR8  *NewString;
 
   Length = 2;
   for (Count = 0; Count < StringList->Count; Count++) {
     if (Count > 0) {
       Length += 2;
     }
+
     Length += strlen (StringList->Strings[Count]) + 2;
   }
 
@@ -288,6 +296,7 @@ StringListToString (
   if (NewString == NULL) {
     return NewString;
   }
+
   NewString[0] = '\0';
 
   strcat (NewString, "[");
@@ -295,10 +304,12 @@ StringListToString (
     if (Count > 0) {
       strcat (NewString, ", ");
     }
+
     strcat (NewString, "\"");
     strcat (NewString, StringList->Strings[Count]);
     strcat (NewString, "\"");
   }
+
   strcat (NewString, "]");
 
   return NewString;
@@ -308,20 +319,19 @@ StringListToString (
   Prints out the string list
 
   @param StringList        The string list to print
- 
+
   @return EFI_STATUS
 **/
 VOID
 PrintStringList (
-  IN STRING_LIST       *StringList
+  IN STRING_LIST  *StringList
   )
 {
-  CHAR8* String;
+  CHAR8  *String;
+
   String = StringListToString (StringList);
   if (String != NULL) {
     printf ("%s", String);
     free (String);
   }
 }
-
-
diff --git a/BaseTools/Source/C/Common/TianoCompress.c b/BaseTools/Source/C/Common/TianoCompress.c
index 2f484b9731dc..5df6947258d7 100644
--- a/BaseTools/Source/C/Common/TianoCompress.c
+++ b/BaseTools/Source/C/Common/TianoCompress.c
@@ -28,9 +28,9 @@ typedef INT32 NODE;
 #define CODE_BIT      16
 #define NIL           0
 #define MAX_HASH_VAL  (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)
-#define HASH(p, c)    ((p) + ((c) << (WNDBIT - 9)) + WNDSIZ * 2)
-#define CRCPOLY       0xA001
-#define UPDATE_CRC(c) mCrc = mCrcTable[(mCrc ^ (c)) & 0xFF] ^ (mCrc >> UINT8_BIT)
+#define HASH(p, c)  ((p) + ((c) << (WNDBIT - 9)) + WNDSIZ * 2)
+#define CRCPOLY  0xA001
+#define UPDATE_CRC(c)  mCrc = mCrcTable[(mCrc ^ (c)) & 0xFF] ^ (mCrc >> UINT8_BIT)
 
 //
 // C: the Char&Len Set; P: the Position Set; T: the exTra Set
@@ -42,9 +42,9 @@ typedef INT32 NODE;
 #define NT    (CODE_BIT + 3)
 #define TBIT  5
 #if NT > NP
-#define NPT NT
+#define NPT  NT
 #else
-#define NPT NP
+#define NPT  NP
 #endif
 //
 // Function Prototypes
@@ -52,8 +52,8 @@ typedef INT32 NODE;
 
 STATIC
 VOID
-PutDword(
-  IN UINT32 Data
+PutDword (
+  IN UINT32  Data
   );
 
 STATIC
@@ -84,15 +84,15 @@ Child (
 STATIC
 VOID
 MakeChild (
-  IN NODE  NodeQ,
-  IN UINT8 CharC,
-  IN NODE  NodeR
+  IN NODE   NodeQ,
+  IN UINT8  CharC,
+  IN NODE   NodeR
   );
 
 STATIC
 VOID
 Split (
-  IN NODE Old
+  IN NODE  Old
   );
 
 STATIC
@@ -128,9 +128,9 @@ CountTFreq (
 STATIC
 VOID
 WritePTLen (
-  IN INT32 Number,
-  IN INT32 nbit,
-  IN INT32 Special
+  IN INT32  Number,
+  IN INT32  nbit,
+  IN INT32  Special
   );
 
 STATIC
@@ -142,13 +142,13 @@ WriteCLen (
 STATIC
 VOID
 EncodeC (
-  IN INT32 Value
+  IN INT32  Value
   );
 
 STATIC
 VOID
 EncodeP (
-  IN UINT32 Value
+  IN UINT32  Value
   );
 
 STATIC
@@ -160,8 +160,8 @@ SendBlock (
 STATIC
 VOID
 Output (
-  IN UINT32 c,
-  IN UINT32 p
+  IN UINT32  c,
+  IN UINT32  p
   );
 
 STATIC
@@ -185,15 +185,15 @@ MakeCrcTable (
 STATIC
 VOID
 PutBits (
-  IN INT32  Number,
-  IN UINT32 Value
+  IN INT32   Number,
+  IN UINT32  Value
   );
 
 STATIC
 INT32
 FreadCrc (
-  OUT UINT8 *Pointer,
-  IN  INT32 Number
+  OUT UINT8  *Pointer,
+  IN  INT32  Number
   );
 
 STATIC
@@ -205,35 +205,35 @@ InitPutBits (
 STATIC
 VOID
 CountLen (
-  IN INT32 Index
+  IN INT32  Index
   );
 
 STATIC
 VOID
 MakeLen (
-  IN INT32 Root
+  IN INT32  Root
   );
 
 STATIC
 VOID
 DownHeap (
-  IN INT32 Index
+  IN INT32  Index
   );
 
 STATIC
 VOID
 MakeCode (
-  IN  INT32       Number,
-  IN  UINT8 Len[  ],
-  OUT UINT16 Code[]
+  IN  INT32   Number,
+  IN  UINT8   Len[],
+  OUT UINT16  Code[]
   );
 
 STATIC
 INT32
 MakeTree (
-  IN  INT32            NParm,
+  IN  INT32   NParm,
   IN  UINT16  FreqParm[],
-  OUT UINT8   LenParm[ ],
+  OUT UINT8   LenParm[],
   OUT UINT16  CodeParm[]
   );
 
@@ -242,16 +242,16 @@ MakeTree (
 //
 STATIC UINT8  *mSrc, *mDst, *mSrcUpperLimit, *mDstUpperLimit;
 
-STATIC UINT8  *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;
-STATIC INT16  mHeap[NC + 1];
-STATIC INT32  mRemainder, mMatchLen, mBitCount, mHeapSize, mN;
-STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;
-STATIC UINT32 mCompSize, mOrigSize;
+STATIC UINT8   *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;
+STATIC INT16   mHeap[NC + 1];
+STATIC INT32   mRemainder, mMatchLen, mBitCount, mHeapSize, mN;
+STATIC UINT32  mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;
+STATIC UINT32  mCompSize, mOrigSize;
 
-STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1], mCrcTable[UINT8_MAX + 1],
-  mCFreq[2 * NC - 1], mCCode[NC], mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
+STATIC UINT16  *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1], mCrcTable[UINT8_MAX + 1],
+               mCFreq[2 * NC - 1], mCCode[NC], mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];
 
-STATIC NODE   mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
+STATIC NODE  mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
 
 //
 // functions
@@ -288,28 +288,28 @@ TianoCompress (
   //
   // Initializations
   //
-  mBufSiz         = 0;
-  mBuf            = NULL;
-  mText           = NULL;
-  mLevel          = NULL;
-  mChildCount     = NULL;
-  mPosition       = NULL;
-  mParent         = NULL;
-  mPrev           = NULL;
-  mNext           = NULL;
+  mBufSiz     = 0;
+  mBuf        = NULL;
+  mText       = NULL;
+  mLevel      = NULL;
+  mChildCount = NULL;
+  mPosition   = NULL;
+  mParent     = NULL;
+  mPrev       = NULL;
+  mNext       = NULL;
 
-  mSrc            = SrcBuffer;
-  mSrcUpperLimit  = mSrc + SrcSize;
-  mDst            = DstBuffer;
-  mDstUpperLimit  = mDst +*DstSize;
+  mSrc           = SrcBuffer;
+  mSrcUpperLimit = mSrc + SrcSize;
+  mDst           = DstBuffer;
+  mDstUpperLimit = mDst +*DstSize;
 
   PutDword (0L);
   PutDword (0L);
 
   MakeCrcTable ();
 
-  mOrigSize             = mCompSize = 0;
-  mCrc                  = INIT_CRC;
+  mOrigSize = mCompSize = 0;
+  mCrc      = INIT_CRC;
 
   //
   // Compress it
@@ -318,12 +318,14 @@ TianoCompress (
   if (EFI_ERROR (Status)) {
     return EFI_OUT_OF_RESOURCES;
   }
+
   //
   // Null terminate the compressed data
   //
   if (mDst < mDstUpperLimit) {
     *mDst++ = 0;
   }
+
   //
   // Fill in compressed size and original size
   //
@@ -341,7 +343,6 @@ TianoCompress (
     *DstSize = mCompSize + 1 + 8;
     return EFI_SUCCESS;
   }
-
 }
 
 /**
@@ -352,23 +353,23 @@ TianoCompress (
 STATIC
 VOID
 PutDword (
-  IN UINT32 Data
+  IN UINT32  Data
   )
 {
   if (mDst < mDstUpperLimit) {
-    *mDst++ = (UINT8) (((UINT8) (Data)) & 0xff);
+    *mDst++ = (UINT8)(((UINT8)(Data)) & 0xff);
   }
 
   if (mDst < mDstUpperLimit) {
-    *mDst++ = (UINT8) (((UINT8) (Data >> 0x08)) & 0xff);
+    *mDst++ = (UINT8)(((UINT8)(Data >> 0x08)) & 0xff);
   }
 
   if (mDst < mDstUpperLimit) {
-    *mDst++ = (UINT8) (((UINT8) (Data >> 0x10)) & 0xff);
+    *mDst++ = (UINT8)(((UINT8)(Data >> 0x10)) & 0xff);
   }
 
   if (mDst < mDstUpperLimit) {
-    *mDst++ = (UINT8) (((UINT8) (Data >> 0x18)) & 0xff);
+    *mDst++ = (UINT8)(((UINT8)(Data >> 0x18)) & 0xff);
   }
 }
 
@@ -390,6 +391,7 @@ AllocateMemory (
   if (mText == NULL) {
     return EFI_OUT_OF_RESOURCES;
   }
+
   for (Index = 0; Index < WNDSIZ * 2 + MAXMATCH; Index++) {
     mText[Index] = 0;
   }
@@ -400,13 +402,14 @@ AllocateMemory (
   mParent     = malloc (WNDSIZ * 2 * sizeof (*mParent));
   mPrev       = malloc (WNDSIZ * 2 * sizeof (*mPrev));
   mNext       = malloc ((MAX_HASH_VAL + 1) * sizeof (*mNext));
-  if (mLevel == NULL || mChildCount == NULL || mPosition == NULL ||
-    mParent == NULL || mPrev == NULL || mNext == NULL) {
+  if ((mLevel == NULL) || (mChildCount == NULL) || (mPosition == NULL) ||
+      (mParent == NULL) || (mPrev == NULL) || (mNext == NULL))
+  {
     return EFI_OUT_OF_RESOURCES;
   }
 
-  mBufSiz     = BLKSIZ;
-  mBuf        = malloc (mBufSiz);
+  mBufSiz = BLKSIZ;
+  mBuf    = malloc (mBufSiz);
   while (mBuf == NULL) {
     mBufSiz = (mBufSiz / 10U) * 9U;
     if (mBufSiz < 4 * 1024U) {
@@ -461,7 +464,7 @@ FreeMemory (
     free (mBuf);
   }
 
-  return ;
+  return;
 }
 
 /**
@@ -476,8 +479,8 @@ InitSlide (
   NODE  Index;
 
   for (Index = WNDSIZ; Index <= WNDSIZ + UINT8_MAX; Index++) {
-    mLevel[Index]     = 1;
-    mPosition[Index]  = NIL;  /* sentinel */
+    mLevel[Index]    = 1;
+    mPosition[Index] = NIL;   /* sentinel */
   }
 
   for (Index = WNDSIZ; Index < WNDSIZ * 2; Index++) {
@@ -486,7 +489,7 @@ InitSlide (
 
   mAvail = 1;
   for (Index = 1; Index < WNDSIZ - 1; Index++) {
-    mNext[Index] = (NODE) (Index + 1);
+    mNext[Index] = (NODE)(Index + 1);
   }
 
   mNext[WNDSIZ - 1] = NIL;
@@ -506,8 +509,8 @@ InitSlide (
 STATIC
 NODE
 Child (
-  IN NODE  NodeQ,
-  IN UINT8 CharC
+  IN NODE   NodeQ,
+  IN UINT8  CharC
   )
 {
   NODE  NodeR;
@@ -534,21 +537,21 @@ Child (
 STATIC
 VOID
 MakeChild (
-  IN NODE  Parent,
-  IN UINT8 CharC,
-  IN NODE  Child
+  IN NODE   Parent,
+  IN UINT8  CharC,
+  IN NODE   Child
   )
 {
   NODE  Node1;
   NODE  Node2;
 
-  Node1           = (NODE) HASH (Parent, CharC);
-  Node2           = mNext[Node1];
-  mNext[Node1]    = Child;
-  mNext[Child]    = Node2;
-  mPrev[Node2]    = Child;
-  mPrev[Child]    = Node1;
-  mParent[Child]  = Parent;
+  Node1          = (NODE)HASH (Parent, CharC);
+  Node2          = mNext[Node1];
+  mNext[Node1]   = Child;
+  mNext[Child]   = Node2;
+  mPrev[Node2]   = Child;
+  mPrev[Child]   = Node1;
+  mParent[Child] = Parent;
   mChildCount[Parent]++;
 }
 
@@ -560,24 +563,24 @@ MakeChild (
 STATIC
 VOID
 Split (
-  NODE Old
+  NODE  Old
   )
 {
   NODE  New;
   NODE  TempNode;
 
-  New               = mAvail;
-  mAvail            = mNext[New];
-  mChildCount[New]  = 0;
-  TempNode          = mPrev[Old];
-  mPrev[New]        = TempNode;
-  mNext[TempNode]   = New;
-  TempNode          = mNext[Old];
-  mNext[New]        = TempNode;
-  mPrev[TempNode]   = New;
-  mParent[New]      = mParent[Old];
-  mLevel[New]       = (UINT8) mMatchLen;
-  mPosition[New]    = mPos;
+  New              = mAvail;
+  mAvail           = mNext[New];
+  mChildCount[New] = 0;
+  TempNode         = mPrev[Old];
+  mPrev[New]       = TempNode;
+  mNext[TempNode]  = New;
+  TempNode         = mNext[Old];
+  mNext[New]       = TempNode;
+  mPrev[TempNode]  = New;
+  mParent[New]     = mParent[Old];
+  mLevel[New]      = (UINT8)mMatchLen;
+  mPosition[New]   = mPos;
   MakeChild (New, mText[mMatchPos + mMatchLen], Old);
   MakeChild (New, mText[mPos + mMatchLen], mPos);
 }
@@ -591,13 +594,13 @@ InsertNode (
   VOID
   )
 {
-  NODE  NodeQ;
-  NODE  NodeR;
-  NODE  Index2;
-  NODE  NodeT;
-  UINT8 CharC;
-  UINT8 *t1;
-  UINT8 *t2;
+  NODE   NodeQ;
+  NODE   NodeR;
+  NODE   Index2;
+  NODE   NodeT;
+  UINT8  CharC;
+  UINT8  *t1;
+  UINT8  *t2;
 
   if (mMatchLen >= 4) {
     //
@@ -608,7 +611,7 @@ InsertNode (
     // in DeleteNode() later.
     //
     mMatchLen--;
-    NodeR = (NODE) ((mMatchPos + 1) | WNDSIZ);
+    NodeR = (NODE)((mMatchPos + 1) | WNDSIZ);
     NodeQ = mParent[NodeR];
     while (NodeQ == NIL) {
       NodeR = mNext[NodeR];
@@ -622,52 +625,53 @@ InsertNode (
 
     NodeT = NodeQ;
     while (mPosition[NodeT] < 0) {
-      mPosition[NodeT]  = mPos;
-      NodeT             = mParent[NodeT];
+      mPosition[NodeT] = mPos;
+      NodeT            = mParent[NodeT];
     }
 
     if (NodeT < WNDSIZ) {
-      mPosition[NodeT] = (NODE) (mPos | (UINT32) PERC_FLAG);
+      mPosition[NodeT] = (NODE)(mPos | (UINT32)PERC_FLAG);
     }
   } else {
     //
     // Locate the target tree
     //
-    NodeQ = (NODE) (mText[mPos] + WNDSIZ);
+    NodeQ = (NODE)(mText[mPos] + WNDSIZ);
     CharC = mText[mPos + 1];
     NodeR = Child (NodeQ, CharC);
     if (NodeR == NIL) {
       MakeChild (NodeQ, CharC, mPos);
       mMatchLen = 1;
-      return ;
+      return;
     }
 
     mMatchLen = 2;
   }
+
   //
   // Traverse down the tree to find a match.
   // Update Position value along the route.
   // Node split or creation is involved.
   //
-  for (;;) {
+  for ( ; ;) {
     if (NodeR >= WNDSIZ) {
       Index2    = MAXMATCH;
       mMatchPos = NodeR;
     } else {
       Index2    = mLevel[NodeR];
-      mMatchPos = (NODE) (mPosition[NodeR] & (UINT32)~PERC_FLAG);
+      mMatchPos = (NODE)(mPosition[NodeR] & (UINT32) ~PERC_FLAG);
     }
 
     if (mMatchPos >= mPos) {
       mMatchPos -= WNDSIZ;
     }
 
-    t1  = &mText[mPos + mMatchLen];
-    t2  = &mText[mMatchPos + mMatchLen];
+    t1 = &mText[mPos + mMatchLen];
+    t2 = &mText[mMatchPos + mMatchLen];
     while (mMatchLen < Index2) {
       if (*t1 != *t2) {
         Split (NodeR);
-        return ;
+        return;
       }
 
       mMatchLen++;
@@ -679,31 +683,30 @@ InsertNode (
       break;
     }
 
-    mPosition[NodeR]  = mPos;
-    NodeQ             = NodeR;
-    NodeR             = Child (NodeQ, *t1);
+    mPosition[NodeR] = mPos;
+    NodeQ            = NodeR;
+    NodeR            = Child (NodeQ, *t1);
     if (NodeR == NIL) {
       MakeChild (NodeQ, *t1, mPos);
-      return ;
+      return;
     }
 
     mMatchLen++;
   }
 
-  NodeT           = mPrev[NodeR];
-  mPrev[mPos]     = NodeT;
-  mNext[NodeT]    = mPos;
-  NodeT           = mNext[NodeR];
-  mNext[mPos]     = NodeT;
-  mPrev[NodeT]    = mPos;
-  mParent[mPos]   = NodeQ;
-  mParent[NodeR]  = NIL;
+  NodeT          = mPrev[NodeR];
+  mPrev[mPos]    = NodeT;
+  mNext[NodeT]   = mPos;
+  NodeT          = mNext[NodeR];
+  mNext[mPos]    = NodeT;
+  mPrev[NodeT]   = mPos;
+  mParent[mPos]  = NodeQ;
+  mParent[NodeR] = NIL;
 
   //
   // Special usage of 'next'
   //
   mNext[NodeR] = mPos;
-
 }
 
 /**
@@ -723,7 +726,7 @@ DeleteNode (
   NODE  NodeU;
 
   if (mParent[mPos] == NIL) {
-    return ;
+    return;
   }
 
   NodeR         = mPrev[mPos];
@@ -733,15 +736,15 @@ DeleteNode (
   NodeR         = mParent[mPos];
   mParent[mPos] = NIL;
   if (NodeR >= WNDSIZ) {
-    return ;
+    return;
   }
 
   mChildCount[NodeR]--;
   if (mChildCount[NodeR] > 1) {
-    return ;
+    return;
   }
 
-  NodeT = (NODE) (mPosition[NodeR] & (UINT32)~PERC_FLAG);
+  NodeT = (NODE)(mPosition[NodeR] & (UINT32) ~PERC_FLAG);
   if (NodeT >= mPos) {
     NodeT -= WNDSIZ;
   }
@@ -749,8 +752,8 @@ DeleteNode (
   NodeS = NodeT;
   NodeQ = mParent[NodeR];
   NodeU = mPosition[NodeQ];
-  while (NodeU & (UINT32) PERC_FLAG) {
-    NodeU &= (UINT32)~PERC_FLAG;
+  while (NodeU & (UINT32)PERC_FLAG) {
+    NodeU &= (UINT32) ~PERC_FLAG;
     if (NodeU >= mPos) {
       NodeU -= WNDSIZ;
     }
@@ -759,9 +762,9 @@ DeleteNode (
       NodeS = NodeU;
     }
 
-    mPosition[NodeQ]  = (NODE) (NodeS | WNDSIZ);
-    NodeQ             = mParent[NodeQ];
-    NodeU             = mPosition[NodeQ];
+    mPosition[NodeQ] = (NODE)(NodeS | WNDSIZ);
+    NodeQ            = mParent[NodeQ];
+    NodeU            = mPosition[NodeQ];
   }
 
   if (NodeQ < WNDSIZ) {
@@ -773,24 +776,24 @@ DeleteNode (
       NodeS = NodeU;
     }
 
-    mPosition[NodeQ] = (NODE) (NodeS | WNDSIZ | (UINT32) PERC_FLAG);
+    mPosition[NodeQ] = (NODE)(NodeS | WNDSIZ | (UINT32)PERC_FLAG);
   }
 
-  NodeS           = Child (NodeR, mText[NodeT + mLevel[NodeR]]);
-  NodeT           = mPrev[NodeS];
-  NodeU           = mNext[NodeS];
-  mNext[NodeT]    = NodeU;
-  mPrev[NodeU]    = NodeT;
-  NodeT           = mPrev[NodeR];
-  mNext[NodeT]    = NodeS;
-  mPrev[NodeS]    = NodeT;
-  NodeT           = mNext[NodeR];
-  mPrev[NodeT]    = NodeS;
-  mNext[NodeS]    = NodeT;
-  mParent[NodeS]  = mParent[NodeR];
-  mParent[NodeR]  = NIL;
-  mNext[NodeR]    = mAvail;
-  mAvail          = NodeR;
+  NodeS          = Child (NodeR, mText[NodeT + mLevel[NodeR]]);
+  NodeT          = mPrev[NodeS];
+  NodeU          = mNext[NodeS];
+  mNext[NodeT]   = NodeU;
+  mPrev[NodeU]   = NodeT;
+  NodeT          = mPrev[NodeR];
+  mNext[NodeT]   = NodeS;
+  mPrev[NodeS]   = NodeT;
+  NodeT          = mNext[NodeR];
+  mPrev[NodeT]   = NodeS;
+  mNext[NodeS]   = NodeT;
+  mParent[NodeS] = mParent[NodeR];
+  mParent[NodeR] = NIL;
+  mNext[NodeR]   = mAvail;
+  mAvail         = NodeR;
 }
 
 /**
@@ -803,15 +806,15 @@ GetNextMatch (
   VOID
   )
 {
-  INT32 Number;
+  INT32  Number;
 
   mRemainder--;
   mPos++;
   if (mPos == WNDSIZ * 2) {
     memmove (&mText[0], &mText[WNDSIZ], WNDSIZ + MAXMATCH);
-    Number = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ);
+    Number      = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ);
     mRemainder += Number;
-    mPos = WNDSIZ;
+    mPos        = WNDSIZ;
   }
 
   DeleteNode ();
@@ -844,38 +847,37 @@ Encode (
 
   HufEncodeStart ();
 
-  mRemainder  = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH);
+  mRemainder = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH);
 
-  mMatchLen   = 0;
-  mPos        = WNDSIZ;
+  mMatchLen = 0;
+  mPos      = WNDSIZ;
   InsertNode ();
   if (mMatchLen > mRemainder) {
     mMatchLen = mRemainder;
   }
 
   while (mRemainder > 0) {
-    LastMatchLen  = mMatchLen;
-    LastMatchPos  = mMatchPos;
+    LastMatchLen = mMatchLen;
+    LastMatchPos = mMatchPos;
     GetNextMatch ();
     if (mMatchLen > mRemainder) {
       mMatchLen = mRemainder;
     }
 
-    if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {
+    if ((mMatchLen > LastMatchLen) || (LastMatchLen < THRESHOLD)) {
       //
       // Not enough benefits are gained by outputting a pointer,
       // so just output the original character
       //
       Output (mText[mPos - 1], 0);
-
     } else {
-
       if (LastMatchLen == THRESHOLD) {
         if (((mPos - LastMatchPos - 2) & (WNDSIZ - 1)) > (1U << 11)) {
           Output (mText[mPos - 1], 0);
           continue;
         }
       }
+
       //
       // Outputting a pointer is beneficial enough, do it.
       //
@@ -909,10 +911,10 @@ CountTFreq (
   VOID
   )
 {
-  INT32 Index;
-  INT32 Index3;
-  INT32 Number;
-  INT32 Count;
+  INT32  Index;
+  INT32  Index3;
+  INT32  Number;
+  INT32  Count;
 
   for (Index = 0; Index < NT; Index++) {
     mTFreq[Index] = 0;
@@ -934,7 +936,7 @@ CountTFreq (
       }
 
       if (Count <= 2) {
-        mTFreq[0] = (UINT16) (mTFreq[0] + Count);
+        mTFreq[0] = (UINT16)(mTFreq[0] + Count);
       } else if (Count <= 18) {
         mTFreq[1]++;
       } else if (Count == 19) {
@@ -959,13 +961,13 @@ CountTFreq (
 STATIC
 VOID
 WritePTLen (
-  IN INT32 Number,
-  IN INT32 nbit,
-  IN INT32 Special
+  IN INT32  Number,
+  IN INT32  nbit,
+  IN INT32  Special
   )
 {
-  INT32 Index;
-  INT32 Index3;
+  INT32  Index;
+  INT32  Index3;
 
   while (Number > 0 && mPTLen[Number - 1] == 0) {
     Number--;
@@ -1000,10 +1002,10 @@ WriteCLen (
   VOID
   )
 {
-  INT32 Index;
-  INT32 Index3;
-  INT32 Number;
-  INT32 Count;
+  INT32  Index;
+  INT32  Index3;
+  INT32  Number;
+  INT32  Count;
 
   Number = NC;
   while (Number > 0 && mCLen[Number - 1] == 0) {
@@ -1045,7 +1047,7 @@ WriteCLen (
 STATIC
 VOID
 EncodeC (
-  IN INT32 Value
+  IN INT32  Value
   )
 {
   PutBits (mCLen[Value], mCCode[Value]);
@@ -1054,7 +1056,7 @@ EncodeC (
 STATIC
 VOID
 EncodeP (
-  IN UINT32 Value
+  IN UINT32  Value
   )
 {
   UINT32  Index;
@@ -1089,10 +1091,11 @@ SendBlock (
   UINT32  Root;
   UINT32  Pos;
   UINT32  Size;
+
   Flags = 0;
 
-  Root  = MakeTree (NC, mCFreq, mCLen, mCCode);
-  Size  = mCFreq[Root];
+  Root = MakeTree (NC, mCFreq, mCLen, mCCode);
+  Size = mCFreq[Root];
   PutBits (16, Size);
   if (Root >= NC) {
     CountTFreq ();
@@ -1133,7 +1136,7 @@ SendBlock (
       Index3 = mBuf[Pos++];
       for (Index2 = 0; Index2 < 3; Index2++) {
         Index3 <<= UINT8_BIT;
-        Index3 += mBuf[Pos++];
+        Index3  += mBuf[Pos++];
       }
 
       EncodeP (Index3);
@@ -1160,11 +1163,11 @@ SendBlock (
 STATIC
 VOID
 Output (
-  IN UINT32 CharC,
-  IN UINT32 Pos
+  IN UINT32  CharC,
+  IN UINT32  Pos
   )
 {
-  STATIC UINT32 CPos;
+  STATIC UINT32  CPos;
 
   if ((mOutputMask >>= 1) == 0) {
     mOutputMask = 1U << (UINT8_BIT - 1);
@@ -1178,19 +1181,19 @@ Output (
       mOutputPos = 0;
     }
 
-    CPos        = mOutputPos++;
-    mBuf[CPos]  = 0;
+    CPos       = mOutputPos++;
+    mBuf[CPos] = 0;
   }
 
-  mBuf[mOutputPos++] = (UINT8) CharC;
+  mBuf[mOutputPos++] = (UINT8)CharC;
   mCFreq[CharC]++;
   if (CharC >= (1U << UINT8_BIT)) {
-    mBuf[CPos] |= mOutputMask;
-    mBuf[mOutputPos++]  = (UINT8) (Pos >> 24);
-    mBuf[mOutputPos++]  = (UINT8) (Pos >> 16);
-    mBuf[mOutputPos++]  = (UINT8) (Pos >> (UINT8_BIT));
-    mBuf[mOutputPos++]  = (UINT8) Pos;
-    CharC               = 0;
+    mBuf[CPos]        |= mOutputMask;
+    mBuf[mOutputPos++] = (UINT8)(Pos >> 24);
+    mBuf[mOutputPos++] = (UINT8)(Pos >> 16);
+    mBuf[mOutputPos++] = (UINT8)(Pos >> (UINT8_BIT));
+    mBuf[mOutputPos++] = (UINT8)Pos;
+    CharC              = 0;
     while (Pos) {
       Pos >>= 1;
       CharC++;
@@ -1206,7 +1209,7 @@ HufEncodeStart (
   VOID
   )
 {
-  INT32 Index;
+  INT32  Index;
 
   for (Index = 0; Index < NC; Index++) {
     mCFreq[Index] = 0;
@@ -1218,7 +1221,7 @@ HufEncodeStart (
 
   mOutputPos = mOutputMask = 0;
   InitPutBits ();
-  return ;
+  return;
 }
 
 STATIC
@@ -1234,7 +1237,7 @@ HufEncodeEnd (
   //
   PutBits (UINT8_BIT - 1, 0);
 
-  return ;
+  return;
 }
 
 STATIC
@@ -1257,37 +1260,37 @@ MakeCrcTable (
       }
     }
 
-    mCrcTable[Index] = (UINT16) Temp;
+    mCrcTable[Index] = (UINT16)Temp;
   }
 }
 
 /**
   Outputs rightmost n bits of x
- 
+
   @param Number the rightmost n bits of the data is used
   @param x      the data
 **/
 STATIC
 VOID
 PutBits (
-  IN INT32  Number,
-  IN UINT32 Value
+  IN INT32   Number,
+  IN UINT32  Value
   )
 {
-  UINT8 Temp;
+  UINT8  Temp;
 
   while (Number >= mBitCount) {
     //
     // Number -= mBitCount should never equal to 32
     //
-    Temp = (UINT8) (mSubBitBuf | (Value >> (Number -= mBitCount)));
+    Temp = (UINT8)(mSubBitBuf | (Value >> (Number -= mBitCount)));
     if (mDst < mDstUpperLimit) {
       *mDst++ = Temp;
     }
 
     mCompSize++;
-    mSubBitBuf  = 0;
-    mBitCount   = UINT8_BIT;
+    mSubBitBuf = 0;
+    mBitCount  = UINT8_BIT;
   }
 
   mSubBitBuf |= Value << (mBitCount -= Number);
@@ -1304,11 +1307,11 @@ PutBits (
 STATIC
 INT32
 FreadCrc (
-  OUT UINT8 *Pointer,
-  IN  INT32 Number
+  OUT UINT8  *Pointer,
+  IN  INT32  Number
   )
 {
-  INT32 Index;
+  INT32  Index;
 
   for (Index = 0; mSrc < mSrcUpperLimit && Index < Number; Index++) {
     *Pointer++ = *mSrc++;
@@ -1316,7 +1319,7 @@ FreadCrc (
 
   Number = Index;
 
-  Pointer -= Number;
+  Pointer   -= Number;
   mOrigSize += Number;
   Index--;
   while (Index >= 0) {
@@ -1333,8 +1336,8 @@ InitPutBits (
   VOID
   )
 {
-  mBitCount   = UINT8_BIT;
-  mSubBitBuf  = 0;
+  mBitCount  = UINT8_BIT;
+  mSubBitBuf = 0;
 }
 
 /**
@@ -1345,7 +1348,7 @@ InitPutBits (
 STATIC
 VOID
 CountLen (
-  IN INT32 Index
+  IN INT32  Index
   )
 {
   STATIC INT32  Depth = 0;
@@ -1368,7 +1371,7 @@ CountLen (
 STATIC
 VOID
 MakeLen (
-  IN INT32 Root
+  IN INT32  Root
   )
 {
   INT32   Index;
@@ -1407,7 +1410,7 @@ MakeLen (
     Index3 = mLenCnt[Index];
     Index3--;
     while (Index3 >= 0) {
-      mLen[*mSortPtr++] = (UINT8) Index;
+      mLen[*mSortPtr++] = (UINT8)Index;
       Index3--;
     }
   }
@@ -1416,19 +1419,19 @@ MakeLen (
 STATIC
 VOID
 DownHeap (
-  IN INT32 Index
+  IN INT32  Index
   )
 {
-  INT32 Index2;
-  INT32 Index3;
+  INT32  Index2;
+  INT32  Index3;
 
   //
   // priority queue: send Index-th entry down heap
   //
-  Index3  = mHeap[Index];
-  Index2  = 2 * Index;
+  Index3 = mHeap[Index];
+  Index2 = 2 * Index;
   while (Index2 <= mHeapSize) {
-    if (Index2 < mHeapSize && mFreq[mHeap[Index2]] > mFreq[mHeap[Index2 + 1]]) {
+    if ((Index2 < mHeapSize) && (mFreq[mHeap[Index2]] > mFreq[mHeap[Index2 + 1]])) {
       Index2++;
     }
 
@@ -1436,12 +1439,12 @@ DownHeap (
       break;
     }
 
-    mHeap[Index]  = mHeap[Index2];
-    Index         = Index2;
-    Index2        = 2 * Index;
+    mHeap[Index] = mHeap[Index2];
+    Index        = Index2;
+    Index2       = 2 * Index;
   }
 
-  mHeap[Index] = (INT16) Index3;
+  mHeap[Index] = (INT16)Index3;
 }
 
 /**
@@ -1454,9 +1457,9 @@ DownHeap (
 STATIC
 VOID
 MakeCode (
-  IN  INT32       Number,
-  IN  UINT8 Len[  ],
-  OUT UINT16 Code[]
+  IN  INT32   Number,
+  IN  UINT8   Len[],
+  OUT UINT16  Code[]
   )
 {
   INT32   Index;
@@ -1464,7 +1467,7 @@ MakeCode (
 
   Start[1] = 0;
   for (Index = 1; Index <= 16; Index++) {
-    Start[Index + 1] = (UINT16) ((Start[Index] + mLenCnt[Index]) << 1);
+    Start[Index + 1] = (UINT16)((Start[Index] + mLenCnt[Index]) << 1);
   }
 
   for (Index = 0; Index < Number; Index++) {
@@ -1485,16 +1488,16 @@ MakeCode (
 STATIC
 INT32
 MakeTree (
-  IN  INT32            NParm,
+  IN  INT32   NParm,
   IN  UINT16  FreqParm[],
-  OUT UINT8   LenParm[ ],
+  OUT UINT8   LenParm[],
   OUT UINT16  CodeParm[]
   )
 {
-  INT32 Index;
-  INT32 Index2;
-  INT32 Index3;
-  INT32 Avail;
+  INT32  Index;
+  INT32  Index2;
+  INT32  Index3;
+  INT32  Avail;
 
   //
   // make tree, calculate len[], return root
@@ -1509,7 +1512,7 @@ MakeTree (
     mLen[Index] = 0;
     if (mFreq[Index]) {
       mHeapSize++;
-      mHeap[mHeapSize] = (INT16) Index;
+      mHeap[mHeapSize] = (INT16)Index;
     }
   }
 
@@ -1529,22 +1532,22 @@ MakeTree (
   do {
     Index = mHeap[1];
     if (Index < mN) {
-      *mSortPtr++ = (UINT16) Index;
+      *mSortPtr++ = (UINT16)Index;
     }
 
     mHeap[1] = mHeap[mHeapSize--];
     DownHeap (1);
     Index2 = mHeap[1];
     if (Index2 < mN) {
-      *mSortPtr++ = (UINT16) Index2;
+      *mSortPtr++ = (UINT16)Index2;
     }
 
     Index3        = Avail++;
-    mFreq[Index3] = (UINT16) (mFreq[Index] + mFreq[Index2]);
-    mHeap[1]      = (INT16) Index3;
+    mFreq[Index3] = (UINT16)(mFreq[Index] + mFreq[Index2]);
+    mHeap[1]      = (INT16)Index3;
     DownHeap (1);
-    mLeft[Index3]   = (UINT16) Index;
-    mRight[Index3]  = (UINT16) Index2;
+    mLeft[Index3]  = (UINT16)Index;
+    mRight[Index3] = (UINT16)Index2;
   } while (mHeapSize > 1);
 
   mSortPtr = CodeParm;
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH 1/3] BaseTools: Source/C/Common: Fix doc block locations and convert to Doxygen
       [not found] ` <1746EB2C4B4E3528.29542@groups.io>
@ 2023-03-09 15:43   ` Rebecca Cran
  0 siblings, 0 replies; 9+ messages in thread
From: Rebecca Cran @ 2023-03-09 15:43 UTC (permalink / raw)
  To: devel, Bob Feng, Liming Gao, Yuwei Chen

Could I get some reviews of this please?

Patch 3/3 can be dropped since Uncrustify doesn't run on BaseTools.


-- 

Rebecca Cran


On 2/24/23 5:54 PM, Rebecca Cran wrote:
> Move the documentation blocks from between the parameter list and function
> body to above the function.
>
> Convert all the documentation blocks to Doxygen format.
>
> Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> ---
>   BaseTools/Source/C/Common/CommonLib.h               |  14 +-
>   BaseTools/Source/C/Common/Compress.h                |  45 +-
>   BaseTools/Source/C/Common/Crc32.h                   |  30 +-
>   BaseTools/Source/C/Common/Decompress.h              | 118 ++-
>   BaseTools/Source/C/Common/MemoryFile.h              |  72 +-
>   BaseTools/Source/C/Common/MyAlloc.h                 | 146 ++--
>   BaseTools/Source/C/Common/OsPath.h                  |  90 +-
>   BaseTools/Source/C/Common/ParseGuidedSectionTools.h |  95 +--
>   BaseTools/Source/C/Common/ParseInf.h                | 204 ++---
>   BaseTools/Source/C/Common/PcdValueCommon.h          | 175 ++--
>   BaseTools/Source/C/Common/StringFuncs.h             | 191 ++---
>   BaseTools/Source/C/Common/BasePeCoff.c              | 202 ++---
>   BaseTools/Source/C/Common/CommonLib.c               | 336 +++-----
>   BaseTools/Source/C/Common/Crc32.c                   |  30 +-
>   BaseTools/Source/C/Common/Decompress.c              | 470 ++++-------
>   BaseTools/Source/C/Common/EfiCompress.c             | 574 +++++--------
>   BaseTools/Source/C/Common/EfiUtilityMsgs.c          | 522 +++++-------
>   BaseTools/Source/C/Common/FirmwareVolumeBuffer.c    | 869 +++++++-------------
>   BaseTools/Source/C/Common/FvLib.c                   | 401 ++++-----
>   BaseTools/Source/C/Common/MemoryFile.c              |  84 +-
>   BaseTools/Source/C/Common/MyAlloc.c                 | 155 ++--
>   BaseTools/Source/C/Common/OsPath.c                  | 101 +--
>   BaseTools/Source/C/Common/ParseGuidedSectionTools.c |  92 +--
>   BaseTools/Source/C/Common/ParseInf.c                | 225 ++---
>   BaseTools/Source/C/Common/PcdValueCommon.c          | 303 +++----
>   BaseTools/Source/C/Common/PeCoffLoaderEx.c          |  66 +-
>   BaseTools/Source/C/Common/SimpleFileParsing.c       | 430 ++++------
>   BaseTools/Source/C/Common/StringFuncs.c             | 246 ++----
>   BaseTools/Source/C/Common/TianoCompress.c           | 610 +++++---------
>   29 files changed, 2452 insertions(+), 4444 deletions(-)
>
> diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h
> index 0f05d88db206..a841029c2aaa 100644
> --- a/BaseTools/Source/C/Common/CommonLib.h
> +++ b/BaseTools/Source/C/Common/CommonLib.h
> @@ -95,13 +95,6 @@ GetFileImage (
>     )
>   ;
>   
> -EFI_STATUS
> -PutFileImage (
> -  IN CHAR8    *OutputFileName,
> -  IN CHAR8    *OutputFileImage,
> -  IN UINT32   BytesToWrite
> -  )
> -;
>   /*++
>   
>   Routine Description:
> @@ -122,6 +115,13 @@ Routine Description:
>     EFI_OUT_OF_RESOURCES     No resource to complete operations.
>   
>   **/
> +EFI_STATUS
> +PutFileImage (
> +  IN CHAR8    *OutputFileName,
> +  IN CHAR8    *OutputFileImage,
> +  IN UINT32   BytesToWrite
> +  )
> +;
>   
>   UINT8
>   CalculateChecksum8 (
> diff --git a/BaseTools/Source/C/Common/Compress.h b/BaseTools/Source/C/Common/Compress.h
> index 40255a9665da..499e183c2b40 100644
> --- a/BaseTools/Source/C/Common/Compress.h
> +++ b/BaseTools/Source/C/Common/Compress.h
> @@ -15,13 +15,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   
>   #include "CommonLib.h"
>   #include <Common/UefiBaseTypes.h>
> -/*++
> -
> -Routine Description:
>   
> +/**
>     Tiano compression routine.
> -
> ---*/
> +**/
>   EFI_STATUS
>   TianoCompress (
>     IN      UINT8   *SrcBuffer,
> @@ -31,13 +28,9 @@ TianoCompress (
>     )
>   ;
>   
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Efi compression routine.
> -
> ---*/
> +**/
>   EFI_STATUS
>   EfiCompress (
>     IN      UINT8   *SrcBuffer,
> @@ -47,29 +40,21 @@ EfiCompress (
>     )
>   ;
>   
> -/*++
> -
> -Routine Description:
> -
> +/**
>     The compression routine.
>   
> -Arguments:
> +  @param SrcBuffer   The buffer storing the source data
> +  @param SrcSize     The size of source data
> +  @param DstBuffer   The buffer to store the compressed data
> +  @param DstSize     On input, the size of DstBuffer; On output,
> +              the size of the actual compressed data.
>   
> -  SrcBuffer   - The buffer storing the source data
> -  SrcSize     - The size of source data
> -  DstBuffer   - The buffer to store the compressed data
> -  DstSize     - On input, the size of DstBuffer; On output,
> -                the size of the actual compressed data.
> -
> -Returns:
> -
> -  EFI_BUFFER_TOO_SMALL  - The DstBuffer is too small. In this case,
> +  @retval EFI_BUFFER_TOO_SMALL  The DstBuffer is too small. In this case,
>                   DstSize contains the size needed.
> -  EFI_SUCCESS           - Compression is successful.
> -  EFI_OUT_OF_RESOURCES  - No resource to complete function.
> -  EFI_INVALID_PARAMETER - Parameter supplied is wrong.
> -
> ---*/
> +  @retval EFI_SUCCESS           Compression is successful.
> +  @retval EFI_OUT_OF_RESOURCES  No resource to complete function.
> +  @retval EFI_INVALID_PARAMETER Parameter supplied is wrong.
> +**/
>   typedef
>   EFI_STATUS
>   (*COMPRESS_FUNCTION) (
> diff --git a/BaseTools/Source/C/Common/Crc32.h b/BaseTools/Source/C/Common/Crc32.h
> index 61f99b96b565..3f6b5b35fc36 100644
> --- a/BaseTools/Source/C/Common/Crc32.h
> +++ b/BaseTools/Source/C/Common/Crc32.h
> @@ -11,31 +11,23 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   
>   #include <Common/UefiBaseTypes.h>
>   
> +/**
> +  The CalculateCrc32 routine.
> +
> +  @param Data        The buffer containing the data to be processed
> +  @param DataSize    The size of data to be processed
> +  @param CrcOut      A pointer to the caller allocated UINT32 that on
> +                    contains the CRC32 checksum of Data
> +
> +  @retval EFI_SUCCESS               - Calculation is successful.
> +  @retval EFI_INVALID_PARAMETER     - Data / CrcOut = NULL, or DataSize = 0
> +**/
>   EFI_STATUS
>   CalculateCrc32 (
>     IN  UINT8                             *Data,
>     IN  UINTN                             DataSize,
>     IN OUT UINT32                         *CrcOut
>     )
> -/*++
> -
> -Routine Description:
> -
> -  The CalculateCrc32 routine.
> -
> -Arguments:
> -
> -  Data        - The buffer containing the data to be processed
> -  DataSize    - The size of data to be processed
> -  CrcOut      - A pointer to the caller allocated UINT32 that on
> -                contains the CRC32 checksum of Data
> -
> -Returns:
> -
> -  EFI_SUCCESS               - Calculation is successful.
> -  EFI_INVALID_PARAMETER     - Data / CrcOut = NULL, or DataSize = 0
> -
> ---*/
>   ;
>   
>   #endif
> diff --git a/BaseTools/Source/C/Common/Decompress.h b/BaseTools/Source/C/Common/Decompress.h
> index 983a27d8fc26..00a1e31b8c21 100644
> --- a/BaseTools/Source/C/Common/Decompress.h
> +++ b/BaseTools/Source/C/Common/Decompress.h
> @@ -11,13 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   
>   #include <Common/UefiBaseTypes.h>
>   
> -EFI_STATUS
> -EfiGetInfo (
> -  IN      VOID    *Source,
> -  IN      UINT32  SrcSize,
> -  OUT     UINT32  *DstSize,
> -  OUT     UINT32  *ScratchSize
> -  );
>   /**
>   
>   Routine Description:
> @@ -37,95 +30,78 @@ Routine Description:
>     EFI_INVALID_PARAMETER - The source data is corrupted
>   
>   **/
> -
>   EFI_STATUS
> -EfiDecompress (
> +EfiGetInfo (
>     IN      VOID    *Source,
>     IN      UINT32  SrcSize,
> -  IN OUT  VOID    *Destination,
> -  IN      UINT32  DstSize,
> -  IN OUT  VOID    *Scratch,
> -  IN      UINT32  ScratchSize
> +  OUT     UINT32  *DstSize,
> +  OUT     UINT32  *ScratchSize
>     );
> +
>   /**
> -
> -Routine Description:
> -
>     The implementation of Efi Decompress().
>   
> -Arguments:
> -
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  Destination - The destination buffer to store the decompressed data
> -  DstSize     - The size of destination buffer.
> -  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - Decompression is successful
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> -
> +  @param Source      The source buffer containing the compressed data.
> +  @param SrcSize     The size of source buffer
> +  @param Destination The destination buffer to store the decompressed data
> +  @param DstSize     The size of destination buffer.
> +  @param Scratch     The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> +  @param ScratchSize The size of scratch buffer.
> +
> +  @retval EFI_SUCCESS           Decompression is successful
> +  @retval EFI_INVALID_PARAMETER The source data is corrupted
>   **/
> -
>   EFI_STATUS
> -TianoGetInfo (
> +EfiDecompress (
>     IN      VOID    *Source,
>     IN      UINT32  SrcSize,
> -  OUT     UINT32  *DstSize,
> -  OUT     UINT32  *ScratchSize
> +  IN OUT  VOID    *Destination,
> +  IN      UINT32  DstSize,
> +  IN OUT  VOID    *Scratch,
> +  IN      UINT32  ScratchSize
>     );
> +
>   /**
> -
> -Routine Description:
> -
>     The implementation Tiano Decompress GetInfo().
>   
> -Arguments:
> -
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  DstSize     - The size of destination buffer.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> +  @param Source      The source buffer containing the compressed data.
> +  @param SrcSize     The size of source buffer
> +  @param DstSize     The size of destination buffer.
> +  @param ScratchSize The size of scratch buffer.
>   
> +  @retval EFI_SUCCESS           The size of destination buffer and the size of scratch buffer are successfully retrieved.
> +  @retval EFI_INVALID_PARAMETER The source data is corrupted
>   **/
> -
>   EFI_STATUS
> -TianoDecompress (
> +TianoGetInfo (
>     IN      VOID    *Source,
>     IN      UINT32  SrcSize,
> -  IN OUT  VOID    *Destination,
> -  IN      UINT32  DstSize,
> -  IN OUT  VOID    *Scratch,
> -  IN      UINT32  ScratchSize
> +  OUT     UINT32  *DstSize,
> +  OUT     UINT32  *ScratchSize
>     );
> +
>   /**
> -
> -Routine Description:
> -
>     The implementation of Tiano Decompress().
>   
> -Arguments:
> -
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  Destination - The destination buffer to store the decompressed data
> -  DstSize     - The size of destination buffer.
> -  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - Decompression is successful
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> -
> +  @param Source      The source buffer containing the compressed data.
> +  @param SrcSize     The size of source buffer
> +  @param Destination The destination buffer to store the decompressed data
> +  @param DstSize     The size of destination buffer.
> +  @param Scratch     The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> +  @param ScratchSize The size of scratch buffer.
> +
> +  @retval EFI_SUCCESS           Decompression is successful
> +  @retval EFI_INVALID_PARAMETER The source data is corrupted
>   **/
> +EFI_STATUS
> +TianoDecompress (
> +  IN      VOID    *Source,
> +  IN      UINT32  SrcSize,
> +  IN OUT  VOID    *Destination,
> +  IN      UINT32  DstSize,
> +  IN OUT  VOID    *Scratch,
> +  IN      UINT32  ScratchSize
> +  );
>   
>   typedef
>   EFI_STATUS
> diff --git a/BaseTools/Source/C/Common/MemoryFile.h b/BaseTools/Source/C/Common/MemoryFile.h
> index 58fc8bb224f3..c84848cf15d6 100644
> --- a/BaseTools/Source/C/Common/MemoryFile.h
> +++ b/BaseTools/Source/C/Common/MemoryFile.h
> @@ -27,79 +27,53 @@ typedef struct {
>   // Functions declarations
>   //
>   
> -EFI_STATUS
> -GetMemoryFile (
> -  IN CHAR8       *InputFileName,
> -  OUT EFI_HANDLE *OutputMemoryFile
> -  )
> -;
>   /**
> -
> -Routine Description:
> -
>     This opens a file, reads it into memory and returns a memory file
>     object.
>   
> -Arguments:
> +  @param InputFile          Memory file image.
> +  @param OutputMemoryFile   Handle to memory file
>   
> -  InputFile          Memory file image.
> -  OutputMemoryFile   Handle to memory file
> -
> -Returns:
> -
> -  EFI_STATUS
> +  @return EFI_STATUS
>     OutputMemoryFile is valid if !EFI_ERROR
> -
>   **/
> +EFI_STATUS
> +GetMemoryFile (
> +  IN CHAR8       *InputFileName,
> +  OUT EFI_HANDLE *OutputMemoryFile
> +  )
> +;
> +
> +/**
> +  Frees all memory associated with the input memory file.
>   
> +  @param InputMemoryFile   Handle to memory file
>   
> +  @return EFI_STATUS
> +**/
>   EFI_STATUS
>   FreeMemoryFile (
>     IN EFI_HANDLE InputMemoryFile
>     )
>   ;
> -/**
> -
> -Routine Description:
> -
> -  Frees all memory associated with the input memory file.
> -
> -Arguments:
> -
> -  InputMemoryFile   Handle to memory file
> -
> -Returns:
>   
> -  EFI_STATUS
> -
> -**/
> -
> -
> -CHAR8 *
> -ReadMemoryFileLine (
> -  IN EFI_HANDLE     InputMemoryFile
> -  )
> -;
>   /**
> -
> -Routine Description:
> -
>     This function reads a line from the memory file.  The newline characters
>     are stripped and a null terminated string is returned.
>   
>     If the string pointer returned is non-NULL, then the caller must free the
>     memory associated with this string.
>   
> -Arguments:
> -
> -  InputMemoryFile   Handle to memory file
> -
> -Returns:
> -
> -  NULL if error or EOF
> -  NULL character termincated string otherwise (MUST BE FREED BY CALLER)
> +  @param InputMemoryFile   Handle to memory file
>   
> +  @retval NULL if error or EOF
> +  @retval NULL character termincated string otherwise (MUST BE FREED BY CALLER)
>   **/
> +CHAR8 *
> +ReadMemoryFileLine (
> +  IN EFI_HANDLE     InputMemoryFile
> +  )
> +;
>   
>   
>   #endif
> diff --git a/BaseTools/Source/C/Common/MyAlloc.h b/BaseTools/Source/C/Common/MyAlloc.h
> index aff29d05ab7d..de3323d30d97 100644
> --- a/BaseTools/Source/C/Common/MyAlloc.h
> +++ b/BaseTools/Source/C/Common/MyAlloc.h
> @@ -71,6 +71,17 @@ typedef struct MyAllocStruct {
>   #define MYALLOC_HEAD_MAGIK  0xBADFACED
>   #define MYALLOC_TAIL_MAGIK  0xDEADBEEF
>   
> +/**
> +  Check for corruptions in the allocated memory chain.  If a corruption
> +  is detection program operation stops w/ an exit(1) call.
> +
> +  @param Final When FALSE, MyCheck() returns if the allocated memory chain
> +               has not been corrupted.  When TRUE, MyCheck() returns if there
> +               are no un-freed allocations.  If there are un-freed allocations,
> +               they are displayed and exit(1) is called.
> +  @param File Set to __FILE__ by macro expansion.
> +  @param Line Set to __LINE__ by macro expansion.
> +**/
>   VOID
>   MyCheck (
>     BOOLEAN      Final,
> @@ -78,31 +89,20 @@ MyCheck (
>     UINTN        Line
>     )
>   ;
> -//
> -// *++
> -// Description:
> -//
> -//  Check for corruptions in the allocated memory chain.  If a corruption
> -//  is detection program operation stops w/ an exit(1) call.
> -//
> -// Parameters:
> -//
> -//  Final := When FALSE, MyCheck() returns if the allocated memory chain
> -//           has not been corrupted.  When TRUE, MyCheck() returns if there
> -//           are no un-freed allocations.  If there are un-freed allocations,
> -//           they are displayed and exit(1) is called.
> -//
> -//
> -//  File := Set to __FILE__ by macro expansion.
> -//
> -//  Line := Set to __LINE__ by macro expansion.
> -//
> -// Returns:
> -//
> -//  n/a
> -//
> -// --*/
> -//
> +
> +/**
> +  Allocate a new link in the allocation chain along with enough storage
> +  for the File[] string, requested Size and alignment overhead.  If
> +  memory cannot be allocated or the allocation chain has been corrupted,
> +  exit(1) will be called.
> +
> +  @param Size Number of bytes (UINT8) requested by the called.
> +              Size cannot be zero.
> +  @param File Set to __FILE__ by macro expansion.
> +  @param Line Set to __LINE__ by macro expansion.
> +
> +  @return Pointer to the caller's buffer.
> +**/
>   VOID  *
>   MyAlloc (
>     UINTN      Size,
> @@ -110,30 +110,20 @@ MyAlloc (
>     UINTN      Line
>     )
>   ;
> -//
> -// *++
> -// Description:
> -//
> -//  Allocate a new link in the allocation chain along with enough storage
> -//  for the File[] string, requested Size and alignment overhead.  If
> -//  memory cannot be allocated or the allocation chain has been corrupted,
> -//  exit(1) will be called.
> -//
> -// Parameters:
> -//
> -//  Size := Number of bytes (UINT8) requested by the called.
> -//          Size cannot be zero.
> -//
> -//  File := Set to __FILE__ by macro expansion.
> -//
> -//  Line := Set to __LINE__ by macro expansion.
> -//
> -// Returns:
> -//
> -//  Pointer to the caller's buffer.
> -//
> -// --*/
> -//
> +
> +/**
> +  This does a MyAlloc(), memcpy() and MyFree().  There is no optimization
> +  for shrinking or expanding buffers.  An invalid parameter will cause
> +  MyRealloc() to fail with a call to exit(1).
> +
> +  @param Ptr Pointer to the caller's buffer to be re-allocated.
> +             Ptr cannot be NULL.
> +  @param Size Size of new buffer.  Size cannot be zero.
> +  @param File Set to __FILE__ by macro expansion.
> +  @param Line Set to __LINE__ by macro expansion.
> +
> +  @return Pointer to new caller's buffer.
> +**/
>   VOID  *
>   MyRealloc (
>     VOID       *Ptr,
> @@ -142,31 +132,16 @@ MyRealloc (
>     UINTN      Line
>     )
>   ;
> -//
> -// *++
> -// Description:
> -//
> -//  This does a MyAlloc(), memcpy() and MyFree().  There is no optimization
> -//  for shrinking or expanding buffers.  An invalid parameter will cause
> -//  MyRealloc() to fail with a call to exit(1).
> -//
> -// Parameters:
> -//
> -//  Ptr := Pointer to the caller's buffer to be re-allocated.
> -//         Ptr cannot be NULL.
> -//
> -//  Size := Size of new buffer.  Size cannot be zero.
> -//
> -//  File := Set to __FILE__ by macro expansion.
> -//
> -//  Line := Set to __LINE__ by macro expansion.
> -//
> -// Returns:
> -//
> -//  Pointer to new caller's buffer.
> -//
> -// --*/
> -//
> +
> +/**
> +  Release a previously allocated buffer.  Invalid parameters will cause
> +  MyFree() to fail with an exit(1) call.
> +
> +  @param Ptr Pointer to the caller's buffer to be freed.
> +             A NULL pointer will be ignored.
> +  @param File Set to __FILE__ by macro expansion.
> +  @param Line Set to __LINE__ by macro expansion.
> +**/
>   VOID
>   MyFree (
>     VOID       *Ptr,
> @@ -174,28 +149,7 @@ MyFree (
>     UINTN      Line
>     )
>   ;
> -//
> -// *++
> -// Description:
> -//
> -//  Release a previously allocated buffer.  Invalid parameters will cause
> -//  MyFree() to fail with an exit(1) call.
> -//
> -// Parameters:
> -//
> -//  Ptr := Pointer to the caller's buffer to be freed.
> -//         A NULL pointer will be ignored.
> -//
> -//  File := Set to __FILE__ by macro expansion.
> -//
> -//  Line := Set to __LINE__ by macro expansion.
> -//
> -// Returns:
> -//
> -//  n/a
> -//
> -// --*/
> -//
> +
>   #else /* USE_MYALLOC */
>   
>   //
> diff --git a/BaseTools/Source/C/Common/OsPath.h b/BaseTools/Source/C/Common/OsPath.h
> index 1868103e7f1b..b1881c4a1ec7 100644
> --- a/BaseTools/Source/C/Common/OsPath.h
> +++ b/BaseTools/Source/C/Common/OsPath.h
> @@ -16,15 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   // Functions declarations
>   //
>   
> -CHAR8*
> -OsPathDirName (
> -  IN CHAR8    *FilePath
> -  )
> -;
>   /**
> -
> -Routine Description:
> -
>     This function returns the directory path which contains the particular path.
>     Some examples:
>       "a/b/c"  -> "a/b"
> @@ -37,26 +29,17 @@ Routine Description:
>   
>     The caller must free the string returned.
>   
> -Arguments:
> -
> -  FilePath     Path name of file to get the parent directory for.
> -
> -Returns:
> -
> -  NULL if error
> +  @param FilePath     Path name of file to get the parent directory for.
>   
> +  @return NULL if error
>   **/
> -
> -
> -VOID
> -OsPathNormPathInPlace (
> -  IN CHAR8    *Path
> +CHAR8*
> +OsPathDirName (
> +  IN CHAR8    *FilePath
>     )
>   ;
> +
>   /**
> -
> -Routine Description:
> -
>     This function returns the directory path which contains the particular path.
>     Some examples:
>       "a/b/../c" -> "a/c"
> @@ -65,27 +48,17 @@ Routine Description:
>   
>     This function does not check for the existence of the file.
>   
> -Arguments:
> -
> -  Path     Path name of file to normalize
> -
> -Returns:
> -
> -  The string is altered in place.
> +  @param Path     Path name of file to normalize
>   
> +  @return The string is altered in place.
>   **/
> -
> -
> -CHAR8*
> -OsPathPeerFilePath (
> -  IN CHAR8    *OldPath,
> -  IN CHAR8    *Peer
> +VOID
> +OsPathNormPathInPlace (
> +  IN CHAR8    *Path
>     )
>   ;
> +
>   /**
> -
> -Routine Description:
> -
>     This function replaces the final portion of a path with an alternative
>     'peer' filename.  For example:
>       "a/b/../c", "peer" -> "a/b/../peer"
> @@ -95,39 +68,30 @@ Routine Description:
>   
>     This function does not check for the existence of the file.
>   
> -Arguments:
> +  @param OldPath     Path name of replace the final segment
> +  @param Peer        The new path name to concatenate to become the peer path
>   
> -  OldPath     Path name of replace the final segment
> -  Peer        The new path name to concatenate to become the peer path
> +  @return A CHAR8* string, which must be freed by the caller
> +**/
> +CHAR8*
> +OsPathPeerFilePath (
> +  IN CHAR8    *OldPath,
> +  IN CHAR8    *Peer
> +  )
> +;
>   
> -Returns:
> +/**
> +  Checks if a file exists
>   
> -  A CHAR8* string, which must be freed by the caller
> +  @param InputFileName     The name of the file to check for existence
>   
> +  @retval TRUE              The file exists
> +  @retval FALSE             The file does not exist
>   **/
> -
> -
>   BOOLEAN
>   OsPathExists (
>     IN CHAR8    *InputFileName
>     )
>   ;
> -/**
> -
> -Routine Description:
> -
> -  Checks if a file exists
> -
> -Arguments:
> -
> -  InputFileName     The name of the file to check for existence
> -
> -Returns:
> -
> -  TRUE              The file exists
> -  FALSE             The file does not exist
> -
> -**/
> -
>   
>   #endif
> diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.h b/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
> index 2714b8ce8222..2180bbd0740f 100644
> --- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
> +++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.h
> @@ -15,106 +15,73 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   // Functions declarations
>   //
>   
> +/**
> +  This function parses the tools_def.txt file.  It returns a
> +  EFI_HANDLE object which can be used for the other library
> +  functions and should be passed to FreeParsedToolsDefHandle
> +  to free resources when the tools_def.txt information is no
> +  longer needed.
> +
> +  @param InputFile     Path name of file to read
> +
> +  @retval NULL if error parsing
> +  @retval A non-NULL EFI_HANDLE otherwise
> +**/
>   EFI_HANDLE
>   ParseGuidedSectionToolsFile (
>     IN CHAR8    *InputFile
>     )
>   ;
> +
>   /**
> -
> -Routine Description:
> -
>     This function parses the tools_def.txt file.  It returns a
>     EFI_HANDLE object which can be used for the other library
>     functions and should be passed to FreeParsedToolsDefHandle
>     to free resources when the tools_def.txt information is no
>     longer needed.
>   
> -Arguments:
> -
> -  InputFile     Path name of file to read
> -
> -Returns:
> -
> -  NULL if error parsing
> -  A non-NULL EFI_HANDLE otherwise
> +  @param InputFile     Memory file image.
>   
> +  @retval NULL if error parsing
> +  @retval A non-NULL EFI_HANDLE otherwise
>   **/
> -
> -
>   EFI_HANDLE
>   ParseGuidedSectionToolsMemoryFile (
>     IN EFI_HANDLE    InputFile
>     )
>   ;
> +
>   /**
> +  This function looks up the appropriate tool to use for extracting
> +  a GUID defined FV section.
>   
> -Routine Description:
> -
> -  This function parses the tools_def.txt file.  It returns a
> -  EFI_HANDLE object which can be used for the other library
> -  functions and should be passed to FreeParsedToolsDefHandle
> -  to free resources when the tools_def.txt information is no
> -  longer needed.
> -
> -Arguments:
> -
> -  InputFile     Memory file image.
> -
> -Returns:
> -
> -  NULL if error parsing
> -  A non-NULL EFI_HANDLE otherwise
> +  @param ParsedGuidedSectionToolsHandle    A parsed GUID section tools handle.
> +  @param SectionGuid                       The GUID for the section.
>   
> +  @retval NULL     if no tool is found or there is another error
> +  @retval Non-NULL The tool to use to access the section contents.  (The caller
> +             must free the memory associated with this string.)
>   **/
> -
>   CHAR8*
>   LookupGuidedSectionToolPath (
>     IN EFI_HANDLE ParsedGuidedSectionToolsHandle,
>     IN EFI_GUID   *SectionGuid
>     )
>   ;
> -/**
> -
> -Routine Description:
> -
> -  This function looks up the appropriate tool to use for extracting
> -  a GUID defined FV section.
> -
> -Arguments:
> -
> -  ParsedGuidedSectionToolsHandle    A parsed GUID section tools handle.
> -  SectionGuid                       The GUID for the section.
>   
> -Returns:
> -
> -  NULL     - if no tool is found or there is another error
> -  Non-NULL - The tool to use to access the section contents.  (The caller
> -             must free the memory associated with this string.)
> -
> -**/
> -
> -EFI_STATUS
> -FreeParsedGuidedSectionToolsHandle (
> -  IN EFI_HANDLE ParsedGuidedSectionToolsHandle
> -  )
> -;
>   /**
> -
> -Routine Description:
> -
>     Frees resources that were allocated by ParseGuidedSectionToolsFile.
>     After freeing these resources, the information that was parsed
>     is no longer accessible.
>   
> -Arguments:
> -
> -  ParsedToolDefHandle   Handle returned from ParseGuidedSectionToolsFile
> -
> -Returns:
> -
> -  EFI_STATUS
> +  @param ParsedToolDefHandle   Handle returned from ParseGuidedSectionToolsFile
>   
> +  @return EFI_STATUS
>   **/
> +EFI_STATUS
> +FreeParsedGuidedSectionToolsHandle (
> +  IN EFI_HANDLE ParsedGuidedSectionToolsHandle
> +  )
> +;
>   
>   #endif
> diff --git a/BaseTools/Source/C/Common/ParseInf.h b/BaseTools/Source/C/Common/ParseInf.h
> index 596cb3aa3bbb..a0881a5c9ed0 100644
> --- a/BaseTools/Source/C/Common/ParseInf.h
> +++ b/BaseTools/Source/C/Common/ParseInf.h
> @@ -20,18 +20,8 @@ extern "C" {
>   //
>   // Functions declarations
>   //
> -CHAR8 *
> -ReadLine (
> -  IN MEMORY_FILE    *InputFile,
> -  IN OUT CHAR8      *InputBuffer,
> -  IN UINTN          MaxLength
> -  )
> -;
> -
> -/*++
> -
> -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
> @@ -39,18 +29,31 @@ Routine Description:
>     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:
> +  @param InputFile     Memory file image.
> +  @param InputBuffer   Buffer to read into, must be MaxLength size.
> +  @param MaxLength     The maximum size of the input buffer.
>   
> -  InputFile     Memory file image.
> -  InputBuffer   Buffer to read into, must be MaxLength size.
> -  MaxLength     The maximum size of the input buffer.
> +  @retval NULL if error or EOF
> +  @retval InputBuffer otherwise
> +**/
> +CHAR8 *
> +ReadLine (
> +  IN MEMORY_FILE    *InputFile,
> +  IN OUT CHAR8      *InputBuffer,
> +  IN UINTN          MaxLength
> +  )
> +;
>   
> -Returns:
> +/**
> +  This function parses a file from the beginning to find a section.
> +  The section string may be anywhere within a line.
>   
> -  NULL if error or EOF
> -  InputBuffer otherwise
> +  @param InputFile     Memory file image.
> +  @param Section       Section to search for
>   
> ---*/
> +  @retval FALSE if error or EOF
> +  @retval TRUE if section found
> +**/
>   BOOLEAN
>   FindSection (
>     IN MEMORY_FILE    *InputFile,
> @@ -58,24 +61,21 @@ FindSection (
>     )
>   ;
>   
> -/*++
> -
> -Routine Description:
> -
> -  This function parses a file from the beginning to find a section.
> -  The section string may be anywhere within a line.
> -
> -Arguments:
> -
> -  InputFile     Memory file image.
> -  Section       Section to search for
> -
> -Returns:
> -
> -  FALSE if error or EOF
> -  TRUE if section found
> -
> ---*/
> +/**
> +  Finds a token value given the section and token to search for.
> +
> +  @param InputFile Memory file image.
> +  @param Section   The section to search for, a string within [].
> +  @param Token     The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
> +  @param Instance  The instance of the token to search for.  Zero is the first instance.
> +  @param Value     The string that holds the value following the =.  Must be MAX_LONG_FILE_PATH in size.
> +
> +  @retval EFI_SUCCESS             Value found.
> +  @retval EFI_ABORTED             Format error detected in INF file.
> +  @retval EFI_INVALID_PARAMETER   Input argument was null.
> +  @retval EFI_LOAD_ERROR          Error reading from the file.
> +  @retval EFI_NOT_FOUND           Section/Token/Value not found.
> +**/
>   EFI_STATUS
>   FindToken (
>     IN MEMORY_FILE    *InputFile,
> @@ -86,29 +86,16 @@ FindToken (
>     )
>   ;
>   
> -/*++
> +/**
> +  Converts a string to an EFI_GUID.  The string must be in the
> +  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
>   
> -Routine Description:
> +  @param GuidBuffer      pointer to destination Guid
> +  @param AsciiGuidBuffer pointer to ascii string
>   
> -  Finds a token value given the section and token to search for.
> -
> -Arguments:
> -
> -  InputFile Memory file image.
> -  Section   The section to search for, a string within [].
> -  Token     The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
> -  Instance  The instance of the token to search for.  Zero is the first instance.
> -  Value     The string that holds the value following the =.  Must be MAX_LONG_FILE_PATH in size.
> -
> -Returns:
> -
> -  EFI_SUCCESS             Value found.
> -  EFI_ABORTED             Format error detected in INF file.
> -  EFI_INVALID_PARAMETER   Input argument was null.
> -  EFI_LOAD_ERROR          Error reading from the file.
> -  EFI_NOT_FOUND           Section/Token/Value not found.
> -
> ---*/
> +  @retval EFI_ABORTED    Could not convert the string
> +  @retval EFI_SUCCESS    The string was successfully converted
> +**/
>   EFI_STATUS
>   StringToGuid (
>     IN CHAR8        *AsciiGuidBuffer,
> @@ -116,53 +103,36 @@ StringToGuid (
>     )
>   ;
>   
> -/*++
> -
> -Routine Description:
> -
> -  Converts a string to an EFI_GUID.  The string must be in the
> -  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
> -
> -Arguments:
> -
> -  GuidBuffer      - pointer to destination Guid
> -  AsciiGuidBuffer - pointer to ascii string
> -
> -Returns:
> -
> -  EFI_ABORTED    Could not convert the string
> -  EFI_SUCCESS    The string was successfully converted
> -
> ---*/
> -EFI_STATUS
> -AsciiStringToUint64 (
> -  IN CONST CHAR8  *AsciiString,
> -  IN BOOLEAN      IsHex,
> -  OUT UINT64      *ReturnValue
> -  )
> -;
> -
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Converts a null terminated ascii string that represents a number into a
>     UINT64 value.  A hex number may be preceded 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:
> +  @param AsciiString   The string to convert.
> +  @param IsHex         Force the string to be treated as a hex number.
> +  @param ReturnValue   The return value.
>   
> -  AsciiString   The string to convert.
> -  IsHex         Force the string to be treated as a hex number.
> -  ReturnValue   The return value.
> +  @retval EFI_SUCCESS   Number successfully converted.
> +  @retval EFI_ABORTED   Invalid character encountered.
> +**/
> +EFI_STATUS
> +AsciiStringToUint64 (
> +  IN CONST CHAR8  *AsciiString,
> +  IN BOOLEAN      IsHex,
> +  OUT UINT64      *ReturnValue
> +  )
> +;
>   
> -Returns:
> +/**
> +  This function reads a line, stripping any comments.
>   
> -  EFI_SUCCESS   Number successfully converted.
> -  EFI_ABORTED   Invalid character encountered.
> +  @param InputFile     Stream pointer.
> +  @param InputBuffer   Buffer to read into, must be MAX_LONG_FILE_PATH size.
>   
> ---*/
> +  @retval NULL if error or EOF
> +  @retval InputBuffer otherwise
> +**/
>   CHAR8 *
>   ReadLineInStream (
>     IN FILE       *InputFile,
> @@ -170,23 +140,16 @@ ReadLineInStream (
>     )
>   ;
>   
> -/*++
> +/**
> +  This function parses a stream file from the beginning to find a section.
> +  The section string may be anywhere within a line.
>   
> -Routine Description:
> +  @param InputFile     Stream pointer.
> +  @param Section       Section to search for
>   
> -  This function reads a line, stripping any comments.
> -
> -Arguments:
> -
> -  InputFile     Stream pointer.
> -  InputBuffer   Buffer to read into, must be MAX_LONG_FILE_PATH size.
> -
> -Returns:
> -
> -  NULL if error or EOF
> -  InputBuffer otherwise
> -
> ---*/
> +  @retval FALSE if error or EOF
> +  @retval TRUE if section found
> +**/
>   BOOLEAN
>   FindSectionInStream (
>     IN FILE       *InputFile,
> @@ -194,25 +157,6 @@ FindSectionInStream (
>     )
>   ;
>   
> -/*++
> -
> -Routine Description:
> -
> -  This function parses a stream file from the beginning to find a section.
> -  The section string may be anywhere within a line.
> -
> -Arguments:
> -
> -  InputFile     Stream pointer.
> -  Section       Section to search for
> -
> -Returns:
> -
> -  FALSE if error or EOF
> -  TRUE if section found
> -
> ---*/
> -
>   #ifdef __cplusplus
>   }
>   #endif
> diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h b/BaseTools/Source/C/Common/PcdValueCommon.h
> index 1652bd543039..02ef803be479 100644
> --- a/BaseTools/Source/C/Common/PcdValueCommon.h
> +++ b/BaseTools/Source/C/Common/PcdValueCommon.h
> @@ -24,101 +24,81 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   #define __STATIC_ASSERT _Static_assert
>   #endif
>   
> +/**
> +  Main function updates PCD values. It is auto generated by Build
> +**/
>   VOID
>   PcdEntryPoint (
>     VOID
>     )
> -/*++
>   
> -Routine Description:
> -
> -  Main function updates PCD values. It is auto generated by Build
> -
> -Arguments:
> -
> -  None
> -
> -Returns:
> -  None
> ---*/
>   ;
>   
> +/**
> +  Main function updates PCD values.
> +
> +  @param argc            Number of command line parameters.
> +  @param argv            Array of pointers to parameter strings.
> +
> +  @retval EXIT_SUCCESS
> +**/
>   int
>   PcdValueMain (
>     int   argc,
>     char  *argv[]
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Main function updates PCD values.
> -
> -Arguments:
> -
> -  argc            Number of command line parameters.
> -  argv            Array of pointers to parameter strings.
> -
> -Returns:
> -  EXIT_SUCCESS
> ---*/
>   ;
>   
> -VOID
> -__PcdSet (
> -  CHAR8   *SkuName             OPTIONAL,
> -  CHAR8   *DefaultValueName    OPTIONAL,
> -  CHAR8   *TokenSpaceGuidName,
> -  CHAR8   *TokenName,
> -  UINT64  Value
> -  )
> -/*++
> -
> -Routine Description:
> -
> -  Get PCD value
> -
> -Arguments:
> -
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -
> -Returns:
> -
> -  PCD value
> ---*/
> -;
> -
> -VOID
> -__PcdSet (
> -  CHAR8   *SkuName             OPTIONAL,
> -  CHAR8   *DefaultValueName    OPTIONAL,
> -  CHAR8   *TokenSpaceGuidName,
> -  CHAR8   *TokenName,
> -  UINT64  Value
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Set PCD value
>   
> -Arguments:
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
> +  @param Value                 PCD value to be set
> +**/
> +VOID
> +__PcdSet (
> +  CHAR8   *SkuName             OPTIONAL,
> +  CHAR8   *DefaultValueName    OPTIONAL,
> +  CHAR8   *TokenSpaceGuidName,
> +  CHAR8   *TokenName,
> +  UINT64  Value
> +  )
> +;
>   
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -  Value                 PCD value to be set
> +/**
> +  Get PCD value
>   
> -Returns:
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
>   
> -  None
> ---*/
> +  @return PCD value
> +**/
> +VOID
> +__PcdSet (
> +  CHAR8   *SkuName             OPTIONAL,
> +  CHAR8   *DefaultValueName    OPTIONAL,
> +  CHAR8   *TokenSpaceGuidName,
> +  CHAR8   *TokenName,
> +  UINT64  Value
> +  )
>   ;
>   
> +/**
> +  Get PCD value buffer
> +
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
> +  @param Size                  Size of PCD value buffer
> +
> +  @return PCD value buffer
> +**/
>   VOID *
>   __PcdGetPtr (
>     CHAR8   *SkuName             OPTIONAL,
> @@ -127,26 +107,18 @@ __PcdGetPtr (
>     CHAR8   *TokenName,
>     UINT32  *Size
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Get PCD value buffer
> -
> -Arguments:
> -
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -  Size                  Size of PCD value buffer
> -
> -Returns:
> -
> -  PCD value buffer
> ---*/
>   ;
>   
> +/**
> +  Set PCD value buffer
> +
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
> +  @param Size                  Size of PCD value
> +  @param Value                 Pointer to the updated PCD value buffer
> +**/
>   VOID
>   __PcdSetPtr (
>     CHAR8   *SkuName             OPTIONAL,
> @@ -156,25 +128,6 @@ __PcdSetPtr (
>     UINT32  Size,
>     UINT8   *Value
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Set PCD value buffer
> -
> -Arguments:
> -
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -  Size                  Size of PCD value
> -  Value                 Pointer to the updated PCD value buffer
> -
> -Returns:
> -
> -  None
> ---*/
>   ;
>   
>   #define PcdGet(A, B, C, D)  __PcdGet(#A, #B, #C, #D)
> diff --git a/BaseTools/Source/C/Common/StringFuncs.h b/BaseTools/Source/C/Common/StringFuncs.h
> index 8fc616de8034..23dce2724448 100644
> --- a/BaseTools/Source/C/Common/StringFuncs.h
> +++ b/BaseTools/Source/C/Common/StringFuncs.h
> @@ -29,216 +29,139 @@ typedef struct {
>   // Functions declarations
>   //
>   
> -CHAR8*
> -CloneString (
> -  IN CHAR8       *String
> -  )
> -;
>   /**
> -
> -Routine Description:
> -
>     Allocates a new string and copies 'String' to clone it
>   
> -Arguments:
> -
> -  String          The string to clone
> -
> -Returns:
> -
> -  CHAR8* - NULL if there are not enough resources
> +  @param String          The string to clone
>   
> +  @return CHAR8* - NULL if there are not enough resources
>   **/
> -
> -
> -EFI_STATUS
> -StripInfDscStringInPlace (
> +CHAR8*
> +CloneString (
>     IN CHAR8       *String
>     )
>   ;
> +
>   /**
> -
> -Routine Description:
> -
>     Remove all comments, leading and trailing whitespace from the string.
>   
> -Arguments:
> -
> -  String          The string to 'strip'
> -
> -Returns:
> -
> -  EFI_STATUS
> +  @param String          The string to 'strip'
>   
> +  @return EFI_STATUS
>   **/
> -
> -
> -STRING_LIST*
> -SplitStringByWhitespace (
> +EFI_STATUS
> +StripInfDscStringInPlace (
>     IN CHAR8       *String
>     )
>   ;
> +
>   /**
> -
> -Routine Description:
> -
>     Creates and returns a 'split' STRING_LIST by splitting the string
>     on whitespace boundaries.
>   
> -Arguments:
> -
> -  String          The string to 'split'
> -
> -Returns:
> -
> -  EFI_STATUS
> +  @param String          The string to 'split'
>   
> +  @return EFI_STATUS
>   **/
> -
> -
>   STRING_LIST*
> -NewStringList (
> +SplitStringByWhitespace (
> +  IN CHAR8       *String
>     )
>   ;
> +
>   /**
> -
> -Routine Description:
> -
>     Creates a new STRING_LIST with 0 strings.
>   
> -Returns:
> -
> -  STRING_LIST* - Null if there is not enough resources to create the object.
> -
> +  @return STRING_LIST* - Null if there is not enough resources to create the object.
>   **/
> -
> -
> -EFI_STATUS
> -AppendCopyOfStringToList (
> -  IN OUT STRING_LIST **StringList,
> -  IN CHAR8       *String
> +STRING_LIST*
> +NewStringList (
>     )
>   ;
> +
> +
>   /**
> -
> -Routine Description:
> -
>     Adds String to StringList.  A new copy of String is made before it is
>     added to StringList.
>   
> -Returns:
> -
> -  EFI_STATUS
> -
> +  @return EFI_STATUS
>   **/
> -
> -
>   EFI_STATUS
> -RemoveLastStringFromList (
> -  IN STRING_LIST       *StringList
> +AppendCopyOfStringToList (
> +  IN OUT STRING_LIST **StringList,
> +  IN CHAR8       *String
>     )
>   ;
> +
>   /**
> -
> -Routine Description:
> -
>     Removes the last string from StringList and frees the memory associated
>     with it.
>   
> -Arguments:
> +  @param StringList        The string list to remove the string from
>   
> -  StringList        The string list to remove the string from
> -
> -Returns:
> +  @return EFI_STATUS
> +**/
> +EFI_STATUS
> +RemoveLastStringFromList (
> +  IN STRING_LIST       *StringList
> +  )
> +;
>   
> -  EFI_STATUS
>   
> -**/
> +/**
> +  Allocates a STRING_LIST structure that can store StringCount strings.
>   
> +  @param StringCount        The number of strings that need to be stored
>   
> +  @return EFI_STATUS
> +**/
>   STRING_LIST*
>   AllocateStringListStruct (
>     IN UINTN StringCount
>     )
>   ;
> -/**
> -
> -Routine Description:
> -
> -  Allocates a STRING_LIST structure that can store StringCount strings.
> -
> -Arguments:
> -
> -  StringCount        The number of strings that need to be stored
>   
> -Returns:
>   
> -  EFI_STATUS
> -
> -**/
> -
> -
> -VOID
> -FreeStringList (
> -  IN STRING_LIST       *StringList
> -  )
> -;
>   /**
> -
> -Routine Description:
> -
>     Frees all memory associated with StringList.
>   
> -Arguments:
> -
> -  StringList        The string list to free
> -
> -Returns:
> -
> -  EFI_STATUS
> +  @param StringList        The string list to free
>   
> +  @return EFI_STATUS
>   **/
> -
> -
> -CHAR8*
> -StringListToString (
> +VOID
> +FreeStringList (
>     IN STRING_LIST       *StringList
>     )
>   ;
> +
> +
>   /**
> -
> -Routine Description:
> -
>     Generates a string that represents the STRING_LIST
>   
> -Arguments:
> +  @param StringList        The string list to convert to a string
>   
> -  StringList        The string list to convert to a string
> -
> -Returns:
> -
> -  CHAR8* - The string list represented with a single string.  The returned
> +  @return CHAR8* The string list represented with a single string.  The returned
>              string must be freed by the caller.
> -
>   **/
> -
> -
> -VOID
> -PrintStringList (
> +CHAR8*
> +StringListToString (
>     IN STRING_LIST       *StringList
>     )
>   ;
> +
> +
>   /**
> -
> -Routine Description:
> -
>     Prints out the string list
>   
> -Arguments:
> -
> -  StringList        The string list to print
> -
> +  @param StringList        The string list to print
>   **/
> +VOID
> +PrintStringList (
> +  IN STRING_LIST       *StringList
> +  )
> +;
> +
>   
>   
>   #endif
> diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c
> index 30400d1341dc..b8bfb7b58b91 100644
> --- a/BaseTools/Source/C/Common/BasePeCoff.c
> +++ b/BaseTools/Source/C/Common/BasePeCoff.c
> @@ -77,33 +77,23 @@ PeCoffLoaderRelocateLoongArch64Image (
>     IN UINT64      Adjust
>     );
>   
> -STATIC
> -RETURN_STATUS
> -PeCoffLoaderGetPeHeader (
> -  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,
> -  OUT    EFI_IMAGE_OPTIONAL_HEADER_UNION **PeHdr,
> -  OUT    EFI_TE_IMAGE_HEADER             **TeHdr
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Retrieves the PE or TE Header from a PE/COFF or TE image
>   
> -Arguments:
> +  @param ImageContext  The context of the image being loaded
> +  @param PeHdr         The buffer in which to return the PE header
> +  @param TeHdr         The buffer in which to return the TE header
>   
> -  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 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.
> -
> ---*/
> +**/
> +STATIC
> +RETURN_STATUS
> +PeCoffLoaderGetPeHeader (
> +  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT    *ImageContext,
> +  OUT    EFI_IMAGE_OPTIONAL_HEADER_UNION **PeHdr,
> +  OUT    EFI_TE_IMAGE_HEADER             **TeHdr
> +  )
>   {
>     RETURN_STATUS         Status;
>     EFI_IMAGE_DOS_HEADER  DosHdr;
> @@ -150,6 +140,17 @@ Routine Description:
>     return RETURN_SUCCESS;
>   }
>   
> +/**
> +  Checks the PE or TE header of a PE/COFF or TE image to determine if it supported
> +
> +  @param ImageContext  The context of the image being loaded
> +  @param PeHdr         The buffer in which to return the PE header
> +  @param TeHdr         The buffer in which to return the TE header
> +
> +  @retval RETURN_SUCCESS if the PE/COFF or TE image is supported
> +  @retval RETURN_UNSUPPORTED of the PE/COFF or TE image is not supported.
> +
> +**/
>   STATIC
>   RETURN_STATUS
>   PeCoffLoaderCheckImageType (
> @@ -157,26 +158,6 @@ PeCoffLoaderCheckImageType (
>     IN     EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr,
>     IN     EFI_TE_IMAGE_HEADER                   *TeHdr
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Checks the PE or TE header of a PE/COFF or TE image to determine if it supported
> -
> -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/COFF or TE image is supported
> -  RETURN_UNSUPPORTED of the PE/COFF or TE image is not supported.
> -
> ---*/
>   {
>     //
>     // See if the machine type is supported.
> @@ -239,31 +220,24 @@ Routine Description:
>     return RETURN_SUCCESS;
>   }
>   
> +/**
> +  Retrieves information on a PE/COFF image
> +
> +  @param This         Calling context
> +  @param ImageContext The context of the image being loaded
> +
> +  @retval RETURN_SUCCESS           The information on the PE/COFF image was collected.
> +  @retval RETURN_INVALID_PARAMETER ImageContext is NULL.
> +  @retval RETURN_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
>   EFIAPI
>   PeCoffLoaderGetImageInfo (
>     IN OUT PE_COFF_LOADER_IMAGE_CONTEXT           *ImageContext
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Retrieves information on a PE/COFF image
> -
> -Arguments:
> -
> -  This         - Calling context
> -  ImageContext - The context of the image being loaded
> -
> -Returns:
> -
> -  RETURN_SUCCESS           - The information on the PE/COFF image was collected.
> -  RETURN_INVALID_PARAMETER - ImageContext is NULL.
> -  RETURN_UNSUPPORTED       - The PE/COFF image is not supported.
> -  Otherwise             - The error status from reading the PE/COFF image using the
> -                          ImageContext->ImageRead() function
> -
> ---*/
>   {
>     RETURN_STATUS                   Status;
>     EFI_IMAGE_OPTIONAL_HEADER_UNION *PeHdr;
> @@ -539,29 +513,21 @@ Routine Description:
>     return RETURN_SUCCESS;
>   }
>   
> -STATIC
> -VOID *
> -PeCoffLoaderImageAddress (
> -  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,
> -  IN     UINTN                                 Address
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Converts an image address to the loaded address
>   
> -Arguments:
> +  @param ImageContext  The context of the image being loaded
> +  @param Address       The address to be converted to the loaded address
>   
> -  ImageContext  - The context of the image being loaded
> -
> -  Address       - The address to be converted to the loaded address
> -
> -Returns:
> -
> -  NULL if the address can not be converted, otherwise, the converted address
> +  @return NULL if the address can not be converted, otherwise, the converted address
>   
>   --*/
> +STATIC
> +VOID *
> +PeCoffLoaderImageAddress (
> +  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,
> +  IN     UINTN                                 Address
> +  )
>   {
>     if (Address >= ImageContext->ImageSize) {
>       ImageContext->ImageError = IMAGE_ERROR_INVALID_IMAGE_ADDRESS;
> @@ -571,30 +537,22 @@ Routine Description:
>     return (UINT8 *) ((UINTN) ImageContext->ImageAddress + Address);
>   }
>   
> -RETURN_STATUS
> -EFIAPI
> -PeCoffLoaderRelocateImage (
> -  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Relocates a PE/COFF image in memory
>   
> -Arguments:
> -
> -  This         - Calling context
> -
> -  ImageContext - Contains information on the loaded image to relocate
> -
> -Returns:
> -
> -  RETURN_SUCCESS      if the PE/COFF image was relocated
> -  RETURN_LOAD_ERROR   if the image is not a valid PE/COFF image
> -  RETURN_UNSUPPORTED  not support
> -
> ---*/
> +  @param This         Calling context
> +  @param ImageContext Contains information on the loaded image to relocate
> +
> +  @retval RETURN_SUCCESS      if the PE/COFF image was relocated
> +  @retval RETURN_LOAD_ERROR   if the image is not a valid PE/COFF image
> +  @retval RETURN_UNSUPPORTED  not support
> +
> +**/
> +RETURN_STATUS
> +EFIAPI
> +PeCoffLoaderRelocateImage (
> +  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
> +  )
>   {
>     RETURN_STATUS                         Status;
>     EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr;
> @@ -853,31 +811,23 @@ Routine Description:
>     return RETURN_SUCCESS;
>   }
>   
> -RETURN_STATUS
> -EFIAPI
> -PeCoffLoaderLoadImage (
> -  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Loads a PE/COFF image into memory
>   
> -Arguments:
> -
> -  This         - Calling context
> -
> -  ImageContext - Contains information on image to load into memory
> -
> -Returns:
> -
> -  RETURN_SUCCESS            if the PE/COFF image was loaded
> -  RETURN_BUFFER_TOO_SMALL   if the caller did not provide a large enough buffer
> -  RETURN_LOAD_ERROR         if the image is a runtime driver with no relocations
> -  RETURN_INVALID_PARAMETER  if the image address is invalid
> -
> ---*/
> +  @param This         Calling context
> +  @param ImageContext Contains information on image to load into memory
> +
> +  @retval RETURN_SUCCESS            if the PE/COFF image was loaded
> +  @retval RETURN_BUFFER_TOO_SMALL   if the caller did not provide a large enough buffer
> +  @retval RETURN_LOAD_ERROR         if the image is a runtime driver with no relocations
> +  @retval RETURN_INVALID_PARAMETER  if the image address is invalid
> +
> +**/
> +RETURN_STATUS
> +EFIAPI
> +PeCoffLoaderLoadImage (
> +  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
> +  )
>   {
>     RETURN_STATUS                         Status;
>     EFI_IMAGE_OPTIONAL_HEADER_UNION       *PeHdr;
> diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c
> index 7fb4ab764fcd..cd270f9a9074 100644
> --- a/BaseTools/Source/C/Common/CommonLib.c
> +++ b/BaseTools/Source/C/Common/CommonLib.c
> @@ -26,28 +26,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>       } \
>     } while (FALSE)
>   
> -VOID
> -PeiZeroMem (
> -  IN VOID   *Buffer,
> -  IN UINTN  Size
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Set Buffer to zero for Size bytes.
>   
> -Arguments:
> -
> -  Buffer  - Memory to set.
> -
> -  Size    - Number of bytes to set
> -
> -Returns:
> -
> -  None
> -
> ---*/
> +  @param Buffer  Memory to set.
> +  @param Size    Number of bytes to set
> +**/
> +VOID
> +PeiZeroMem (
> +  IN VOID   *Buffer,
> +  IN UINTN  Size
> +  )
>   {
>     INT8  *Ptr;
>   
> @@ -57,31 +46,19 @@ Routine Description:
>     }
>   }
>   
> -VOID
> -PeiCopyMem (
> -  IN VOID   *Destination,
> -  IN VOID   *Source,
> -  IN UINTN  Length
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Copy Length bytes from Source to Destination.
>   
> -Arguments:
> -
> -  Destination - Target of copy
> -
> -  Source      - Place to copy from
> -
> -  Length      - Number of bytes to copy
> -
> -Returns:
> -
> -  None
> -
> ---*/
> +  @param Destination Target of copy
> +  @param Source      Place to copy from
> +  @param Length      Number of bytes to copy
> +**/
> +VOID
> +PeiCopyMem (
> +  IN VOID   *Destination,
> +  IN VOID   *Source,
> +  IN UINTN  Length
> +  )
>   {
>     CHAR8 *Destination8;
>     CHAR8 *Source8;
> @@ -112,27 +89,20 @@ CopyMem (
>     PeiCopyMem (Destination, Source, Length);
>   }
>   
> +/**
> +  Compares to GUIDs
> +
> +  @param Guid1 guid to compare
> +  @param Guid2 guid to compare
> +
> +  @retval =  0  if Guid1 == Guid2
> +  @retval != 0  if Guid1 != Guid2
> +**/
>   INTN
>   CompareGuid (
>     IN EFI_GUID     *Guid1,
>     IN EFI_GUID     *Guid2
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Compares to GUIDs
> -
> -Arguments:
> -
> -  Guid1 - guid to compare
> -  Guid2 - guid to compare
> -
> -Returns:
> -  =  0  if Guid1 == Guid2
> -  != 0  if Guid1 != Guid2
> -
> ---*/
>   {
>     INT32 *g1;
>     INT32 *g2;
> @@ -152,34 +122,25 @@ Routine Description:
>     return r;
>   }
>   
> +/**
> +  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.
>   
> +  @param InputFileName     The name of the file to read.
> +  @param InputFileImage    A pointer to the memory buffer.
> +  @param BytesRead         The size of the memory buffer.
> +
> +  @retval EFI_SUCCESS              The function completed successfully.
> +  @retval EFI_INVALID_PARAMETER    One of the input parameters was invalid.
> +  @retval EFI_ABORTED              An error occurred.
> +  @retval EFI_OUT_OF_RESOURCES     No resource to complete operations.
> +**/
>   EFI_STATUS
>   GetFileImage (
>     IN CHAR8    *InputFileName,
>     OUT CHAR8   **InputFileImage,
>     OUT UINT32  *BytesRead
>     )
> -/*++
> -
> -Routine Description:
> -
> -  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:
> -
> -  InputFileName     The name of the file to read.
> -  InputFileImage    A pointer to the memory buffer.
> -  BytesRead         The size of the memory buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS              The function completed successfully.
> -  EFI_INVALID_PARAMETER    One of the input parameters was invalid.
> -  EFI_ABORTED              An error occurred.
> -  EFI_OUT_OF_RESOURCES     No resource to complete operations.
> -
> ---*/
>   {
>     FILE    *InputFile;
>     UINT32  FileSize;
> @@ -255,32 +216,24 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  This function opens a file and writes OutputFileImage into the file.
> +
> +  @param OutputFileName     The name of the file to write.
> +  @param OutputFileImage    A pointer to the memory buffer.
> +  @param BytesToWrite       The size of the memory buffer.
> +
> +  @retval EFI_SUCCESS              The function completed successfully.
> +  @retval EFI_INVALID_PARAMETER    One of the input parameters was invalid.
> +  @retval EFI_ABORTED              An error occurred.
> +  @retval EFI_OUT_OF_RESOURCES     No resource to complete operations.
> +**/
>   EFI_STATUS
>   PutFileImage (
>     IN CHAR8    *OutputFileName,
>     IN CHAR8    *OutputFileImage,
>     IN UINT32   BytesToWrite
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function opens a file and writes OutputFileImage into the file.
> -
> -Arguments:
> -
> -  OutputFileName     The name of the file to write.
> -  OutputFileImage    A pointer to the memory buffer.
> -  BytesToWrite       The size of the memory buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS              The function completed successfully.
> -  EFI_INVALID_PARAMETER    One of the input parameters was invalid.
> -  EFI_ABORTED              An error occurred.
> -  EFI_OUT_OF_RESOURCES     No resource to complete operations.
> -
> ---*/
>   {
>     FILE    *OutputFile;
>     UINT32  BytesWrote;
> @@ -320,52 +273,36 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  This function calculates the value needed for a valid UINT8 checksum
> +
> +  @param Buffer      Pointer to buffer containing byte data of component.
> +  @param Size        Size of the buffer
> +
> +  @return The 8 bit checksum value needed.
> +**/
>   UINT8
>   CalculateChecksum8 (
>     IN UINT8        *Buffer,
>     IN UINTN        Size
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function calculates the value needed for a valid UINT8 checksum
> -
> -Arguments:
> -
> -  Buffer      Pointer to buffer containing byte data of component.
> -  Size        Size of the buffer
> -
> -Returns:
> -
> -  The 8 bit checksum value needed.
> -
> ---*/
>   {
>     return (UINT8) (0x100 - CalculateSum8 (Buffer, Size));
>   }
>   
> +/**
> +  This function calculates the UINT8 sum for the requested region.
> +
> +  @param Buffer      Pointer to buffer containing byte data of component.
> +  @param Size      Size of the buffer
> +
> +  @return The 8 bit checksum value needed.
> +**/
>   UINT8
>   CalculateSum8 (
>     IN UINT8  *Buffer,
>     IN UINTN  Size
>     )
> -/*++
> -
> -Routine Description::
> -
> -  This function calculates the UINT8 sum for the requested region.
> -
> -Arguments:
> -
> -  Buffer      Pointer to buffer containing byte data of component.
> -  Size        Size of the buffer
> -
> -Returns:
> -
> -  The 8 bit checksum value needed.
> -
> ---*/
>   {
>     UINTN Index;
>     UINT8 Sum;
> @@ -382,52 +319,36 @@ Routine Description::
>     return Sum;
>   }
>   
> -UINT16
> -CalculateChecksum16 (
> -  IN UINT16       *Buffer,
> -  IN UINTN        Size
> -  )
> -/*++
> -
> -Routine Description::
> -
> +/**
>     This function calculates the value needed for a valid UINT16 checksum
>   
> -Arguments:
> -
> -  Buffer      Pointer to buffer containing byte data of component.
> -  Size        Size of the buffer
> -
> -Returns:
> -
> -  The 16 bit checksum value needed.
> -
> ---*/
> +  @param Buffer      Pointer to buffer containing byte data of component.
> +  @param Size        Size of the buffer
> +
> +  @return The 16 bit checksum value needed.
> +**/
> +UINT16
> +CalculateChecksum16 (
> +  IN UINT16       *Buffer,
> +  IN UINTN        Size
> +  )
>   {
>     return (UINT16) (0x10000 - CalculateSum16 (Buffer, Size));
>   }
>   
> -UINT16
> -CalculateSum16 (
> -  IN UINT16       *Buffer,
> -  IN UINTN        Size
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     This function calculates the UINT16 sum for the requested region.
>   
> -Arguments:
> -
> -  Buffer      Pointer to buffer containing byte data of component.
> -  Size        Size of the buffer
> -
> -Returns:
> -
> -  The 16 bit checksum
> -
> ---*/
> +  @param Buffer      Pointer to buffer containing byte data of component.
> +  @param Size        Size of the buffer
> +
> +  @return The 16 bit checksum
> +**/
> +UINT16
> +CalculateSum16 (
> +  IN UINT16       *Buffer,
> +  IN UINTN        Size
> +  )
>   {
>     UINTN   Index;
>     UINT16  Sum;
> @@ -444,26 +365,18 @@ Routine Description:
>     return (UINT16) Sum;
>   }
>   
> +/**
> +  This function prints a GUID to STDOUT.
> +
> +  @param Guid    Pointer to a GUID to print.
> +
> +  @retval EFI_SUCCESS             The GUID was printed.
> +  @retval EFI_INVALID_PARAMETER   The input was NULL.
> +**/
>   EFI_STATUS
>   PrintGuid (
>     IN EFI_GUID *Guid
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function prints a GUID to STDOUT.
> -
> -Arguments:
> -
> -  Guid    Pointer to a GUID to print.
> -
> -Returns:
> -
> -  EFI_SUCCESS             The GUID was printed.
> -  EFI_INVALID_PARAMETER   The input was NULL.
> -
> ---*/
>   {
>     if (Guid == NULL) {
>       Error (NULL, 0, 2000, "Invalid parameter", "PrintGuidToBuffer() called with a NULL value");
> @@ -487,6 +400,18 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  This function prints a GUID to a buffer
> +
> +  @param Guid      Pointer to a GUID to print.
> +  @param Buffer    Pointer to a user-provided buffer to print to
> +  @param BufferLen Size of the Buffer
> +  @param Uppercase If use upper case.
> +
> +  @retval EFI_SUCCESS             The GUID was printed.
> +  @retval EFI_INVALID_PARAMETER   The input was NULL.
> +  @retval EFI_BUFFER_TOO_SMALL    The input buffer was not big enough
> +**/
>   EFI_STATUS
>   PrintGuidToBuffer (
>     IN EFI_GUID     *Guid,
> @@ -494,26 +419,6 @@ PrintGuidToBuffer (
>     IN UINT32       BufferLen,
>     IN BOOLEAN      Uppercase
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function prints a GUID to a buffer
> -
> -Arguments:
> -
> -  Guid      - Pointer to a GUID to print.
> -  Buffer    - Pointer to a user-provided buffer to print to
> -  BufferLen - Size of the Buffer
> -  Uppercase - If use upper case.
> -
> -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) {
>       Error (NULL, 0, 2000, "Invalid parameter", "PrintGuidToBuffer() called with a NULL value");
> @@ -591,22 +496,17 @@ char *strlwr(char *s)
>   //
>   CHAR8 mCommonLibFullPath[MAX_LONG_FILE_PATH];
>   
> +/**
> +  Convert FileName to the long file path, which can support larger than 260 length.
> +
> +  @param FileName         FileName.
> +
> +  @return LongFilePath      A pointer to the converted long file path.
> +**/
>   CHAR8 *
>   LongFilePath (
>    IN CHAR8 *FileName
>    )
> -/*++
> -
> -Routine Description:
> -  Convert FileName to the long file path, which can support larger than 260 length.
> -
> -Arguments:
> -  FileName         - FileName.
> -
> -Returns:
> -  LongFilePath      A pointer to the converted long file path.
> -
> ---*/
>   {
>   #ifdef __GNUC__
>     //
> diff --git a/BaseTools/Source/C/Common/Crc32.c b/BaseTools/Source/C/Common/Crc32.c
> index 7281d5f0e913..00cae948985d 100644
> --- a/BaseTools/Source/C/Common/Crc32.c
> +++ b/BaseTools/Source/C/Common/Crc32.c
> @@ -268,31 +268,23 @@ UINT32  mCrcTable[256] = {
>     0x2D02EF8D
>   };
>   
> +/**
> +  The CalculateCrc32 routine.
> +
> +  @param Data        The buffer containing the data to be processed
> +  @param DataSize    The size of data to be processed
> +  @param CrcOut      A pointer to the caller allocated UINT32 that on
> +                     contains the CRC32 checksum of Data
> +
> +  @retval EFI_SUCCESS               Calculation is successful.
> +  @retval EFI_INVALID_PARAMETER     Data / CrcOut = NULL, or DataSize = 0
> +**/
>   EFI_STATUS
>   CalculateCrc32 (
>     IN  UINT8                             *Data,
>     IN  UINTN                             DataSize,
>     IN OUT UINT32                         *CrcOut
>     )
> -/*++
> -
> -Routine Description:
> -
> -  The CalculateCrc32 routine.
> -
> -Arguments:
> -
> -  Data        - The buffer containing the data to be processed
> -  DataSize    - The size of data to be processed
> -  CrcOut      - A pointer to the caller allocated UINT32 that on
> -                contains the CRC32 checksum of Data
> -
> -Returns:
> -
> -  EFI_SUCCESS               - Calculation is successful.
> -  EFI_INVALID_PARAMETER     - Data / CrcOut = NULL, or DataSize = 0
> -
> ---*/
>   {
>     UINT32  Crc;
>     UINTN   Index;
> diff --git a/BaseTools/Source/C/Common/Decompress.c b/BaseTools/Source/C/Common/Decompress.c
> index d85098f13140..a0f54c08342b 100644
> --- a/BaseTools/Source/C/Common/Decompress.c
> +++ b/BaseTools/Source/C/Common/Decompress.c
> @@ -62,26 +62,18 @@ typedef struct {
>   
>   STATIC UINT16 mPbit = EFIPBIT;
>   
> -STATIC
> -VOID
> -FillBuf (
> -  IN  SCRATCH_DATA  *Sd,
> -  IN  UINT16        NumOfBits
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
>   
> -Arguments:
> -
> -  Sd        - The global scratch data
> -  NumOfBit  - The number of bits to shift and read.
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param Sd        The global scratch data
> +  @param NumOfBit  The number of bits to shift and read.
> +**/
> +STATIC
> +VOID
> +FillBuf (
> +  IN  SCRATCH_DATA  *Sd,
> +  IN  UINT16        NumOfBits
> +  )
>   {
>     Sd->mBitBuf = (UINT32) (((UINT64)Sd->mBitBuf) << NumOfBits);
>   
> @@ -112,30 +104,22 @@ Returns: (VOID)
>     Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
>   }
>   
> -STATIC
> -UINT32
> -GetBits (
> -  IN  SCRATCH_DATA  *Sd,
> -  IN  UINT16        NumOfBits
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     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:
> -
> -  Sd            - The global scratch data.
> -  NumOfBits     - The number of bits to pop and read.
> -
> -Returns:
> -
> -  The bits that are popped out.
> -
> ---*/
> +  @param Sd            The global scratch data.
> +  @param NumOfBits     The number of bits to pop and read.
> +
> +  @return The bits that are popped out.
> +**/
> +STATIC
> +UINT32
> +GetBits (
> +  IN  SCRATCH_DATA  *Sd,
> +  IN  UINT16        NumOfBits
> +  )
>   {
>     UINT32  OutBits;
>   
> @@ -146,6 +130,18 @@ Routine Description:
>     return OutBits;
>   }
>   
> +/**
> +  Creates Huffman Code mapping table according to code length array.
> +
> +  @param Sd        The global scratch data
> +  @param NumOfChar Number of symbols in the symbol set
> +  @param BitLen    Code length array
> +  @param TableBits The width of the mapping table
> +  @param Table     The table
> +
> +  @retval 0         - OK.
> +  @retval BAD_TABLE - The table is corrupted.
> +**/
>   STATIC
>   UINT16
>   MakeTable (
> @@ -155,26 +151,6 @@ MakeTable (
>     IN  UINT16        TableBits,
>     OUT UINT16        *Table
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Creates Huffman Code mapping table according to code length array.
> -
> -Arguments:
> -
> -  Sd        - The global scratch data
> -  NumOfChar - Number of symbols in the symbol set
> -  BitLen    - Code length array
> -  TableBits - The width of the mapping table
> -  Table     - The table
> -
> -Returns:
> -
> -  0         - OK.
> -  BAD_TABLE - The table is corrupted.
> -
> ---*/
>   {
>     UINT16  Count[17];
>     UINT16  Weight[17];
> @@ -290,26 +266,18 @@ Routine Description:
>     return 0;
>   }
>   
> +/**
> +  Decodes a position value.
> +
> +  @param Sd      the global scratch data
> +
> +  @return The position value decoded.
> +**/
>   STATIC
>   UINT32
>   DecodeP (
>     IN  SCRATCH_DATA  *Sd
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Decodes a position value.
> -
> -Arguments:
> -
> -  Sd      - the global scratch data
> -
> -Returns:
> -
> -  The position value decoded.
> -
> ---*/
>   {
>     UINT16  Val;
>     UINT32  Mask;
> @@ -344,6 +312,17 @@ Routine Description:
>     return Pos;
>   }
>   
> +/**
> +  Reads code lengths for the Extra Set or the Position Set
> +
> +  @param Sd        The global scratch data
> +  @param nn        Number of symbols
> +  @param nbit      Number of bits needed to represent nn
> +  @param Special   The special symbol that needs to be taken care of
> +
> +  @retval 0         - OK.
> +  @retval BAD_TABLE - Table is corrupted.
> +**/
>   STATIC
>   UINT16
>   ReadPTLen (
> @@ -352,25 +331,6 @@ ReadPTLen (
>     IN  UINT16        nbit,
>     IN  UINT16        Special
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Reads code lengths for the Extra Set or the Position Set
> -
> -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
> -
> -Returns:
> -
> -  0         - OK.
> -  BAD_TABLE - Table is corrupted.
> -
> ---*/
>   {
>     UINT16  Number;
>     UINT16  CharC;
> @@ -430,24 +390,16 @@ Routine Description:
>     return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
>   }
>   
> -STATIC
> -VOID
> -ReadCLen (
> -  SCRATCH_DATA  *Sd
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Reads code lengths for Char&Len Set.
>   
> -Arguments:
> -
> -  Sd    - the global scratch data
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param Sd    the global scratch data
> +**/
> +STATIC
> +VOID
> +ReadCLen (
> +  SCRATCH_DATA  *Sd
> +  )
>   {
>     UINT16  Number;
>     UINT16  CharC;
> @@ -526,26 +478,18 @@ Returns: (VOID)
>     return ;
>   }
>   
> -STATIC
> -UINT16
> -DecodeC (
> -  SCRATCH_DATA  *Sd
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Decode a character/length value.
>   
> -Arguments:
> -
> -  Sd    - The global scratch data.
> -
> -Returns:
> -
> -  The value decoded.
> -
> ---*/
> +  @param Sd    The global scratch data.
> +
> +  @return The value decoded.
> +**/
> +STATIC
> +UINT16
> +DecodeC (
> +  SCRATCH_DATA  *Sd
> +  )
>   {
>     UINT16  Index2;
>     UINT32  Mask;
> @@ -592,24 +536,16 @@ Routine Description:
>     return Index2;
>   }
>   
> -STATIC
> -VOID
> -Decode (
> -  SCRATCH_DATA  *Sd
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Decode the source data and put the resulting data into the destination buffer.
>   
> -Arguments:
> -
> -  Sd            - The global scratch data
> -
> -Returns: (VOID)
> -
> - --*/
> +  @param Sd            The global scratch data
> + **/
> +STATIC
> +VOID
> +Decode (
> +  SCRATCH_DATA  *Sd
> +  )
>   {
>     UINT16  BytesRemain;
>     UINT32  DataIdx;
> @@ -669,32 +605,24 @@ Returns: (VOID)
>     return ;
>   }
>   
> -EFI_STATUS
> -GetInfo (
> -  IN      VOID    *Source,
> -  IN      UINT32  SrcSize,
> -  OUT     UINT32  *DstSize,
> -  OUT     UINT32  *ScratchSize
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     The implementation of EFI_DECOMPRESS_PROTOCOL.GetInfo().
>   
> -Arguments:
> -
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  DstSize     - The size of destination buffer.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> -
> ---*/
> +  @param Source      The source buffer containing the compressed data.
> +  @param SrcSize     The size of source buffer
> +  @param DstSize     The size of destination buffer.
> +  @param ScratchSize The size of scratch buffer.
> +
> +  @retval EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
> +  @retval EFI_INVALID_PARAMETER - The source data is corrupted
> +**/
> +EFI_STATUS
> +GetInfo (
> +  IN      VOID    *Source,
> +  IN      UINT32  SrcSize,
> +  OUT     UINT32  *DstSize,
> +  OUT     UINT32  *ScratchSize
> +  )
>   {
>     UINT8 *Src;
>     UINT32 CompSize;
> @@ -716,36 +644,28 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -EFI_STATUS
> -Decompress (
> -  IN      VOID    *Source,
> -  IN      UINT32  SrcSize,
> -  IN OUT  VOID    *Destination,
> -  IN      UINT32  DstSize,
> -  IN OUT  VOID    *Scratch,
> -  IN      UINT32  ScratchSize
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     The implementation Efi and Tiano Decompress().
>   
> -Arguments:
> +  @param Source      - The source buffer containing the compressed data.
> +  @param SrcSize     - The size of source buffer
> +  @param Destination - The destination buffer to store the decompressed data
> +  @param DstSize     - The size of destination buffer.
> +  @param Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> +  @param ScratchSize - The size of scratch buffer.
>   
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  Destination - The destination buffer to store the decompressed data
> -  DstSize     - The size of destination buffer.
> -  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - Decompression is successful
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> -
> ---*/
> +  @retval EFI_SUCCESS           - Decompression is successful
> +  @retval EFI_INVALID_PARAMETER - The source data is corrupted
> +**/
> +EFI_STATUS
> +Decompress (
> +  IN      VOID    *Source,
> +  IN      UINT32  SrcSize,
> +  IN OUT  VOID    *Destination,
> +  IN      UINT32  DstSize,
> +  IN OUT  VOID    *Scratch,
> +  IN      UINT32  ScratchSize
> +  )
>   {
>     UINT32        Index;
>     UINT32        CompSize;
> @@ -811,131 +731,99 @@ Routine Description:
>     return Status;
>   }
>   
> -EFI_STATUS
> -EfiGetInfo (
> -  IN      VOID    *Source,
> -  IN      UINT32  SrcSize,
> -  OUT     UINT32  *DstSize,
> -  OUT     UINT32  *ScratchSize
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     The implementation Efi Decompress GetInfo().
>   
> -Arguments:
> -
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  DstSize     - The size of destination buffer.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> -
> ---*/
> -{
> -  return GetInfo (Source, SrcSize, DstSize, ScratchSize);
> -}
> -
> +  @param Source      The source buffer containing the compressed data.
> +  @param SrcSize     The size of source buffer
> +  @param DstSize     The size of destination buffer.
> +  @param ScratchSize The size of scratch buffer.
> +
> +  @retval EFI_SUCCESS           The size of destination buffer and the size of scratch buffer are successfully retrieved.
> +  @retval EFI_INVALID_PARAMETER The source data is corrupted
> +**/
>   EFI_STATUS
> -TianoGetInfo (
> +EfiGetInfo (
>     IN      VOID    *Source,
>     IN      UINT32  SrcSize,
>     OUT     UINT32  *DstSize,
>     OUT     UINT32  *ScratchSize
>     )
> -/*++
> -
> -Routine Description:
> +{
> +  return GetInfo (Source, SrcSize, DstSize, ScratchSize);
> +}
>   
> +/**
>     The implementation Tiano Decompress GetInfo().
>   
> -Arguments:
> -
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  DstSize     - The size of destination buffer.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successfully retrieved.
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> -
> ---*/
> -{
> -  return GetInfo (Source, SrcSize, DstSize, ScratchSize);
> -}
> -
> +  @param Source      The source buffer containing the compressed data.
> +  @param SrcSize     The size of source buffer
> +  @param DstSize     The size of destination buffer.
> +  @param ScratchSize The size of scratch buffer.
> +
> +  @retval EFI_SUCCESS           The size of destination buffer and the size of scratch buffer are successfully retrieved.
> +  @retval EFI_INVALID_PARAMETER The source data is corrupted
> +**/
>   EFI_STATUS
> -EfiDecompress (
> +TianoGetInfo (
>     IN      VOID    *Source,
>     IN      UINT32  SrcSize,
> -  IN OUT  VOID    *Destination,
> -  IN      UINT32  DstSize,
> -  IN OUT  VOID    *Scratch,
> -  IN      UINT32  ScratchSize
> +  OUT     UINT32  *DstSize,
> +  OUT     UINT32  *ScratchSize
>     )
> -/*++
> -
> -Routine Description:
> +{
> +  return GetInfo (Source, SrcSize, DstSize, ScratchSize);
> +}
>   
> +/**
>     The implementation of Efi Decompress().
>   
> -Arguments:
> +  @param Source      The source buffer containing the compressed data.
> +  @param SrcSize     The size of source buffer
> +  @param Destination The destination buffer to store the decompressed data
> +  @param DstSize     The size of destination buffer.
> +  @param Scratch     The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> +  @param ScratchSize The size of scratch buffer.
>   
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  Destination - The destination buffer to store the decompressed data
> -  DstSize     - The size of destination buffer.
> -  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - Decompression is successful
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> -
> ---*/
> +  @retval EFI_SUCCESS           Decompression is successful
> +  @retval EFI_INVALID_PARAMETER The source data is corrupted
> +**/
> +EFI_STATUS
> +EfiDecompress (
> +  IN      VOID    *Source,
> +  IN      UINT32  SrcSize,
> +  IN OUT  VOID    *Destination,
> +  IN      UINT32  DstSize,
> +  IN OUT  VOID    *Scratch,
> +  IN      UINT32  ScratchSize
> +  )
>   {
>     mPbit = EFIPBIT;
>     return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
>   }
>   
> -EFI_STATUS
> -TianoDecompress (
> -  IN      VOID    *Source,
> -  IN      UINT32  SrcSize,
> -  IN OUT  VOID    *Destination,
> -  IN      UINT32  DstSize,
> -  IN OUT  VOID    *Scratch,
> -  IN      UINT32  ScratchSize
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     The implementation of Tiano Decompress().
>   
> -Arguments:
> +  @param Source      The source buffer containing the compressed data.
> +  @param SrcSize     The size of source buffer
> +  @param Destination The destination buffer to store the decompressed data
> +  @param DstSize     The size of destination buffer.
> +  @param Scratch     The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> +  @param ScratchSize The size of scratch buffer.
>   
> -  Source      - The source buffer containing the compressed data.
> -  SrcSize     - The size of source buffer
> -  Destination - The destination buffer to store the decompressed data
> -  DstSize     - The size of destination buffer.
> -  Scratch     - The buffer used internally by the decompress routine. This  buffer is needed to store intermediate data.
> -  ScratchSize - The size of scratch buffer.
> -
> -Returns:
> -
> -  EFI_SUCCESS           - Decompression is successful
> -  EFI_INVALID_PARAMETER - The source data is corrupted
> -
> ---*/
> +  @retval EFI_SUCCESS           Decompression is successful
> +  @retval EFI_INVALID_PARAMETER The source data is corrupted
> +**/
> +EFI_STATUS
> +TianoDecompress (
> +  IN      VOID    *Source,
> +  IN      UINT32  SrcSize,
> +  IN OUT  VOID    *Destination,
> +  IN      UINT32  DstSize,
> +  IN OUT  VOID    *Scratch,
> +  IN      UINT32  ScratchSize
> +  )
>   {
>     mPbit = MAXPBIT;
>     return Decompress (Source, SrcSize, Destination, DstSize, Scratch, ScratchSize);
> diff --git a/BaseTools/Source/C/Common/EfiCompress.c b/BaseTools/Source/C/Common/EfiCompress.c
> index db5ebe3157d2..0db958b8535a 100644
> --- a/BaseTools/Source/C/Common/EfiCompress.c
> +++ b/BaseTools/Source/C/Common/EfiCompress.c
> @@ -250,6 +250,20 @@ STATIC NODE   mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NU
>   // functions
>   //
>   
> +/**
> +  The main compression routine.
> +
> +  @param SrcBuffer   The buffer storing the source data
> +  @param SrcSize     The size of source data
> +  @param DstBuffer   The buffer to store the compressed data
> +  @param DstSize     On input, the size of DstBuffer; On output,
> +                     the size of the actual compressed data.
> +
> +  @retval EFI_BUFFER_TOO_SMALL  The DstBuffer is too small. In this case,
> +                               DstSize contains the size needed.
> +  @retval EFI_SUCCESS           Compression is successful.
> +
> +**/
>   EFI_STATUS
>   EfiCompress (
>     IN      UINT8   *SrcBuffer,
> @@ -257,27 +271,6 @@ EfiCompress (
>     IN      UINT8   *DstBuffer,
>     IN OUT  UINT32  *DstSize
>     )
> -/*++
> -
> -Routine Description:
> -
> -  The main compression routine.
> -
> -Arguments:
> -
> -  SrcBuffer   - The buffer storing the source data
> -  SrcSize     - The size of source data
> -  DstBuffer   - The buffer to store the compressed data
> -  DstSize     - On input, the size of DstBuffer; On output,
> -                the size of the actual compressed data.
> -
> -Returns:
> -
> -  EFI_BUFFER_TOO_SMALL  - The DstBuffer is too small. In this case,
> -                DstSize contains the size needed.
> -  EFI_SUCCESS           - Compression is successful.
> -
> ---*/
>   {
>     EFI_STATUS Status = EFI_SUCCESS;
>   
> @@ -345,24 +338,16 @@ Routine Description:
>   
>   }
>   
> -STATIC
> -VOID
> -PutDword(
> -  IN UINT32 Data
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Put a dword to output stream
>   
> -Arguments:
> -
> -  Data    - the dword to put
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param Data    the dword to put
> +**/
> +STATIC
> +VOID
> +PutDword(
> +  IN UINT32 Data
> +  )
>   {
>     if (mDst < mDstUpperLimit) {
>       *mDst++ = (UINT8)(((UINT8)(Data        )) & 0xff);
> @@ -381,23 +366,15 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -EFI_STATUS
> -AllocateMemory ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Allocate memory spaces for data structures used in compression process
>   
> -Arguments: (VOID)
> -
> -Returns:
> -
> -  EFI_SUCCESS           - Memory is allocated successfully
> -  EFI_OUT_OF_RESOURCES  - Allocation fails
> -
> ---*/
> +  @retval EFI_SUCCESS           Memory is allocated successfully
> +  @retva; EFI_OUT_OF_RESOURCES  Allocation fails
> +**/
> +STATIC
> +EFI_STATUS
> +AllocateMemory ()
>   {
>     UINT32      i;
>   
> @@ -432,19 +409,11 @@ Arguments: (VOID)
>     return EFI_SUCCESS;
>   }
>   
> -VOID
> -FreeMemory ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Called when compression is completed to free memory previously allocated.
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +VOID
> +FreeMemory ()
>   {
>     if (mText) {
>       free (mText);
> @@ -481,21 +450,12 @@ Returns: (VOID)
>     return;
>   }
>   
> -
> -STATIC
> -VOID
> -InitSlide ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Initialize String Info Log data structures
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +InitSlide ()
>   {
>     NODE i;
>   
> @@ -517,29 +477,20 @@ Returns: (VOID)
>     }
>   }
>   
> -
> -STATIC
> -NODE
> -Child (
> -  IN NODE q,
> -  IN UINT8 c
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Find child node given the parent node and the edge character
>   
> -Arguments:
> -
> -  q       - the parent node
> -  c       - the edge character
> -
> -Returns:
> -
> -  The child node (NIL if not found)
> -
> ---*/
> +  @param q       the parent node
> +  @param c       the edge character
> +
> +  @return The child node (NIL if not found)
> +**/
> +STATIC
> +NODE
> +Child (
> +  IN NODE q,
> +  IN UINT8 c
> +  )
>   {
>     NODE r;
>   
> @@ -552,28 +503,20 @@ Routine Description:
>     return r;
>   }
>   
> -STATIC
> -VOID
> -MakeChild (
> -  IN NODE q,
> -  IN UINT8 c,
> -  IN NODE r
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Create a new child for a given parent node.
>   
> -Arguments:
> -
> -  q       - the parent node
> -  c       - the edge character
> -  r       - the child node
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param q       the parent node
> +  @param c       the edge character
> +  @param r       the child node
> +**/
> +STATIC
> +VOID
> +MakeChild (
> +  IN NODE q,
> +  IN UINT8 c,
> +  IN NODE r
> +  )
>   {
>     NODE h, t;
>   
> @@ -587,24 +530,16 @@ Returns: (VOID)
>     mChildCount[q]++;
>   }
>   
> -STATIC
> -VOID
> -Split (
> -  NODE Old
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Split a node.
>   
> -Arguments:
> -
> -  Old     - the node to split
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param Old     the node to split
> +**/
> +STATIC
> +VOID
> +Split (
> +  NODE Old
> +  )
>   {
>     NODE New, t;
>   
> @@ -624,20 +559,12 @@ Returns: (VOID)
>     MakeChild(New, mText[mPos + mMatchLen], mPos);
>   }
>   
> -STATIC
> -VOID
> -InsertNode ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Insert string info for current position into the String Info Log
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +InsertNode ()
>   {
>     NODE q, r, j, t;
>     UINT8 c, *t1, *t2;
> @@ -739,21 +666,13 @@ Returns: (VOID)
>   
>   }
>   
> -STATIC
> -VOID
> -DeleteNode ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Delete outdated string info. (The Usage of PERC_FLAG
>     ensures a clean deletion)
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +DeleteNode ()
>   {
>     NODE q, r, s, t, u;
>   
> @@ -813,21 +732,13 @@ Returns: (VOID)
>     mAvail = r;
>   }
>   
> -STATIC
> -VOID
> -GetNextMatch ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Advance the current position (read in new data if needed).
>     Delete outdated string info. Find a match string for current position.
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +GetNextMatch ()
>   {
>     INT32 n;
>   
> @@ -842,23 +753,15 @@ Returns: (VOID)
>     InsertNode();
>   }
>   
> -STATIC
> -EFI_STATUS
> -Encode ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     The main controlling routine for compression process.
>   
> -Arguments: (VOID)
> -
> -Returns:
> -
> -  EFI_SUCCESS           - The compression is successful
> -  EFI_OUT_0F_RESOURCES  - Not enough memory for compression process
> -
> ---*/
> +  @retval EFI_SUCCESS           The compression is successful
> +  @retval EFI_OUT_0F_RESOURCES  Not enough memory for compression process
> +**/
> +STATIC
> +EFI_STATUS
> +Encode ()
>   {
>     EFI_STATUS  Status;
>     INT32       LastMatchLen;
> @@ -920,20 +823,12 @@ Arguments: (VOID)
>     return EFI_SUCCESS;
>   }
>   
> -STATIC
> -VOID
> -CountTFreq ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Count the frequencies for the Extra Set
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +CountTFreq ()
>   {
>     INT32 i, k, n, Count;
>   
> @@ -969,28 +864,20 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -VOID
> -WritePTLen (
> -  IN INT32 n,
> -  IN INT32 nbit,
> -  IN INT32 Special
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Outputs the code length array for the Extra Set or the Position Set.
>   
> -Arguments:
> -
> -  n       - 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)
> -
> ---*/
> +  @param n       the number of symbols
> +  @param nbit    the number of bits needed to represent 'n'
> +  @param Special the special symbol that needs to be take care of
> +**/
> +STATIC
> +VOID
> +WritePTLen (
> +  IN INT32 n,
> +  IN INT32 nbit,
> +  IN INT32 Special
> +  )
>   {
>     INT32 i, k;
>   
> @@ -1015,20 +902,12 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -VOID
> -WriteCLen ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Outputs the code length array for Char&Length Set
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +WriteCLen ()
>   {
>     INT32 i, k, n, Count;
>   
> @@ -1096,20 +975,12 @@ EncodeP (
>     }
>   }
>   
> -STATIC
> -VOID
> -SendBlock ()
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Huffman code the block and output it.
> -
> -Argument: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +SendBlock ()
>   {
>     UINT32 i, k, Flags, Root, Pos, Size;
>     Flags = 0;
> @@ -1164,27 +1035,18 @@ Returns: (VOID)
>     }
>   }
>   
> -
> -STATIC
> -VOID
> -Output (
> -  IN UINT32 c,
> -  IN UINT32 p
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Outputs an Original Character or a Pointer
>   
> -Arguments:
> -
> -  c     - The original character or the 'String Length' element of a Pointer
> -  p     - The 'Position' field of a Pointer
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param c     The original character or the 'String Length' element of a Pointer
> +  @param p     The 'Position' field of a Pointer
> +**/
> +STATIC
> +VOID
> +Output (
> +  IN UINT32 c,
> +  IN UINT32 p
> +  )
>   {
>     STATIC UINT32 CPos;
>   
> @@ -1263,26 +1125,18 @@ MakeCrcTable ()
>     }
>   }
>   
> -STATIC
> -VOID
> -PutBits (
> -  IN INT32 n,
> -  IN UINT32 x
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Outputs rightmost n bits of x
>   
> -Arguments:
> -
> -  n   - the rightmost n bits of the data is used
> -  x   - the data
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param n   the rightmost n bits of the data is used
> +  @param x   the data
> +**/
> +STATIC
> +VOID
> +PutBits (
> +  IN INT32 n,
> +  IN UINT32 x
> +  )
>   {
>     UINT8 Temp;
>   
> @@ -1311,28 +1165,20 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -INT32
> -FreadCrc (
> -  OUT UINT8 *p,
> -  IN  INT32 n
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Read in source data
>   
> -Arguments:
> -
> -  p   - the buffer to hold the data
> -  n   - number of bytes to read
> -
> -Returns:
> -
> -  number of bytes actually read
> -
> ---*/
> +  @param p   the buffer to hold the data
> +  @param n   number of bytes to read
> +
> +  @return number of bytes actually read
> +**/
> +STATIC
> +INT32
> +FreadCrc (
> +  OUT UINT8 *p,
> +  IN  INT32 n
> +  )
>   {
>     INT32 i;
>   
> @@ -1358,24 +1204,16 @@ InitPutBits ()
>     mSubBitBuf = 0;
>   }
>   
> -STATIC
> -VOID
> -CountLen (
> -  IN INT32 i
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Count the number of each code length for a Huffman tree.
>   
> -Arguments:
> -
> -  i   - the top node
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param i   the top node
> +**/
> +STATIC
> +VOID
> +CountLen (
> +  IN INT32 i
> +  )
>   {
>     STATIC INT32 Depth = 0;
>   
> @@ -1389,22 +1227,16 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -VOID
> -MakeLen (
> -  IN INT32 Root
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Create code length array for a Huffman tree
>   
> -Arguments:
> -
> -  Root   - the root of the tree
> -
> ---*/
> +  @param Root   the root of the tree
> +**/
> +STATIC
> +VOID
> +MakeLen (
> +  IN INT32 Root
> +  )
>   {
>     INT32 i, k;
>     UINT32 Cum;
> @@ -1468,28 +1300,20 @@ DownHeap (
>     mHeap[i] = (INT16)k;
>   }
>   
> -STATIC
> -VOID
> -MakeCode (
> -  IN  INT32 n,
> -  IN  UINT8 Len[],
> -  OUT UINT16 Code[]
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Assign code to each symbol based on the code length array
>   
> -Arguments:
> -
> -  n     - number of symbols
> -  Len   - the code length array
> -  Code  - stores codes for each symbol
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param n     number of symbols
> +  @param Len   the code length array
> +  @param Code  stores codes for each symbol
> +**/
> +STATIC
> +VOID
> +MakeCode (
> +  IN  INT32 n,
> +  IN  UINT8 Len[],
> +  OUT UINT16 Code[]
> +  )
>   {
>     INT32    i;
>     UINT16   Start[18];
> @@ -1503,32 +1327,24 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -INT32
> -MakeTree (
> -  IN  INT32   NParm,
> -  IN  UINT16  FreqParm[],
> -  OUT UINT8   LenParm[],
> -  OUT UINT16  CodeParm[]
> -  )
> -/*++
> -
> -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.
> -
> ---*/
> +  @param NParm    number of symbols
> +  @param FreqParm frequency of each symbol
> +  @param LenParm  code length for each symbol
> +  @param CodeParm code for each symbol
> +
> +  @return Root of the Huffman tree.
> +**/
> +STATIC
> +INT32
> +MakeTree (
> +  IN  INT32   NParm,
> +  IN  UINT16  FreqParm[],
> +  OUT UINT8   LenParm[],
> +  OUT UINT16  CodeParm[]
> +  )
>   {
>     INT32 i, j, k, Avail;
>   
> diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.c b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
> index f8d2a40be1e1..89524550884a 100644
> --- a/BaseTools/Source/C/Common/EfiUtilityMsgs.c
> +++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
> @@ -36,65 +36,59 @@ PrintLimitExceeded (
>     VOID
>     );
>   
> -VOID
> -Error (
> -  CHAR8   *FileName,
> -  UINT32  LineNumber,
> -  UINT32  MessageCode,
> -  CHAR8   *Text,
> -  CHAR8   *MsgFmt,
> -  ...
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Prints an error message.
>   
> -Arguments:
>     All arguments are optional, though the printed message may be useless if
>     at least something valid is not specified.
> +
> + @note:
> +   We print the following (similar to the Warn() and Debug()
> +   W
> +   Typical error/warning message format:
>   
> -  FileName - name of the file or application. If not specified, then the
> +   bin\VfrCompile.cpp(330) : error C2660: 'AddVfrDataStructField' : function does not take 2 parameters
> +
> +   BUGBUG -- these three utility functions are almost identical, and
> +   should be modified to share code.
> +
> +   Visual Studio does not find error messages with:
> +
> +      " error :"
> +      " error 1:"
> +      " error c1:"
> +      " error 1000:"
> +      " error c100:"
> +
> +   It does find:
> +      " error c1000:"
> +
> +  @param FileName name of the file or application. If not specified, then the
>                utility name (as set by the utility calling SetUtilityName()
>                earlier) is used. Otherwise "Unknown utility" is used.
>   
> -  LineNumber - the line number of error, typically used by parsers. If the
> +  @param LineNumber the line number of error, typically used by parsers. If the
>                  utility is not a parser, then 0 should be specified. Otherwise
>                  the FileName and LineNumber info can be used to cause
>                  MS Visual Studio to jump to the error.
>   
> -  MessageCode - an application-specific error code that can be referenced in
> +  @param MessageCode an application-specific error code that can be referenced in
>                 other documentation.
>   
> -  Text        - the text in question, typically used by parsers.
> +  @param Text        the text in question, typically used by parsers.
>   
> -  MsgFmt - the format string for the error message. Can contain formatting
> +  @param MsgFmt the format string for the error message. Can contain formatting
>              controls for use with the varargs.
> -
> -Returns:
> -  None.
> -
> -Notes:
> -  We print the following (similar to the Warn() and Debug()
> -  W
> -  Typical error/warning message format:
> -
> -  bin\VfrCompile.cpp(330) : error C2660: 'AddVfrDataStructField' : function does not take 2 parameters
> -
> -  BUGBUG -- these three utility functions are almost identical, and
> -  should be modified to share code.
> -
> -  Visual Studio does not find error messages with:
> -
> -     " error :"
> -     " error 1:"
> -     " error c1:"
> -     " error 1000:"
> -     " error c100:"
> -
> -  It does find:
> -     " error c1000:"
> ---*/
> +**/
> +VOID
> +Error (
> +  CHAR8   *FileName,
> +  UINT32  LineNumber,
> +  UINT32  MessageCode,
> +  CHAR8   *Text,
> +  CHAR8   *MsgFmt,
> +  ...
> +  )
>   {
>     va_list List;
>     //
> @@ -127,28 +121,21 @@ Routine Description:
>     va_end (List);
>   }
>   
> -VOID
> -ParserError (
> -  UINT32  MessageCode,
> -  CHAR8   *Text,
> -  CHAR8   *MsgFmt,
> -  ...
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Print a parser error, using the source file name and line number
>     set by a previous call to SetParserPosition().
>   
> -Arguments:
> -  MessageCode   - application-specific error code
> -  Text          - text to print in the error message
> -  MsgFmt        - format string to print at the end of the error message
> -
> -Returns:
> -  NA
> -
> ---*/
> +  @param MessageCode   application-specific error code
> +  @param Text          text to print in the error message
> +  @param MsgFmt        format string to print at the end of the error message
> +**/
> +VOID
> +ParserError (
> +  UINT32  MessageCode,
> +  CHAR8   *Text,
> +  CHAR8   *MsgFmt,
> +  ...
> +  )
>   {
>     va_list List;
>     //
> @@ -181,6 +168,14 @@ Routine Description:
>     va_end (List);
>   }
>   
> +/**
> +  Print a parser warning, using the source file name and line number
> +  set by a previous call to SetParserPosition().
> +
> +  @param ErrorCode     application-specific error code
> +  @param OffendingText text to print in the warning message
> +  @param MsgFmt        format string to print at the end of the warning message
> +**/
>   VOID
>   ParserWarning (
>     UINT32  ErrorCode,
> @@ -188,21 +183,6 @@ ParserWarning (
>     CHAR8   *MsgFmt,
>     ...
>     )
> -/*++
> -
> -Routine Description:
> -  Print a parser warning, using the source file name and line number
> -  set by a previous call to SetParserPosition().
> -
> -Arguments:
> -  ErrorCode     - application-specific error code
> -  OffendingText - text to print in the warning message
> -  MsgFmt        - format string to print at the end of the warning message
> -
> -Returns:
> -  NA
> -
> ---*/
>   {
>     va_list List;
>     //
> @@ -241,39 +221,28 @@ Routine Description:
>     //  }
>   }
>   
> -VOID
> -Warning (
> -  CHAR8   *FileName,
> -  UINT32  LineNumber,
> -  UINT32  MessageCode,
> -  CHAR8   *Text,
> -  CHAR8   *MsgFmt,
> -  ...
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Print a warning message.
>   
> -Arguments:
> -  FileName    - name of the file where the warning was detected, or the name
> -                of the application that detected the warning
> -
> -  LineNumber  - the line number where the warning was detected (parsers).
> -                0 should be specified if the utility is not a parser.
> -
> -  MessageCode - an application-specific warning code that can be referenced in
> -                other documentation.
> -
> -  Text        - the text in question (parsers)
> -
> -  MsgFmt      - the format string for the warning message. Can contain formatting
> -                controls for use with varargs.
> -
> -Returns:
> -  None.
> -
> ---*/
> +  @param FileName    name of the file where the warning was detected, or the name
> +                     of the application that detected the warning
> +  @param LineNumber  the line number where the warning was detected (parsers).
> +                     0 should be specified if the utility is not a parser.
> +  @param MessageCode an application-specific warning code that can be referenced in
> +                     other documentation.
> +  @param Text        the text in question (parsers)
> +  @param MsgFmt      the format string for the warning message. Can contain formatting
> +                     controls for use with varargs.
> +**/
> +VOID
> +Warning (
> +  CHAR8   *FileName,
> +  UINT32  LineNumber,
> +  UINT32  MessageCode,
> +  CHAR8   *Text,
> +  CHAR8   *MsgFmt,
> +  ...
> +  )
>   {
>     va_list List;
>   
> @@ -313,6 +282,18 @@ Routine Description:
>     va_end (List);
>   }
>   
> +/**
> +  Print a Debug message.
> +
> +  @param FileName    typically the name of the utility printing the debug message, but
> +                     can be the name of a file being parsed.
> +  @param LineNumber  the line number in FileName (parsers)
> +  @param MsgLevel    Debug message print level (0~9)
> +  @param Text        the text in question (parsers)
> +  @param MsgFmt      the format string for the debug message. Can contain formatting
> +                     controls for use with varargs.
> +
> +**/
>   VOID
>   DebugMsg (
>     CHAR8   *FileName,
> @@ -322,28 +303,6 @@ DebugMsg (
>     CHAR8   *MsgFmt,
>     ...
>     )
> -/*++
> -
> -Routine Description:
> -  Print a Debug message.
> -
> -Arguments:
> -  FileName    - typically the name of the utility printing the debug message, but
> -                can be the name of a file being parsed.
> -
> -  LineNumber  - the line number in FileName (parsers)
> -
> -  MsgLevel    - Debug message print level (0~9)
> -
> -  Text        - the text in question (parsers)
> -
> -  MsgFmt      - the format string for the debug message. Can contain formatting
> -                controls for use with varargs.
> -
> -Returns:
> -  None.
> -
> ---*/
>   {
>     va_list List;
>     //
> @@ -358,64 +317,52 @@ Routine Description:
>     va_end (List);
>   }
>   
> -VOID
> -PrintMessage (
> -  CHAR8   *Type,
> -  CHAR8   *FileName,
> -  UINT32  LineNumber,
> -  UINT32  MessageCode,
> -  CHAR8   *Text,
> -  CHAR8   *MsgFmt,
> -  va_list List
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Worker routine for all the utility printing services. Prints the message in
>     a format that Visual Studio will find when scanning build outputs for
>     errors or warnings.
> +
> + @note:
> +   If FileName == NULL then this utility will use the string passed into SetUtilityName().
>   
> -Arguments:
> -  Type        - "warning" or "error" string to insert into the message to be
> +   LineNumber is only used if the caller is a parser, in which case FileName refers to the
> +   file being parsed.
> +
> +   Text and MsgFmt are both optional, though it would be of little use calling this function with
> +   them both NULL.
> +
> +   Output will typically be of the form:
> +     <FileName>(<LineNumber>) : <Type> <Type[0]><MessageCode>: <Text> : <MsgFmt>
> +
> +     Parser (LineNumber != 0)
> +       VfrCompile.cpp(330) : error E2660: AddVfrDataStructField : function does not take 2 parameters
> +     Generic utility (LineNumber == 0)
> +       UtilityName : error E1234 : Text string : MsgFmt string and args
> +
> +  @param Type        "warning" or "error" string to insert into the message to be
>                   printed. The first character of this string (converted to uppercase)
>                   is used to precede the MessageCode value in the output string.
> -
> -  FileName    - name of the file where the warning was detected, or the name
> +  @param FileName    name of the file where the warning was detected, or the name
>                   of the application that detected the warning
> -
> -  LineNumber  - the line number where the warning was detected (parsers).
> +  @param LineNumber  the line number where the warning was detected (parsers).
>                   0 should be specified if the utility is not a parser.
> -
> -  MessageCode - an application-specific warning code that can be referenced in
> +  @param MessageCode an application-specific warning code that can be referenced in
>                   other documentation.
> -
> -  Text        - part of the message to print
> -
> -  MsgFmt      - the format string for the message. Can contain formatting
> +  @param Text        part of the message to print
> +  @param MsgFmt      the format string for the message. Can contain formatting
>                   controls for use with varargs.
> -  List        - the variable list.
> -
> -Returns:
> -  None.
> -
> -Notes:
> -  If FileName == NULL then this utility will use the string passed into SetUtilityName().
> -
> -  LineNumber is only used if the caller is a parser, in which case FileName refers to the
> -  file being parsed.
> -
> -  Text and MsgFmt are both optional, though it would be of little use calling this function with
> -  them both NULL.
> -
> -  Output will typically be of the form:
> -    <FileName>(<LineNumber>) : <Type> <Type[0]><MessageCode>: <Text> : <MsgFmt>
> -
> -    Parser (LineNumber != 0)
> -      VfrCompile.cpp(330) : error E2660: AddVfrDataStructField : function does not take 2 parameters
> -    Generic utility (LineNumber == 0)
> -      UtilityName : error E1234 : Text string : MsgFmt string and args
> -
> ---*/
> +  @param List        the variable list.
> +**/
> +VOID
> +PrintMessage (
> +  CHAR8   *Type,
> +  CHAR8   *FileName,
> +  UINT32  LineNumber,
> +  UINT32  MessageCode,
> +  CHAR8   *Text,
> +  CHAR8   *MsgFmt,
> +  va_list List
> +  )
>   {
>     CHAR8       Line[MAX_LINE_LEN];
>     CHAR8       Line2[MAX_LINE_LEN];
> @@ -523,24 +470,19 @@ Routine Description:
>   
>   }
>   
> -STATIC
> -VOID
> -PrintSimpleMessage (
> -  CHAR8   *MsgFmt,
> -  va_list List
> -  )
> -/*++
> -Routine Description:
> +/**
>     Print message into stdout.
>   
> -Arguments:
> -  MsgFmt      - the format string for the message. Can contain formatting
> -                controls for use with varargs.
> -  List        - the variable list.
> -
> -Returns:
> -  None.
> ---*/
> +  @param MsgFmt      the format string for the message. Can contain formatting
> +                     controls for use with varargs.
> +  @param List        the variable list.
> +**/
> +STATIC
> +VOID
> +PrintSimpleMessage (
> +  CHAR8   *MsgFmt,
> +  va_list List
> +  )
>   {
>     CHAR8       Line[MAX_LINE_LEN];
>     //
> @@ -552,51 +494,37 @@ Routine Description:
>     }
>   }
>   
> +/**
> +  Set the position in a file being parsed. This can be used to
> +  print error messages deeper down in a parser.
> +
> +  @param SourceFileName name of the source file being parsed
> +  @param LineNum        line number of the source file being parsed
> +**/
>   VOID
>   ParserSetPosition (
>     CHAR8   *SourceFileName,
>     UINT32  LineNum
>     )
> -/*++
> -
> -Routine Description:
> -  Set the position in a file being parsed. This can be used to
> -  print error messages deeper down in a parser.
> -
> -Arguments:
> -  SourceFileName - name of the source file being parsed
> -  LineNum        - line number of the source file being parsed
> -
> -Returns:
> -  NA
> -
> ---*/
>   {
>     mSourceFileName     = SourceFileName;
>     mSourceFileLineNum  = LineNum;
>   }
>   
> -VOID
> -SetUtilityName (
> -  CHAR8   *UtilityName
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     All printed error/warning/debug messages follow the same format, and
>     typically will print a filename or utility name followed by the error
>     text. However if a filename is not passed to the print routines, then
>     they'll print the utility name if you call this function early in your
>     app to set the utility name.
>   
> -Arguments:
> -  UtilityName  -  name of the utility, which will be printed with all
> -                  error/warning/debug messages.
> -
> -Returns:
> -  NA
> -
> ---*/
> +  @param UtilityName  name of the utility, which will be printed with all
> +                      error/warning/debug messages.
> +**/
> +VOID
> +SetUtilityName (
> +  CHAR8   *UtilityName
> +  )
>   {
>     //
>     // Save the name of the utility in our local variable. Make sure its
> @@ -613,69 +541,48 @@ Routine Description:
>     }
>   }
>   
> -STATUS
> -GetUtilityStatus (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     When you call Error() or Warning(), this module keeps track of it and
>     sets a local mStatus to STATUS_ERROR or STATUS_WARNING. When the utility
>     exits, it can call this function to get the status and use it as a return
>     value.
>   
> -Arguments:
> -  None.
> -
> -Returns:
> -  Worst-case status reported, as defined by which print function was called.
> -
> ---*/
> +  @return Worst-case status reported, as defined by which print function was called.
> +**/
> +STATUS
> +GetUtilityStatus (
> +  VOID
> +  )
>   {
>     return mStatus;
>   }
>   
> -VOID
> -SetPrintLevel (
> -  UINT64  LogLevel
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Set the printing message Level. This is used by the PrintMsg() function
>     to determine when/if a message should be printed.
>   
> -Arguments:
> -  LogLevel  - 0~50 to specify the different level message.
> -
> -Returns:
> -  NA
> -
> ---*/
> +  @param LogLevel  0~50 to specify the different level message.
> +**/
> +VOID
> +SetPrintLevel (
> +  UINT64  LogLevel
> +  )
>   {
>     mPrintLogLevel = LogLevel;
>   }
>   
> -VOID
> -VerboseMsg (
> -  CHAR8   *MsgFmt,
> -  ...
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Print a verbose level message.
>   
> -Arguments:
> -  MsgFmt      - the format string for the message. Can contain formatting
> -                controls for use with varargs.
> -  List        - the variable list.
> -
> -Returns:
> -  NA
> -
> ---*/
> +  @param MsgFmt      the format string for the message. Can contain formatting
> +                     controls for use with varargs.
> +  @param List        the variable list.
> +**/
> +VOID
> +VerboseMsg (
> +  CHAR8   *MsgFmt,
> +  ...
> +  )
>   {
>     va_list List;
>     //
> @@ -690,25 +597,18 @@ Routine Description:
>     va_end (List);
>   }
>   
> -VOID
> -NormalMsg (
> -  CHAR8   *MsgFmt,
> -  ...
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Print a default level message.
>   
> -Arguments:
> -  MsgFmt      - the format string for the message. Can contain formatting
> -                controls for use with varargs.
> -  List        - the variable list.
> -
> -Returns:
> -  NA
> -
> ---*/
> +  @param MsgFmt      the format string for the message. Can contain formatting
> +                     controls for use with varargs.
> +  @param List        the variable list.
> +**/
> +VOID
> +NormalMsg (
> +  CHAR8   *MsgFmt,
> +  ...
> +  )
>   {
>     va_list List;
>     //
> @@ -723,25 +623,18 @@ Routine Description:
>     va_end (List);
>   }
>   
> -VOID
> -KeyMsg (
> -  CHAR8   *MsgFmt,
> -  ...
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Print a key level message.
>   
> -Arguments:
> -  MsgFmt      - the format string for the message. Can contain formatting
> -                controls for use with varargs.
> -  List        - the variable list.
> -
> -Returns:
> -  NA
> -
> ---*/
> +  @param MsgFmt      the format string for the message. Can contain formatting
> +                     controls for use with varargs.
> +  @param List        the variable list.
> +**/
> +VOID
> +KeyMsg (
> +  CHAR8   *MsgFmt,
> +  ...
> +  )
>   {
>     va_list List;
>     //
> @@ -756,28 +649,21 @@ Routine Description:
>     va_end (List);
>   }
>   
> +/**
> +  Set the limits of how many errors, warnings, and errors+warnings
> +  we will print.
> +
> +  @param MaxErrors       maximum number of error messages to print
> +  @param MaxWarnings     maximum number of warning messages to print
> +  @param MaxWarningsPlusErrors
> +                  maximum number of errors+warnings to print
> +**/
>   VOID
>   SetPrintLimits (
>     UINT32  MaxErrors,
>     UINT32  MaxWarnings,
>     UINT32  MaxWarningsPlusErrors
>     )
> -/*++
> -
> -Routine Description:
> -  Set the limits of how many errors, warnings, and errors+warnings
> -  we will print.
> -
> -Arguments:
> -  MaxErrors       - maximum number of error messages to print
> -  MaxWarnings     - maximum number of warning messages to print
> -  MaxWarningsPlusErrors
> -                  - maximum number of errors+warnings to print
> -
> -Returns:
> -  NA
> -
> ---*/
>   {
>     mMaxErrors              = MaxErrors;
>     mMaxWarnings            = MaxWarnings;
> diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
> index ace26eb71c6b..3fae6f901da0 100644
> --- a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
> +++ b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
> @@ -78,29 +78,21 @@ FvBufCalculateChecksum8 (
>   // Procedures start
>   //
>   
> +/**
> +  Clears out all files from the Fv buffer in memory
> +
> +  @param SourceFv Address of the Fv in memory, this firmware volume will
> +                  be modified, if SourceFfsFile exists
> +  @param SourceFfsFile Input FFS file to replace
> +
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +**/
>   EFI_STATUS
>   FvBufRemoveFileNew (
>     IN OUT VOID *Fv,
>     IN EFI_GUID *Name
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Clears out all files from the Fv buffer in memory
> -
> -Arguments:
> -
> -  SourceFv - Address of the Fv in memory, this firmware volume will
> -             be modified, if SourceFfsFile exists
> -  SourceFfsFile - Input FFS file to replace
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -
> ---*/
>   {
>     EFI_STATUS                  Status;
>     EFI_FFS_FILE_HEADER*        FileToRm;
> @@ -127,30 +119,21 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Clears out all files from the Fv buffer in memory
>   
> +  @param SourceFv Address of the Fv in memory, this firmware volume will
> +                  be modified, if SourceFfsFile exists
> +  @param SourceFfsFile Input FFS file to replace
> +
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +**/
>   EFI_STATUS
>   FvBufRemoveFile (
>     IN OUT VOID *Fv,
>     IN EFI_GUID *Name
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Clears out all files from the Fv buffer in memory
> -
> -Arguments:
> -
> -  SourceFv - Address of the Fv in memory, this firmware volume will
> -             be modified, if SourceFfsFile exists
> -  SourceFfsFile - Input FFS file to replace
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -
> ---*/
>   {
>     EFI_STATUS                  Status;
>     EFI_FFS_FILE_HEADER        *NextFile;
> @@ -216,27 +199,18 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Clears out all files from the Fv buffer in memory
>   
> +  @param SourceFfsFile Input FFS file to update the checksum for
> +
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +**/
>   EFI_STATUS
>   FvBufChecksumFile (
>     IN OUT VOID *FfsFile
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Clears out all files from the Fv buffer in memory
> -
> -Arguments:
> -
> -  SourceFfsFile - Input FFS file to update the checksum for
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -
> ---*/
>   {
>     EFI_FFS_FILE_HEADER* File = (EFI_FFS_FILE_HEADER*)FfsFile;
>     EFI_FFS_FILE_STATE StateBackup;
> @@ -272,29 +246,20 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Clears out all files from the Fv buffer in memory
>   
> +  @param SourceFv Address of the Fv in memory, this firmware volume will
> +                  be modified, if SourceFfsFile exists
> +  @param SourceFfsFile Input FFS file to replace
> +
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +**/
>   EFI_STATUS
>   FvBufChecksumHeader (
>     IN OUT VOID *Fv
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Clears out all files from the Fv buffer in memory
> -
> -Arguments:
> -
> -  SourceFv - Address of the Fv in memory, this firmware volume will
> -             be modified, if SourceFfsFile exists
> -  SourceFfsFile - Input FFS file to replace
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -
> ---*/
>   {
>     EFI_FIRMWARE_VOLUME_HEADER* FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
>   
> @@ -308,31 +273,22 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -
> -EFI_STATUS
> -FvBufDuplicate (
> -  IN VOID *SourceFv,
> -  IN OUT VOID **DestinationFv
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Clears out all files from the Fv buffer in memory
>   
> -Arguments:
> -
> -  SourceFv - Address of the Fv in memory
> -  DestinationFv - Output for destination Fv
> +  @param SourceFv - Address of the Fv in memory
> +  @param DestinationFv - Output for destination Fv
>       DestinationFv == NULL - invalid parameter
>       *DestinationFv == NULL - memory will be allocated
>       *DestinationFv != NULL - this address will be the destination
>   
> -Returns:
> -
> -  EFI_SUCCESS
> -
> ---*/
> +  @retval EFI_SUCCESS
> +**/
> +EFI_STATUS
> +FvBufDuplicate (
> +  IN VOID *SourceFv,
> +  IN OUT VOID **DestinationFv
> +  )
>   {
>     EFI_STATUS Status;
>     UINTN size;
> @@ -358,35 +314,26 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Extends a firmware volume by the given number of bytes.
>   
> +  BUGBUG: Does not handle the case where the firmware volume has a
> +          VTF (Volume Top File).  The VTF will not be moved to the
> +          end of the extended FV.
> +
> +  @param Fv Source and destination firmware volume.
> +            Note: The original firmware volume buffer is freed!
> +
> +  @param Size The minimum size that the firmware volume is to be extended by.
> +              The FV may be extended more than this size.
> +
> +  @retval EFI_SUCCESS
> +**/
>   EFI_STATUS
>   FvBufExtend (
>     IN VOID **Fv,
>     IN UINTN Size
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Extends a firmware volume by the given number of bytes.
> -
> -  BUGBUG: Does not handle the case where the firmware volume has a
> -          VTF (Volume Top File).  The VTF will not be moved to the
> -          end of the extended FV.
> -
> -Arguments:
> -
> -  Fv - Source and destination firmware volume.
> -       Note: The original firmware volume buffer is freed!
> -
> -  Size - The minimum size that the firmware volume is to be extended by.
> -         The FV may be extended more than this size.
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -
> ---*/
>   {
>     EFI_STATUS Status;
>     UINTN OldSize;
> @@ -469,27 +416,17 @@ Routine Description:
>   
>   }
>   
> +/**
> +  Clears out all files from the Fv buffer in memory
>   
> +  @param Fv Address of the Fv in memory
> +
> +  @retval EFI_SUCCESS
> +**/
>   EFI_STATUS
>   FvBufClearAllFiles (
>     IN OUT VOID *Fv
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Clears out all files from the Fv buffer in memory
> -
> -Arguments:
> -
> -  Fv - Address of the Fv in memory
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -
> ---*/
> -
>   {
>     EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
>     EFI_STATUS Status;
> @@ -509,28 +446,18 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Clears out all files from the Fv buffer in memory
>   
> +  @param Fv Address of the Fv in memory
> +
> +  @retval EFI_SUCCESS
> +**/
>   EFI_STATUS
>   FvBufGetSize (
>     IN VOID *Fv,
>     OUT UINTN *Size
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Clears out all files from the Fv buffer in memory
> -
> -Arguments:
> -
> -  Fv - Address of the Fv in memory
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -
> ---*/
> -
>   {
>     EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
>     EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
> @@ -554,28 +481,19 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -
> -EFI_STATUS
> -FvBufAddFile (
> -  IN OUT VOID *Fv,
> -  IN VOID *File
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Adds a new FFS file
>   
> -Arguments:
> -
> -  Fv - Address of the Fv in memory
> -  File - FFS file to add to Fv
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -
> ---*/
> +  @param Fv Address of the Fv in memory
> +  @param File FFS file to add to Fv
> +
> +  @retval EFI_SUCCESS
> +**/
> +EFI_STATUS
> +FvBufAddFile (
> +  IN OUT VOID *Fv,
> +  IN VOID *File
> +  )
>   {
>     EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
>   
> @@ -652,32 +570,23 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -
> -EFI_STATUS
> -FvBufAddFileWithExtend (
> -  IN OUT VOID **Fv,
> -  IN VOID *File
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Adds a new FFS file.  Extends the firmware volume if needed.
>   
> -Arguments:
> -
> -  Fv - Source and destination firmware volume.
> -       Note: If the FV is extended, then the original firmware volume
> +  @param Fv Source and destination firmware volume.
> +            Note: If the FV is extended, then the original firmware volume
>                buffer is freed!
>   
> -  Size - The minimum size that the firmware volume is to be extended by.
> -         The FV may be extended more than this size.
> +  @param Size The minimum size that the firmware volume is to be extended by.
> +              The FV may be extended more than this size.
>   
> -Returns:
> -
> -  EFI_SUCCESS
> -
> ---*/
> +  @retval EFI_SUCCESS
> +**/
> +EFI_STATUS
> +FvBufAddFileWithExtend (
> +  IN OUT VOID **Fv,
> +  IN VOID *File
> +  )
>   {
>     EFI_STATUS Status;
>     EFI_FFS_FILE_HEADER* NewFile;
> @@ -706,29 +615,20 @@ Routine Description:
>     return Status;
>   }
>   
> -
> -EFI_STATUS
> -FvBufAddVtfFile (
> -  IN OUT VOID *Fv,
> -  IN VOID *File
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Adds a new FFS VFT (Volume Top File) file.  In other words, adds the
>     file to the end of the firmware volume.
>   
> -Arguments:
> -
> -  Fv - Address of the Fv in memory
> -  File - FFS file to add to Fv
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -
> ---*/
> +  @param Fv Address of the Fv in memory
> +  @param File FFS file to add to Fv
> +
> +  @retval EFI_SUCCESS
> +**/
> +EFI_STATUS
> +FvBufAddVtfFile (
> +  IN OUT VOID *Fv,
> +  IN VOID *File
> +  )
>   {
>     EFI_STATUS Status;
>   
> @@ -811,52 +711,35 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Expands the 3 byte size commonly used in Firmware Volume data structures
>   
> +  @param Size Address of the 3 byte array representing the size
> +
> +  @return UINT32
> +**/
>   VOID
>   FvBufCompact3ByteSize (
>     OUT VOID* SizeDest,
>     IN UINT32 Size
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Expands the 3 byte size commonly used in Firmware Volume data structures
> -
> -Arguments:
> -
> -  Size - Address of the 3 byte array representing the size
> -
> -Returns:
> -
> -  UINT32
> -
> ---*/
>   {
>     ((UINT8*)SizeDest)[0] = (UINT8)Size;
>     ((UINT8*)SizeDest)[1] = (UINT8)(Size >> 8);
>     ((UINT8*)SizeDest)[2] = (UINT8)(Size >> 16);
>   }
>   
> -UINT32
> -FvBufGetFfsFileSize (
> -  IN EFI_FFS_FILE_HEADER *Ffs
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Get the FFS file size.
>   
> -Arguments:
> -
> -  Ffs - Pointer to FFS header
> -
> -Returns:
> -
> -  UINT32
> -
> ---*/
> +  @param Ffs Pointer to FFS header
> +
> +  @return UINT32
> +**/
> +UINT32
> +FvBufGetFfsFileSize (
> +  IN EFI_FFS_FILE_HEADER *Ffs
> +  )
>   {
>     if (Ffs == NULL) {
>       return 0;
> @@ -867,25 +750,17 @@ Routine Description:
>     return FvBufExpand3ByteSize(Ffs->Size);
>   }
>   
> -UINT32
> -FvBufGetFfsHeaderSize (
> -  IN EFI_FFS_FILE_HEADER *Ffs
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Get the FFS header size.
>   
> -Arguments:
> -
> -  Ffs - Pointer to FFS header
> -
> -Returns:
> -
> -  UINT32
> -
> ---*/
> +  @param Ffs Pointer to FFS header
> +
> +  @return UINT32
> +**/
> +UINT32
> +FvBufGetFfsHeaderSize (
> +  IN EFI_FFS_FILE_HEADER *Ffs
> +  )
>   {
>     if (Ffs == NULL) {
>       return 0;
> @@ -896,60 +771,44 @@ Routine Description:
>     return sizeof(EFI_FFS_FILE_HEADER);
>   }
>   
> +/**
> +  Expands the 3 byte size commonly used in Firmware Volume data structures
> +
> +  @param Size Address of the 3 byte array representing the size
> +
> +  @return UINT32
> +**/
>   UINT32
>   FvBufExpand3ByteSize (
>     IN VOID* Size
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Expands the 3 byte size commonly used in Firmware Volume data structures
> -
> -Arguments:
> -
> -  Size - Address of the 3 byte array representing the size
> -
> -Returns:
> -
> -  UINT32
> -
> ---*/
>   {
>     return (((UINT8*)Size)[2] << 16) +
>            (((UINT8*)Size)[1] << 8) +
>            ((UINT8*)Size)[0];
>   }
>   
> -EFI_STATUS
> -FvBufFindNextFile (
> -  IN VOID *Fv,
> -  IN OUT UINTN *Key,
> -  OUT VOID **File
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Iterates through the files contained within the firmware volume
>   
> -Arguments:
> -
> -  Fv - Address of the Fv in memory
> -  Key - Should be 0 to get the first file.  After that, it should be
> -        passed back in without modifying its contents to retrieve
> -        subsequent files.
> -  File - Output file pointer
> +  @param Fv Address of the Fv in memory
> +  @param Key Should be 0 to get the first file.  After that, it should be
> +             passed back in without modifying its contents to retrieve
> +             subsequent files.
> +  @param File Output file pointer
>       File == NULL - invalid parameter
>       otherwise - *File will be update to the location of the file
>   
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -  EFI_VOLUME_CORRUPTED
> -
> ---*/
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +  @retval EFI_VOLUME_CORRUPTED
> +**/
> +EFI_STATUS
> +FvBufFindNextFile (
> +  IN VOID *Fv,
> +  IN OUT UINTN *Key,
> +  OUT VOID **File
> +  )
>   {
>     EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
>   
> @@ -1028,35 +887,26 @@ Routine Description:
>     return EFI_NOT_FOUND;
>   }
>   
> -
> -EFI_STATUS
> -FvBufFindFileByName (
> -  IN VOID *Fv,
> -  IN EFI_GUID *Name,
> -  OUT VOID **File
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Searches the Fv for a file by its name
>   
> -Arguments:
> -
> -  Fv - Address of the Fv in memory
> -  Name - Guid filename to search for in the firmware volume
> -  File - Output file pointer
> +  @param Fv Address of the Fv in memory
> +  @param Name Guid filename to search for in the firmware volume
> +  @param File Output file pointer
>       File == NULL - Only determine if the file exists, based on return
>                      value from the function call.
>       otherwise - *File will be update to the location of the file
>   
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -  EFI_VOLUME_CORRUPTED
> -
> ---*/
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +  @retval EFI_VOLUME_CORRUPTED
> +**/
> +EFI_STATUS
> +FvBufFindFileByName (
> +  IN VOID *Fv,
> +  IN EFI_GUID *Name,
> +  OUT VOID **File
> +  )
>   {
>     EFI_STATUS Status;
>     UINTN Key;
> @@ -1080,35 +930,26 @@ Routine Description:
>     return EFI_NOT_FOUND;
>   }
>   
> -
> -EFI_STATUS
> -FvBufFindFileByType (
> -  IN VOID *Fv,
> -  IN EFI_FV_FILETYPE Type,
> -  OUT VOID **File
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Searches the Fv for a file by its type
>   
> -Arguments:
> -
> -  Fv - Address of the Fv in memory
> -  Type - FFS FILE type to search for
> -  File - Output file pointer
> +  @param Fv Address of the Fv in memory
> +  @param Type FFS FILE type to search for
> +  @param File Output file pointer
>       (File == NULL) -> Only determine if the file exists, based on return
>                         value from the function call.
>       otherwise -> *File will be update to the location of the file
>   
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -  EFI_VOLUME_CORRUPTED
> -
> ---*/
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +  @retval EFI_VOLUME_CORRUPTED
> +**/
> +EFI_STATUS
> +FvBufFindFileByType (
> +  IN VOID *Fv,
> +  IN EFI_FV_FILETYPE Type,
> +  OUT VOID **File
> +  )
>   {
>     EFI_STATUS Status;
>     UINTN Key;
> @@ -1132,34 +973,25 @@ Routine Description:
>     return EFI_NOT_FOUND;
>   }
>   
> +/**
> +  Searches the requested file for raw data.
>   
> +  This routine either returns all the payload of a EFI_FV_FILETYPE_RAW file,
> +  or finds the EFI_SECTION_RAW section within the file and returns its data.
> +
> +  @param FfsFile Address of the FFS file in memory
> +  @param RawData Pointer to the raw data within the file
> +                 (This is NOT allocated.  It is within the file.)
> +  @param RawDataSize Size of the raw data within the file
> +
> +  @return EFI_STATUS
> +**/
>   EFI_STATUS
>   FvBufGetFileRawData (
>     IN  VOID*     FfsFile,
>     OUT VOID**    RawData,
>     OUT UINTN*    RawDataSize
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Searches the requested file for raw data.
> -
> -  This routine either returns all the payload of a EFI_FV_FILETYPE_RAW file,
> -  or finds the EFI_SECTION_RAW section within the file and returns its data.
> -
> -Arguments:
> -
> -  FfsFile - Address of the FFS file in memory
> -  RawData - Pointer to the raw data within the file
> -            (This is NOT allocated.  It is within the file.)
> -  RawDataSize - Size of the raw data within the file
> -
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
>   {
>     EFI_STATUS Status;
>     EFI_FFS_FILE_HEADER* File;
> @@ -1195,7 +1027,19 @@ Routine Description:
>   
>   }
>   
> +/**
> +  Packages up a FFS file containing the input raw data.
>   
> +  The file created will have a type of EFI_FV_FILETYPE_FREEFORM, and will
> +  contain one EFI_FV_FILETYPE_RAW section.
> +
> +  @param RawData Pointer to the raw data to be packed
> +  @param RawDataSize Size of the raw data to be packed
> +  @param FfsFile Address of the packaged FFS file.
> +                 Note: The called must deallocate this memory!
> +
> +  @return EFI_STATUS
> +**/
>   EFI_STATUS
>   FvBufPackageFreeformRawFile (
>     IN EFI_GUID*  Filename,
> @@ -1203,27 +1047,6 @@ FvBufPackageFreeformRawFile (
>     IN UINTN      RawDataSize,
>     OUT VOID**    FfsFile
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Packages up a FFS file containing the input raw data.
> -
> -  The file created will have a type of EFI_FV_FILETYPE_FREEFORM, and will
> -  contain one EFI_FV_FILETYPE_RAW section.
> -
> -Arguments:
> -
> -  RawData - Pointer to the raw data to be packed
> -  RawDataSize - Size of the raw data to be packed
> -  FfsFile - Address of the packaged FFS file.
> -            Note: The called must deallocate this memory!
> -
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
>   {
>     EFI_FFS_FILE_HEADER* NewFile;
>     UINT32 NewFileSize;
> @@ -1304,7 +1127,22 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Iterates through the sections contained within a given array of sections
>   
> +  @param SectionsStart Address of the start of the FFS sections array
> +  @param TotalSectionsSize Total size of all the sections
> +  @param Key Should be 0 to get the first section.  After that, it should be
> +             passed back in without modifying its contents to retrieve
> +             subsequent files.
> +  @param Section Output section pointer
> +    (Section == NULL) -> invalid parameter
> +    otherwise -> *Section will be update to the location of the file
> +
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +  @retval EFI_VOLUME_CORRUPTED
> +**/
>   EFI_STATUS
>   FvBufFindNextSection (
>     IN VOID *SectionsStart,
> @@ -1312,30 +1150,6 @@ FvBufFindNextSection (
>     IN OUT UINTN *Key,
>     OUT VOID **Section
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Iterates through the sections contained within a given array of sections
> -
> -Arguments:
> -
> -  SectionsStart - Address of the start of the FFS sections array
> -  TotalSectionsSize - Total size of all the sections
> -  Key - Should be 0 to get the first section.  After that, it should be
> -        passed back in without modifying its contents to retrieve
> -        subsequent files.
> -  Section - Output section pointer
> -    (Section == NULL) -> invalid parameter
> -    otherwise -> *Section will be update to the location of the file
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -  EFI_VOLUME_CORRUPTED
> -
> ---*/
>   {
>     EFI_COMMON_SECTION_HEADER *sectionHdr;
>     UINTN sectionSize;
> @@ -1363,31 +1177,22 @@ Routine Description:
>   
>   }
>   
> +/**
> +  Searches the FFS file and counts the number of sections found.
> +  The sections are NOT recursed.
>   
> +  @param FfsFile Address of the FFS file in memory
> +  @param Count The location to store the section count in
> +
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +  @retval EFI_VOLUME_CORRUPTED
> +**/
>   EFI_STATUS
>   FvBufCountSections (
>     IN VOID* FfsFile,
>     IN UINTN* Count
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Searches the FFS file and counts the number of sections found.
> -  The sections are NOT recursed.
> -
> -Arguments:
> -
> -  FfsFile - Address of the FFS file in memory
> -  Count - The location to store the section count in
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -  EFI_VOLUME_CORRUPTED
> -
> ---*/
>   {
>     EFI_STATUS                 Status;
>     UINTN                      Key;
> @@ -1424,35 +1229,26 @@ Routine Description:
>     return EFI_NOT_FOUND;
>   }
>   
> +/**
> +  Searches the FFS file for a section by its type
>   
> +  @param FfsFile Address of the FFS file in memory
> +  @param Type FFS FILE section type to search for
> +  @param Section Output section pointer
> +    (Section == NULL) -> Only determine if the section exists, based on return
> +                         value from the function call.
> +    otherwise -> *Section will be update to the location of the file
> +
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +  @retval EFI_VOLUME_CORRUPTED
> +**/
>   EFI_STATUS
>   FvBufFindSectionByType (
>     IN VOID *FfsFile,
>     IN UINT8 Type,
>     OUT VOID **Section
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Searches the FFS file for a section by its type
> -
> -Arguments:
> -
> -  FfsFile - Address of the FFS file in memory
> -  Type - FFS FILE section type to search for
> -  Section - Output section pointer
> -    (Section == NULL) -> Only determine if the section exists, based on return
> -                         value from the function call.
> -    otherwise -> *Section will be update to the location of the file
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -  EFI_VOLUME_CORRUPTED
> -
> ---*/
>   {
>     EFI_STATUS Status;
>     UINTN Key;
> @@ -1487,30 +1283,21 @@ Routine Description:
>     return EFI_NOT_FOUND;
>   }
>   
> +/**
> +  Shrinks a firmware volume (in place) to provide a minimal FV.
>   
> +  BUGBUG: Does not handle the case where the firmware volume has a
> +          VTF (Volume Top File).  The VTF will not be moved to the
> +          end of the extended FV.
> +
> +  @param Fv Firmware volume.
> +
> + @retval EFI_SUCCESS
> +**/
>   EFI_STATUS
>   FvBufShrinkWrap (
>     IN VOID *Fv
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Shrinks a firmware volume (in place) to provide a minimal FV.
> -
> -  BUGBUG: Does not handle the case where the firmware volume has a
> -          VTF (Volume Top File).  The VTF will not be moved to the
> -          end of the extended FV.
> -
> -Arguments:
> -
> -  Fv - Firmware volume.
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -
> ---*/
>   {
>     EFI_STATUS Status;
>     UINTN OldSize;
> @@ -1569,32 +1356,23 @@ Routine Description:
>   
>   }
>   
> +/**
> +  Searches the FFS file for a section by its type
>   
> +  @param Fv Address of the Fv in memory
> +  @param BlockSize The size of the blocks to convert the Fv to.  If the total size
> +                   of the Fv is not evenly divisible by this size, then
> +                   EFI_INVALID_PARAMETER will be returned.
> +
> +  @retval EFI_SUCCESS
> +  @retval EFI_NOT_FOUND
> +  @retval EFI_VOLUME_CORRUPTED
> +**/
>   EFI_STATUS
>   FvBufUnifyBlockSizes (
>     IN OUT VOID *Fv,
>     IN UINTN BlockSize
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Searches the FFS file for a section by its type
> -
> -Arguments:
> -
> -  Fv - Address of the Fv in memory
> -  BlockSize - The size of the blocks to convert the Fv to.  If the total size
> -              of the Fv is not evenly divisible by this size, then
> -              EFI_INVALID_PARAMETER will be returned.
> -
> -Returns:
> -
> -  EFI_SUCCESS
> -  EFI_NOT_FOUND
> -  EFI_VOLUME_CORRUPTED
> -
> ---*/
>   {
>     EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
>     EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
> @@ -1641,28 +1419,20 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -STATIC
> -UINT16
> -FvBufCalculateSum16 (
> -  IN UINT16       *Buffer,
> -  IN UINTN        Size
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     This function calculates the UINT16 sum for the requested region.
>   
> -Arguments:
> -
> -  Buffer      Pointer to buffer containing byte data of component.
> -  Size        Size of the buffer
> -
> -Returns:
> -
> -  The 16 bit checksum
> -
> ---*/
> +  @param Buffer      Pointer to buffer containing byte data of component.
> +  @param Size        Size of the buffer
> +
> +  @return The 16 bit checksum
> +**/
> +STATIC
> +UINT16
> +FvBufCalculateSum16 (
> +  IN UINT16       *Buffer,
> +  IN UINTN        Size
> +  )
>   {
>     UINTN   Index;
>     UINT16  Sum;
> @@ -1679,56 +1449,38 @@ Routine Description:
>     return (UINT16) Sum;
>   }
>   
> -
> -STATIC
> -UINT16
> -FvBufCalculateChecksum16 (
> -  IN UINT16       *Buffer,
> -  IN UINTN        Size
> -  )
> -/*++
> -
> -Routine Description::
> -
> +/**
>     This function calculates the value needed for a valid UINT16 checksum
>   
> -Arguments:
> -
> -  Buffer      Pointer to buffer containing byte data of component.
> -  Size        Size of the buffer
> -
> -Returns:
> -
> -  The 16 bit checksum value needed.
> -
> ---*/
> +  @param Buffer      Pointer to buffer containing byte data of component.
> +  @param Size        Size of the buffer
> +
> +  @return The 16 bit checksum value needed.
> +**/
> +STATIC
> +UINT16
> +FvBufCalculateChecksum16 (
> +  IN UINT16       *Buffer,
> +  IN UINTN        Size
> +  )
>   {
>     return (UINT16)(0x10000 - FvBufCalculateSum16 (Buffer, Size));
>   }
>   
> +/**
> +  This function calculates the UINT8 sum for the requested region.
>   
> +  @param Buffer      Pointer to buffer containing byte data of component.
> +  @param Size        Size of the buffer
> +
> +  @return The 8 bit checksum value needed.
> +**/
>   STATIC
>   UINT8
>   FvBufCalculateSum8 (
>     IN UINT8  *Buffer,
>     IN UINTN  Size
>     )
> -/*++
> -
> -Description:
> -
> -  This function calculates the UINT8 sum for the requested region.
> -
> -Input:
> -
> -  Buffer      Pointer to buffer containing byte data of component.
> -  Size        Size of the buffer
> -
> -Return:
> -
> -  The 8 bit checksum value needed.
> -
> ---*/
>   {
>     UINTN   Index;
>     UINT8   Sum;
> @@ -1745,29 +1497,20 @@ FvBufCalculateSum8 (
>     return Sum;
>   }
>   
> -
> -STATIC
> -UINT8
> -FvBufCalculateChecksum8 (
> -  IN UINT8        *Buffer,
> -  IN UINTN        Size
> -  )
> -/*++
> -
> -Description:
> -
> +/**
>     This function calculates the value needed for a valid UINT8 checksum
>   
> -Input:
> -
> -  Buffer      Pointer to buffer containing byte data of component.
> -  Size        Size of the buffer
> -
> -Return:
> -
> -  The 8 bit checksum value needed.
> -
> ---*/
> +  @param Buffer      Pointer to buffer containing byte data of component.
> +  @param Size        Size of the buffer
> +
> +  @return The 8 bit checksum value needed.
> +**/
> +STATIC
> +UINT8
> +FvBufCalculateChecksum8 (
> +  IN UINT8        *Buffer,
> +  IN UINTN        Size
> +  )
>   {
>     return (UINT8)(0x100 - FvBufCalculateSum8 (Buffer, Size));
>   }
> diff --git a/BaseTools/Source/C/Common/FvLib.c b/BaseTools/Source/C/Common/FvLib.c
> index 82dc557bb7db..37631f470f2a 100644
> --- a/BaseTools/Source/C/Common/FvLib.c
> +++ b/BaseTools/Source/C/Common/FvLib.c
> @@ -22,29 +22,22 @@ UINT32                      mFvLength   = 0;
>   //
>   // External function implementations
>   //
> +
> +/**
> +  This initializes the FV lib with a pointer to the FV and length.  It does not
> +  verify the FV in any way.
> +
> +  @param Fv            Buffer containing the FV.
> +  @param FvLength      Length of the FV
> +
> +  @retval EFI_SUCCESS             Function Completed successfully.
> +  @retval EFI_INVALID_PARAMETER   A required parameter was NULL.
> +**/
>   EFI_STATUS
>   InitializeFvLib (
>     IN VOID                         *Fv,
>     IN UINT32                       FvLength
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This initializes the FV lib with a pointer to the FV and length.  It does not
> -  verify the FV in any way.
> -
> -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.
> -
> ---*/
>   {
>     //
>     // Verify input arguments
> @@ -59,29 +52,21 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  This function returns a pointer to the current FV and the size.
> +
> +  @param FvHeader      Pointer to the FV buffer.
> +  @param FvLength      Length of the FV
> +
> +  @retval EFI_SUCCESS             Function Completed successfully.
> +  @retval EFI_INVALID_PARAMETER   A required parameter was NULL.
> +  @retvalEFI_ABORTED             The library needs to be initialized.
> +**/
>   EFI_STATUS
>   GetFvHeader (
>     OUT EFI_FIRMWARE_VOLUME_HEADER  **FvHeader,
>     OUT UINT32                      *FvLength
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function returns a pointer to the current FV and the size.
> -
> -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.
> -
> ---*/
>   {
>     //
>     // Verify library has been initialized.
> @@ -101,31 +86,23 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -EFI_STATUS
> -GetNextFile (
> -  IN EFI_FFS_FILE_HEADER          *CurrentFile,
> -  OUT EFI_FFS_FILE_HEADER         **NextFile
> -  )
> -/*++
> -
> -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
>     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.
> -
> ---*/
> +  @param CurrentFile   Pointer to the current file, must be within the current FV.
> +  @param NextFile      Pointer to the next file in the FV.
> +
> +  @retval EFI_SUCCESS             Function completed successfully.
> +  @retval EFI_INVALID_PARAMETER   A required parameter was NULL or is out of range.
> +  @retval EFI_ABORTED             The library needs to be initialized.
> +**/
> +EFI_STATUS
> +GetNextFile (
> +  IN EFI_FFS_FILE_HEADER          *CurrentFile,
> +  OUT EFI_FFS_FILE_HEADER         **NextFile
> +  )
>   {
>     EFI_STATUS  Status;
>   
> @@ -214,29 +191,21 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Find a file by name.  The function will return NULL if the file is not found.
> +
> +  @param FileName    The GUID file name of the file to search for.
> +  @param File        Return pointer.  In the case of an error, contents are undefined.
> +
> +  @retval EFI_SUCCESS             The function completed successfully.
> +  @retval EFI_ABORTED             An error was encountered.
> +  @retval EFI_INVALID_PARAMETER   One of the parameters was NULL.
> +**/
>   EFI_STATUS
>   GetFileByName (
>     IN EFI_GUID                     *FileName,
>     OUT EFI_FFS_FILE_HEADER         **File
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Find a file by name.  The function will return NULL if the file is not found.
> -
> -Arguments:
> -
> -  FileName    The GUID file name of the file to search for.
> -  File        Return pointer.  In the case of an error, contents are undefined.
> -
> -Returns:
> -
> -  EFI_SUCCESS             The function completed successfully.
> -  EFI_ABORTED             An error was encountered.
> -  EFI_INVALID_PARAMETER   One of the parameters was NULL.
> -
> ---*/
>   {
>     EFI_FFS_FILE_HEADER *CurrentFile;
>     EFI_STATUS          Status;
> @@ -295,33 +264,25 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -EFI_STATUS
> -GetFileByType (
> -  IN EFI_FV_FILETYPE              FileType,
> -  IN UINTN                        Instance,
> -  OUT EFI_FFS_FILE_HEADER         **File
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Find a file by type and instance.  An instance of 1 is the first instance.
>     The function will return NULL if a matching file cannot be found.
>     File type EFI_FV_FILETYPE_ALL means any file type is valid.
>   
> -Arguments:
> -
> -  FileType    Type of file to search for.
> -  Instance    Instance of the file type to return.
> -  File        Return pointer.  In the case of an error, contents are undefined.
> -
> -Returns:
> -
> -  EFI_SUCCESS             The function completed successfully.
> -  EFI_ABORTED             An error was encountered.
> -  EFI_INVALID_PARAMETER   One of the parameters was NULL.
> -
> ---*/
> +  @param FileType    Type of file to search for.
> +  @param Instance    Instance of the file type to return.
> +  @param File        Return pointer.  In the case of an error, contents are undefined.
> +
> +  @retval EFI_SUCCESS             The function completed successfully.
> +  @retval EFI_ABORTED             An error was encountered.
> +  @retval EFI_INVALID_PARAMETER   One of the parameters was NULL.
> +**/
> +EFI_STATUS
> +GetFileByType (
> +  IN EFI_FV_FILETYPE              FileType,
> +  IN UINTN                        Instance,
> +  OUT EFI_FFS_FILE_HEADER         **File
> +  )
>   {
>     EFI_FFS_FILE_HEADER *CurrentFile;
>     EFI_STATUS          Status;
> @@ -383,6 +344,23 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Helper function to search a sequence of sections from the section pointed
> +  by FirstSection to SearchEnd for the Instance-th section of type SectionType.
> +  The current counter is saved in StartIndex and when the section is found, it's
> +  saved in Section. GUID-defined sections, if special processing is not required,
> +  are searched recursively in a depth-first manner.
> +
> +  @param FirstSection The first section to start searching from.
> +  @param SearchEnd    The end address to stop search.
> +  @param SectionType  The type of section to search.
> +  @param StartIndex   The current counter is saved.
> +  @param Instance     The requested n-th section number.
> +  @param Section      The found section returned.
> +
> +  @retval EFI_SUCCESS             The function completed successfully.
> +  @retval EFI_NOT_FOUND           The section is not found.
> +**/
>   EFI_STATUS
>   SearchSectionByType (
>     IN EFI_FILE_SECTION_POINTER  FirstSection,
> @@ -392,30 +370,6 @@ SearchSectionByType (
>     IN UINTN                     Instance,
>     OUT EFI_FILE_SECTION_POINTER *Section
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Helper function to search a sequence of sections from the section pointed
> -  by FirstSection to SearchEnd for the Instance-th section of type SectionType.
> -  The current counter is saved in StartIndex and when the section is found, it's
> -  saved in Section. GUID-defined sections, if special processing is not required,
> -  are searched recursively in a depth-first manner.
> -
> -Arguments:
> -
> -  FirstSection The first section to start searching from.
> -  SearchEnd    The end address to stop search.
> -  SectionType  The type of section to search.
> -  StartIndex   The current counter is saved.
> -  Instance     The requested n-th section number.
> -  Section      The found section returned.
> -
> -Returns:
> -
> -  EFI_SUCCESS             The function completed successfully.
> -  EFI_NOT_FOUND           The section is not found.
> ---*/
>   {
>     EFI_FILE_SECTION_POINTER  CurrentSection;
>     EFI_FILE_SECTION_POINTER  InnerSection;
> @@ -479,36 +433,29 @@ Routine Description:
>     return EFI_NOT_FOUND;
>   }
>   
> -EFI_STATUS
> -GetSectionByType (
> -  IN EFI_FFS_FILE_HEADER          *File,
> -  IN EFI_SECTION_TYPE             SectionType,
> -  IN UINTN                        Instance,
> -  OUT EFI_FILE_SECTION_POINTER    *Section
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     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.
>   
> -Arguments:
> +  @param File        The file to search.
> +  @param SectionType Type of file to search for.
> +  @param Instance    Instance of the section to return.
> +  @param Section     Return pointer.  In the case of an error, contents are undefined.
>   
> -  File        The file to search.
> -  SectionType Type of file to search for.
> -  Instance    Instance of the section to return.
> -  Section     Return pointer.  In the case of an error, contents are undefined.
> -
> -Returns:
> -
> -  EFI_SUCCESS             The function completed successfully.
> -  EFI_ABORTED             An error was encountered.
> -  EFI_INVALID_PARAMETER   One of the parameters was NULL.
> -  EFI_NOT_FOUND           No found.
> ---*/
> +  @retval EFI_SUCCESS             The function completed successfully.
> +  @retval EFI_ABORTED             An error was encountered.
> +  @retval EFI_INVALID_PARAMETER   One of the parameters was NULL.
> +  @retval EFI_NOT_FOUND           No found.
> +**/
> +EFI_STATUS
> +GetSectionByType (
> +  IN EFI_FFS_FILE_HEADER          *File,
> +  IN EFI_SECTION_TYPE             SectionType,
> +  IN UINTN                        Instance,
> +  OUT EFI_FILE_SECTION_POINTER    *Section
> +  )
>   {
>     EFI_FILE_SECTION_POINTER  CurrentSection;
>     EFI_STATUS                Status;
> @@ -560,31 +507,25 @@ Routine Description:
>       return EFI_NOT_FOUND;
>     }
>   }
> +
>   //
>   // will not parse compressed sections
>   //
> +
> +/**
> +  Verify the current pointer points to a valid FV header.
> +
> +  @param FvHeader     Pointer to an alleged FV file.
> +
> +  @retval EFI_SUCCESS             The FV header is valid.
> +  @retval EFI_VOLUME_CORRUPTED    The FV header is not valid.
> +  @retval EFI_INVALID_PARAMETER   A required parameter was NULL.
> +  @retval EFI_ABORTED             Operation aborted.
> +**/
>   EFI_STATUS
>   VerifyFv (
>     IN EFI_FIRMWARE_VOLUME_HEADER   *FvHeader
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Verify the current pointer points to a valid FV header.
> -
> -Arguments:
> -
> -  FvHeader     Pointer to an alleged FV file.
> -
> -Returns:
> -
> -  EFI_SUCCESS             The FV header is valid.
> -  EFI_VOLUME_CORRUPTED    The FV header is not valid.
> -  EFI_INVALID_PARAMETER   A required parameter was NULL.
> -  EFI_ABORTED             Operation aborted.
> -
> ---*/
>   {
>     UINT16  Checksum;
>   
> @@ -612,28 +553,20 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -EFI_STATUS
> -VerifyFfsFile (
> -  IN EFI_FFS_FILE_HEADER  *FfsHeader
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Verify the current pointer points to a FFS file header.
>   
> -Arguments:
> -
> -  FfsHeader     Pointer to an alleged FFS file.
> -
> -Returns:
> -
> -  EFI_SUCCESS           The Ffs header is valid.
> -  EFI_NOT_FOUND         This "file" is the beginning of free space.
> -  EFI_VOLUME_CORRUPTED  The Ffs header is not valid.
> -  EFI_ABORTED           The erase polarity is not known.
> -
> ---*/
> +  @param FfsHeader     Pointer to an alleged FFS file.
> +
> +  @retval EFI_SUCCESS           The Ffs header is valid.
> +  @retval EFI_NOT_FOUND         This "file" is the beginning of free space.
> +  @retval EFI_VOLUME_CORRUPTED  The Ffs header is not valid.
> +  @retval EFI_ABORTED           The erase polarity is not known.
> +**/
> +EFI_STATUS
> +VerifyFfsFile (
> +  IN EFI_FFS_FILE_HEADER  *FfsHeader
> +  )
>   {
>     BOOLEAN             ErasePolarity;
>     EFI_STATUS          Status;
> @@ -754,25 +687,17 @@ GetSectionHeaderLength(
>     return sizeof(EFI_COMMON_SECTION_HEADER);
>   }
>   
> +/**
> +  Get FFS file length including FFS header.
> +
> +  @param FfsHeader   Pointer to EFI_FFS_FILE_HEADER.
> +
> +  @return UINT32      Length of FFS file header.
> +**/
>   UINT32
>   GetFfsFileLength (
>     EFI_FFS_FILE_HEADER *FfsHeader
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Get FFS file length including FFS header.
> -
> -Arguments:
> -
> -  FfsHeader   Pointer to EFI_FFS_FILE_HEADER.
> -
> -Returns:
> -
> -  UINT32      Length of FFS file header.
> -
> ---*/
>   {
>     if (FfsHeader == NULL) {
>       return 0;
> @@ -800,25 +725,17 @@ GetSectionFileLength (
>     return Length;
>   }
>   
> +/**
> +  Converts a three byte length value into a UINT32.
> +
> +  @param ThreeByteLength   Pointer to the first of the 3 byte length.
> +
> +  @return UINT32      Size of the section
> +**/
>   UINT32
>   GetLength (
>     UINT8     *ThreeByteLength
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Converts a three byte length value into a UINT32.
> -
> -Arguments:
> -
> -  ThreeByteLength   Pointer to the first of the 3 byte length.
> -
> -Returns:
> -
> -  UINT32      Size of the section
> -
> ---*/
>   {
>     UINT32  Length;
>   
> @@ -832,28 +749,20 @@ Routine Description:
>     return Length;
>   }
>   
> -EFI_STATUS
> -GetErasePolarity (
> -  OUT BOOLEAN   *ErasePolarity
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     This function returns with the FV erase polarity.  If the erase polarity
>     for a bit is 1, the function return TRUE.
>   
> -Arguments:
> -
> -  ErasePolarity   A pointer to the erase polarity.
> -
> -Returns:
> -
> -  EFI_SUCCESS              The function completed successfully.
> -  EFI_INVALID_PARAMETER    One of the input parameters was invalid.
> -  EFI_ABORTED              Operation aborted.
> -
> ---*/
> +  @param ErasePolarity   A pointer to the erase polarity.
> +
> +  @retval EFI_SUCCESS              The function completed successfully.
> +  @retval EFI_INVALID_PARAMETER    One of the input parameters was invalid.
> +  @retval EFI_ABORTED              Operation aborted.
> +**/
> +EFI_STATUS
> +GetErasePolarity (
> +  OUT BOOLEAN   *ErasePolarity
> +  )
>   {
>     EFI_STATUS  Status;
>   
> @@ -886,28 +795,20 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  This function returns a the highest state bit in the FFS that is set.
> +  It in no way validate the FFS file.
> +
> +  @param ErasePolarity The erase polarity for the file state bits.
> +  @param FfsHeader     Pointer to a FFS file.
> +
> +  @retval UINT8   The hightest set state of the file.
> +**/
>   UINT8
>   GetFileState (
>     IN BOOLEAN              ErasePolarity,
>     IN EFI_FFS_FILE_HEADER  *FfsHeader
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function returns a the highest state bit in the FFS that is set.
> -  It in no way validate the FFS file.
> -
> -Arguments:
> -
> -  ErasePolarity The erase polarity for the file state bits.
> -  FfsHeader     Pointer to a FFS file.
> -
> -Returns:
> -
> -  UINT8   The hightest set state of the file.
> -
> ---*/
>   {
>     UINT8 FileState;
>     UINT8 HighestBit;
> diff --git a/BaseTools/Source/C/Common/MemoryFile.c b/BaseTools/Source/C/Common/MemoryFile.c
> index 8154a3c99006..47481326833e 100644
> --- a/BaseTools/Source/C/Common/MemoryFile.c
> +++ b/BaseTools/Source/C/Common/MemoryFile.c
> @@ -27,29 +27,21 @@ CheckMemoryFileState (
>   // Function implementations
>   //
>   
> -EFI_STATUS
> -GetMemoryFile (
> -  IN CHAR8       *InputFileName,
> -  OUT EFI_HANDLE *OutputMemoryFile
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     This opens a file, reads it into memory and returns a memory file
>     object.
>   
> -Arguments:
> +  @param InputFile          Memory file image.
> +  @param OutputMemoryFile   Handle to memory file
>   
> -  InputFile          Memory file image.
> -  OutputMemoryFile   Handle to memory file
> -
> -Returns:
> -
> -  EFI_STATUS
> +  @return EFI_STATUS
>     OutputMemoryFile is valid if !EFI_ERROR
> -
> ---*/
> +**/
> +EFI_STATUS
> +GetMemoryFile (
> +  IN CHAR8       *InputFileName,
> +  OUT EFI_HANDLE *OutputMemoryFile
> +  )
>   {
>     EFI_STATUS  Status;
>     CHAR8       *InputFileImage;
> @@ -78,26 +70,17 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -
> -EFI_STATUS
> -FreeMemoryFile (
> -  IN EFI_HANDLE InputMemoryFile
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Frees all memory associated with the input memory file.
>   
> -Arguments:
> -
> -  InputMemoryFile   Handle to memory file
> -
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
> +  @param InputMemoryFile   Handle to memory file
> +
> +  @return EFI_STATUS
> +**/
> +EFI_STATUS
> +FreeMemoryFile (
> +  IN EFI_HANDLE InputMemoryFile
> +  )
>   {
>     MEMORY_FILE *MemoryFile;
>   
> @@ -118,31 +101,22 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -
> -CHAR8 *
> -ReadMemoryFileLine (
> -  IN EFI_HANDLE     InputMemoryFile
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     This function reads a line from the memory file.  The newline characters
>     are stripped and a null terminated string is returned.
>   
>     If the string pointer returned is non-NULL, then the caller must free the
>     memory associated with this string.
>   
> -Arguments:
> -
> -  InputMemoryFile   Handle to memory file
> -
> -Returns:
> -
> -  NULL if error or EOF
> -  NULL character termincated string otherwise (MUST BE FREED BY CALLER)
> -
> ---*/
> +  @param InputMemoryFile   Handle to memory file
> +
> +  @retval NULL if error or EOF
> +  @retval NULL character termincated string otherwise (MUST BE FREED BY CALLER)
> +**/
> +CHAR8 *
> +ReadMemoryFileLine (
> +  IN EFI_HANDLE     InputMemoryFile
> +  )
>   {
>     CHAR8       *EndOfLine;
>     UINTN       CharsToCopy;
> diff --git a/BaseTools/Source/C/Common/MyAlloc.c b/BaseTools/Source/C/Common/MyAlloc.c
> index d104795d4687..17ff5cfbbd3e 100644
> --- a/BaseTools/Source/C/Common/MyAlloc.c
> +++ b/BaseTools/Source/C/Common/MyAlloc.c
> @@ -27,40 +27,23 @@ STATIC MY_ALLOC_STRUCT  *MyAllocData = NULL;
>   STATIC UINT32           MyAllocHeadMagik  = MYALLOC_HEAD_MAGIK;
>   STATIC UINT32           MyAllocTailMagik  = MYALLOC_TAIL_MAGIK;
>   
> -//
> -// ////////////////////////////////////////////////////////////////////////////
> -//
> -//
> +/**
> +  Check for corruptions in the allocated memory chain.  If a corruption
> +  is detection program operation stops w/ an exit(1) call.
> +
> +  @param Final When FALSE, MyCheck() returns if the allocated memory chain
> +               has not been corrupted.  When TRUE, MyCheck() returns if there
> +               are no un-freed allocations.  If there are un-freed allocations,
> +               they are displayed and exit(1) is called.
> +  @param File Set to __FILE__ by macro expansion.
> +  @param Line Set to __LINE__ by macro expansion.
> +**/
>   VOID
>   MyCheck (
>     BOOLEAN      Final,
>     UINT8        File[],
>     UINTN        Line
>     )
> -// *++
> -// Description:
> -//
> -//  Check for corruptions in the allocated memory chain.  If a corruption
> -//  is detection program operation stops w/ an exit(1) call.
> -//
> -// Parameters:
> -//
> -//  Final := When FALSE, MyCheck() returns if the allocated memory chain
> -//           has not been corrupted.  When TRUE, MyCheck() returns if there
> -//           are no un-freed allocations.  If there are un-freed allocations,
> -//           they are displayed and exit(1) is called.
> -//
> -//
> -//  File := Set to __FILE__ by macro expansion.
> -//
> -//  Line := Set to __LINE__ by macro expansion.
> -//
> -// Returns:
> -//
> -//  n/a
> -//
> -// --*/
> -//
>   {
>     MY_ALLOC_STRUCT *Tmp;
>   
> @@ -155,39 +138,26 @@ MyCheck (
>       }
>     }
>   }
> -//
> -// ////////////////////////////////////////////////////////////////////////////
> -//
> -//
> +
> +/**
> +  Allocate a new link in the allocation chain along with enough storage
> +  for the File[] string, requested Size and alignment overhead.  If
> +  memory cannot be allocated or the allocation chain has been corrupted,
> +  exit(1) will be called.
> +
> +  @param Size Number of bytes (UINT8) requested by the called.
> +              Size cannot be zero.
> +  @param File Set to __FILE__ by macro expansion.
> +  @param Line Set to __LINE__ by macro expansion.
> +
> +  @return Pointer to the caller's buffer.
> +**/
>   VOID *
>   MyAlloc (
>     UINTN      Size,
>     UINT8 File[],
>     UINTN      Line
>     )
> -// *++
> -// Description:
> -//
> -//  Allocate a new link in the allocation chain along with enough storage
> -//  for the File[] string, requested Size and alignment overhead.  If
> -//  memory cannot be allocated or the allocation chain has been corrupted,
> -//  exit(1) will be called.
> -//
> -// Parameters:
> -//
> -//  Size := Number of bytes (UINT8) requested by the called.
> -//          Size cannot be zero.
> -//
> -//  File := Set to __FILE__ by macro expansion.
> -//
> -//  Line := Set to __LINE__ by macro expansion.
> -//
> -// Returns:
> -//
> -//  Pointer to the caller's buffer.
> -//
> -// --*/
> -//
>   {
>     MY_ALLOC_STRUCT *Tmp;
>     UINTN           Len;
> @@ -278,10 +248,19 @@ MyAlloc (
>   
>     return Tmp->Buffer + sizeof (UINT32);
>   }
> -//
> -// ////////////////////////////////////////////////////////////////////////////
> -//
> -//
> +
> +/**
> +  This does a MyAlloc(), memcpy() and MyFree().  There is no optimization
> +  for shrinking or expanding buffers.  An invalid parameter will cause
> +  MyRealloc() to fail with a call to exit(1).
> +
> +  @param Ptr Pointer to the caller's buffer to be re-allocated.
> +  @param Size Size of new buffer.  Size cannot be zero.
> +  @param File Set to __FILE__ by macro expansion.
> +  @param Line Set to __LINE__ by macro expansion.
> +
> +  @return Pointer to new caller's buffer.
> +**/
>   VOID *
>   MyRealloc (
>     VOID       *Ptr,
> @@ -289,29 +268,6 @@ MyRealloc (
>     UINT8 File[],
>     UINTN      Line
>     )
> -// *++
> -// Description:
> -//
> -//  This does a MyAlloc(), memcpy() and MyFree().  There is no optimization
> -//  for shrinking or expanding buffers.  An invalid parameter will cause
> -//  MyRealloc() to fail with a call to exit(1).
> -//
> -// Parameters:
> -//
> -//  Ptr := Pointer to the caller's buffer to be re-allocated.
> -//
> -//  Size := Size of new buffer.  Size cannot be zero.
> -//
> -//  File := Set to __FILE__ by macro expansion.
> -//
> -//  Line := Set to __LINE__ by macro expansion.
> -//
> -// Returns:
> -//
> -//  Pointer to new caller's buffer.
> -//
> -// --*/
> -//
>   {
>     MY_ALLOC_STRUCT *Tmp;
>     VOID            *Buffer;
> @@ -398,37 +354,22 @@ MyRealloc (
>   
>     return Buffer;
>   }
> -//
> -// ////////////////////////////////////////////////////////////////////////////
> -//
> -//
> +
> +/**
> +  Release a previously allocated buffer.  Invalid parameters will cause
> +  MyFree() to fail with an exit(1) call.
> +
> +  @param Ptr Pointer to the caller's buffer to be freed.
> +             A NULL pointer will be ignored.
> +  @param File Set to __FILE__ by macro expansion.
> +  @param Line Set to __LINE__ by macro expansion.
> +**/
>   VOID
>   MyFree (
>     VOID       *Ptr,
>     UINT8 File[],
>     UINTN      Line
>     )
> -// *++
> -// Description:
> -//
> -//  Release a previously allocated buffer.  Invalid parameters will cause
> -//  MyFree() to fail with an exit(1) call.
> -//
> -// Parameters:
> -//
> -//  Ptr := Pointer to the caller's buffer to be freed.
> -//         A NULL pointer will be ignored.
> -//
> -//  File := Set to __FILE__ by macro expansion.
> -//
> -//  Line := Set to __LINE__ by macro expansion.
> -//
> -// Returns:
> -//
> -//  n/a
> -//
> -// --*/
> -//
>   {
>     MY_ALLOC_STRUCT *Tmp;
>     MY_ALLOC_STRUCT *Tmp2;
> diff --git a/BaseTools/Source/C/Common/OsPath.c b/BaseTools/Source/C/Common/OsPath.c
> index 35ca54761f14..9901f686c98f 100644
> --- a/BaseTools/Source/C/Common/OsPath.c
> +++ b/BaseTools/Source/C/Common/OsPath.c
> @@ -20,14 +20,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>     //
>     // BUGBUG: Not fully implemented yet.
>     //
> -CHAR8*
> -OsPathDirName (
> -  IN CHAR8    *FilePath
> -  )
> -/*++
> -
> -Routine Description:
>   
> +/**
>     This function returns the directory path which contains the particular path.
>     Some examples:
>       "a/b/c"  -> "a/b"
> @@ -40,15 +34,15 @@ Routine Description:
>   
>     The caller must free the string returned.
>   
> -Arguments:
> +  @param FilePath     Path name of file to get the parent directory for.
>   
> -  FilePath     Path name of file to get the parent directory for.
> +  @return NULL if error
> +**/
> +CHAR8*
> +OsPathDirName (
> +  IN CHAR8    *FilePath
> +  )
>   
> -Returns:
> -
> -  NULL if error
> -
> ---*/
>   {
>     CHAR8 *Return;
>     CHAR8 *Pos;
> @@ -97,14 +91,8 @@ Routine Description:
>     //
>     // BUGBUG: Not fully implemented yet.
>     //
> -VOID
> -OsPathNormPathInPlace (
> -  IN CHAR8    *Path
> -  )
> -/*++
> -
> -Routine Description:
>   
> +/**
>     This function returns the directory path which contains the particular path.
>     Some examples:
>       "a/b/../c" -> "a/c"
> @@ -113,15 +101,14 @@ Routine Description:
>   
>     This function does not check for the existence of the file.
>   
> -Arguments:
> -
> -  Path     Path name of file to normalize
> -
> -Returns:
> -
> -  The string is altered in place.
> -
> ---*/
> +  @param Path     Path name of file to normalize
> +
> +  @return The string is altered in place.
> +**/
> +VOID
> +OsPathNormPathInPlace (
> +  IN CHAR8    *Path
> +  )
>   {
>     CHAR8   *Pos;
>     INTN    Offset;
> @@ -200,16 +187,7 @@ Routine Description:
>   }
>   #endif
>   
> -
> -CHAR8*
> -OsPathPeerFilePath (
> -  IN CHAR8    *OldPath,
> -  IN CHAR8    *Peer
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     This function replaces the final portion of a path with an alternative
>     'peer' filename.  For example:
>       "a/b/../c", "peer" -> "a/b/../peer"
> @@ -219,16 +197,16 @@ Routine Description:
>   
>     This function does not check for the existence of the file.
>   
> -Arguments:
> -
> -  OldPath     Path name of replace the final segment
> -  Peer        The new path name to concatenate to become the peer path
> -
> -Returns:
> -
> -  A CHAR8* string, which must be freed by the caller
> -
> ---*/
> +  @param OldPath     Path name of replace the final segment
> +  @param Peer        The new path name to concatenate to become the peer path
> +
> +  @return A CHAR8* string, which must be freed by the caller
> +**/
> +CHAR8*
> +OsPathPeerFilePath (
> +  IN CHAR8    *OldPath,
> +  IN CHAR8    *Peer
> +  )
>   {
>     CHAR8 *Result;
>     INTN    Offset;
> @@ -259,27 +237,18 @@ Routine Description:
>     return Result;
>   }
>   
> +/**
> +  Checks if a file exists
>   
> +  @param InputFileName     The name of the file to check for existence
> +
> +  @retval TRUE              The file exists
> +  @retval FALSE             The file does not exist
> +**/
>   BOOLEAN
>   OsPathExists (
>     IN CHAR8    *InputFileName
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Checks if a file exists
> -
> -Arguments:
> -
> -  InputFileName     The name of the file to check for existence
> -
> -Returns:
> -
> -  TRUE              The file exists
> -  FALSE             The file does not exist
> -
> ---*/
>   {
>     FILE    *InputFile;
>     InputFile = fopen (LongFilePath (InputFileName), "rb");
> diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
> index a34581ecb61a..e1e9a97e7bf6 100644
> --- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
> +++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
> @@ -33,30 +33,22 @@ typedef struct _GUID_SEC_TOOL_ENTRY {
>   // Function Implementation
>   //
>   
> +/**
> +  This function parses the tools_def.txt file.  It returns a
> +  EFI_HANDLE object which can be used for the other library
> +  functions and should be passed to FreeParsedGuidedSectionToolsHandle
> +  to free resources when the tools_def.txt information is no
> +  longer needed.
> +
> +  @param InputFile     Path name of file to read
> +
> +  @retval NULL if error parsing
> +  @retval A non-NULL EFI_HANDLE otherwise
> +**/
>   EFI_HANDLE
>   ParseGuidedSectionToolsFile (
>     IN CHAR8    *InputFile
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function parses the tools_def.txt file.  It returns a
> -  EFI_HANDLE object which can be used for the other library
> -  functions and should be passed to FreeParsedGuidedSectionToolsHandle
> -  to free resources when the tools_def.txt information is no
> -  longer needed.
> -
> -Arguments:
> -
> -  InputFile     Path name of file to read
> -
> -Returns:
> -
> -  NULL if error parsing
> -  A non-NULL EFI_HANDLE otherwise
> -
> ---*/
>   {
>     EFI_STATUS Status;
>     EFI_HANDLE MemoryFile;
> @@ -74,31 +66,22 @@ Routine Description:
>     return ParsedGuidedSectionTools;
>   }
>   
> +/**
> +  This function parses the tools_def.txt file.  It returns a
> +  EFI_HANDLE object which can be used for the other library
> +  functions and should be passed to FreeParsedGuidedSectionToolsHandle
> +  to free resources when the tools_def.txt information is no
> +  longer needed.
>   
> +  @param InputFile     Memory file image.
> +
> +  @retval NULL if error or EOF
> +  @retval InputBuffer otherwise
> +**/
>   EFI_HANDLE
>   ParseGuidedSectionToolsMemoryFile (
>     IN EFI_HANDLE    InputFile
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function parses the tools_def.txt file.  It returns a
> -  EFI_HANDLE object which can be used for the other library
> -  functions and should be passed to FreeParsedGuidedSectionToolsHandle
> -  to free resources when the tools_def.txt information is no
> -  longer needed.
> -
> -Arguments:
> -
> -  InputFile     Memory file image.
> -
> -Returns:
> -
> -  NULL if error or EOF
> -  InputBuffer otherwise
> -
> ---*/
>   {
>     EFI_STATUS  Status;
>     CHAR8       *NextLine;
> @@ -160,31 +143,22 @@ Routine Description:
>     return FirstGuidTool;
>   }
>   
> +/**
> +  This function looks up the appropriate tool to use for extracting
> +  a GUID defined FV section.
>   
> +  @param ParsedGuidedSectionToolsHandle    A parsed GUID section tools handle.
> +  @param SectionGuid                       The GUID for the section.
> +
> +  @retval NULL     if no tool is found or there is another error
> +  @retval Non-NULL The tool to use to access the section contents.  (The caller
> +             must free the memory associated with this string.)
> +**/
>   CHAR8*
>   LookupGuidedSectionToolPath (
>     IN EFI_HANDLE ParsedGuidedSectionToolsHandle,
>     IN EFI_GUID   *SectionGuid
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function looks up the appropriate tool to use for extracting
> -  a GUID defined FV section.
> -
> -Arguments:
> -
> -  ParsedGuidedSectionToolsHandle    A parsed GUID section tools handle.
> -  SectionGuid                       The GUID for the section.
> -
> -Returns:
> -
> -  NULL     - if no tool is found or there is another error
> -  Non-NULL - The tool to use to access the section contents.  (The caller
> -             must free the memory associated with this string.)
> -
> ---*/
>   {
>     GUID_SEC_TOOL_ENTRY *GuidTool;
>   
> diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c
> index 5ef8f1306d65..63da3d647cb7 100644
> --- a/BaseTools/Source/C/Common/ParseInf.c
> +++ b/BaseTools/Source/C/Common/ParseInf.c
> @@ -14,16 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   #include "ParseInf.h"
>   #include "CommonLib.h"
>   
> -CHAR8 *
> -ReadLine (
> -  IN MEMORY_FILE    *InputFile,
> -  IN OUT CHAR8      *InputBuffer,
> -  IN UINTN          MaxLength
> -  )
> -/*++
> -
> -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
> @@ -31,18 +22,20 @@ Routine Description:
>     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:
> +  @param InputFile     Memory file image.
> +  @param InputBuffer   Buffer to read into, must be MaxLength size.
> +  @param MaxLength     The maximum size of the input buffer.
> +
> +  @retval NULL if error or EOF
> +  @retval InputBuffer otherwise
> +**/
> +CHAR8 *
> +ReadLine (
> +  IN MEMORY_FILE    *InputFile,
> +  IN OUT CHAR8      *InputBuffer,
> +  IN UINTN          MaxLength
> +  )
>   
> -  InputFile     Memory file image.
> -  InputBuffer   Buffer to read into, must be MaxLength size.
> -  MaxLength     The maximum size of the input buffer.
> -
> -Returns:
> -
> -  NULL if error or EOF
> -  InputBuffer otherwise
> -
> ---*/
>   {
>     CHAR8 *CharPtr;
>     CHAR8 *EndOfLine;
> @@ -129,29 +122,21 @@ Routine Description:
>     return InputBuffer;
>   }
>   
> +/**
> +  This function parses a file from the beginning to find a section.
> +  The section string may be anywhere within a line.
> +
> +  @param InputFile     Memory file image.
> +  @param Section       Section to search for
> +
> +  @retval FALSE if error or EOF
> +  @retval TRUE if section found
> +**/
>   BOOLEAN
>   FindSection (
>     IN MEMORY_FILE    *InputFile,
>     IN CHAR8          *Section
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function parses a file from the beginning to find a section.
> -  The section string may be anywhere within a line.
> -
> -Arguments:
> -
> -  InputFile     Memory file image.
> -  Section       Section to search for
> -
> -Returns:
> -
> -  FALSE if error or EOF
> -  TRUE if section found
> -
> ---*/
>   {
>     CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
>     CHAR8 *CurrentToken;
> @@ -190,6 +175,21 @@ Routine Description:
>     return FALSE;
>   }
>   
> +/**
> +  Finds a token value given the section and token to search for.
> +
> +  @param InputFile Memory file image.
> +  @param Section   The section to search for, a string within [].
> +  @param Token     The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
> +  @param Instance  The instance of the token to search for.  Zero is the first instance.
> +  @param Value     The string that holds the value following the =.  Must be MAX_LONG_FILE_PATH in size.
> +
> +  @retval EFI_SUCCESS             Value found.
> +  @retval EFI_ABORTED             Format error detected in INF file.
> +  @retval EFI_INVALID_PARAMETER   Input argument was null.
> +  @retval EFI_LOAD_ERROR          Error reading from the file.
> +  @retval EFI_NOT_FOUND           Section/Token/Value not found.
> +**/
>   EFI_STATUS
>   FindToken (
>     IN MEMORY_FILE    *InputFile,
> @@ -198,29 +198,6 @@ FindToken (
>     IN UINTN          Instance,
>     OUT CHAR8         *Value
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Finds a token value given the section and token to search for.
> -
> -Arguments:
> -
> -  InputFile Memory file image.
> -  Section   The section to search for, a string within [].
> -  Token     The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
> -  Instance  The instance of the token to search for.  Zero is the first instance.
> -  Value     The string that holds the value following the =.  Must be MAX_LONG_FILE_PATH in size.
> -
> -Returns:
> -
> -  EFI_SUCCESS             Value found.
> -  EFI_ABORTED             Format error detected in INF file.
> -  EFI_INVALID_PARAMETER   Input argument was null.
> -  EFI_LOAD_ERROR          Error reading from the file.
> -  EFI_NOT_FOUND           Section/Token/Value not found.
> -
> ---*/
>   {
>     CHAR8   InputBuffer[MAX_LONG_FILE_PATH];
>     CHAR8   *CurrentToken;
> @@ -359,30 +336,22 @@ Routine Description:
>     return EFI_NOT_FOUND;
>   }
>   
> +/**
> +  Converts a string to an EFI_GUID.  The string must be in the
> +  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
> +
> +  @param AsciiGuidBuffer pointer to ascii string
> +  @param GuidBuffer      pointer to destination Guid
> +
> +  @retval EFI_ABORTED             Could not convert the string
> +  @retval EFI_SUCCESS             The string was successfully converted
> +  @retval EFI_INVALID_PARAMETER   Input parameter is invalid.
> +**/
>   EFI_STATUS
>   StringToGuid (
>     IN CHAR8      *AsciiGuidBuffer,
>     OUT EFI_GUID  *GuidBuffer
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Converts a string to an EFI_GUID.  The string must be in the
> -  xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
> -
> -Arguments:
> -
> -  AsciiGuidBuffer - pointer to ascii string
> -  GuidBuffer      - pointer to destination Guid
> -
> -Returns:
> -
> -  EFI_ABORTED             Could not convert the string
> -  EFI_SUCCESS             The string was successfully converted
> -  EFI_INVALID_PARAMETER   Input parameter is invalid.
> -
> ---*/
>   {
>     INT32 Index;
>     int   Data1;
> @@ -461,33 +430,25 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -EFI_STATUS
> -AsciiStringToUint64 (
> -  IN CONST CHAR8  *AsciiString,
> -  IN BOOLEAN      IsHex,
> -  OUT UINT64      *ReturnValue
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Converts a null terminated ascii string that represents a number into a
>     UINT64 value.  A hex number may be preceded 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:
> -
> -  AsciiString   The string to convert.
> -  IsHex         Force the string to be treated as a hex number.
> -  ReturnValue   The return value.
> -
> -Returns:
> -
> -  EFI_SUCCESS   Number successfully converted.
> -  EFI_ABORTED   Invalid character encountered.
> -
> ---*/
> +  @param AsciiString   The string to convert.
> +  @param IsHex         Force the string to be treated as a hex number.
> +  @param ReturnValue   The return value.
> +
> +  @retval EFI_SUCCESS   Number successfully converted.
> +  @retval EFI_ABORTED   Invalid character encountered.
> +**/
> +EFI_STATUS
> +AsciiStringToUint64 (
> +  IN CONST CHAR8  *AsciiString,
> +  IN BOOLEAN      IsHex,
> +  OUT UINT64      *ReturnValue
> +  )
>   {
>     UINT8   Index;
>     UINT64  Value;
> @@ -577,29 +538,21 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  This function reads a line, stripping any comments.
> +  // BUGBUG:  This is obsolete once genmake goes away...
> +
> +  @param InputFile     Stream pointer.
> +  @param InputBuffer   Buffer to read into, must be MAX_LONG_FILE_PATH size.
> +
> +  @retval NULL if error or EOF
> +  @retval InputBuffer otherwise
> +**/
>   CHAR8 *
>   ReadLineInStream (
>     IN FILE       *InputFile,
>     IN OUT CHAR8  *InputBuffer
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function reads a line, stripping any comments.
> -  // BUGBUG:  This is obsolete once genmake goes away...
> -
> -Arguments:
> -
> -  InputFile     Stream pointer.
> -  InputBuffer   Buffer to read into, must be MAX_LONG_FILE_PATH size.
> -
> -Returns:
> -
> -  NULL if error or EOF
> -  InputBuffer otherwise
> -
> ---*/
>   {
>     CHAR8 *CharPtr;
>   
> @@ -633,30 +586,22 @@ Routine Description:
>     return InputBuffer;
>   }
>   
> +/**
> +  This function parses a stream file from the beginning to find a section.
> +  The section string may be anywhere within a line.
> +  // BUGBUG:  This is obsolete once genmake goes away...
> +
> +  @param InputFile     Stream pointer.
> +  @param Section       Section to search for
> +
> +  @retval FALSE if error or EOF
> +  @retval TRUE if section found
> +**/
>   BOOLEAN
>   FindSectionInStream (
>     IN FILE       *InputFile,
>     IN CHAR8      *Section
>     )
> -/*++
> -
> -Routine Description:
> -
> -  This function parses a stream file from the beginning to find a section.
> -  The section string may be anywhere within a line.
> -  // BUGBUG:  This is obsolete once genmake goes away...
> -
> -Arguments:
> -
> -  InputFile     Stream pointer.
> -  Section       Section to search for
> -
> -Returns:
> -
> -  FALSE if error or EOF
> -  TRUE if section found
> -
> ---*/
>   {
>     CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
>     CHAR8 *CurrentToken;
> diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/C/Common/PcdValueCommon.c
> index 98023e8786d8..591a7787828c 100644
> --- a/BaseTools/Source/C/Common/PcdValueCommon.c
> +++ b/BaseTools/Source/C/Common/PcdValueCommon.c
> @@ -35,6 +35,15 @@ typedef struct {
>   PCD_ENTRY  *PcdList;
>   UINT32     PcdListLength;
>   
> +/**
> +  Record new token information
> +
> +  @param FileBuffer    File Buffer to be record
> +  @param PcdIndex      Index of PCD in database
> +  @param TokenIndex    Index of Token
> +  @param TokenStart    Start of Token
> +  @param TokenEnd      End of Token
> +**/
>   VOID
>   STATIC
>   RecordToken (
> @@ -44,24 +53,7 @@ RecordToken (
>     UINT32  TokenStart,
>     UINT32  TokenEnd
>     )
> -/*++
>   
> -Routine Description:
> -
> -  Record new token information
> -
> -Arguments:
> -
> -  FileBuffer    File Buffer to be record
> -  PcdIndex      Index of PCD in database
> -  TokenIndex    Index of Token
> -  TokenStart    Start of Token
> -  TokenEnd      End of Token
> -
> -Returns:
> -
> -  None
> ---*/
>   {
>     CHAR8  *Token;
>   
> @@ -109,31 +101,24 @@ Routine Description:
>     }
>   }
>   
> -int
> -STATIC
> -LookupPcdIndex (
> -  CHAR8  *SkuName             OPTIONAL,
> -  CHAR8  *DefaultValueName    OPTIONAL,
> -  CHAR8  *TokenSpaceGuidName,
> -  CHAR8  *TokenName
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Get PCD index in Pcd database
>   
> -Arguments:
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
>   
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -
> -Returns:
> -
> -  Index of PCD in Pcd database
> ---*/
> +  @return Index of PCD in Pcd database
> +**/
> +int
> +STATIC
> +LookupPcdIndex (
> +  CHAR8  *SkuName             OPTIONAL,
> +  CHAR8  *DefaultValueName    OPTIONAL,
> +  CHAR8  *TokenSpaceGuidName,
> +  CHAR8  *TokenName
> +  )
>   {
>     UINT32  Index;
>   
> @@ -161,6 +146,16 @@ Routine Description:
>     return -1;
>   }
>   
> +/**
> +  Get PCD value
> +
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
> +
> +  @return PCD value
> +**/
>   UINT64
>   __PcdGet (
>     CHAR8  *SkuName             OPTIONAL,
> @@ -168,23 +163,6 @@ __PcdGet (
>     CHAR8  *TokenSpaceGuidName,
>     CHAR8  *TokenName
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Get PCD value
> -
> -Arguments:
> -
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -
> -Returns:
> -
> -  PCD value
> ---*/
>   {
>     int    Index;
>     CHAR8  *End;
> @@ -212,6 +190,15 @@ Routine Description:
>     return 0;
>   }
>   
> +/**
> +  Set PCD value
> +
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
> +  @param Value                 PCD value to be set
> +**/
>   VOID
>   __PcdSet (
>     CHAR8   *SkuName             OPTIONAL,
> @@ -220,24 +207,6 @@ __PcdSet (
>     CHAR8   *TokenName,
>     UINT64  Value
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Set PCD value
> -
> -Arguments:
> -
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -  Value                 PCD value to be set
> -
> -Returns:
> -
> -  None
> ---*/
>   {
>     int    Index;
>   
> @@ -275,6 +244,17 @@ Routine Description:
>     }
>   }
>   
> +/**
> +  Get PCD value buffer
> +
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
> +  @param Size                  Size of PCD value buffer
> +
> +  @return PCD value buffer
> +**/
>   VOID *
>   __PcdGetPtr (
>     CHAR8   *SkuName             OPTIONAL,
> @@ -283,24 +263,6 @@ __PcdGetPtr (
>     CHAR8   *TokenName,
>     UINT32  *Size
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Get PCD value buffer
> -
> -Arguments:
> -
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -  Size                  Size of PCD value buffer
> -
> -Returns:
> -
> -  PCD value buffer
> ---*/
>   {
>     int    Index;
>     CHAR8   *Value;
> @@ -341,6 +303,16 @@ Routine Description:
>     return 0;
>   }
>   
> +/**
> +  Set PCD value buffer
> +
> +  @param SkuName               SkuName String
> +  @param DefaultValueName      DefaultValueName String
> +  @param TokenSpaceGuidName    TokenSpaceGuidName String
> +  @param TokenName             TokenName String
> +  @param Size                  Size of PCD value
> +  @param Value                 Pointer to the updated PCD value buffer
> +**/
>   VOID
>   __PcdSetPtr (
>     CHAR8   *SkuName             OPTIONAL,
> @@ -350,25 +322,6 @@ __PcdSetPtr (
>     UINT32  Size,
>     UINT8   *Value
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Set PCD value buffer
> -
> -Arguments:
> -
> -  SkuName               SkuName String
> -  DefaultValueName      DefaultValueName String
> -  TokenSpaceGuidName    TokenSpaceGuidName String
> -  TokenName             TokenName String
> -  Size                  Size of PCD value
> -  Value                 Pointer to the updated PCD value buffer
> -
> -Returns:
> -
> -  None
> ---*/
>   {
>     int    Index;
>     UINT32  ValueIndex;
> @@ -400,6 +353,13 @@ Routine Description:
>     }
>   }
>   
> +/**
> +  Read the file buffer from the input file.
> +
> +  @param InputFileName Point to the input file name.
> +  @param FileBuffer    Point to the input file buffer.
> +  @param FileSize      Size of the file buffer.
> +**/
>   VOID
>   STATIC
>   ReadInputFile (
> @@ -407,22 +367,6 @@ ReadInputFile (
>     UINT8   **FileBuffer,
>     UINT32  *FileSize
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Read the file buffer from the input file.
> -
> -Arguments:
> -
> -  InputFileName Point to the input file name.
> -  FileBuffer    Point to the input file buffer.
> -  FileSize      Size of the file buffer.
> -
> -Returns:
> -
> -  None
> ---*/
>   {
>     FILE    *InputFile;
>     UINT32  BytesRead;
> @@ -492,27 +436,18 @@ Routine Description:
>     fclose (InputFile);
>   }
>   
> +/**
> +  Read the initial PCD value from the input file buffer.
> +
> +  @param FileBuffer  Point to the input file buffer.
> +  @param FileSize    Size of the file buffer.
> +**/
>   VOID
>   STATIC
>   ParseFile (
>     UINT8   *FileBuffer,
>     UINT32  FileSize
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Read the initial PCD value from the input file buffer.
> -
> -Arguments:
> -
> -  FileBuffer  Point to the input file buffer.
> -  FileSize    Size of the file buffer.
> -
> -Returns:
> -
> -  None
> ---*/
>   {
>     UINT32  Index;
>     UINT32  NumLines;
> @@ -552,25 +487,16 @@ Routine Description:
>     }
>   }
>   
> +/**
> +  Write the updated PCD value into the output file name.
> +
> +  @param OutputFileName  Point to the output file name.
> +**/
>   VOID
>   STATIC
>   WriteOutputFile (
>     CHAR8   *OutputFileName
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Write the updated PCD value into the output file name.
> -
> -Arguments:
> -
> -  OutputFileName  Point to the output file name.
> -
> -Returns:
> -
> -  None
> ---*/
>   {
>     FILE    *OutputFile;
>     UINT32  Index;
> @@ -605,26 +531,14 @@ Routine Description:
>     }
>   }
>   
> +/**
> +  Displays the utility usage syntax to STDOUT
> +**/
>   VOID
>   STATIC
>   Usage (
>     VOID
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Displays the utility usage syntax to STDOUT
> -
> -Arguments:
> -
> -  None
> -
> -Returns:
> -
> -  None
> -
> ---*/
>   {
>     fprintf (stdout, "Usage: -i <input_file> -o <output_file>\n\n");
>     fprintf (stdout, "optional arguments:\n");
> @@ -635,6 +549,14 @@ Routine Description:
>                           PCD Database Output file name\n");
>   }
>   
> +/**
> + Parse the input parameters to get the input/output file name.
> +
> + @param argc            Number of command line parameters.
> + @param argv            Array of pointers to parameter strings.
> + @param InputFileName   Point to the input file name.
> + @param OutputFileName  Point to the output file name.
> +**/
>   VOID
>   STATIC
>   ParseArguments (
> @@ -643,23 +565,6 @@ ParseArguments (
>     CHAR8  **InputFileName,
>     CHAR8  **OutputFileName
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Parse the input parameters to get the input/output file name.
> -
> -Arguments:
> -
> -  argc            Number of command line parameters.
> -  argv            Array of pointers to parameter strings.
> -  InputFileName   Point to the input file name.
> -  OutputFileName  Point to the output file name.
> -
> -Returns:
> -
> -  None
> ---*/
>   {
>     if (argc == 1) {
>       fprintf (stderr, "Missing options\n");
> @@ -722,25 +627,19 @@ Routine Description:
>     }
>   }
>   
> +/**
> + Main function updates PCD values.
> +
> + @param argc            Number of command line parameters.
> + @param argv            Array of pointers to parameter strings.
> +
> + @retval EXIT_SUCCESS
> +**/
>   int
>   PcdValueMain (
>     int   argc,
>     char  *argv[]
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Main function updates PCD values.
> -
> -Arguments:
> -
> -  argc            Number of command line parameters.
> -  argv            Array of pointers to parameter strings.
> -
> -Returns:
> -  EXIT_SUCCESS
> ---*/
>   {
>     CHAR8   *InputFileName;
>     CHAR8   *OutputFileName;
> diff --git a/BaseTools/Source/C/Common/PeCoffLoaderEx.c b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
> index 2cc428d733b4..181192035ef1 100644
> --- a/BaseTools/Source/C/Common/PeCoffLoaderEx.c
> +++ b/BaseTools/Source/C/Common/PeCoffLoaderEx.c
> @@ -65,59 +65,37 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   
>   UINT32 *RiscVHi20Fixup = NULL;
>   
> -RETURN_STATUS
> -PeCoffLoaderRelocateIa32Image (
> -  IN UINT16      *Reloc,
> -  IN OUT CHAR8   *Fixup,
> -  IN OUT CHAR8   **FixupData,
> -  IN UINT64      Adjust
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Performs an IA-32 specific relocation fixup
>   
> -Arguments:
> -
> -  Reloc      - Pointer to the relocation record
> -
> -  Fixup      - Pointer to the address to fix up
> -
> -  FixupData  - Pointer to a buffer to log the fixups
> -
> -  Adjust     - The offset to adjust the fixup
> -
> -Returns:
> -
> -  EFI_UNSUPPORTED   - Unsupported now
> -
> ---*/
> +  @param Reloc      Pointer to the relocation record
> +  @param Fixup      Pointer to the address to fix up
> +  @param FixupData  Pointer to a buffer to log the fixups
> +  @param Adjust     The offset to adjust the fixup
> +
> +  @retval EFI_UNSUPPORTED   - Unsupported now
> +**/
> +RETURN_STATUS
> +PeCoffLoaderRelocateIa32Image (
> +  IN UINT16      *Reloc,
> +  IN OUT CHAR8   *Fixup,
> +  IN OUT CHAR8   **FixupData,
> +  IN UINT64      Adjust
> +  )
>   {
>     return RETURN_UNSUPPORTED;
>   }
>   
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Performs an RISC-V specific relocation fixup
>   
> -Arguments:
> +  @param Reloc      Pointer to the relocation record
> +  @param Fixup      Pointer to the address to fix up
> +  @param FixupData  Pointer to a buffer to log the fixups
> +  @param Adjust     The offset to adjust the fixup
>   
> -  Reloc      - Pointer to the relocation record
> -
> -  Fixup      - Pointer to the address to fix up
> -
> -  FixupData  - Pointer to a buffer to log the fixups
> -
> -  Adjust     - The offset to adjust the fixup
> -
> -Returns:
> -
> -  Status code
> -
> ---*/
> +  @return Status code
> +**/
>   RETURN_STATUS
>   PeCoffLoaderRelocateRiscVImage (
>     IN UINT16      *Reloc,
> diff --git a/BaseTools/Source/C/Common/SimpleFileParsing.c b/BaseTools/Source/C/Common/SimpleFileParsing.c
> index eb6abea1bec7..51d59cf4a765 100644
> --- a/BaseTools/Source/C/Common/SimpleFileParsing.c
> +++ b/BaseTools/Source/C/Common/SimpleFileParsing.c
> @@ -152,65 +152,43 @@ SetFilePosition (
>     FILE_POSITION *Fpos
>     );
>   
> +/**
> +  @retval STATUS_SUCCESS always
> +**/
>   STATUS
>   SFPInit (
>     VOID
>     )
> -/*++
> -
> -Routine Description:
> -
> -Arguments:
> -  None.
> -
> -Returns:
> -  STATUS_SUCCESS always
> -
> ---*/
>   {
>     memset ((VOID *) &mGlobals, 0, sizeof (mGlobals));
>     return STATUS_SUCCESS;
>   }
>   
> -UINTN
> -SFPGetLineNumber (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Return the line number of the file we're parsing. Used
>     for error reporting purposes.
>   
> -Arguments:
> -  None.
> -
> -Returns:
> -  The line number, or 0 if no file is being processed
> -
> ---*/
> +  @return The line number, or 0 if no file is being processed
> +**/
> +UINTN
> +SFPGetLineNumber (
> +  VOID
> +  )
>   {
>     return mGlobals.SourceFile.LineNum;
>   }
>   
> -CHAR8  *
> -SFPGetFileName (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Return the name of the file we're parsing. Used
>     for error reporting purposes.
>   
> -Arguments:
> -  None.
> -
> -Returns:
> -  A pointer to the file name. Null if no file is being
> +  @return A pointer to the file name. Null if no file is being
>     processed.
> -
> ---*/
> +**/
> +CHAR8  *
> +SFPGetFileName (
> +  VOID
> +  )
>   {
>     if (mGlobals.SourceFile.FileName[0]) {
>       return mGlobals.SourceFile.FileName;
> @@ -219,22 +197,15 @@ Routine Description:
>     return NULL;
>   }
>   
> +/**
> +  Open a file for parsing.
> +
> +  @param FileName  name of the file to parse
> +**/
>   STATUS
>   SFPOpenFile (
>     CHAR8      *FileName
>     )
> -/*++
> -
> -Routine Description:
> -  Open a file for parsing.
> -
> -Arguments:
> -  FileName  - name of the file to parse
> -
> -Returns:
> -
> -
> ---*/
>   {
>     STATUS  Status;
>     t_strcpy (mGlobals.SourceFile.FileName, FileName);
> @@ -242,31 +213,26 @@ Routine Description:
>     return Status;
>   }
>   
> -BOOLEAN
> -SFPIsToken (
> -  CHAR8  *Str
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Check to see if the specified token is found at
>     the current position in the input file.
>   
> -Arguments:
> -  Str - the token to look for
> + @note:
> +   We do a simple string comparison on this function. It is
> +   the responsibility of the caller to ensure that the token
> +   is not a subset of some other token.
>   
> -Returns:
> -  TRUE - the token is next
> -  FALSE - the token is not next
> +   The file pointer is advanced past the token in the input file.
> +
> +  @param Str the token to look for
>   
> -Notes:
> -  We do a simple string comparison on this function. It is
> -  the responsibility of the caller to ensure that the token
> -  is not a subset of some other token.
> -
> -  The file pointer is advanced past the token in the input file.
> -
> ---*/
> +  @retval TRUE the token is next
> +  @retval FALSE the token is not next
> +**/
> +BOOLEAN
> +SFPIsToken (
> +  CHAR8  *Str
> +  )
>   {
>     UINTN  Len;
>     SkipWhiteSpace (&mGlobals.SourceFile);
> @@ -286,28 +252,23 @@ Routine Description:
>     return FALSE;
>   }
>   
> -BOOLEAN
> -SFPIsKeyword (
> -  CHAR8  *Str
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Check to see if the specified keyword is found at
>     the current position in the input file.
>   
> -Arguments:
> -  Str - keyword to look for
> + @note:
> +   A keyword is defined as a "special" string that has a non-alphanumeric
> +   character following it.
> +
> +  @param Str keyword to look for
>   
> -Returns:
> -  TRUE - the keyword is next
> -  FALSE - the keyword is not next
> -
> -Notes:
> -  A keyword is defined as a "special" string that has a non-alphanumeric
> -  character following it.
> -
> ---*/
> +  @retval TRUE the keyword is next
> +  @retval FALSE the keyword is not next
> +**/
> +BOOLEAN
> +SFPIsKeyword (
> +  CHAR8  *Str
> +  )
>   {
>     UINTN  Len;
>     SkipWhiteSpace (&mGlobals.SourceFile);
> @@ -331,30 +292,25 @@ Routine Description:
>     return FALSE;
>   }
>   
> +/**
> +  Get the next token from the input stream.
> +
> + @note:
> +   Preceding white space is ignored.
> +   The parser's buffer pointer is advanced past the end of the
> +   token.
> +
> +  @param Str pointer to a copy of the next token
> +  @param Len size of buffer pointed to by Str
> +
> +  @retval TRUE  next token successfully returned
> +  @retval FALSE otherwise
> +**/
>   BOOLEAN
>   SFPGetNextToken (
>     CHAR8  *Str,
>     UINTN  Len
>     )
> -/*++
> -
> -Routine Description:
> -  Get the next token from the input stream.
> -
> -Arguments:
> -  Str - pointer to a copy of the next token
> -  Len - size of buffer pointed to by Str
> -
> -Returns:
> -  TRUE  - next token successfully returned
> -  FALSE - otherwise
> -
> -Notes:
> -  Preceding white space is ignored.
> -  The parser's buffer pointer is advanced past the end of the
> -  token.
> -
> ---*/
>   {
>     UINTN  Index;
>     CHAR8  TempChar;
> @@ -436,25 +392,20 @@ Routine Description:
>     return FALSE;
>   }
>   
> +/**
> +  Parse a GUID from the input stream. Stop when you discover white space.
> +
> +  @param Str pointer to a copy of the next token
> +  @param Len size of buffer pointed to by Str
> +
> +  @retval TRUE  GUID string returned successfully
> +  @retval FALSE otherwise
> +**/
>   BOOLEAN
>   SFPGetGuidToken (
>     CHAR8  *Str,
>     UINT32 Len
>     )
> -/*++
> -
> -Routine Description:
> -  Parse a GUID from the input stream. Stop when you discover white space.
> -
> -Arguments:
> -  Str - pointer to a copy of the next token
> -  Len - size of buffer pointed to by Str
> -
> -Returns:
> -  TRUE  - GUID string returned successfully
> -  FALSE - otherwise
> -
> ---*/
>   {
>     UINT32  Index;
>     SkipWhiteSpace (&mGlobals.SourceFile);
> @@ -505,24 +456,19 @@ SFPSkipToToken (
>     return FALSE;
>   }
>   
> -BOOLEAN
> -SFPGetNumber (
> -  UINTN *Value
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Check the token at the current file position for a numeric value.
>     May be either decimal or hex.
>   
> -Arguments:
> -  Value  - pointer where to store the value
> +  @param Value  pointer where to store the value
>   
> -Returns:
> -  FALSE    - current token is not a number
> -  TRUE     - current token is a number
> -
> ---*/
> +  @retval FALSE    current token is not a number
> +  @retval TRUE     current token is a number
> +**/
> +BOOLEAN
> +SFPGetNumber (
> +  UINTN *Value
> +  )
>   {
>     int Val;
>   
> @@ -561,23 +507,16 @@ Routine Description:
>     }
>   }
>   
> -STATUS
> -SFPCloseFile (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Close the file being parsed.
>   
> -Arguments:
> -  None.
> -
> -Returns:
> -  STATUS_SUCCESS - the file was closed
> -  STATUS_ERROR   - no file is currently open
> -
> ---*/
> +  @retval STATUS_SUCCESS the file was closed
> +  @retval STATUS_ERROR   no file is currently open
> +**/
> +STATUS
> +SFPCloseFile (
> +  VOID
> +  )
>   {
>     if (mGlobals.SourceFile.FileBuffer != NULL) {
>       free (mGlobals.SourceFile.FileBuffer);
> @@ -588,28 +527,20 @@ Routine Description:
>     return STATUS_ERROR;
>   }
>   
> -STATIC
> -STATUS
> -ProcessIncludeFile (
> -  SOURCE_FILE *SourceFile,
> -  SOURCE_FILE *ParentSourceFile
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Given a source file, open the file and parse it
>   
> -Arguments:
> -
> -  SourceFile        - name of file to parse
> -  ParentSourceFile  - for error reporting purposes, the file that #included SourceFile.
> -
> -Returns:
> -
> -  Standard status.
> -
> ---*/
> +  @param SourceFile        name of file to parse
> +  @param ParentSourceFile  for error reporting purposes, the file that #included SourceFile.
> +
> +  @return Standard status.
> +**/
> +STATIC
> +STATUS
> +ProcessIncludeFile (
> +  SOURCE_FILE *SourceFile,
> +  SOURCE_FILE *ParentSourceFile
> +  )
>   {
>     STATIC UINTN NestDepth = 0;
>     CHAR8               FoundFileName[MAX_PATH];
> @@ -657,27 +588,19 @@ Routine Description:
>     return Status;
>   }
>   
> -STATIC
> -STATUS
> -ProcessFile (
> -  SOURCE_FILE *SourceFile
> -  )
> -/*++
> -
> -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
> -
> -Returns:
> -
> -  Standard status.
> -
> ---*/
> +  @param SourceFile        structure containing info on the file to process
> +
> +  @return Standard status.
> +**/
> +STATIC
> +STATUS
> +ProcessFile (
> +  SOURCE_FILE *SourceFile
> +  )
>   {
>     //
>     // Get the file size, and then read the entire thing into memory.
> @@ -706,24 +629,17 @@ Routine Description:
>     return STATUS_SUCCESS;
>   }
>   
> -STATIC
> -VOID
> -PreprocessFile (
> -  SOURCE_FILE *SourceFile
> -  )
> -/*++
> -
> -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.
> -
> ---*/
> +  @param SourceFile structure that we use to keep track of an input file.
> +**/
> +STATIC
> +VOID
> +PreprocessFile (
> +  SOURCE_FILE *SourceFile
> +  )
>   {
>     BOOLEAN InComment;
>     BOOLEAN SlashSlashComment;
> @@ -812,26 +728,21 @@ Routine Description:
>     }
>   }
>   
> +/**
> +  Retrieve a quoted-string from the input file.
> +
> +  @param Str    pointer to a copy of the quoted string parsed
> +  @param Length size of buffer pointed to by Str
> +
> +  @retval TRUE    next token in input stream was a quoted string, and
> +                  the string value was returned in Str
> +  @retval FALSE   otherwise
> +**/
>   BOOLEAN
>   SFPGetQuotedString (
>     CHAR8       *Str,
>     INTN         Length
>     )
> -/*++
> -
> -Routine Description:
> -  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
> -
> -Returns:
> -  TRUE    - next token in input stream was a quoted string, and
> -            the string value was returned in Str
> -  FALSE   - otherwise
> -
> ---*/
>   {
>     SkipWhiteSpace (&mGlobals.SourceFile);
>     if (EndOfFile (&mGlobals.SourceFile)) {
> @@ -866,24 +777,17 @@ Routine Description:
>     return FALSE;
>   }
>   
> -BOOLEAN
> -SFPIsEOF (
> -  VOID
> -  )
> -/*++
> -
> -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
> -
> ---*/
> +  @retval TRUE    EOF reached
> +  @retval FALSE   otherwise
> +**/
> +BOOLEAN
> +SFPIsEOF (
> +  VOID
> +  )
>   {
>     SkipWhiteSpace (&mGlobals.SourceFile);
>     return EndOfFile (&mGlobals.SourceFile);
> @@ -1112,27 +1016,22 @@ SkipWhiteSpace (
>     return Count;
>   }
>   
> -STATIC
> -UINTN
> -t_strcmp (
> -  CHAR8  *Buffer,
> -  CHAR8  *Str
> -  )
> -/*++
> -
> -Routine Description:
> +/**
>     Compare two strings for equality. The string pointed to by 'Buffer' may or may not be null-terminated,
>     so only compare up to the length of Str.
>   
> -Arguments:
> -  Buffer  - pointer to first (possibly not null-terminated) string
> -  Str     - pointer to null-terminated string to compare to Buffer
> +  @param Buffer  pointer to first (possibly not null-terminated) string
> +  @param Str     pointer to null-terminated string to compare to Buffer
>   
> -Returns:
> -  Number of bytes matched if exact match
> -  0 if Buffer does not start with Str
> -
> ---*/
> +  @retval Number of bytes matched if exact match
> +  @retval 0 if Buffer does not start with Str
> +**/
> +STATIC
> +UINTN
> +t_strcmp (
> +  CHAR8  *Buffer,
> +  CHAR8  *Str
> +  )
>   {
>     UINTN  Len;
>   
> @@ -1245,28 +1144,23 @@ GetHexChars (
>     return Len;
>   }
>   
> +/**
> +  Parse a GUID from the input stream. Stop when you discover white space.
> +
> + GUID styles
> +   Style[0] 12345678-1234-5678-AAAA-BBBBCCCCDDDD
> +
> +  @param GuidStyle Style of the following GUID token
> +  @param Value     pointer to EFI_GUID struct for output
> +
> +  @retval TRUE  GUID string parsed successfully
> +  @retval FALSE otherwise
> +**/
>   BOOLEAN
>   SFPGetGuid (
>     INTN         GuidStyle,
>     EFI_GUID    *Value
>     )
> -/*++
> -
> -Routine Description:
> -  Parse a GUID from the input stream. Stop when you discover white space.
> -
> -Arguments:
> -  GuidStyle - Style of the following GUID token
> -  Value     - pointer to EFI_GUID struct for output
> -
> -Returns:
> -  TRUE  - GUID string parsed successfully
> -  FALSE - otherwise
> -
> -  GUID styles
> -    Style[0] 12345678-1234-5678-AAAA-BBBBCCCCDDDD
> -
> ---*/
>   {
>     INT32         Value32;
>     UINT32        Index;
> diff --git a/BaseTools/Source/C/Common/StringFuncs.c b/BaseTools/Source/C/Common/StringFuncs.c
> index 50573fdf0999..bc85ba012440 100644
> --- a/BaseTools/Source/C/Common/StringFuncs.c
> +++ b/BaseTools/Source/C/Common/StringFuncs.c
> @@ -14,25 +14,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>   // Functions implementations
>   //
>   
> -CHAR8*
> -CloneString (
> -  IN CHAR8       *String
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Allocates a new string and copies 'String' to clone it
>   
> -Arguments:
> -
> -  String          The string to clone
> -
> -Returns:
> -
> -  CHAR8* - NULL if there are not enough resources
> -
> ---*/
> +  @param String          The string to clone
> +
> +  @return CHAR8* - NULL if there are not enough resources
> +**/
> +CHAR8*
> +CloneString (
> +  IN CHAR8       *String
> +  )
>   {
>     CHAR8* NewString;
>   
> @@ -44,26 +36,17 @@ Routine Description:
>     return NewString;
>   }
>   
> -
> -EFI_STATUS
> -StripInfDscStringInPlace (
> -  IN CHAR8       *String
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Remove all comments, leading and trailing whitespace from the string.
>   
> -Arguments:
> -
> -  String          The string to 'strip'
> -
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
> +  @param String          The string to 'strip'
> +
> +  @return EFI_STATUS
> +**/
> +EFI_STATUS
> +StripInfDscStringInPlace (
> +  IN CHAR8       *String
> +  )
>   {
>     CHAR8 *Pos;
>   
> @@ -110,27 +93,18 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -
> -STRING_LIST*
> -SplitStringByWhitespace (
> -  IN CHAR8       *String
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Creates and returns a 'split' STRING_LIST by splitting the string
>     on whitespace boundaries.
>   
> -Arguments:
> -
> -  String          The string to 'split'
> -
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
> +  @param String          The string to 'split'
> +
> +  @return EFI_STATUS
> +**/
> +STRING_LIST*
> +SplitStringByWhitespace (
> +  IN CHAR8       *String
> +  )
>   {
>     CHAR8       *Pos;
>     CHAR8       *EndOfSubString;
> @@ -172,21 +146,14 @@ Routine Description:
>     return Output;
>   }
>   
> -
> -STRING_LIST*
> -NewStringList (
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Creates a new STRING_LIST with 0 strings.
>   
> -Returns:
> -
> -  STRING_LIST* - Null if there is not enough resources to create the object.
> -
> ---*/
> +  @return STRING_LIST* - Null if there is not enough resources to create the object.
> +**/
> +STRING_LIST*
> +NewStringList (
> +  )
>   {
>     STRING_LIST *NewList;
>     NewList = AllocateStringListStruct (0);
> @@ -196,24 +163,17 @@ Routine Description:
>     return NewList;
>   }
>   
> -
> -EFI_STATUS
> -AppendCopyOfStringToList (
> -  IN OUT STRING_LIST **StringList,
> -  IN CHAR8       *String
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Adds String to StringList.  A new copy of String is made before it is
>     added to StringList.
>   
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
> +  @return EFI_STATUS
> +**/
> +EFI_STATUS
> +AppendCopyOfStringToList (
> +  IN OUT STRING_LIST **StringList,
> +  IN CHAR8       *String
> +  )
>   {
>     STRING_LIST *OldList;
>     STRING_LIST *NewList;
> @@ -245,27 +205,18 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -
> -EFI_STATUS
> -RemoveLastStringFromList (
> -  IN STRING_LIST       *StringList
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Removes the last string from StringList and frees the memory associated
>     with it.
>   
> -Arguments:
> -
> -  StringList        The string list to remove the string from
> -
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
> +  @param StringList        The string list to remove the string from
> +
> +  @return EFI_STATUS
> +**/
> +EFI_STATUS
> +RemoveLastStringFromList (
> +  IN STRING_LIST       *StringList
> +  )
>   {
>     if (StringList->Count == 0) {
>       return EFI_INVALID_PARAMETER;
> @@ -276,49 +227,30 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> +/**
> +  Allocates a STRING_LIST structure that can store StringCount strings.
>   
> +  @param StringCount        The number of strings that need to be stored
> +
> +  @return EFI_STATUS
> +**/
>   STRING_LIST*
>   AllocateStringListStruct (
>     IN UINTN StringCount
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Allocates a STRING_LIST structure that can store StringCount strings.
> -
> -Arguments:
> -
> -  StringCount        The number of strings that need to be stored
> -
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
>   {
>     return malloc (OFFSET_OF(STRING_LIST, Strings[StringCount + 1]));
>   }
>   
> -
> -VOID
> -FreeStringList (
> -  IN STRING_LIST       *StringList
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Frees all memory associated with StringList.
>   
> -Arguments:
> -
> -  StringList        The string list to free
> -
> -Returns:
> -
> -  VOID
> ---*/
> +  @param StringList        The string list to free
> +**/
> +VOID
> +FreeStringList (
> +  IN STRING_LIST       *StringList
> +  )
>   {
>     while (StringList->Count > 0) {
>       RemoveLastStringFromList (StringList);
> @@ -327,27 +259,18 @@ Routine Description:
>     free (StringList);
>   }
>   
> -
> -CHAR8*
> -StringListToString (
> -  IN STRING_LIST       *StringList
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Generates a string that represents the STRING_LIST
>   
> -Arguments:
> +  @param StringList        The string list to convert to a string
>   
> -  StringList        The string list to convert to a string
> -
> -Returns:
> -
> -  CHAR8* - The string list represented with a single string.  The returned
> +  @return CHAR8* - The string list represented with a single string.  The returned
>              string must be freed by the caller.
> -
> ---*/
> +**/
> +CHAR8*
> +StringListToString (
> +  IN STRING_LIST       *StringList
> +  )
>   {
>     UINTN Count;
>     UINTN Length;
> @@ -381,26 +304,17 @@ Routine Description:
>     return NewString;
>   }
>   
> -
> -VOID
> -PrintStringList (
> -  IN STRING_LIST       *StringList
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Prints out the string list
>   
> -Arguments:
> -
> -  StringList        The string list to print
> -
> -Returns:
> -
> -  EFI_STATUS
> -
> ---*/
> +  @param StringList        The string list to print
> +
> +  @return EFI_STATUS
> +**/
> +VOID
> +PrintStringList (
> +  IN STRING_LIST       *StringList
> +  )
>   {
>     CHAR8* String;
>     String = StringListToString (StringList);
> diff --git a/BaseTools/Source/C/Common/TianoCompress.c b/BaseTools/Source/C/Common/TianoCompress.c
> index 030cdca025b8..2f484b9731dc 100644
> --- a/BaseTools/Source/C/Common/TianoCompress.c
> +++ b/BaseTools/Source/C/Common/TianoCompress.c
> @@ -256,6 +256,25 @@ STATIC NODE   mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NU
>   //
>   // functions
>   //
> +
> +/**
> +  The internal implementation of [Efi/Tiano]Compress().
> +
> +  @param SrcBuffer   The buffer storing the source data
> +  @param SrcSize     The size of source data
> +  @param DstBuffer   The buffer to store the compressed data
> +  @param DstSize     On input, the size of DstBuffer; On output,
> +                     the size of the actual compressed data.
> +  @param Version     The version of de/compression algorithm.
> +                     Version 1 for UEFI 2.0 de/compression algorithm.
> +                     Version 2 for Tiano de/compression algorithm.
> +
> +  @retval EFI_BUFFER_TOO_SMALL  The DstBuffer is too small. In this case,
> +                DstSize contains the size needed.
> +  @retval EFI_SUCCESS           Compression is successful.
> +  @retval EFI_OUT_OF_RESOURCES  No resource to complete function.
> +  @retval EFI_INVALID_PARAMETER Parameter supplied is wrong.
> +**/
>   EFI_STATUS
>   TianoCompress (
>     IN      UINT8   *SrcBuffer,
> @@ -263,32 +282,6 @@ TianoCompress (
>     IN      UINT8   *DstBuffer,
>     IN OUT  UINT32  *DstSize
>     )
> -/*++
> -
> -Routine Description:
> -
> -  The internal implementation of [Efi/Tiano]Compress().
> -
> -Arguments:
> -
> -  SrcBuffer   - The buffer storing the source data
> -  SrcSize     - The size of source data
> -  DstBuffer   - The buffer to store the compressed data
> -  DstSize     - On input, the size of DstBuffer; On output,
> -                the size of the actual compressed data.
> -  Version     - The version of de/compression algorithm.
> -                Version 1 for UEFI 2.0 de/compression algorithm.
> -                Version 2 for Tiano de/compression algorithm.
> -
> -Returns:
> -
> -  EFI_BUFFER_TOO_SMALL  - The DstBuffer is too small. In this case,
> -                DstSize contains the size needed.
> -  EFI_SUCCESS           - Compression is successful.
> -  EFI_OUT_OF_RESOURCES  - No resource to complete function.
> -  EFI_INVALID_PARAMETER - Parameter supplied is wrong.
> -
> ---*/
>   {
>     EFI_STATUS  Status;
>   
> @@ -351,24 +344,16 @@ Routine Description:
>   
>   }
>   
> -STATIC
> -VOID
> -PutDword (
> -  IN UINT32 Data
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Put a dword to output stream
>   
> -Arguments:
> -
> -  Data    - the dword to put
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param Data    the dword to put
> +**/
> +STATIC
> +VOID
> +PutDword (
> +  IN UINT32 Data
> +  )
>   {
>     if (mDst < mDstUpperLimit) {
>       *mDst++ = (UINT8) (((UINT8) (Data)) & 0xff);
> @@ -387,26 +372,17 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -EFI_STATUS
> -AllocateMemory (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Allocate memory spaces for data structures used in compression process
>   
> -Arguments:
> +  @retval EFI_SUCCESS           Memory is allocated successfully
> +  @retval EFI_OUT_OF_RESOURCES  Allocation fails
> +**/
> +STATIC
> +EFI_STATUS
> +AllocateMemory (
>     VOID
> -
> -Returns:
> -
> -  EFI_SUCCESS           - Memory is allocated successfully
> -  EFI_OUT_OF_RESOURCES  - Allocation fails
> -
> ---*/
> +  )
>   {
>     UINT32  Index;
>   
> @@ -445,21 +421,13 @@ Routine Description:
>     return EFI_SUCCESS;
>   }
>   
> -VOID
> -FreeMemory (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Called when compression is completed to free memory previously allocated.
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +VOID
> +FreeMemory (
> +  VOID
> +  )
>   {
>     if (mText != NULL) {
>       free (mText);
> @@ -496,22 +464,14 @@ Returns: (VOID)
>     return ;
>   }
>   
> -STATIC
> -VOID
> -InitSlide (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Initialize String Info Log data structures
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +InitSlide (
> +  VOID
> +  )
>   {
>     NODE  Index;
>   
> @@ -535,28 +495,20 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -NODE
> -Child (
> -  IN NODE  NodeQ,
> -  IN UINT8 CharC
> -  )
> -/*++
> -
> -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)
> -
> ---*/
> +  @param NodeQ       the parent node
> +  @param CharC       the edge character
> +
> +  @return The child node (NIL if not found)
> +**/
> +STATIC
> +NODE
> +Child (
> +  IN NODE  NodeQ,
> +  IN UINT8 CharC
> +  )
>   {
>     NODE  NodeR;
>   
> @@ -572,6 +524,13 @@ Routine Description:
>     return NodeR;
>   }
>   
> +/**
> +  Create a new child for a given parent node.
> +
> +  @param Parent  the parent node
> +  @param CharC   the edge character
> +  @param Child   the child node
> +**/
>   STATIC
>   VOID
>   MakeChild (
> @@ -579,21 +538,6 @@ MakeChild (
>     IN UINT8 CharC,
>     IN NODE  Child
>     )
> -/*++
> -
> -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)
> -
> ---*/
>   {
>     NODE  Node1;
>     NODE  Node2;
> @@ -608,24 +552,16 @@ Returns: (VOID)
>     mChildCount[Parent]++;
>   }
>   
> -STATIC
> -VOID
> -Split (
> -  NODE Old
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Split a node.
>   
> -Arguments:
> -
> -  Old     - the node to split
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param Old     the node to split
> +**/
> +STATIC
> +VOID
> +Split (
> +  NODE Old
> +  )
>   {
>     NODE  New;
>     NODE  TempNode;
> @@ -646,22 +582,14 @@ Returns: (VOID)
>     MakeChild (New, mText[mPos + mMatchLen], mPos);
>   }
>   
> -STATIC
> -VOID
> -InsertNode (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Insert string info for current position into the String Info Log
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +InsertNode (
> +  VOID
> +  )
>   {
>     NODE  NodeQ;
>     NODE  NodeR;
> @@ -778,23 +706,15 @@ Returns: (VOID)
>   
>   }
>   
> -STATIC
> -VOID
> -DeleteNode (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Delete outdated string info. (The Usage of PERC_FLAG
>     ensures a clean deletion)
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +DeleteNode (
> +  VOID
> +  )
>   {
>     NODE  NodeQ;
>     NODE  NodeR;
> @@ -873,23 +793,15 @@ Returns: (VOID)
>     mAvail          = NodeR;
>   }
>   
> -STATIC
> -VOID
> -GetNextMatch (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Advance the current position (read in new data if needed).
>     Delete outdated string info. Find a match string for current position.
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +GetNextMatch (
> +  VOID
> +  )
>   {
>     INT32 Number;
>   
> @@ -906,25 +818,17 @@ Returns: (VOID)
>     InsertNode ();
>   }
>   
> -STATIC
> -EFI_STATUS
> -Encode (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     The main controlling routine for compression process.
>   
> -Arguments: (VOID)
> -
> -Returns:
> -
> -  EFI_SUCCESS           - The compression is successful
> -  EFI_OUT_0F_RESOURCES  - Not enough memory for compression process
> -
> ---*/
> +  @retval EFI_SUCCESS           The compression is successful
> +  @retval EFI_OUT_0F_RESOURCES  Not enough memory for compression process
> +**/
> +STATIC
> +EFI_STATUS
> +Encode (
> +  VOID
> +  )
>   {
>     EFI_STATUS  Status;
>     INT32       LastMatchLen;
> @@ -996,22 +900,14 @@ Arguments: (VOID)
>     return EFI_SUCCESS;
>   }
>   
> -STATIC
> -VOID
> -CountTFreq (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Count the frequencies for the Extra Set
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +CountTFreq (
> +  VOID
> +  )
>   {
>     INT32 Index;
>     INT32 Index3;
> @@ -1053,28 +949,20 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -VOID
> -WritePTLen (
> -  IN INT32 Number,
> -  IN INT32 nbit,
> -  IN INT32 Special
> -  )
> -/*++
> -
> -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)
> -
> ---*/
> +  @param Number  the number of symbols
> +  @param nbit    the number of bits needed to represent 'n'
> +  @param Special the special symbol that needs to be take care of
> +**/
> +STATIC
> +VOID
> +WritePTLen (
> +  IN INT32 Number,
> +  IN INT32 nbit,
> +  IN INT32 Special
> +  )
>   {
>     INT32 Index;
>     INT32 Index3;
> @@ -1103,22 +991,14 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -VOID
> -WriteCLen (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Outputs the code length array for Char&Length Set
> -
> -Arguments: (VOID)
> -
> -Returns: (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +WriteCLen (
> +  VOID
> +  )
>   {
>     INT32 Index;
>     INT32 Index3;
> @@ -1193,24 +1073,14 @@ EncodeP (
>     }
>   }
>   
> -STATIC
> -VOID
> -SendBlock (
> -  VOID
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Huffman code the block and output it.
> -
> -Arguments:
> -  (VOID)
> -
> -Returns:
> -  (VOID)
> -
> ---*/
> +**/
> +STATIC
> +VOID
> +SendBlock (
> +  VOID
> +  )
>   {
>     UINT32  Index;
>     UINT32  Index2;
> @@ -1281,26 +1151,18 @@ Routine Description:
>     }
>   }
>   
> +/**
> +  Outputs an Original Character or a Pointer
> +
> +  @param CharC   The original character or the 'String Length' element of a Pointer
> +  @param Pos     The 'Position' field of a Pointer
> +**/
>   STATIC
>   VOID
>   Output (
>     IN UINT32 CharC,
>     IN UINT32 Pos
>     )
> -/*++
> -
> -Routine Description:
> -
> -  Outputs an Original Character or a Pointer
> -
> -Arguments:
> -
> -  CharC     - The original character or the 'String Length' element of a Pointer
> -  Pos     - The 'Position' field of a Pointer
> -
> -Returns: (VOID)
> -
> ---*/
>   {
>     STATIC UINT32 CPos;
>   
> @@ -1399,26 +1261,18 @@ MakeCrcTable (
>     }
>   }
>   
> -STATIC
> -VOID
> -PutBits (
> -  IN INT32  Number,
> -  IN UINT32 Value
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Outputs rightmost n bits of x
> -
> -Arguments:
> -
> -  Number   - the rightmost n bits of the data is used
> -  x   - the data
> -
> -Returns: (VOID)
> -
> ---*/
> +
> +  @param Number the rightmost n bits of the data is used
> +  @param x      the data
> +**/
> +STATIC
> +VOID
> +PutBits (
> +  IN INT32  Number,
> +  IN UINT32 Value
> +  )
>   {
>     UINT8 Temp;
>   
> @@ -1439,28 +1293,20 @@ Returns: (VOID)
>     mSubBitBuf |= Value << (mBitCount -= Number);
>   }
>   
> -STATIC
> -INT32
> -FreadCrc (
> -  OUT UINT8 *Pointer,
> -  IN  INT32 Number
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Read in source data
>   
> -Arguments:
> -
> -  Pointer   - the buffer to hold the data
> -  Number   - number of bytes to read
> -
> -Returns:
> -
> -  number of bytes actually read
> -
> ---*/
> +  @param Pointer   - the buffer to hold the data
> +  @param Number   - number of bytes to read
> +
> +  @return number of bytes actually read
> +**/
> +STATIC
> +INT32
> +FreadCrc (
> +  OUT UINT8 *Pointer,
> +  IN  INT32 Number
> +  )
>   {
>     INT32 Index;
>   
> @@ -1491,24 +1337,16 @@ InitPutBits (
>     mSubBitBuf  = 0;
>   }
>   
> -STATIC
> -VOID
> -CountLen (
> -  IN INT32 Index
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Count the number of each code length for a Huffman tree.
>   
> -Arguments:
> -
> -  Index   - the top node
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param Index   the top node
> +**/
> +STATIC
> +VOID
> +CountLen (
> +  IN INT32 Index
> +  )
>   {
>     STATIC INT32  Depth = 0;
>   
> @@ -1522,26 +1360,16 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -VOID
> -MakeLen (
> -  IN INT32 Root
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Create code length array for a Huffman tree
>   
> -Arguments:
> -
> -  Root   - the root of the tree
> -
> -Returns:
> -
> -  VOID
> -
> ---*/
> +  @param Root   the root of the tree
> +**/
> +STATIC
> +VOID
> +MakeLen (
> +  IN INT32 Root
> +  )
>   {
>     INT32   Index;
>     INT32   Index3;
> @@ -1616,28 +1444,20 @@ DownHeap (
>     mHeap[Index] = (INT16) Index3;
>   }
>   
> -STATIC
> -VOID
> -MakeCode (
> -  IN  INT32       Number,
> -  IN  UINT8 Len[  ],
> -  OUT UINT16 Code[]
> -  )
> -/*++
> -
> -Routine Description:
> -
> +/**
>     Assign code to each symbol based on the code length array
>   
> -Arguments:
> -
> -  Number     - number of symbols
> -  Len   - the code length array
> -  Code  - stores codes for each symbol
> -
> -Returns: (VOID)
> -
> ---*/
> +  @param Number number of symbols
> +  @param Len    the code length array
> +  @param Code   stores codes for each symbol
> +**/
> +STATIC
> +VOID
> +MakeCode (
> +  IN  INT32       Number,
> +  IN  UINT8 Len[  ],
> +  OUT UINT16 Code[]
> +  )
>   {
>     INT32   Index;
>     UINT16  Start[18];
> @@ -1652,32 +1472,24 @@ Returns: (VOID)
>     }
>   }
>   
> -STATIC
> -INT32
> -MakeTree (
> -  IN  INT32            NParm,
> -  IN  UINT16  FreqParm[],
> -  OUT UINT8   LenParm[ ],
> -  OUT UINT16  CodeParm[]
> -  )
> -/*++
> -
> -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.
> -
> ---*/
> +  @param NParm    number of symbols
> +  @param FreqParm frequency of each symbol
> +  @param LenParm  code length for each symbol
> +  @param CodeParm code for each symbol
> +
> +  @return Root of the Huffman tree.
> +**/
> +STATIC
> +INT32
> +MakeTree (
> +  IN  INT32            NParm,
> +  IN  UINT16  FreqParm[],
> +  OUT UINT8   LenParm[ ],
> +  OUT UINT16  CodeParm[]
> +  )
>   {
>     INT32 Index;
>     INT32 Index2;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* 回复: [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify
  2023-02-25  0:54 [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify Rebecca Cran
                   ` (3 preceding siblings ...)
       [not found] ` <1746EB2C4B4E3528.29542@groups.io>
@ 2023-03-10  2:57 ` gaoliming
  2023-03-10 17:57   ` Rebecca Cran
  4 siblings, 1 reply; 9+ messages in thread
From: gaoliming @ 2023-03-10  2:57 UTC (permalink / raw)
  To: 'Rebecca Cran', devel, 'Bob Feng',
	'Yuwei Chen'

Rebecca:
  I think these changes are good. Reviewed-by: Liming Gao
<gaoliming@byosoft.com.cn>

  Besides, which tool is used to convert function comments to Doxygen
format?

Thanks
Liming
> -----邮件原件-----
> 发件人: Rebecca Cran <rebecca@bsdio.com>
> 发送时间: 2023年2月25日 8:54
> 收件人: devel@edk2.groups.io; Bob Feng <bob.c.feng@intel.com>; Liming
> Gao <gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com>
> 抄送: Rebecca Cran <rebecca@bsdio.com>
> 主题: [PATCH 0/3] BaseTools: Fix doc block location and formatting; run
> uncrustify
> 
> Fix the formatting and location of documentation blocks in
Source/C/Common,
> and replace the duplicate prototype of __PcdSet with __PcdGet. Those
> patches
> will fail CI because it appears Uncrustify was never run on BaseTools?
> 
> Patch 3/3 reformats the files in Source/C/Common according to
> Uncrustify.
> 
> Rebecca Cran (3):
>   BaseTools: Source/C/Common: Fix doc block locations and convert to
>     Doxygen
>   BaseTools: Replace duplicate __PcdSet prototype with __PcdGet
>   BaseTools: Run Uncrustify over files in Source/C/Common
> 
>  BaseTools/Source/C/Common/BinderFuncs.h             |   27 +-
>  BaseTools/Source/C/Common/CommonLib.h               |  267 ++--
>  BaseTools/Source/C/Common/Compress.h                |   45 +-
>  BaseTools/Source/C/Common/Crc32.h                   |   36 +-
>  BaseTools/Source/C/Common/Decompress.h              |  122 +-
>  BaseTools/Source/C/Common/EfiUtilityMsgs.h          |   38 +-
>  BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h |  101 +-
>  BaseTools/Source/C/Common/FvLib.h                   |   51 +-
>  BaseTools/Source/C/Common/MemoryFile.h              |   76 +-
>  BaseTools/Source/C/Common/MyAlloc.h                 |  196 +--
>  BaseTools/Source/C/Common/OsPath.h                  |   92 +-
>  BaseTools/Source/C/Common/ParseGuidedSectionTools.h |  101 +-
>  BaseTools/Source/C/Common/ParseInf.h                |  228 ++--
>  BaseTools/Source/C/Common/PcdValueCommon.h          |  196 +--
>  BaseTools/Source/C/Common/PeCoffLib.h               |   66 +-
>  BaseTools/Source/C/Common/SimpleFileParsing.h       |   24 +-
>  BaseTools/Source/C/Common/StringFuncs.h             |  203 +--
>  BaseTools/Source/C/Common/WinNtInclude.h            |   28 +-
>  BaseTools/Source/C/Common/BasePeCoff.c              | 1068
> +++++++--------
>  BaseTools/Source/C/Common/BinderFuncs.c             |   31 +-
>  BaseTools/Source/C/Common/CommonLib.c               |  914
> ++++++-------
>  BaseTools/Source/C/Common/Crc32.c                   |   38 +-
>  BaseTools/Source/C/Common/Decompress.c              |  795
> +++++------
>  BaseTools/Source/C/Common/EfiCompress.c             | 1189
> ++++++++--------
>  BaseTools/Source/C/Common/EfiUtilityMsgs.c          |  663 ++++-----
>  BaseTools/Source/C/Common/FirmwareVolumeBuffer.c    | 1426
> ++++++++------------
>  BaseTools/Source/C/Common/FvLib.c                   |  638
> ++++-----
>  BaseTools/Source/C/Common/MemoryFile.c              |  131 +-
>  BaseTools/Source/C/Common/MyAlloc.c                 |  265 ++--
>  BaseTools/Source/C/Common/OsPath.c                  |  180 +--
>  BaseTools/Source/C/Common/ParseGuidedSectionTools.c |  142 +-
>  BaseTools/Source/C/Common/ParseInf.c                |  401 +++---
>  BaseTools/Source/C/Common/PcdValueCommon.c          |  618
> ++++-----
>  BaseTools/Source/C/Common/PeCoffLoaderEx.c          |  277 ++--
>  BaseTools/Source/C/Common/SimpleFileParsing.c       |  737
> +++++-----
>  BaseTools/Source/C/Common/StringFuncs.c             |  310 ++---
>  BaseTools/Source/C/Common/TianoCompress.c           | 1075
> ++++++---------
>  37 files changed, 5544 insertions(+), 7251 deletions(-)
> 
> --
> 2.37.1 (Apple Git-137.1)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: 回复: [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify
  2023-03-10  2:57 ` 回复: [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify gaoliming
@ 2023-03-10 17:57   ` Rebecca Cran
  0 siblings, 0 replies; 9+ messages in thread
From: Rebecca Cran @ 2023-03-10 17:57 UTC (permalink / raw)
  To: gaoliming, devel, 'Bob Feng', 'Yuwei Chen'

I'm not aware of a tool: I converted the comments manually.


-- 
Rebecca Cran


On 3/9/23 7:57 PM, gaoliming wrote:
> Rebecca:
>    I think these changes are good. Reviewed-by: Liming Gao
> <gaoliming@byosoft.com.cn>
>
>    Besides, which tool is used to convert function comments to Doxygen
> format?
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: Rebecca Cran <rebecca@bsdio.com>
>> 发送时间: 2023年2月25日 8:54
>> 收件人: devel@edk2.groups.io; Bob Feng <bob.c.feng@intel.com>; Liming
>> Gao <gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com>
>> 抄送: Rebecca Cran <rebecca@bsdio.com>
>> 主题: [PATCH 0/3] BaseTools: Fix doc block location and formatting; run
>> uncrustify
>>
>> Fix the formatting and location of documentation blocks in
> Source/C/Common,
>> and replace the duplicate prototype of __PcdSet with __PcdGet. Those
>> patches
>> will fail CI because it appears Uncrustify was never run on BaseTools?
>>
>> Patch 3/3 reformats the files in Source/C/Common according to
>> Uncrustify.
>>
>> Rebecca Cran (3):
>>    BaseTools: Source/C/Common: Fix doc block locations and convert to
>>      Doxygen
>>    BaseTools: Replace duplicate __PcdSet prototype with __PcdGet
>>    BaseTools: Run Uncrustify over files in Source/C/Common
>>
>>   BaseTools/Source/C/Common/BinderFuncs.h             |   27 +-
>>   BaseTools/Source/C/Common/CommonLib.h               |  267 ++--
>>   BaseTools/Source/C/Common/Compress.h                |   45 +-
>>   BaseTools/Source/C/Common/Crc32.h                   |   36 +-
>>   BaseTools/Source/C/Common/Decompress.h              |  122 +-
>>   BaseTools/Source/C/Common/EfiUtilityMsgs.h          |   38 +-
>>   BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h |  101 +-
>>   BaseTools/Source/C/Common/FvLib.h                   |   51 +-
>>   BaseTools/Source/C/Common/MemoryFile.h              |   76 +-
>>   BaseTools/Source/C/Common/MyAlloc.h                 |  196 +--
>>   BaseTools/Source/C/Common/OsPath.h                  |   92 +-
>>   BaseTools/Source/C/Common/ParseGuidedSectionTools.h |  101 +-
>>   BaseTools/Source/C/Common/ParseInf.h                |  228 ++--
>>   BaseTools/Source/C/Common/PcdValueCommon.h          |  196 +--
>>   BaseTools/Source/C/Common/PeCoffLib.h               |   66 +-
>>   BaseTools/Source/C/Common/SimpleFileParsing.h       |   24 +-
>>   BaseTools/Source/C/Common/StringFuncs.h             |  203 +--
>>   BaseTools/Source/C/Common/WinNtInclude.h            |   28 +-
>>   BaseTools/Source/C/Common/BasePeCoff.c              | 1068
>> +++++++--------
>>   BaseTools/Source/C/Common/BinderFuncs.c             |   31 +-
>>   BaseTools/Source/C/Common/CommonLib.c               |  914
>> ++++++-------
>>   BaseTools/Source/C/Common/Crc32.c                   |   38 +-
>>   BaseTools/Source/C/Common/Decompress.c              |  795
>> +++++------
>>   BaseTools/Source/C/Common/EfiCompress.c             | 1189
>> ++++++++--------
>>   BaseTools/Source/C/Common/EfiUtilityMsgs.c          |  663 ++++-----
>>   BaseTools/Source/C/Common/FirmwareVolumeBuffer.c    | 1426
>> ++++++++------------
>>   BaseTools/Source/C/Common/FvLib.c                   |  638
>> ++++-----
>>   BaseTools/Source/C/Common/MemoryFile.c              |  131 +-
>>   BaseTools/Source/C/Common/MyAlloc.c                 |  265 ++--
>>   BaseTools/Source/C/Common/OsPath.c                  |  180 +--
>>   BaseTools/Source/C/Common/ParseGuidedSectionTools.c |  142 +-
>>   BaseTools/Source/C/Common/ParseInf.c                |  401 +++---
>>   BaseTools/Source/C/Common/PcdValueCommon.c          |  618
>> ++++-----
>>   BaseTools/Source/C/Common/PeCoffLoaderEx.c          |  277 ++--
>>   BaseTools/Source/C/Common/SimpleFileParsing.c       |  737
>> +++++-----
>>   BaseTools/Source/C/Common/StringFuncs.c             |  310 ++---
>>   BaseTools/Source/C/Common/TianoCompress.c           | 1075
>> ++++++---------
>>   37 files changed, 5544 insertions(+), 7251 deletions(-)
>>
>> --
>> 2.37.1 (Apple Git-137.1)
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with __PcdGet
  2023-02-25  0:54 ` [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with __PcdGet Rebecca Cran
@ 2023-03-23 17:06   ` Rebecca Cran
  2023-03-24  4:55   ` 回复: " gaoliming
  1 sibling, 0 replies; 9+ messages in thread
From: Rebecca Cran @ 2023-03-23 17:06 UTC (permalink / raw)
  To: devel, Bob Feng, Liming Gao, Yuwei Chen

Hi Liming,


Could you review this patch please?

I've dropped the 3rd patch which was running Uncrustify over the code, 
so this is the only one left before I can merge the series.


Thanks.

Rebecca Cran


On 2/24/23 5:54 PM, Rebecca Cran wrote:
> Replace the duplicate __PcdSet prototype in PcdValueCommon.h
> with the prototype for __PcdGet.
>
> Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> ---
>   BaseTools/Source/C/Common/PcdValueCommon.h | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h b/BaseTools/Source/C/Common/PcdValueCommon.h
> index 02ef803be479..7dac5bd92dbc 100644
> --- a/BaseTools/Source/C/Common/PcdValueCommon.h
> +++ b/BaseTools/Source/C/Common/PcdValueCommon.h
> @@ -78,13 +78,12 @@ __PcdSet (
>   
>     @return PCD value
>   **/
> -VOID
> -__PcdSet (
> -  CHAR8   *SkuName             OPTIONAL,
> -  CHAR8   *DefaultValueName    OPTIONAL,
> -  CHAR8   *TokenSpaceGuidName,
> -  CHAR8   *TokenName,
> -  UINT64  Value
> +UINT64
> +__PcdGet (
> +  CHAR8  *SkuName             OPTIONAL,
> +  CHAR8  *DefaultValueName    OPTIONAL,
> +  CHAR8  *TokenSpaceGuidName,
> +  CHAR8  *TokenName
>     )
>   ;
>   

^ permalink raw reply	[flat|nested] 9+ messages in thread

* 回复: [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with __PcdGet
  2023-02-25  0:54 ` [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with __PcdGet Rebecca Cran
  2023-03-23 17:06   ` Rebecca Cran
@ 2023-03-24  4:55   ` gaoliming
  1 sibling, 0 replies; 9+ messages in thread
From: gaoliming @ 2023-03-24  4:55 UTC (permalink / raw)
  To: 'Rebecca Cran', devel, 'Bob Feng',
	'Yuwei Chen'

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Rebecca Cran <rebecca@bsdio.com>
> 发送时间: 2023年2月25日 8:55
> 收件人: devel@edk2.groups.io; Bob Feng <bob.c.feng@intel.com>; Liming
> Gao <gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com>
> 抄送: Rebecca Cran <rebecca@bsdio.com>
> 主题: [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with
> __PcdGet
> 
> Replace the duplicate __PcdSet prototype in PcdValueCommon.h
> with the prototype for __PcdGet.
> 
> Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
> ---
>  BaseTools/Source/C/Common/PcdValueCommon.h | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h
> b/BaseTools/Source/C/Common/PcdValueCommon.h
> index 02ef803be479..7dac5bd92dbc 100644
> --- a/BaseTools/Source/C/Common/PcdValueCommon.h
> +++ b/BaseTools/Source/C/Common/PcdValueCommon.h
> @@ -78,13 +78,12 @@ __PcdSet (
> 
>    @return PCD value
>  **/
> -VOID
> -__PcdSet (
> -  CHAR8   *SkuName             OPTIONAL,
> -  CHAR8   *DefaultValueName    OPTIONAL,
> -  CHAR8   *TokenSpaceGuidName,
> -  CHAR8   *TokenName,
> -  UINT64  Value
> +UINT64
> +__PcdGet (
> +  CHAR8  *SkuName             OPTIONAL,
> +  CHAR8  *DefaultValueName    OPTIONAL,
> +  CHAR8  *TokenSpaceGuidName,
> +  CHAR8  *TokenName
>    )
>  ;
> 
> --
> 2.37.1 (Apple Git-137.1)




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-24  4:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-25  0:54 [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify Rebecca Cran
2023-02-25  0:54 ` [PATCH 1/3] BaseTools: Source/C/Common: Fix doc block locations and convert to Doxygen Rebecca Cran
2023-02-25  0:54 ` [PATCH 2/3] BaseTools: Replace duplicate __PcdSet prototype with __PcdGet Rebecca Cran
2023-03-23 17:06   ` Rebecca Cran
2023-03-24  4:55   ` 回复: " gaoliming
2023-02-25  0:54 ` [PATCH 3/3] BaseTools: Run Uncrustify over files in Source/C/Common Rebecca Cran
     [not found] ` <1746EB2C4B4E3528.29542@groups.io>
2023-03-09 15:43   ` [edk2-devel] [PATCH 1/3] BaseTools: Source/C/Common: Fix doc block locations and convert to Doxygen Rebecca Cran
2023-03-10  2:57 ` 回复: [PATCH 0/3] BaseTools: Fix doc block location and formatting; run uncrustify gaoliming
2023-03-10 17:57   ` Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox