]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
MdeModule cleanup for PI:
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / SectionExtraction / CoreSectionExtraction.c
index 1a98e97e9a6738d1b9f013bdab597103f9c635e3..fcc55650407a03ad14984737a7d83bcfeec099af 100644 (file)
@@ -1,20 +1,4 @@
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-\r
-Module Name:\r
-\r
-  CoreSectionExtraction.c\r
-  \r
-Abstract:\r
-\r
+/**@file\r
   Section Extraction Protocol implementation.\r
   \r
   Stream database is implemented as a linked list of section streams,\r
@@ -42,8 +26,17 @@ Abstract:
      \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
---*/\r
+     \r
+Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+**/\r
 \r
 #include <DxeMain.h>\r
 \r
@@ -131,38 +124,6 @@ CreateGuidedExtractionRpnEvent (
   IN CORE_SECTION_CHILD_NODE                  *ChildNode\r
   );\r
 \r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-OpenSectionStream (\r
-  IN     EFI_SECTION_EXTRACTION_PROTOCOL      *This,\r
-  IN     UINTN                                SectionStreamLength,\r
-  IN     VOID                                 *SectionStream,\r
-     OUT UINTN                                *SectionStreamHandle\r
-  );\r
-  \r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-GetSection (\r
-  IN EFI_SECTION_EXTRACTION_PROTOCOL          *This,\r
-  IN UINTN                                    SectionStreamHandle,\r
-  IN EFI_SECTION_TYPE                         *SectionType,\r
-  IN EFI_GUID                                 *SectionDefinitionGuid,\r
-  IN UINTN                                    SectionInstance,\r
-  IN VOID                                     **Buffer,\r
-  IN OUT UINTN                                *BufferSize,\r
-  OUT UINT32                                  *AuthenticationStatus\r
-  );\r
-  \r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-CloseSectionStream (\r
-  IN  EFI_SECTION_EXTRACTION_PROTOCOL         *This,\r
-  IN  UINTN                                   StreamHandleToClose\r
-  );\r
-  \r
 STATIC\r
 EFI_STATUS\r
 FindStreamNode (\r
@@ -214,8 +175,9 @@ IsValidSectionStream (
   );\r
 \r
 EFI_STATUS\r
+EFIAPI\r
 CustomGuidedSectionExtract (\r
-  IN CONST  EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,\r
+  IN CONST  EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL  *This,\r
   IN CONST  VOID                                   *InputSection,\r
   OUT       VOID                                   **OutputBuffer,\r
   OUT       UINTN                                  *OutputSize,\r
@@ -228,12 +190,6 @@ LIST_ENTRY mStreamRoot = INITIALIZE_LIST_HEAD_VARIABLE (mStreamRoot);
 \r
 EFI_HANDLE mSectionExtractionHandle = NULL;\r
 \r
-EFI_SECTION_EXTRACTION_PROTOCOL mSectionExtraction = { \r
-  OpenSectionStream, \r
-  GetSection, \r
-  CloseSectionStream\r
-};\r
-\r
 EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL mCustomGuidedSectionExtractionProtocol = {\r
   CustomGuidedSectionExtract\r
 };\r
@@ -264,22 +220,12 @@ Returns:
   EFI_GUID                           *ExtractHandlerGuidTable;\r
   UINTN                              ExtractHandlerNumber;\r
 \r
-  //\r
-  // Install SEP to a new handle\r
-  //\r
-  Status = CoreInstallProtocolInterface (\r
-            &mSectionExtractionHandle,\r
-            &gEfiSectionExtractionProtocolGuid,\r
-            EFI_NATIVE_INTERFACE,\r
-            &mSectionExtraction\r
-            );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
   //\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
   //\r
@@ -296,11 +242,9 @@ Returns:
   return Status;\r
 }\r
 \r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 OpenSectionStream (\r
-  IN     EFI_SECTION_EXTRACTION_PROTOCOL           *This,\r
   IN     UINTN                                     SectionStreamLength,\r
   IN     VOID                                      *SectionStream,\r
      OUT UINTN                                     *SectionStreamHandle\r
@@ -342,11 +286,9 @@ Returns:
           );\r
 }\r
   \r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 GetSection (\r
-  IN EFI_SECTION_EXTRACTION_PROTOCOL                    *This,\r
   IN UINTN                                              SectionStreamHandle,\r
   IN EFI_SECTION_TYPE                                   *SectionType,\r
   IN EFI_GUID                                           *SectionDefinitionGuid,\r
@@ -361,7 +303,6 @@ Routine Description:
   SEP member function.  Retrieves requested section from section stream.\r
 \r
 Arguments:  \r
-  This:                 Pointer to SEP instance.\r
   SectionStreamHandle:  The section stream from which to extract the requested\r
                           section.\r
   SectionType:         A pointer to the type of section to search for.\r
@@ -485,11 +426,9 @@ GetSection_Done:
 }\r
 \r
 \r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 CloseSectionStream (\r
-  IN  EFI_SECTION_EXTRACTION_PROTOCOL           *This,\r
   IN  UINTN                                     StreamHandleToClose\r
   )\r
 /*++\r
@@ -922,7 +861,7 @@ Returns:
           //\r
           // OR in the parent stream's aggregate status.\r
           //\r
-          AuthenticationStatus |= Stream->AuthenticationStatus & EFI_AGGREGATE_AUTH_STATUS_ALL;\r
+          AuthenticationStatus |= Stream->AuthenticationStatus & EFI_AUTH_STATUS_ALL;\r
         } else {\r
           //\r
           // since there's no authentication data contributed by the section,\r
@@ -959,23 +898,6 @@ Returns:
         // Figure out the proper authentication status\r
         //\r
         AuthenticationStatus = Stream->AuthenticationStatus;\r
-        if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) {\r
-          //\r
-          //  The local status of the new stream is contained in \r
-          //  AuthenticaionStatus.  This value needs to be ORed into the\r
-          //  Aggregate bits also...\r
-          //\r
-          \r
-          //\r
-          // Clear out and initialize the local status\r
-          //\r
-          AuthenticationStatus &= ~EFI_LOCAL_AUTH_STATUS_ALL;\r
-          AuthenticationStatus |= EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED | EFI_LOCAL_AUTH_STATUS_NOT_TESTED;\r
-          //\r
-          // OR local status into aggregate status\r
-          //\r
-          AuthenticationStatus |= AuthenticationStatus >> 16;\r
-        }\r
         \r
         SectionLength = SECTION_SIZE (GuidedHeader);\r
         Status = OpenSectionStreamEx (\r
@@ -991,17 +913,6 @@ Returns:
         }\r
       }\r
       \r
-      if ((AuthenticationStatus & EFI_LOCAL_AUTH_STATUS_ALL) == \r
-            (EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED | EFI_LOCAL_AUTH_STATUS_NOT_TESTED)) {\r
-        //\r
-        // Need to register for RPN for when the required GUIDed extraction\r
-        // protocol becomes available.  This will enable us to refresh the\r
-        // AuthenticationStatus cached in the Stream if it's ever requested\r
-        // again.\r
-        //\r
-        CreateGuidedExtractionRpnEvent (Stream, Node);\r
-      }\r
-      \r
       break;\r
 \r
     default:\r
@@ -1097,7 +1008,7 @@ Returns:
   \r
   Context = RpnContext;\r
   \r
-  Status = CloseSectionStream (&mSectionExtraction, Context->ChildNode->EncapsulatedStreamHandle);\r
+  Status = CloseSectionStream (Context->ChildNode->EncapsulatedStreamHandle);\r
   if (!EFI_ERROR (Status)) {\r
     //\r
     // The stream closed successfully, so re-open the stream with correct AuthenticationStatus\r
@@ -1122,7 +1033,7 @@ Returns:
     //\r
     // OR in the parent stream's aggregagate status.\r
     //\r
-    AuthenticationStatus |= Context->ParentStream->AuthenticationStatus & EFI_AGGREGATE_AUTH_STATUS_ALL;\r
+    AuthenticationStatus |= Context->ParentStream->AuthenticationStatus & EFI_AUTH_STATUS_ALL;\r
     Status = OpenSectionStreamEx (\r
                NewStreamBufferSize,\r
                NewStreamBuffer,\r
@@ -1173,7 +1084,7 @@ Returns:
     // If it's an encapsulating section, we close the resulting section stream.\r
     // CloseSectionStream will free all memory associated with the stream.\r
     //\r
-    CloseSectionStream (&mSectionExtraction, ChildNode->EncapsulatedStreamHandle);\r
+    CloseSectionStream (ChildNode->EncapsulatedStreamHandle);\r
   }\r
   //\r
   // Last, free the child node itself\r
@@ -1454,6 +1365,7 @@ Returns:
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 CustomGuidedSectionExtract (\r
   IN CONST  EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,\r
   IN CONST  VOID                                   *InputSection,\r