Revision: 17460
          http://sourceforge.net/p/edk2/code/17460
Author:   lzeng14
Date:     2015-05-18 01:28:24 +0000 (Mon, 18 May 2015)
Log Message:
-----------
MdeModulePkg DxeCore: Add OEM reserved memory type support.

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

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Imem.h
    trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c
    trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c

Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Imem.h
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Imem.h 2015-05-18 01:27:25 UTC (rev 
17459)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Imem.h 2015-05-18 01:28:24 UTC (rev 
17460)
@@ -1,7 +1,7 @@
 /** @file
   Data structure and functions to allocate and free memory space.
 
-Copyright (c) 2006 - 2008, 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
@@ -40,6 +40,21 @@
 
 #endif
 
+//
+// +---------------------------------------------------+
+// | 0..(EfiMaxMemoryType - 1)    - Normal memory type |
+// +---------------------------------------------------+
+// | EfiMaxMemoryType..0x6FFFFFFF - Ilegal             |
+// +---------------------------------------------------+
+// | 0x70000000..0x7FFFFFFF       - OEM reserved       |
+// +---------------------------------------------------+
+// | 0x80000000..0xFFFFFFFF       - OS reserved        |
+// +---------------------------------------------------+
+//
+#define MEMORY_TYPE_OS_RESERVED_MIN                 0x80000000
+#define MEMORY_TYPE_OS_RESERVED_MAX                 0xFFFFFFFF
+#define MEMORY_TYPE_OEM_RESERVED_MIN                0x70000000
+#define MEMORY_TYPE_OEM_RESERVED_MAX                0x7FFFFFFF
 
 //
 // MEMORY_MAP_ENTRY

Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c 2015-05-18 01:27:25 UTC (rev 
17459)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Page.c 2015-05-18 01:28:24 UTC (rev 
17460)
@@ -544,7 +544,7 @@
     return;
   }
 
-  if (Type >= EfiMaxMemoryType && Type <= 0x7fffffff) {
+  if (Type >= EfiMaxMemoryType && Type < MEMORY_TYPE_OEM_RESERVED_MIN) {
     return;
   }
   CoreAcquireMemoryLock ();
@@ -1203,7 +1203,7 @@
     return EFI_INVALID_PARAMETER;
   }
 
-  if ((MemoryType >= EfiMaxMemoryType && MemoryType <= 0x7fffffff) ||
+  if ((MemoryType >= EfiMaxMemoryType && MemoryType < 
MEMORY_TYPE_OEM_RESERVED_MIN) ||
        (MemoryType == EfiConventionalMemory) || (MemoryType == 
EfiPersistentMemory)) {
     return EFI_INVALID_PARAMETER;
   }

Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c 2015-05-18 01:27:25 UTC (rev 
17459)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c 2015-05-18 01:28:24 UTC (rev 
17460)
@@ -154,10 +154,11 @@
   }
 
   //
-  // MemoryType values in the range 0x80000000..0xFFFFFFFF are reserved for 
use by UEFI 
-  // OS loaders that are provided by operating system vendors
+  // MemoryType values in the range 0x80000000..0xFFFFFFFF are reserved for 
use by UEFI
+  // OS loaders that are provided by operating system vendors.
+  // MemoryType values in the range 0x70000000..0x7FFFFFFF are reserved for 
OEM use.
   //
-  if ((INT32)MemoryType < 0) {
+  if ((UINT32) MemoryType >= MEMORY_TYPE_OEM_RESERVED_MIN) {
 
     for (Link = mPoolHeadList.ForwardLink; Link != &mPoolHeadList; Link = 
Link->ForwardLink) {
       Pool = CR(Link, POOL, Link, POOL_SIGNATURE);
@@ -215,7 +216,7 @@
   //
   // If it's not a valid type, fail it
   //
-  if ((PoolType >= EfiMaxMemoryType && PoolType <= 0x7fffffff) ||
+  if ((PoolType >= EfiMaxMemoryType && PoolType < 
MEMORY_TYPE_OEM_RESERVED_MIN) ||
        (PoolType == EfiConventionalMemory) || (PoolType == 
EfiPersistentMemory)) {
     return EFI_INVALID_PARAMETER;
   }


------------------------------------------------------------------------------
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