[edk2] [PATCH] MdeModulePkg DxeCore: Move ProcessLibraryConstructorList()

2015-08-02 Thread Star Zeng
to right after CoreInitializeGcdServices().

Why?
Some platforms maybe report both below 4G and above 4G memory resource hob as 
tested,
then CoreInitializeMemoryServices() will find and add the tested above 4G 
memory resource hob to memory descriptor for early memory allocation services,
then if ProcessLibraryConstructorList() that has library constructor tries to 
allocate below 4G memory and will fail.
In fact, the following CoreInitializeGcdServices() will add all the memory 
resource hob to GCD map,
and add the tested below 4G memory resource hob to memory descriptor,
but it has been too late for ProcessLibraryConstructorList().

Also move below two lines as they are needed to be after
the constructor of DxeCorePerfomanceLib.
  PERF_END   (NULL,PEI, NULL, 0) ;
  PERF_START (NULL,DXE, NULL, 0) ;

Cc: Liming Gao liming@intel.com
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng star.z...@intel.com
---
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index e6ed247..e60d2f2 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -290,13 +290,6 @@ DxeMain (
   ASSERT_EFI_ERROR (Status);
 
   //
-  // Call constructor for all libraries
-  //
-  ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
-  PERF_END   (NULL,PEI, NULL, 0) ;
-  PERF_START (NULL,DXE, NULL, 0) ;
-
-  //
   // Report DXE Core image information to the PE/COFF Extra Action Library
   //
   ZeroMem (ImageContext, sizeof (ImageContext));
@@ -311,6 +304,13 @@ DxeMain (
   ASSERT_EFI_ERROR (Status);
 
   //
+  // Call constructor for all libraries
+  //
+  ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
+  PERF_END   (NULL,PEI, NULL, 0) ;
+  PERF_START (NULL,DXE, NULL, 0) ;
+
+  //
   // Install the DXE Services Table into the EFI System Tables's Configuration 
Table
   //
   Status = CoreInstallConfigurationTable (gEfiDxeServicesTableGuid, 
gDxeCoreDS);
-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg DxeCore: Move ProcessLibraryConstructorList()

2015-08-02 Thread Gao, Liming
Reviewed-by: Liming Gao liming@intel.com

-Original Message-
From: Zeng, Star 
Sent: Monday, August 03, 2015 10:57 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming
Subject: [PATCH] MdeModulePkg DxeCore: Move ProcessLibraryConstructorList()

to right after CoreInitializeGcdServices().

Why?
Some platforms maybe report both below 4G and above 4G memory resource hob as 
tested, then CoreInitializeMemoryServices() will find and add the tested above 
4G memory resource hob to memory descriptor for early memory allocation 
services, then if ProcessLibraryConstructorList() that has library constructor 
tries to allocate below 4G memory and will fail.
In fact, the following CoreInitializeGcdServices() will add all the memory 
resource hob to GCD map, and add the tested below 4G memory resource hob to 
memory descriptor, but it has been too late for ProcessLibraryConstructorList().

Also move below two lines as they are needed to be after the constructor of 
DxeCorePerfomanceLib.
  PERF_END   (NULL,PEI, NULL, 0) ;
  PERF_START (NULL,DXE, NULL, 0) ;

Cc: Liming Gao liming@intel.com
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng star.z...@intel.com
---
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c 
b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index e6ed247..e60d2f2 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -290,13 +290,6 @@ DxeMain (
   ASSERT_EFI_ERROR (Status);
 
   //
-  // Call constructor for all libraries
-  //
-  ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
-  PERF_END   (NULL,PEI, NULL, 0) ;
-  PERF_START (NULL,DXE, NULL, 0) ;
-
-  //
   // Report DXE Core image information to the PE/COFF Extra Action Library
   //
   ZeroMem (ImageContext, sizeof (ImageContext)); @@ -311,6 +304,13 @@ DxeMain 
(
   ASSERT_EFI_ERROR (Status);
 
   //
+  // Call constructor for all libraries  //  
+ ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
+  PERF_END   (NULL,PEI, NULL, 0) ;
+  PERF_START (NULL,DXE, NULL, 0) ;
+
+  //
   // Install the DXE Services Table into the EFI System Tables's Configuration 
Table
   //
   Status = CoreInstallConfigurationTable (gEfiDxeServicesTableGuid, 
gDxeCoreDS);
--
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel