]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
MdePkg: Fix typos in comments
[mirror_edk2.git] / MdePkg / Library / DxeExtractGuidedSectionLib / DxeExtractGuidedSectionLib.c
index b8bb83c20e700297f760965342680f8f045e9678..8b8e52829b2f5e09014a7dbaf4ae33aa43281ec2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provide generic extract guided section functions for Dxe phase.\r
 \r
-  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -18,6 +18,7 @@
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/ExtractGuidedSectionLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
 \r
 #define EXTRACT_HANDLER_TABLE_SIZE   0x10\r
 \r
@@ -175,8 +176,10 @@ ExtractGuidedSectionRegisterHandlers (
   )\r
 {\r
   UINT32 Index;\r
+  VOID   *GuidData;\r
+\r
   //\r
-  // Check input paramter.\r
+  // Check input parameter.\r
   //\r
   ASSERT (SectionGuid != NULL);\r
   ASSERT (GetInfoHandler != NULL);\r
@@ -211,7 +214,16 @@ ExtractGuidedSectionRegisterHandlers (
   CopyGuid (&mExtractHandlerGuidTable [mNumberOfExtractHandler], SectionGuid);\r
   mExtractDecodeHandlerTable [mNumberOfExtractHandler] = DecodeHandler;\r
   mExtractGetInfoHandlerTable [mNumberOfExtractHandler++] = GetInfoHandler;\r
-  \r
+\r
+  //\r
+  // Install the Guided Section GUID configuration table to record the GUID itself.\r
+  // Then the content of the configuration table buffer will be the same as the GUID value itself.\r
+  //\r
+  GuidData = AllocateCopyPool (sizeof (GUID), (VOID *) SectionGuid);\r
+  if (GuidData != NULL) {\r
+    gBS->InstallConfigurationTable ((EFI_GUID *) SectionGuid, GuidData);\r
+  }\r
+\r
   return RETURN_SUCCESS;\r
 }\r
 \r
@@ -259,17 +271,24 @@ ExtractGuidedSectionGetInfo (
   )\r
 {\r
   UINT32 Index;\r
+  EFI_GUID *SectionDefinitionGuid;\r
 \r
   ASSERT (InputSection != NULL);  \r
   ASSERT (OutputBufferSize != NULL);\r
   ASSERT (ScratchBufferSize != NULL);\r
   ASSERT (SectionAttribute != NULL);\r
+\r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
  \r
   //\r
   // Search the match registered GetInfo handler for the input guided section.\r
   //\r
   for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (&mExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to getinfo for the input section data.\r
       //\r
@@ -333,6 +352,7 @@ ExtractGuidedSectionDecode (
   )\r
 {\r
   UINT32 Index;\r
+  EFI_GUID *SectionDefinitionGuid;\r
   \r
   //\r
   // Check the input parameters\r
@@ -341,11 +361,17 @@ ExtractGuidedSectionDecode (
   ASSERT (OutputBuffer != NULL);\r
   ASSERT (AuthenticationStatus != NULL);\r
 \r
+  if (IS_SECTION2 (InputSection)) {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
+  } else {\r
+    SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
+  }\r
+\r
   //\r
   // Search the match registered extract handler for the input guided section.\r
   //\r
   for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
-    if (CompareGuid (&mExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
+    if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionDefinitionGuid)) {\r
       //\r
       // Call the match handler to extract raw data for the input section data.\r
       //\r