Revision: 17395
          http://sourceforge.net/p/edk2/code/17395
Author:   lzeng14
Date:     2015-05-11 03:12:51 +0000 (Mon, 11 May 2015)
Log Message:
-----------
MdePkg: Update PeiMemoryAllocationLib to allocate EfiReservedMemoryType memory 
directly.

The old implementation was to allocate EfiBootServicesData memory first,
and then update the MemoryType of memory allocation hob to
EfiReservedMemoryType.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c

Modified: trunk/edk2/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
===================================================================
--- trunk/edk2/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c      
2015-05-11 03:12:21 UTC (rev 17394)
+++ trunk/edk2/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c      
2015-05-11 03:12:51 UTC (rev 17395)
@@ -2,7 +2,7 @@
   Support routines for memory allocation routines 
   based on PeiService for PEI phase drivers.
 
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD 
License         
   which accompanies this distribution.  The full text of the license may be 
found at        
@@ -45,42 +45,15 @@
 {
   EFI_STATUS            Status;
   EFI_PHYSICAL_ADDRESS  Memory; 
-  EFI_MEMORY_TYPE       RequestType;
-  EFI_PEI_HOB_POINTERS  Hob;
 
   if (Pages == 0) {
     return NULL;
   }
 
-  RequestType = MemoryType;
-  if (MemoryType == EfiReservedMemoryType) {
-    //
-    // PEI AllocatePages() doesn't support EfiReservedMemoryType. 
-    // Change RequestType to EfiBootServicesData for memory allocation.
-    //
-    RequestType = EfiBootServicesData;
-  }
-
-  Status = PeiServicesAllocatePages (RequestType, Pages, &Memory);
+  Status = PeiServicesAllocatePages (MemoryType, Pages, &Memory);
   if (EFI_ERROR (Status)) {
     return NULL;
   }
-  
-  if (MemoryType == EfiReservedMemoryType) {
-    //
-    // Memory type needs to be updated to EfiReservedMemoryType. Per PI spec 
Volume 1, 
-    // PEI AllocatePages() will automate the creation of the Memory Allocation 
HOB types. 
-    // Search Memory Allocation HOB and find the matched memory region,
-    // then change its memory type to EfiReservedMemoryType.
-    //
-    Hob.Raw = GetFirstHob (EFI_HOB_TYPE_MEMORY_ALLOCATION);
-    while (Hob.Raw != NULL && 
Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress != Memory) {
-      Hob.Raw = GET_NEXT_HOB (Hob);
-      Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw);
-    }
-    ASSERT (Hob.Raw != NULL);
-    Hob.MemoryAllocation->AllocDescriptor.MemoryType = EfiReservedMemoryType;
-  }
 
   return (VOID *) (UINTN) Memory;
 }


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to