]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Code Scrub DxeIpl module.
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Jul 2008 13:17:50 +0000 (13:17 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Jul 2008 13:17:50 +0000 (13:17 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5502 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
MdeModulePkg/Core/DxeIplPeim/Ia32/ImageRead.c
MdeModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c
MdeModulePkg/Core/DxeIplPeim/Ipf/ImageRead.c
MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c
MdeModulePkg/MdeModulePkg.dsc

index b046f392226bae42217a4f5eeb68a8d2715195bb..151f28d222eeef36e4c9cd3a1c6a2588d20dadb4 100644 (file)
@@ -21,10 +21,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Ppi/EndOfPeiPhase.h>\r
 #include <Ppi/MemoryDiscovered.h>\r
 #include <Ppi/ReadOnlyVariable2.h>\r
 #include <Ppi/EndOfPeiPhase.h>\r
 #include <Ppi/MemoryDiscovered.h>\r
 #include <Ppi/ReadOnlyVariable2.h>\r
-#include <Guid/MemoryTypeInformation.h>\r
 #include <Ppi/Decompress.h>\r
 #include <Ppi/FirmwareVolumeInfo.h>\r
 #include <Ppi/Decompress.h>\r
 #include <Ppi/FirmwareVolumeInfo.h>\r
+#include <Ppi/GuidedSectionExtraction.h>\r
 \r
 \r
+#include <Guid/MemoryTypeInformation.h>\r
 #include <Guid/MemoryAllocationHob.h>\r
 #include <Guid/FirmwareFileSystem2.h>\r
 \r
 #include <Guid/MemoryAllocationHob.h>\r
 #include <Guid/FirmwareFileSystem2.h>\r
 \r
@@ -48,13 +49,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define STACK_SIZE      0x20000\r
 #define BSP_STORE_SIZE  0x4000\r
 \r
 #define STACK_SIZE      0x20000\r
 #define BSP_STORE_SIZE  0x4000\r
 \r
+\r
+//\r
+// This macro aligns the ActualSize with a given alignment and is used to \r
+// calculate the size an image occupies.\r
+//\r
 #define GET_OCCUPIED_SIZE(ActualSize, Alignment) ((ActualSize + (Alignment - 1)) & ~(Alignment - 1))\r
 \r
 #define GET_OCCUPIED_SIZE(ActualSize, Alignment) ((ActualSize + (Alignment - 1)) & ~(Alignment - 1))\r
 \r
+//\r
+// Indicate whether DxeIpl has been shadowed to memory.\r
+//\r
 extern BOOLEAN gInMemory;\r
 \r
 extern BOOLEAN gInMemory;\r
 \r
-\r
-\r
-\r
 /**\r
    Loads and relocates a PE/COFF image into memory.\r
 \r
 /**\r
    Loads and relocates a PE/COFF image into memory.\r
 \r
@@ -109,7 +115,6 @@ GetImageReadFunction (
   );\r
 \r
 \r
   );\r
 \r
 \r
-\r
 /**\r
    Main entry point to last PEIM \r
     \r
 /**\r
    Main entry point to last PEIM \r
     \r
@@ -168,7 +173,98 @@ UpdateStackHob (
   IN UINT64                      Length\r
   );\r
 \r
   IN UINT64                      Length\r
   );\r
 \r
+/**\r
+  The ExtractSection() function processes the input section and\r
+  returns a pointer to the section contents. If the section being\r
+  extracted does not require processing (if the section\r
+  GuidedSectionHeader.Attributes has the\r
+  EFI_GUIDED_SECTION_PROCESSING_REQUIRED field cleared), then\r
+  OutputBuffer is just updated to point to the start of the\r
+  section's contents. Otherwise, *Buffer must be allocated\r
+  from PEI permanent memory.\r
+\r
+  @param This                   Indicates the\r
+                                EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI instance.\r
+                                Buffer containing the input GUIDed section to be\r
+                                processed. OutputBuffer OutputBuffer is\r
+                                allocated from PEI permanent memory and contains\r
+                                the new section stream.\r
+  @param InputSection           A pointer to the input buffer, which contains\r
+                                the input section to be processed.\r
+  @param OutputBuffer           A pointer to a caller-allocated buffer, whose\r
+                                size is specified by the contents of OutputSize.\r
+  @param OutputSize             A pointer to a caller-allocated\r
+                                UINTN in which the size of *OutputBuffer\r
+                                allocation is stored. If the function\r
+                                returns anything other than EFI_SUCCESS,\r
+                                the value of OutputSize is undefined.\r
+  @param AuthenticationStatus   A pointer to a caller-allocated\r
+                                UINT32 that indicates the\r
+                                authentication status of the\r
+                                output buffer. If the input\r
+                                section's GuidedSectionHeader.\r
+                                Attributes field has the\r
+                                EFI_GUIDED_SECTION_AUTH_STATUS_VALID \r
+                                bit as clear,\r
+                                AuthenticationStatus must return\r
+                                zero. These bits reflect the\r
+                                status of the extraction\r
+                                operation. If the function\r
+                                returns anything other than\r
+                                EFI_SUCCESS, the value of\r
+                                AuthenticationStatus is\r
+                                undefined.\r
+  \r
+  @retval EFI_SUCCESS           The InputSection was\r
+                                successfully processed and the\r
+                                section contents were returned.\r
+  \r
+  @retval EFI_OUT_OF_RESOURCES  The system has insufficient\r
+                                resources to process the request.\r
+  \r
+  @retval EFI_INVALID_PARAMETER The GUID in InputSection does\r
+                                not match this instance of the\r
+                                GUIDed Section Extraction PPI.\r
 \r
 \r
+**/\r
+EFI_STATUS\r
+CustomGuidedSectionExtract (\r
+  IN CONST  EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI *This,\r
+  IN CONST  VOID                                  *InputSection,\r
+  OUT       VOID                                  **OutputBuffer,\r
+  OUT       UINTN                                 *OutputSize,\r
+  OUT       UINT32                                *AuthenticationStatus\r
+  );\r
+\r
+\r
+/**\r
+   Decompresses a section to the output buffer.\r
+\r
+   This function lookes up the compression type field in the input section and\r
+   applies the appropriate compression algorithm to compress the section to a\r
+   callee allocated buffer.\r
+    \r
+   @param  This                  Points to this instance of the\r
+                                 EFI_PEI_DECOMPRESS_PEI PPI.\r
+   @param  CompressionSection    Points to the compressed section.\r
+   @param  OutputBuffer          Holds the returned pointer to the decompressed\r
+                                 sections.\r
+   @param  OutputSize            Holds the returned size of the decompress\r
+                                 section streams.\r
+   \r
+   @retval EFI_SUCCESS           The section was decompressed successfully.\r
+                                 OutputBuffer contains the resulting data and\r
+                                 OutputSize contains the resulting size.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI \r
+Decompress (\r
+  IN CONST  EFI_PEI_DECOMPRESS_PPI  *This,\r
+  IN CONST  EFI_COMPRESSION_SECTION *CompressionSection,\r
+  OUT       VOID                    **OutputBuffer,\r
+  OUT       UINTN                   *OutputSize\r
+  );\r
 \r
 /**\r
   Initializes the Dxe Ipl PPI\r
 \r
 /**\r
   Initializes the Dxe Ipl PPI\r
index 33d9bfc1f775ade4d093cfbbcbde6d547114c22c..0e7f382a5c129abf007a0bd5bd57020c0136df8a 100644 (file)
@@ -1,8 +1,9 @@
 #/** @file\r
 #  \r
 #/** @file\r
 #  \r
-#    Component description file for DxeIpl module\r
+#  Component description file for DxeIpl module\r
 #  \r
 #  \r
-#   The responsibility of this module is to load the DXE Core from a Firmware Volume. This implementation i used to load a 32-bit DXE Core.\r
+#  The responsibility of this module is to load the DXE Core from a Firmware Volume.\r
+#  This implementation is used to load a 32-bit DXE Core.\r
 #  \r
 #  Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 #  All rights reserved. This program and the accompanying materials\r
 #  \r
 #  Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 #  All rights reserved. This program and the accompanying materials\r
@@ -29,7 +30,7 @@
 #\r
 # The following information is for reference only and not required by the build tools.\r
 #\r
 #\r
 # The following information is for reference only and not required by the build tools.\r
 #\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF\r
 #\r
 \r
 [Sources.common]\r
 #\r
 \r
 [Sources.common]\r
   Ipf/DxeLoadFunc.c\r
   Ipf/ImageRead.c\r
 \r
   Ipf/DxeLoadFunc.c\r
   Ipf/ImageRead.c\r
 \r
-[Sources.EBC]\r
-  X64/DxeLoadFunc.c\r
-  Ia32/ImageRead.c\r
-\r
-\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
index 3988d9cb608927cb656aa2ed315942ff1cb85e17..3b8245d9d79879b9fe4cdfb5c931299819d1681a 100644 (file)
@@ -14,123 +14,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DxeIpl.h"\r
 **/\r
 \r
 #include "DxeIpl.h"\r
-#include <Ppi/GuidedSectionExtraction.h>\r
-\r
-\r
-\r
-/**\r
-  The ExtractSection() function processes the input section and\r
-  returns a pointer to the section contents. If the section being\r
-  extracted does not require processing (if the section\r
-  GuidedSectionHeader.Attributes has the\r
-  EFI_GUIDED_SECTION_PROCESSING_REQUIRED field cleared), then\r
-  OutputBuffer is just updated to point to the start of the\r
-  section's contents. Otherwise, *Buffer must be allocated\r
-  from PEI permanent memory.\r
-\r
-  @param This                   Indicates the\r
-                                EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI instance.\r
-                                Buffer containing the input GUIDed section to be\r
-                                processed. OutputBuffer OutputBuffer is\r
-                                allocated from PEI permanent memory and contains\r
-                                the new section stream.\r
-  @param InputSection           A pointer to the input buffer, which contains\r
-                                the input section to be processed.\r
-  @param OutputBuffer           A pointer to a caller-allocated buffer, whose\r
-                                size is specified by the contents of OutputSize.\r
-  @param OutputSize             A pointer to a caller-allocated\r
-                                UINTN in which the size of *OutputBuffer\r
-                                allocation is stored. If the function\r
-                                returns anything other than EFI_SUCCESS,\r
-                                the value of OutputSize is undefined.\r
-  @param AuthenticationStatus   A pointer to a caller-allocated\r
-                                UINT32 that indicates the\r
-                                authentication status of the\r
-                                output buffer. If the input\r
-                                section's GuidedSectionHeader.\r
-                                Attributes field has the\r
-                                EFI_GUIDED_SECTION_AUTH_STATUS_VALID \r
-                                bit as clear,\r
-                                AuthenticationStatus must return\r
-                                zero. These bits reflect the\r
-                                status of the extraction\r
-                                operation. If the function\r
-                                returns anything other than\r
-                                EFI_SUCCESS, the value of\r
-                                AuthenticationStatus is\r
-                                undefined.\r
-  \r
-  @retval EFI_SUCCESS           The InputSection was\r
-                                successfully processed and the\r
-                                section contents were returned.\r
-  \r
-  @retval EFI_OUT_OF_RESOURCES  The system has insufficient\r
-                                resources to process the request.\r
-  \r
-  @retval EFI_INVALID_PARAMETER The GUID in InputSection does\r
-                                not match this instance of the\r
-                                GUIDed Section Extraction PPI.\r
-\r
-**/\r
-EFI_STATUS\r
-CustomGuidedSectionExtract (\r
-  IN CONST  EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI *This,\r
-  IN CONST  VOID                                  *InputSection,\r
-  OUT       VOID                                  **OutputBuffer,\r
-  OUT       UINTN                                 *OutputSize,\r
-  OUT       UINT32                                *AuthenticationStatus\r
-);\r
-\r
-\r
-/**\r
-   Decompresses a section to the output buffer.\r
-\r
-   This function lookes up the compression type field in the input section and\r
-   applies the appropriate compression algorithm to compress the section to a\r
-   callee allocated buffer.\r
-    \r
-   @param  This                  Points to this instance of the\r
-                                 EFI_PEI_DECOMPRESS_PEI PPI.\r
-   @param  CompressionSection    Points to the compressed section.\r
-   @param  OutputBuffer          Holds the returned pointer to the decompressed\r
-                                 sections.\r
-   @param  OutputSize            Holds the returned size of the decompress\r
-                                 section streams.\r
-   \r
-   @retval EFI_SUCCESS           The section was decompressed successfully.\r
-                                 OutputBuffer contains the resulting data and\r
-                                 OutputSize contains the resulting size.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI \r
-Decompress (\r
-  IN CONST  EFI_PEI_DECOMPRESS_PPI  *This,\r
-  IN CONST  EFI_COMPRESSION_SECTION *CompressionSection,\r
-  OUT       VOID                    **OutputBuffer,\r
-  OUT       UINTN                   *OutputSize\r
- );\r
-\r
 \r
 \r
+//\r
+// This global variable indicates whether this module has been shadowed\r
+// to memory.\r
+//\r
 BOOLEAN gInMemory = FALSE;\r
 \r
 //\r
 // Module Globals used in the DXE to PEI handoff\r
 // These must be module globals, so the stack can be switched\r
 //\r
 BOOLEAN gInMemory = FALSE;\r
 \r
 //\r
 // Module Globals used in the DXE to PEI handoff\r
 // These must be module globals, so the stack can be switched\r
 //\r
-STATIC EFI_DXE_IPL_PPI mDxeIplPpi = {\r
+CONST EFI_DXE_IPL_PPI mDxeIplPpi = {\r
   DxeLoadCore\r
 };\r
 \r
   DxeLoadCore\r
 };\r
 \r
-STATIC EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI mCustomGuidedSectionExtractionPpi = {\r
+CONST EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI mCustomGuidedSectionExtractionPpi = {\r
   CustomGuidedSectionExtract\r
 };\r
 \r
   CustomGuidedSectionExtract\r
 };\r
 \r
-STATIC EFI_PEI_DECOMPRESS_PPI mDecompressPpi = {\r
+CONST EFI_PEI_DECOMPRESS_PPI mDecompressPpi = {\r
   Decompress\r
 };\r
 \r
   Decompress\r
 };\r
 \r
-STATIC EFI_PEI_PPI_DESCRIPTOR     mPpiList[] = {\r
+CONST EFI_PEI_PPI_DESCRIPTOR     mPpiList[] = {\r
   {\r
     EFI_PEI_PPI_DESCRIPTOR_PPI,\r
     &gEfiDxeIplPpiGuid,\r
   {\r
     EFI_PEI_PPI_DESCRIPTOR_PPI,\r
     &gEfiDxeIplPpiGuid,\r
@@ -143,7 +50,7 @@ STATIC EFI_PEI_PPI_DESCRIPTOR     mPpiList[] = {
   }\r
 };\r
 \r
   }\r
 };\r
 \r
-STATIC EFI_PEI_PPI_DESCRIPTOR     mPpiSignal = {\r
+CONST EFI_PEI_PPI_DESCRIPTOR     mPpiSignal = {\r
   (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
   &gEfiEndOfPeiSignalPpiGuid,\r
   NULL\r
   (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
   &gEfiEndOfPeiSignalPpiGuid,\r
   NULL\r
@@ -171,8 +78,7 @@ PeimInitializeDxeIpl (
   UINTN                                     ExtractHandlerNumber;\r
   EFI_PEI_PPI_DESCRIPTOR                    *GuidPpi;\r
   \r
   UINTN                                     ExtractHandlerNumber;\r
   EFI_PEI_PPI_DESCRIPTOR                    *GuidPpi;\r
   \r
-  Status = PeiServicesGetBootMode (&BootMode);\r
-  ASSERT_EFI_ERROR (Status);\r
+  BootMode = GetBootModeHob ();\r
 \r
   if (BootMode != BOOT_ON_S3_RESUME) {\r
     Status = PeiServicesRegisterForShadow (FfsHandle);\r
 \r
   if (BootMode != BOOT_ON_S3_RESUME) {\r
     Status = PeiServicesRegisterForShadow (FfsHandle);\r
@@ -182,9 +88,7 @@ PeimInitializeDxeIpl (
       // \r
       return Status;\r
     } else if (Status == EFI_ALREADY_STARTED) {\r
       // \r
       return Status;\r
     } else if (Status == EFI_ALREADY_STARTED) {\r
-      \r
-      gInMemory = TRUE;\r
-      \r
+     \r
       //\r
       // Get custom extract guided section method guid list \r
       //\r
       //\r
       // Get custom extract guided section method guid list \r
       //\r
@@ -194,7 +98,6 @@ PeimInitializeDxeIpl (
       // Install custom extraction guid ppi\r
       //\r
       if (ExtractHandlerNumber > 0) {\r
       // Install custom extraction guid ppi\r
       //\r
       if (ExtractHandlerNumber > 0) {\r
-        GuidPpi = NULL;\r
         GuidPpi = (EFI_PEI_PPI_DESCRIPTOR *) AllocatePool (ExtractHandlerNumber * sizeof (EFI_PEI_PPI_DESCRIPTOR));\r
         ASSERT (GuidPpi != NULL);\r
         while (ExtractHandlerNumber-- > 0) {\r
         GuidPpi = (EFI_PEI_PPI_DESCRIPTOR *) AllocatePool (ExtractHandlerNumber * sizeof (EFI_PEI_PPI_DESCRIPTOR));\r
         ASSERT (GuidPpi != NULL);\r
         while (ExtractHandlerNumber-- > 0) {\r
@@ -220,11 +123,11 @@ PeimInitializeDxeIpl (
 }\r
 \r
 /**\r
 }\r
 \r
 /**\r
-   Main entry point to last PEIM \r
+   Main entry point to last PEIM. \r
     \r
     \r
-   @param This          Entry point for DXE IPL PPI\r
+   @param This          Entry point for DXE IPL PPI.\r
    @param PeiServices   General purpose services available to every PEIM.\r
    @param PeiServices   General purpose services available to every PEIM.\r
-   @param HobList       Address to the Pei HOB list\r
+   @param HobList       Address to the Pei HOB list.\r
    \r
    @return EFI_SUCCESS              DXE core was successfully loaded. \r
    @return EFI_OUT_OF_RESOURCES     There are not enough resources to load DXE core.\r
    \r
    @return EFI_SUCCESS              DXE core was successfully loaded. \r
    @return EFI_OUT_OF_RESOURCES     There are not enough resources to load DXE core.\r
@@ -252,8 +155,7 @@ DxeLoadCore (
   //\r
   // if in S3 Resume, restore configure\r
   //\r
   //\r
   // if in S3 Resume, restore configure\r
   //\r
-  Status = PeiServicesGetBootMode (&BootMode);\r
-  ASSERT_EFI_ERROR(Status);\r
+  BootMode = GetBootModeHob ();\r
 \r
   if (BootMode == BOOT_ON_S3_RESUME) {\r
     Status = AcpiS3ResumeOs();\r
 \r
   if (BootMode == BOOT_ON_S3_RESUME) {\r
     Status = AcpiS3ResumeOs();\r
@@ -305,18 +207,17 @@ DxeLoadCore (
   Status = DxeIplFindDxeCore (&FileHandle);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   Status = DxeIplFindDxeCore (&FileHandle);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  CopyMem(&DxeCoreFileName, &(((EFI_FFS_FILE_HEADER*)FileHandle)->Name), sizeof (EFI_GUID));\r
+  CopyGuid(&DxeCoreFileName, &(((EFI_FFS_FILE_HEADER*)FileHandle)->Name));\r
 \r
   //\r
   // Load the DXE Core from a Firmware Volume, may use LoadFile ppi to do this for save code size.\r
   //\r
   Status = PeiLoadFile (\r
 \r
   //\r
   // Load the DXE Core from a Firmware Volume, may use LoadFile ppi to do this for save code size.\r
   //\r
   Status = PeiLoadFile (\r
-            FileHandle,\r
-            &DxeCoreAddress,\r
-            &DxeCoreSize,\r
-            &DxeCoreEntryPoint\r
-            );\r
-\r
+             FileHandle,\r
+             &DxeCoreAddress,\r
+             &DxeCoreSize,\r
+             &DxeCoreEntryPoint\r
+             );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
@@ -325,7 +226,7 @@ DxeLoadCore (
   BuildModuleHob (\r
     &DxeCoreFileName,\r
     DxeCoreAddress,\r
   BuildModuleHob (\r
     &DxeCoreFileName,\r
     DxeCoreAddress,\r
-    EFI_SIZE_TO_PAGES ((UINT32) DxeCoreSize) * EFI_PAGE_SIZE,\r
+    EFI_SIZE_TO_PAGES ((UINTN) DxeCoreSize) * EFI_PAGE_SIZE,\r
     DxeCoreEntryPoint\r
     );\r
 \r
     DxeCoreEntryPoint\r
     );\r
 \r
@@ -341,15 +242,9 @@ DxeLoadCore (
 \r
     EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION       PtrPeImage;\r
     PtrPeImage.Pe32 = (EFI_IMAGE_NT_HEADERS32 *) ((UINTN) DxeCoreAddress + ((EFI_IMAGE_DOS_HEADER *) (UINTN) DxeCoreAddress)->e_lfanew);\r
 \r
     EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION       PtrPeImage;\r
     PtrPeImage.Pe32 = (EFI_IMAGE_NT_HEADERS32 *) ((UINTN) DxeCoreAddress + ((EFI_IMAGE_DOS_HEADER *) (UINTN) DxeCoreAddress)->e_lfanew);\r
-    \r
-    if (PtrPeImage.Pe32->FileHeader.Machine != IMAGE_FILE_MACHINE_IA64) {\r
-      DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Loading DXE CORE at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)DxeCoreAddress, (VOID *)(UINTN)DxeCoreEntryPoint));\r
-    } else {\r
-      //\r
-      // For IPF Image, the real entry point should be print.\r
-      //\r
-      DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Loading DXE CORE at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)DxeCoreAddress, (VOID *)(UINTN)(*(UINT64 *)(UINTN)DxeCoreEntryPoint)));\r
-    }\r
+     \r
+    DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Loading DXE CORE at 0x%10p EntryPoint=0x%10p\n", (VOID *)(UINTN)DxeCoreAddress, FUNCTION_ENTRY_POINT (DxeCoreEntryPoint)));\r
+   \r
 \r
   DEBUG_CODE_END ();\r
   //\r
 \r
   DEBUG_CODE_END ();\r
   //\r
@@ -406,8 +301,6 @@ DxeIplFindDxeCore (
 }\r
 \r
 \r
 }\r
 \r
 \r
-\r
-\r
 /**\r
    Loads and relocates a PE/COFF image into memory.\r
 \r
 /**\r
    Loads and relocates a PE/COFF image into memory.\r
 \r
@@ -432,6 +325,7 @@ PeiLoadFile (
   EFI_STATUS                        Status;\r
   PE_COFF_LOADER_IMAGE_CONTEXT      ImageContext;\r
   VOID                              *Pe32Data;\r
   EFI_STATUS                        Status;\r
   PE_COFF_LOADER_IMAGE_CONTEXT      ImageContext;\r
   VOID                              *Pe32Data;\r
+\r
   //\r
   // First try to find the PE32 section in this ffs file.\r
   //\r
   //\r
   // First try to find the PE32 section in this ffs file.\r
   //\r
@@ -440,7 +334,6 @@ PeiLoadFile (
              FileHandle,\r
              &Pe32Data\r
              );\r
              FileHandle,\r
              &Pe32Data\r
              );\r
-  \r
   if (EFI_ERROR (Status)) {\r
     //\r
     // NO image types we support so exit.\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // NO image types we support so exit.\r
@@ -615,7 +508,6 @@ CustomGuidedSectionExtract (
              ScratchBuffer,\r
              AuthenticationStatus\r
            );\r
              ScratchBuffer,\r
              AuthenticationStatus\r
            );\r
-\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // Decode failed\r
   if (EFI_ERROR (Status)) {\r
     //\r
     // Decode failed\r
@@ -674,7 +566,7 @@ Decompress (
   }\r
 \r
   Section = (EFI_COMMON_SECTION_HEADER *) CompressionSection;\r
   }\r
 \r
   Section = (EFI_COMMON_SECTION_HEADER *) CompressionSection;\r
-  SectionLength         = *(UINT32 *) (Section->Size) & 0x00ffffff;\r
+  SectionLength = *(UINT32 *) (Section->Size) & 0x00ffffff;\r
   \r
   //\r
   // This is a compression set, expand it\r
   \r
   //\r
   // This is a compression set, expand it\r
index 7dfb3407b4deaccff5a834d9c0079f816bbe5cd9..4458ddd8ff56966dbc132291f5dc647630db877d 100644 (file)
@@ -18,7 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 // Global Descriptor Table (GDT)\r
 //\r
 //\r
 // Global Descriptor Table (GDT)\r
 //\r
-GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT gGdtEntries [] = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT gGdtEntries[] = {\r
 /* selector { Global Segment Descriptor                              } */  \r
 /* 0x00 */  {{0,      0,  0,  0,    0,  0,  0,  0,    0,  0, 0,  0,  0}}, //null descriptor \r
 /* 0x08 */  {{0xffff, 0,  0,  0x2,  1,  0,  1,  0xf,  0,  0, 1,  1,  0}}, //linear data segment descriptor\r
 /* selector { Global Segment Descriptor                              } */  \r
 /* 0x00 */  {{0,      0,  0,  0,    0,  0,  0,  0,    0,  0, 0,  0,  0}}, //null descriptor \r
 /* 0x08 */  {{0xffff, 0,  0,  0x2,  1,  0,  1,  0xf,  0,  0, 1,  1,  0}}, //linear data segment descriptor\r
@@ -44,10 +44,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED  IA32_DESCRIPTOR gLidtDescriptor = {
   0\r
 };\r
 \r
   0\r
 };\r
 \r
-\r
-\r
-\r
-\r
 /**\r
    Transfers control to DxeCore.\r
 \r
 /**\r
    Transfers control to DxeCore.\r
 \r
@@ -93,7 +89,7 @@ HandOffToDxeCore (
     TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;\r
 \r
     //\r
     TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;\r
 \r
     //\r
-    //  X64 Calling Conventions requires that the stack must be aligned to 16 bytes\r
+    //  x64 Calling Conventions requires that the stack must be aligned to 16 bytes\r
     //\r
     TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, 16);\r
 \r
     //\r
     TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, 16);\r
 \r
@@ -128,7 +124,6 @@ HandOffToDxeCore (
                  EFI_SIZE_TO_PAGES((SizeOfTemplate + sizeof (X64_IDT_GATE_DESCRIPTOR)) * 32), \r
                  &VectorAddress\r
                  );\r
                  EFI_SIZE_TO_PAGES((SizeOfTemplate + sizeof (X64_IDT_GATE_DESCRIPTOR)) * 32), \r
                  &VectorAddress\r
                  );\r
-  \r
       ASSERT_EFI_ERROR (Status);\r
   \r
       IdtTable      = (X64_IDT_GATE_DESCRIPTOR *) (UINTN) (VectorAddress + SizeOfTemplate * 32);\r
       ASSERT_EFI_ERROR (Status);\r
   \r
       IdtTable      = (X64_IDT_GATE_DESCRIPTOR *) (UINTN) (VectorAddress + SizeOfTemplate * 32);\r
@@ -152,7 +147,8 @@ HandOffToDxeCore (
       AsmWriteIdtr (&gLidtDescriptor);\r
     }\r
     //\r
       AsmWriteIdtr (&gLidtDescriptor);\r
     }\r
     //\r
-    // Go to Long Mode. Interrupts will not get turned on until the CPU AP is loaded.\r
+    // Go to Long Mode and transfer control to DxeCore.\r
+    // Interrupts will not get turned on until the CPU AP is loaded.\r
     // Call x64 drivers passing in single argument, a pointer to the HOBs.\r
     // \r
     AsmEnablePaging64 (\r
     // Call x64 drivers passing in single argument, a pointer to the HOBs.\r
     // \r
     AsmEnablePaging64 (\r
@@ -180,7 +176,10 @@ HandOffToDxeCore (
     // Update the contents of BSP stack HOB to reflect the real stack info passed to DxeCore.\r
     //    \r
     UpdateStackHob (BaseOfStack, STACK_SIZE);\r
     // Update the contents of BSP stack HOB to reflect the real stack info passed to DxeCore.\r
     //    \r
     UpdateStackHob (BaseOfStack, STACK_SIZE);\r
-\r
+    \r
+    //\r
+    // Transfer the control to the entry point of DxeCore.\r
+    //\r
     SwitchStack (\r
       (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
       HobList.Raw,\r
     SwitchStack (\r
       (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
       HobList.Raw,\r
index bca3180aada568c6b6908f7c571032755a498dfe..a303c90721946310b21000534fe27cc734860d9e 100644 (file)
@@ -14,10 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "DxeIpl.h"\r
 \r
 \r
 #include "DxeIpl.h"\r
 \r
-\r
-\r
-\r
-\r
 /**\r
   Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file\r
 \r
 /**\r
   Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file\r
 \r
@@ -50,8 +46,6 @@ PeiImageRead (
   //\r
   // This function assumes 32-bit alignment to increase performance\r
   //\r
   //\r
   // This function assumes 32-bit alignment to increase performance\r
   //\r
-//  ASSERT (ALIGN_POINTER (Destination32, sizeof (UINT32)) == Destination32);\r
-//  ASSERT (ALIGN_POINTER (Source32, sizeof (UINT32)) == Source32);\r
 \r
   Length = *ReadSize;\r
   while (Length-- != 0) {\r
 \r
   Length = *ReadSize;\r
   while (Length-- != 0) {\r
@@ -72,7 +66,7 @@ PeiImageRead (
    @param ImageContext       A pointer to the structure of \r
                              PE_COFF_LOADER_IMAGE_CONTEXT\r
    \r
    @param ImageContext       A pointer to the structure of \r
                              PE_COFF_LOADER_IMAGE_CONTEXT\r
    \r
-   @retval EFI_SUCCESS       This function always return EFI_SUCCESS.\r
+   @retval EFI_SUCCESS       This function always returns EFI_SUCCESS.\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
index c31cba8dcf1f9150267c33ada8aba64e78afdb3e..2c94dc70b74d12d0f5d1c2993b5472e6bee681e9 100644 (file)
@@ -74,6 +74,9 @@ HandOffToDxeCore (
   //\r
   UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE);\r
 \r
   //\r
   UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE);\r
 \r
+  //\r
+  // Transfer the control to the entry point of DxeCore.\r
+  //\r
   SwitchStack (\r
     (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
     HobList.Raw,\r
   SwitchStack (\r
     (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
     HobList.Raw,\r
index fd827248a19b74a2c5acfc8dab17a6c61a19db6e..c7367609f22677df0a5b1bca1d449c347dc1fa6d 100644 (file)
@@ -57,7 +57,7 @@ PeiImageRead (
    @param ImageContext       A pointer to the structure of \r
                              PE_COFF_LOADER_IMAGE_CONTEXT\r
    \r
    @param ImageContext       A pointer to the structure of \r
                              PE_COFF_LOADER_IMAGE_CONTEXT\r
    \r
-   @retval EFI_SUCCESS       This function always return EFI_SUCCESS.\r
+   @retval EFI_SUCCESS       This function always returns EFI_SUCCESS.\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
index 4fca3f6ac7f535c22ff0fab784c0ae74156339d9..c871dbe41f548cf3cce7825bee41848a259bfccf 100644 (file)
@@ -63,6 +63,9 @@ HandOffToDxeCore (
   //    \r
   UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE);\r
 \r
   //    \r
   UpdateStackHob ((EFI_PHYSICAL_ADDRESS)(UINTN) BaseOfStack, STACK_SIZE);\r
 \r
+  //\r
+  // Transfer the control to the entry point of DxeCore.\r
+  //\r
   SwitchStack (\r
     (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
     HobList.Raw,\r
   SwitchStack (\r
     (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,\r
     HobList.Raw,\r
index 87c140b0eab28f0b3baae897c6bbb31549a356f0..49e9f320c5cf3d40cf7933ac3dd7fa0fba04b83e 100644 (file)
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf\r
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf\r
 \r
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf\r
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf\r
 \r
-  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf\r
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf\r
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf\r
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf\r
   MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf\r
   MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf\r
   MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf\r
   MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf\r
   MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
   MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf\r
   MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
+  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf\r
 \r
 [Components.X64]\r
   MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf\r
 \r
 [Components.X64]\r
   MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf\r
   MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf\r
   MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf\r
   MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf\r
   MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf\r
+  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf\r
 \r
 [Components.IPF]\r
   MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf\r
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf\r
   MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf\r
 \r
 [Components.IPF]\r
   MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf\r
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf\r
   MdeModulePkg/Universal/DebugSupportDxe/DebugSupportDxe.inf\r
+  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf\r
 \r
 [Components.EBC]\r
   #BugBug: Need DXE I/O library instance for EBC.\r
 \r
 [Components.EBC]\r
   #BugBug: Need DXE I/O library instance for EBC.\r