]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
Code Scrub for Dxe Core.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / SectionExtraction / CoreSectionExtraction.c
index 07ada03d2ce72c119ea8465035c80047e3a50f6c..1660b9da071cbcca60224636e7aaef2ac217f7e7 100644 (file)
@@ -1,29 +1,29 @@
 /** @file\r
   Section Extraction Protocol implementation.\r
-  \r
+\r
   Stream database is implemented as a linked list of section streams,\r
   where each stream contains a linked list of children, which may be leaves or\r
-  encapsulations.  \r
-  \r
+  encapsulations.\r
+\r
   Children that are encapsulations generate new stream entries\r
-  when they are created.  Streams can also be created by calls to \r
+  when they are created.  Streams can also be created by calls to\r
   SEP->OpenSectionStream().\r
-  \r
+\r
   The database is only created far enough to return the requested data from\r
   any given stream, or to determine that the requested data is not found.\r
-  \r
+\r
   If a GUIDed encapsulation is encountered, there are three possiblilites.\r
-  \r
+\r
   1) A support protocol is found, in which the stream is simply processed with\r
      the support protocol.\r
-     \r
+\r
   2) A support protocol is not found, but the data is available to be read\r
      without processing.  In this case, the database is built up through the\r
      recursions to return the data, and a RPN event is set that will enable\r
      the stream in question to be refreshed if and when the required section\r
-     extraction protocol is published.This insures the AuthenticationStatus \r
+     extraction protocol is published.This insures the AuthenticationStatus\r
      does not become stale in the cache.\r
-     \r
+\r
   3) A support protocol is not found, and the data is not available to be read\r
      without it.  This results in EFI_PROTOCOL_ERROR.\r
 \r
@@ -93,8 +93,8 @@ typedef struct {
   VOID                        *Registration;\r
   EFI_EVENT                   Event;\r
 } RPN_EVENT_CONTEXT;\r
-  \r
-  \r
+\r
+\r
 \r
 //\r
 // Local prototypes\r
@@ -102,15 +102,15 @@ typedef struct {
 /**\r
   Worker function.  Determine if the input stream:child matches the input type.\r
 \r
-  @param  Stream                 Indicates the section stream associated with the \r
-                                 child \r
-  @param  Child                  Indicates the child to check \r
-  @param  SearchType             Indicates the type of section to check against \r
-                                 for \r
-  @param  SectionDefinitionGuid  Indicates the GUID to check against if the type \r
-                                 is EFI_SECTION_GUID_DEFINED \r
+  @param  Stream                 Indicates the section stream associated with the\r
+                                 child\r
+  @param  Child                  Indicates the child to check\r
+  @param  SearchType             Indicates the type of section to check against\r
+                                 for\r
+  @param  SectionDefinitionGuid  Indicates the GUID to check against if the type\r
+                                 is EFI_SECTION_GUID_DEFINED\r
 \r
-  @retval TRUE                   The child matches \r
+  @retval TRUE                   The child matches\r
   @retval FALSE                  The child doesn't match\r
 \r
 **/\r
@@ -126,12 +126,12 @@ ChildIsType (
 /**\r
   Worker function.  Search stream database for requested stream handle.\r
 \r
-  @param  SearchHandle           Indicates which stream to look for. \r
-  @param  FoundStream            Output pointer to the found stream. \r
+  @param  SearchHandle           Indicates which stream to look for.\r
+  @param  FoundStream            Output pointer to the found stream.\r
 \r
-  @retval EFI_SUCCESS            StreamHandle was found and *FoundStream contains \r
-                                 the stream node. \r
-  @retval EFI_NOT_FOUND          SearchHandle was not found in the stream \r
+  @retval EFI_SUCCESS            StreamHandle was found and *FoundStream contains\r
+                                 the stream node.\r
+  @retval EFI_NOT_FOUND          SearchHandle was not found in the stream\r
                                  database.\r
 \r
 **/\r
@@ -140,31 +140,31 @@ FindStreamNode (
   IN  UINTN                                     SearchHandle,\r
   OUT CORE_SECTION_STREAM_NODE                  **FoundStream\r
   );\r
-  \r
+\r
 \r
 /**\r
   Worker function  Recursively searches / builds section stream database\r
   looking for requested section.\r
 \r
-  @param  SourceStream           Indicates the section stream in which to do the \r
-                                 search. \r
-  @param  SearchType             Indicates the type of section to search for. \r
-  @param  SectionInstance        Indicates which instance of section to find.  \r
-                                 This is an in/out parameter to deal with \r
-                                 recursions. \r
-  @param  SectionDefinitionGuid  Guid of section definition \r
-  @param  FoundChild             Output indicating the child node that is found. \r
-  @param  FoundStream            Output indicating which section stream the child \r
-                                 was found in.  If this stream was generated as a \r
-                                 result of an encapsulation section, the \r
-                                 streamhandle is visible within the SEP driver \r
+  @param  SourceStream           Indicates the section stream in which to do the\r
+                                 search.\r
+  @param  SearchType             Indicates the type of section to search for.\r
+  @param  SectionInstance        Indicates which instance of section to find.\r
+                                 This is an in/out parameter to deal with\r
+                                 recursions.\r
+  @param  SectionDefinitionGuid  Guid of section definition\r
+  @param  FoundChild             Output indicating the child node that is found.\r
+  @param  FoundStream            Output indicating which section stream the child\r
+                                 was found in.  If this stream was generated as a\r
+                                 result of an encapsulation section, the\r
+                                 streamhandle is visible within the SEP driver\r
                                  only.\r
-  @param  AuthenticationStatus   Indicates the authentication status of the found section. \r
+  @param  AuthenticationStatus   Indicates the authentication status of the found section.\r
 \r
-  @retval EFI_SUCCESS            Child node was found and returned. \r
-                                 EFI_OUT_OF_RESOURCES- Memory allocation failed. \r
-  @retval EFI_NOT_FOUND          Requested child node does not exist. \r
-  @retval EFI_PROTOCOL_ERROR     a required GUIDED section extraction protocol \r
+  @retval EFI_SUCCESS            Child node was found and returned.\r
+                                 EFI_OUT_OF_RESOURCES- Memory allocation failed.\r
+  @retval EFI_NOT_FOUND          Requested child node does not exist.\r
+  @retval EFI_PROTOCOL_ERROR     a required GUIDED section extraction protocol\r
                                  does not exist\r
 \r
 **/\r
@@ -178,26 +178,26 @@ FindChildNode (
   OUT    CORE_SECTION_STREAM_NODE                   **FoundStream,\r
   OUT    UINT32                                     *AuthenticationStatus\r
   );\r
-  \r
+\r
 \r
 /**\r
   Worker function.  Constructor for new child nodes.\r
 \r
-  @param  Stream                 Indicates the section stream in which to add the \r
-                                 child. \r
-  @param  ChildOffset            Indicates the offset in Stream that is the \r
-                                 beginning of the child section. \r
-  @param  ChildNode              Indicates the Callee allocated and initialized \r
-                                 child. \r
-\r
-  @retval EFI_SUCCESS            Child node was found and returned. \r
-                                 EFI_OUT_OF_RESOURCES- Memory allocation failed. \r
-  @retval EFI_PROTOCOL_ERROR     Encapsulation sections produce new stream \r
-                                 handles when the child node is created.  If the \r
-                                 section type is GUID defined, and the extraction \r
-                                 GUID does not exist, and producing the stream \r
-                                 requires the GUID, then a protocol error is \r
-                                 generated and no child is produced. Values \r
+  @param  Stream                 Indicates the section stream in which to add the\r
+                                 child.\r
+  @param  ChildOffset            Indicates the offset in Stream that is the\r
+                                 beginning of the child section.\r
+  @param  ChildNode              Indicates the Callee allocated and initialized\r
+                                 child.\r
+\r
+  @retval EFI_SUCCESS            Child node was found and returned.\r
+                                 EFI_OUT_OF_RESOURCES- Memory allocation failed.\r
+  @retval EFI_PROTOCOL_ERROR     Encapsulation sections produce new stream\r
+                                 handles when the child node is created.  If the\r
+                                 section type is GUID defined, and the extraction\r
+                                 GUID does not exist, and producing the stream\r
+                                 requires the GUID, then a protocol error is\r
+                                 generated and no child is produced. Values\r
                                  returned by OpenSectionStreamEx.\r
 \r
 **/\r
@@ -207,7 +207,7 @@ CreateChildNode (
   IN     UINT32                                ChildOffset,\r
      OUT CORE_SECTION_CHILD_NODE               **ChildNode\r
   );\r
-  \r
+\r
 \r
 /**\r
   Worker function.  Destructor for child nodes.\r
@@ -224,13 +224,13 @@ FreeChildNode (
 /**\r
   Worker function.  Constructor for section streams.\r
 \r
-  @param  SectionStreamLength    Size in bytes of the section stream. \r
-  @param  SectionStream          Buffer containing the new section stream. \r
-  @param  AllocateBuffer         Indicates whether the stream buffer is to be \r
-                                 copied or the input buffer is to be used in \r
-                                 place. AuthenticationStatus- Indicates the \r
-                                 default authentication status for the new \r
-                                 stream. \r
+  @param  SectionStreamLength    Size in bytes of the section stream.\r
+  @param  SectionStream          Buffer containing the new section stream.\r
+  @param  AllocateBuffer         Indicates whether the stream buffer is to be\r
+                                 copied or the input buffer is to be used in\r
+                                 place. AuthenticationStatus- Indicates the\r
+                                 default authentication status for the new\r
+                                 stream.\r
   @param  AuthenticationStatus   A pointer to a caller-allocated UINT32 that\r
                                  indicates the authentication status of the\r
                                  output buffer. If the input section's\r
@@ -247,10 +247,10 @@ FreeChildNode (
                                  function returns anything other than\r
                                  EFI_SUCCESS, the value of *AuthenticationStatus\r
                                  is undefined.\r
-  @param  SectionStreamHandle    A pointer to a caller allocated section stream \r
-                                 handle. \r
+  @param  SectionStreamHandle    A pointer to a caller allocated section stream\r
+                                 handle.\r
 \r
-  @retval EFI_SUCCESS            Stream was added to stream database. \r
+  @retval EFI_SUCCESS            Stream was added to stream database.\r
   @retval EFI_OUT_OF_RESOURCES   memory allocation failed.\r
 \r
 **/\r
@@ -259,7 +259,7 @@ OpenSectionStreamEx (
   IN     UINTN                                     SectionStreamLength,\r
   IN     VOID                                      *SectionStream,\r
   IN     BOOLEAN                                   AllocateBuffer,\r
-  IN     UINT32                                    AuthenticationStatus,   \r
+  IN     UINT32                                    AuthenticationStatus,\r
      OUT UINTN                                     *SectionStreamHandle\r
   );\r
 \r
@@ -267,8 +267,8 @@ OpenSectionStreamEx (
 /**\r
   Check if a stream is valid.\r
 \r
-  @param  SectionStream          The section stream to be checked \r
-  @param  SectionStreamLength    The length of section stream \r
+  @param  SectionStream          The section stream to be checked\r
+  @param  SectionStreamLength    The length of section stream\r
 \r
   @return A boolean value indicating the validness of the section stream.\r
 \r
@@ -306,7 +306,7 @@ IsValidSectionStream (
   EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is\r
   defined in RaiseTPL() in the UEFI 2.0 specification.\r
 \r
-  \r
+\r
   @param This         Indicates the\r
                       EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.\r
   @param InputSection Buffer containing the input GUIDed section\r
@@ -323,6 +323,7 @@ IsValidSectionStream (
                       is stored. If the function returns\r
                       anything other than EFI_SUCCESS, the value\r
                       of OutputSize is undefined.\r
+\r
   @param AuthenticationStatus A pointer to a caller-allocated\r
                               UINT32 that indicates the\r
                               authentication status of the\r
@@ -370,7 +371,7 @@ CustomGuidedSectionExtract (
   OUT       VOID                                   **OutputBuffer,\r
   OUT       UINTN                                  *OutputSize,\r
   OUT       UINT32                                 *AuthenticationStatus\r
-  );  \r
+  );\r
 \r
 //\r
 // Module globals\r
@@ -382,7 +383,7 @@ EFI_HANDLE mSectionExtractionHandle = NULL;
 EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL mCustomGuidedSectionExtractionProtocol = {\r
   CustomGuidedSectionExtract\r
 };\r
-                                             \r
+\r
 \r
 /**\r
   Entry point of the section extraction code. Initializes an instance of the\r
@@ -407,13 +408,13 @@ InitializeSectionExtraction (
   UINTN                              ExtractHandlerNumber;\r
 \r
   //\r
-  // Get custom extract guided section method guid list \r
+  // Get custom extract guided section method guid list\r
   //\r
   ExtractHandlerNumber = ExtractGuidedSectionGetGuidList (&ExtractHandlerGuidTable);\r
-  \r
+\r
   Status = EFI_SUCCESS;\r
   //\r
-  // Install custom guided extraction protocol \r
+  // Install custom guided extraction protocol\r
   //\r
   while (ExtractHandlerNumber-- > 0) {\r
     Status = CoreInstallProtocolInterface (\r
@@ -433,14 +434,14 @@ InitializeSectionExtraction (
   SEP member function.  This function creates and returns a new section stream\r
   handle to represent the new section stream.\r
 \r
-  @param  SectionStreamLength    Size in bytes of the section stream. \r
-  @param  SectionStream          Buffer containing the new section stream. \r
-  @param  SectionStreamHandle    A pointer to a caller allocated UINTN that on \r
-                                 output contains the new section stream handle. \r
+  @param  SectionStreamLength    Size in bytes of the section stream.\r
+  @param  SectionStream          Buffer containing the new section stream.\r
+  @param  SectionStreamHandle    A pointer to a caller allocated UINTN that on\r
+                                 output contains the new section stream handle.\r
 \r
   @retval EFI_SUCCESS            The section stream is created successfully.\r
-  @retval EFI_OUT_OF_RESOURCES   memory allocation failed. \r
-  @retval EFI_INVALID_PARAMETER  Section stream does not end concident with end \r
+  @retval EFI_OUT_OF_RESOURCES   memory allocation failed.\r
+  @retval EFI_INVALID_PARAMETER  Section stream does not end concident with end\r
                                  of last section.\r
 \r
 **/\r
@@ -458,16 +459,16 @@ OpenSectionStream (
   if (!IsValidSectionStream (SectionStream, SectionStreamLength)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
-  return OpenSectionStreamEx ( \r
-           SectionStreamLength, \r
+\r
+  return OpenSectionStreamEx (\r
+           SectionStreamLength,\r
            SectionStream,\r
            TRUE,\r
            0,\r
            SectionStreamHandle\r
            );\r
 }\r
-  \r
+\r
 \r
 /**\r
   SEP member function.  Retrieves requested section from section stream.\r
@@ -548,11 +549,11 @@ GetSection (
   UINTN                                                 Instance;\r
   UINT8                                                 *CopyBuffer;\r
   UINTN                                                 SectionSize;\r
-  \r
+\r
 \r
   OldTpl = CoreRaiseTpl (TPL_NOTIFY);\r
   Instance = SectionInstance + 1;\r
-  \r
+\r
   //\r
   // Locate target stream\r
   //\r
@@ -561,7 +562,7 @@ GetSection (
     Status = EFI_INVALID_PARAMETER;\r
     goto GetSection_Done;\r
   }\r
-  \r
+\r
   //\r
   // Found the stream, now locate and return the appropriate section\r
   //\r
@@ -577,12 +578,12 @@ GetSection (
     // There's a requested section type, so go find it and return it...\r
     //\r
     Status = FindChildNode (\r
-               StreamNode, \r
-               *SectionType, \r
-               &Instance, \r
+               StreamNode,\r
+               *SectionType,\r
+               &Instance,\r
                SectionDefinitionGuid,\r
                &ChildNode,\r
-               &ChildStreamNode, \r
+               &ChildStreamNode,\r
                &ExtractedAuthenticationStatus\r
                );\r
     if (EFI_ERROR (Status)) {\r
@@ -591,9 +592,9 @@ GetSection (
     CopySize = ChildNode->Size - sizeof (EFI_COMMON_SECTION_HEADER);\r
     CopyBuffer = ChildStreamNode->StreamBuffer + ChildNode->OffsetInStream + sizeof (EFI_COMMON_SECTION_HEADER);\r
     *AuthenticationStatus = ExtractedAuthenticationStatus;\r
-  }   \r
-    \r
-  SectionSize = CopySize;  \r
+  }\r
+\r
+  SectionSize = CopySize;\r
   if (*Buffer != NULL) {\r
     //\r
     // Caller allocated buffer.  Fill to size and return required size...\r
@@ -614,10 +615,10 @@ GetSection (
   }\r
   CopyMem (*Buffer, CopyBuffer, CopySize);\r
   *BufferSize = SectionSize;\r
-  \r
+\r
 GetSection_Done:\r
   CoreRestoreTpl (OldTpl);\r
-  \r
+\r
   return Status;\r
 }\r
 \r
@@ -626,11 +627,11 @@ GetSection_Done:
 /**\r
   SEP member function.  Deletes an existing section stream\r
 \r
-  @param  StreamHandleToClose    Indicates the stream to close \r
+  @param  StreamHandleToClose    Indicates the stream to close\r
 \r
   @retval EFI_SUCCESS            The section stream is closed sucessfully.\r
-  @retval EFI_OUT_OF_RESOURCES   Memory allocation failed. \r
-  @retval EFI_INVALID_PARAMETER  Section stream does not end concident with end \r
+  @retval EFI_OUT_OF_RESOURCES   Memory allocation failed.\r
+  @retval EFI_INVALID_PARAMETER  Section stream does not end concident with end\r
                                  of last section.\r
 \r
 **/\r
@@ -645,9 +646,9 @@ CloseSectionStream (
   EFI_STATUS                                    Status;\r
   LIST_ENTRY                                    *Link;\r
   CORE_SECTION_CHILD_NODE                       *ChildNode;\r
-  \r
+\r
   OldTpl = CoreRaiseTpl (TPL_NOTIFY);\r
-  \r
+\r
   //\r
   // Locate target stream\r
   //\r
@@ -668,7 +669,7 @@ CloseSectionStream (
   } else {\r
     Status = EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   CoreRestoreTpl (OldTpl);\r
   return Status;\r
 }\r
@@ -678,15 +679,15 @@ CloseSectionStream (
 /**\r
   Worker function.  Determine if the input stream:child matches the input type.\r
 \r
-  @param  Stream                 Indicates the section stream associated with the \r
-                                 child \r
-  @param  Child                  Indicates the child to check \r
-  @param  SearchType             Indicates the type of section to check against \r
-                                 for \r
-  @param  SectionDefinitionGuid  Indicates the GUID to check against if the type \r
-                                 is EFI_SECTION_GUID_DEFINED \r
+  @param  Stream                 Indicates the section stream associated with the\r
+                                 child\r
+  @param  Child                  Indicates the child to check\r
+  @param  SearchType             Indicates the type of section to check against\r
+                                 for\r
+  @param  SectionDefinitionGuid  Indicates the GUID to check against if the type\r
+                                 is EFI_SECTION_GUID_DEFINED\r
 \r
-  @retval TRUE                   The child matches \r
+  @retval TRUE                   The child matches\r
   @retval FALSE                  The child doesn't match\r
 \r
 **/\r
@@ -699,7 +700,7 @@ ChildIsType (
   )\r
 {\r
   EFI_GUID_DEFINED_SECTION    *GuidedSection;\r
-  \r
+\r
   if (SearchType == EFI_SECTION_ALL) {\r
     return TRUE;\r
   }\r
@@ -718,25 +719,25 @@ ChildIsType (
   Worker function  Recursively searches / builds section stream database\r
   looking for requested section.\r
 \r
-  @param  SourceStream           Indicates the section stream in which to do the \r
-                                 search. \r
-  @param  SearchType             Indicates the type of section to search for. \r
-  @param  SectionInstance        Indicates which instance of section to find.  \r
-                                 This is an in/out parameter to deal with \r
-                                 recursions. \r
-  @param  SectionDefinitionGuid  Guid of section definition \r
-  @param  FoundChild             Output indicating the child node that is found. \r
-  @param  FoundStream            Output indicating which section stream the child \r
-                                 was found in.  If this stream was generated as a \r
-                                 result of an encapsulation section, the \r
-                                 streamhandle is visible within the SEP driver \r
+  @param  SourceStream           Indicates the section stream in which to do the\r
+                                 search.\r
+  @param  SearchType             Indicates the type of section to search for.\r
+  @param  SectionInstance        Indicates which instance of section to find.\r
+                                 This is an in/out parameter to deal with\r
+                                 recursions.\r
+  @param  SectionDefinitionGuid  Guid of section definition\r
+  @param  FoundChild             Output indicating the child node that is found.\r
+  @param  FoundStream            Output indicating which section stream the child\r
+                                 was found in.  If this stream was generated as a\r
+                                 result of an encapsulation section, the\r
+                                 streamhandle is visible within the SEP driver\r
                                  only.\r
-  @param  AuthenticationStatus   Indicates the authentication status of the found section. \r
+  @param  AuthenticationStatus   Indicates the authentication status of the found section.\r
 \r
-  @retval EFI_SUCCESS            Child node was found and returned. \r
-                                 EFI_OUT_OF_RESOURCES- Memory allocation failed. \r
-  @retval EFI_NOT_FOUND          Requested child node does not exist. \r
-  @retval EFI_PROTOCOL_ERROR     a required GUIDED section extraction protocol \r
+  @retval EFI_SUCCESS            Child node was found and returned.\r
+                                 EFI_OUT_OF_RESOURCES- Memory allocation failed.\r
+  @retval EFI_NOT_FOUND          Requested child node does not exist.\r
+  @retval EFI_PROTOCOL_ERROR     a required GUIDED section extraction protocol\r
                                  does not exist\r
 \r
 **/\r
@@ -757,21 +758,21 @@ FindChildNode (
   UINT32                                        NextChildOffset;\r
   EFI_STATUS                                    ErrorStatus;\r
   EFI_STATUS                                    Status;\r
-  \r
+\r
   CurrentChildNode = NULL;\r
   ErrorStatus = EFI_NOT_FOUND;\r
-  \r
+\r
   if (SourceStream->StreamLength == 0) {\r
     return EFI_NOT_FOUND;\r
   }\r
-  \r
-  if (IsListEmpty (&SourceStream->Children) && \r
+\r
+  if (IsListEmpty (&SourceStream->Children) &&\r
       SourceStream->StreamLength >= sizeof (EFI_COMMON_SECTION_HEADER)) {\r
     //\r
     // This occurs when a section stream exists, but no child sections\r
     // have been parsed out yet.  Therefore, extract the first child and add it\r
     // to the list of children so we can get started.\r
-    // Section stream may contain an array of zero or more bytes. \r
+    // Section stream may contain an array of zero or more bytes.\r
     // So, its size should be >= the size of commen section header.\r
     //\r
     Status = CreateChildNode (SourceStream, 0, &CurrentChildNode);\r
@@ -779,7 +780,7 @@ FindChildNode (
       return Status;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // At least one child has been parsed out of the section stream.  So, walk\r
   // through the sections that have already been parsed out looking for the\r
@@ -805,7 +806,7 @@ FindChildNode (
         return EFI_SUCCESS;\r
       }\r
     }\r
-    \r
+\r
     if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {\r
       //\r
       // If the current node is an encapsulating node, recurse into it...\r
@@ -832,7 +833,7 @@ FindChildNode (
         ErrorStatus = Status;\r
       }\r
     }\r
-    \r
+\r
     if (!IsNodeAtEnd (&SourceStream->Children, &CurrentChildNode->Link)) {\r
       //\r
       // We haven't found the child node we're interested in yet, but there's\r
@@ -872,21 +873,21 @@ FindChildNode (
 /**\r
   Worker function.  Constructor for new child nodes.\r
 \r
-  @param  Stream                 Indicates the section stream in which to add the \r
-                                 child. \r
-  @param  ChildOffset            Indicates the offset in Stream that is the \r
-                                 beginning of the child section. \r
-  @param  ChildNode              Indicates the Callee allocated and initialized \r
-                                 child. \r
-\r
-  @retval EFI_SUCCESS            Child node was found and returned. \r
-                                 EFI_OUT_OF_RESOURCES- Memory allocation failed. \r
-  @retval EFI_PROTOCOL_ERROR     Encapsulation sections produce new stream \r
-                                 handles when the child node is created.  If the \r
-                                 section type is GUID defined, and the extraction \r
-                                 GUID does not exist, and producing the stream \r
-                                 requires the GUID, then a protocol error is \r
-                                 generated and no child is produced. Values \r
+  @param  Stream                 Indicates the section stream in which to add the\r
+                                 child.\r
+  @param  ChildOffset            Indicates the offset in Stream that is the\r
+                                 beginning of the child section.\r
+  @param  ChildNode              Indicates the Callee allocated and initialized\r
+                                 child.\r
+\r
+  @retval EFI_SUCCESS            Child node was found and returned.\r
+                                 EFI_OUT_OF_RESOURCES- Memory allocation failed.\r
+  @retval EFI_PROTOCOL_ERROR     Encapsulation sections produce new stream\r
+                                 handles when the child node is created.  If the\r
+                                 section type is GUID defined, and the extraction\r
+                                 GUID does not exist, and producing the stream\r
+                                 requires the GUID, then a protocol error is\r
+                                 generated and no child is produced. Values\r
                                  returned by OpenSectionStreamEx.\r
 \r
 **/\r
@@ -909,7 +910,7 @@ CreateChildNode (
   UINTN                                        NewStreamBufferSize;\r
   UINT32                                       AuthenticationStatus;\r
   UINT32                                       SectionLength;\r
-    \r
+\r
   CORE_SECTION_CHILD_NODE                      *Node;\r
 \r
   SectionHeader = (EFI_COMMON_SECTION_HEADER *) (Stream->StreamBuffer + ChildOffset);\r
@@ -922,7 +923,7 @@ CreateChildNode (
   if (Node == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
+\r
   //\r
   // Now initialize it\r
   //\r
@@ -932,7 +933,7 @@ CreateChildNode (
   Node->OffsetInStream = ChildOffset;\r
   Node->EncapsulatedStreamHandle = NULL_STREAM_HANDLE;\r
   Node->EncapsulationGuid = NULL;\r
-  \r
+\r
   //\r
   // If it's an encapsulating section, then create the new section stream also\r
   //\r
@@ -942,9 +943,9 @@ CreateChildNode (
       // Get the CompressionSectionHeader\r
       //\r
       ASSERT (Node->Size >= sizeof (EFI_COMPRESSION_SECTION));\r
-      \r
+\r
       CompressionHeader = (EFI_COMPRESSION_SECTION *) SectionHeader;\r
-      \r
+\r
       //\r
       // Allocate space for the new stream\r
       //\r
@@ -955,7 +956,7 @@ CreateChildNode (
           CoreFreePool (Node);\r
           return EFI_OUT_OF_RESOURCES;\r
         }\r
-        \r
+\r
         if (CompressionHeader->CompressionType == EFI_NOT_COMPRESSED) {\r
           //\r
           // stream is not actually compressed, just encapsulated.  So just copy it.\r
@@ -964,15 +965,15 @@ CreateChildNode (
         } else if (CompressionHeader->CompressionType == EFI_STANDARD_COMPRESSION) {\r
           //\r
           // Only support the EFI_SATNDARD_COMPRESSION algorithm.\r
-          // \r
+          //\r
 \r
           //\r
           // Decompress the stream\r
           //\r
           Status = CoreLocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress);\r
-          \r
+\r
           ASSERT_EFI_ERROR (Status);\r
-          \r
+\r
           Status = Decompress->GetInfo (\r
                                  Decompress,\r
                                  CompressionHeader + 1,\r
@@ -1000,13 +1001,13 @@ CreateChildNode (
                                  ScratchSize\r
                                  );\r
           ASSERT_EFI_ERROR (Status);\r
-          CoreFreePool (ScratchBuffer);                                           \r
+          CoreFreePool (ScratchBuffer);\r
         }\r
       } else {\r
         NewStreamBuffer = NULL;\r
         NewStreamBufferSize = 0;\r
       }\r
-      \r
+\r
       Status = OpenSectionStreamEx (\r
                  NewStreamBufferSize,\r
                  NewStreamBuffer,\r
@@ -1041,9 +1042,9 @@ CreateChildNode (
           CoreFreePool (*ChildNode);\r
           return EFI_PROTOCOL_ERROR;\r
         }\r
-        \r
+\r
         //\r
-        // Make sure we initialize the new stream with the correct \r
+        // Make sure we initialize the new stream with the correct\r
         // authentication status for both aggregate and local status fields.\r
         //\r
         if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) {\r
@@ -1058,7 +1059,7 @@ CreateChildNode (
           //\r
           AuthenticationStatus = Stream->AuthenticationStatus;\r
         }\r
-        \r
+\r
         Status = OpenSectionStreamEx (\r
                    NewStreamBufferSize,\r
                    NewStreamBuffer,\r
@@ -1082,12 +1083,12 @@ CreateChildNode (
           CoreFreePool (*ChildNode);\r
           return EFI_PROTOCOL_ERROR;\r
         }\r
-        \r
+\r
         //\r
         // Figure out the proper authentication status\r
         //\r
         AuthenticationStatus = Stream->AuthenticationStatus;\r
-        \r
+\r
         SectionLength = SECTION_SIZE (GuidedHeader);\r
         Status = OpenSectionStreamEx (\r
                    SectionLength - GuidedHeader->DataOffset,\r
@@ -1101,17 +1102,17 @@ CreateChildNode (
           return Status;\r
         }\r
       }\r
-      \r
+\r
       break;\r
 \r
     default:\r
-      \r
+\r
       //\r
       // Nothing to do if it's a leaf\r
       //\r
       break;\r
   }\r
-  \r
+\r
   //\r
   // Last, add the new child node to the stream\r
   //\r
@@ -1137,7 +1138,7 @@ FreeChildNode (
   // Remove the child from it's list\r
   //\r
   RemoveEntryList (&ChildNode->Link);\r
-  \r
+\r
   if (ChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {\r
     //\r
     // If it's an encapsulating section, we close the resulting section stream.\r
@@ -1149,20 +1150,20 @@ FreeChildNode (
   // Last, free the child node itself\r
   //\r
   CoreFreePool (ChildNode);\r
-}  \r
+}\r
 \r
 \r
 \r
 /**\r
   Worker function.  Constructor for section streams.\r
 \r
-  @param  SectionStreamLength    Size in bytes of the section stream. \r
-  @param  SectionStream          Buffer containing the new section stream. \r
-  @param  AllocateBuffer         Indicates whether the stream buffer is to be \r
-                                 copied or the input buffer is to be used in \r
-                                 place. AuthenticationStatus- Indicates the \r
-                                 default authentication status for the new \r
-                                 stream. \r
+  @param  SectionStreamLength    Size in bytes of the section stream.\r
+  @param  SectionStream          Buffer containing the new section stream.\r
+  @param  AllocateBuffer         Indicates whether the stream buffer is to be\r
+                                 copied or the input buffer is to be used in\r
+                                 place. AuthenticationStatus- Indicates the\r
+                                 default authentication status for the new\r
+                                 stream.\r
   @param  AuthenticationStatus   A pointer to a caller-allocated UINT32 that\r
                                  indicates the authentication status of the\r
                                  output buffer. If the input section's\r
@@ -1179,10 +1180,10 @@ FreeChildNode (
                                  function returns anything other than\r
                                  EFI_SUCCESS, the value of *AuthenticationStatus\r
                                  is undefined.\r
-  @param  SectionStreamHandle    A pointer to a caller allocated section stream \r
-                                 handle. \r
+  @param  SectionStreamHandle    A pointer to a caller allocated section stream\r
+                                 handle.\r
 \r
-  @retval EFI_SUCCESS            Stream was added to stream database. \r
+  @retval EFI_SUCCESS            Stream was added to stream database.\r
   @retval EFI_OUT_OF_RESOURCES   memory allocation failed.\r
 \r
 **/\r
@@ -1191,13 +1192,13 @@ OpenSectionStreamEx (
   IN     UINTN                                     SectionStreamLength,\r
   IN     VOID                                      *SectionStream,\r
   IN     BOOLEAN                                   AllocateBuffer,\r
-  IN     UINT32                                    AuthenticationStatus,   \r
+  IN     UINT32                                    AuthenticationStatus,\r
      OUT UINTN                                     *SectionStreamHandle\r
   )\r
 {\r
   CORE_SECTION_STREAM_NODE    *NewStream;\r
   EFI_TPL                     OldTpl;\r
-  \r
+\r
   //\r
   // Allocate a new stream\r
   //\r
@@ -1205,14 +1206,14 @@ OpenSectionStreamEx (
   if (NewStream == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  \r
-  if (AllocateBuffer) { \r
+\r
+  if (AllocateBuffer) {\r
     //\r
     // if we're here, we're double buffering, allocate the buffer and copy the\r
     // data in\r
     //\r
     if (SectionStreamLength > 0) {\r
-      NewStream->StreamBuffer = CoreAllocateBootServicesPool (SectionStreamLength); \r
+      NewStream->StreamBuffer = CoreAllocateBootServicesPool (SectionStreamLength);\r
       if (NewStream->StreamBuffer == NULL) {\r
         CoreFreePool (NewStream);\r
         return EFI_OUT_OF_RESOURCES;\r
@@ -1235,7 +1236,7 @@ OpenSectionStreamEx (
     //\r
     NewStream->StreamBuffer = SectionStream;\r
   }\r
-  \r
+\r
   //\r
   // Initialize the rest of the section stream\r
   //\r
@@ -1244,7 +1245,7 @@ OpenSectionStreamEx (
   NewStream->StreamLength = SectionStreamLength;\r
   InitializeListHead (&NewStream->Children);\r
   NewStream->AuthenticationStatus = AuthenticationStatus;\r
-  \r
+\r
   //\r
   // Add new stream to stream list\r
   //\r
@@ -1253,7 +1254,7 @@ OpenSectionStreamEx (
   CoreRestoreTpl (OldTpl);\r
 \r
   *SectionStreamHandle = NewStream->StreamHandle;\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -1262,12 +1263,12 @@ OpenSectionStreamEx (
 /**\r
   Worker function.  Search stream database for requested stream handle.\r
 \r
-  @param  SearchHandle           Indicates which stream to look for. \r
-  @param  FoundStream            Output pointer to the found stream. \r
+  @param  SearchHandle           Indicates which stream to look for.\r
+  @param  FoundStream            Output pointer to the found stream.\r
 \r
-  @retval EFI_SUCCESS            StreamHandle was found and *FoundStream contains \r
-                                 the stream node. \r
-  @retval EFI_NOT_FOUND          SearchHandle was not found in the stream \r
+  @retval EFI_SUCCESS            StreamHandle was found and *FoundStream contains\r
+                                 the stream node.\r
+  @retval EFI_NOT_FOUND          SearchHandle was not found in the stream\r
                                  database.\r
 \r
 **/\r
@@ -1276,9 +1277,9 @@ FindStreamNode (
   IN  UINTN                                     SearchHandle,\r
   OUT CORE_SECTION_STREAM_NODE                  **FoundStream\r
   )\r
-{  \r
+{\r
   CORE_SECTION_STREAM_NODE                      *StreamNode;\r
-  \r
+\r
   if (!IsListEmpty (&mStreamRoot)) {\r
     StreamNode = STREAM_NODE_FROM_LINK (GetFirstNode (&mStreamRoot));\r
     for (;;) {\r
@@ -1292,7 +1293,7 @@ FindStreamNode (
       }\r
     }\r
   }\r
-  \r
+\r
   return EFI_NOT_FOUND;\r
 }\r
 \r
@@ -1300,8 +1301,8 @@ FindStreamNode (
 /**\r
   Check if a stream is valid.\r
 \r
-  @param  SectionStream          The section stream to be checked \r
-  @param  SectionStreamLength    The length of section stream \r
+  @param  SectionStream          The section stream to be checked\r
+  @param  SectionStreamLength    The length of section stream\r
 \r
   @return A boolean value indicating the validness of the section stream.\r
 \r
@@ -1319,20 +1320,20 @@ IsValidSectionStream (
 \r
   TotalLength = 0;\r
   SectionHeader = (EFI_COMMON_SECTION_HEADER *)SectionStream;\r
-  \r
+\r
   while (TotalLength < SectionStreamLength) {\r
     SectionLength = SECTION_SIZE (SectionHeader);\r
     TotalLength += SectionLength;\r
 \r
     if (TotalLength == SectionStreamLength) {\r
-      return TRUE;    \r
+      return TRUE;\r
     }\r
 \r
     //\r
     // Move to the next byte following the section...\r
     //\r
     SectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) SectionHeader + SectionLength);\r
-    \r
+\r
     //\r
     // Figure out where the next section begins\r
     //\r
@@ -1373,7 +1374,7 @@ IsValidSectionStream (
   EFI_TPL above TPL_NOTIFY is undefined. Type EFI_TPL is\r
   defined in RaiseTPL() in the UEFI 2.0 specification.\r
 \r
-  \r
+\r
   @param This         Indicates the\r
                       EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL instance.\r
   @param InputSection Buffer containing the input GUIDed section\r
@@ -1446,7 +1447,7 @@ CustomGuidedSectionExtract (
   UINT32          OutputBufferSize;\r
   UINT32          ScratchBufferSize;\r
   UINT16          SectionAttribute;\r
-  \r
+\r
   //\r
   // Init local variable\r
   //\r
@@ -1462,12 +1463,12 @@ CustomGuidedSectionExtract (
              &ScratchBufferSize,\r
              &SectionAttribute\r
              );\r
-  \r
+\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((DEBUG_ERROR, "GetInfo from guided section Failed - %r\n", Status));\r
     return Status;\r
   }\r
-  \r
+\r
   if (ScratchBufferSize != 0) {\r
     //\r
     // Allocate scratch buffer\r
@@ -1478,7 +1479,7 @@ CustomGuidedSectionExtract (
     }\r
   }\r
 \r
-  if (OutputBufferSize > 0) {  \r
+  if (OutputBufferSize > 0) {\r
     //\r
     // Allocate output buffer\r
     //\r
@@ -1493,7 +1494,7 @@ CustomGuidedSectionExtract (
   // Call decode function to extract raw data from the guided section.\r
   //\r
   Status = ExtractGuidedSectionDecode (\r
-             InputSection, \r
+             InputSection,\r
              OutputBuffer,\r
              ScratchBuffer,\r
              AuthenticationStatus\r
@@ -1514,9 +1515,9 @@ CustomGuidedSectionExtract (
 \r
   if (*OutputBuffer != AllocatedOutputBuffer) {\r
     //\r
-    // OutputBuffer was returned as a different value, \r
+    // OutputBuffer was returned as a different value,\r
     // so copy section contents to the allocated memory buffer.\r
-    // \r
+    //\r
     CopyMem (AllocatedOutputBuffer, *OutputBuffer, OutputBufferSize);\r
     *OutputBuffer = AllocatedOutputBuffer;\r
   }\r