]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg PiSmmCore: Free FullSmramRanges at error condition.
authorStar Zeng <star.zeng@intel.com>
Tue, 9 Jun 2015 09:41:50 +0000 (09:41 +0000)
committerlzeng14 <lzeng14@Edk2>
Tue, 9 Jun 2015 09:41:50 +0000 (09:41 +0000)
1. In PiSmmIpl.c, free FullSmramRanges at error condition.
2. Move pool and page management definitions and structures
from PiSmmCorePrivateData.h to PiSmmCore.h.
PiSmmCorePrivateData.h should be only used to share SMM_CORE_PRIVATE_DATA
between PiSmmCore and PiSmmIpl. Pool and page management definitions
and structures were moved from Pool.c and Page.c to PiSmmCorePrivateData.h
incorrectly for memory profile feature at EDK2 R16335 commit.
3. DumpSmramInfo() only used for memory profile, so move the declaration
into SmramProfileRecord.c.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17598 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c

index 41e8f83155205a19204ce8b8ea0f07cfbc10ed49..afac9e2db37c0f7dcfdb9b375f4041a553daa5ed 100644 (file)
@@ -2,7 +2,7 @@
   The internal header file includes the common header files, defines\r
   internal structure and functions used by SmmCore module.\r
 \r
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -909,16 +909,51 @@ SmramProfileReadyToLock (
   VOID\r
   );\r
 \r
-/**\r
-  Dump SMRAM infromation.\r
-\r
-**/\r
-VOID\r
-DumpSmramInfo (\r
-  VOID\r
-  );\r
-\r
 extern UINTN                    mFullSmramRangeCount;\r
 extern EFI_SMRAM_DESCRIPTOR     *mFullSmramRanges;\r
 \r
+//\r
+// Page management\r
+//\r
+\r
+typedef struct {\r
+  LIST_ENTRY  Link;\r
+  UINTN       NumberOfPages;\r
+} FREE_PAGE_LIST;\r
+\r
+extern LIST_ENTRY  mSmmMemoryMap;\r
+\r
+//\r
+// Pool management\r
+//\r
+\r
+//\r
+// MIN_POOL_SHIFT must not be less than 5\r
+//\r
+#define MIN_POOL_SHIFT  6\r
+#define MIN_POOL_SIZE   (1 << MIN_POOL_SHIFT)\r
+\r
+//\r
+// MAX_POOL_SHIFT must not be less than EFI_PAGE_SHIFT - 1\r
+//\r
+#define MAX_POOL_SHIFT  (EFI_PAGE_SHIFT - 1)\r
+#define MAX_POOL_SIZE   (1 << MAX_POOL_SHIFT)\r
+\r
+//\r
+// MAX_POOL_INDEX are calculated by maximum and minimum pool sizes\r
+//\r
+#define MAX_POOL_INDEX  (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)\r
+\r
+typedef struct {\r
+  UINTN        Size;\r
+  BOOLEAN      Available;\r
+} POOL_HEADER;\r
+\r
+typedef struct {\r
+  POOL_HEADER  Header;\r
+  LIST_ENTRY   Link;\r
+} FREE_POOL_HEADER;\r
+\r
+extern LIST_ENTRY  mSmmPoolLists[MAX_POOL_INDEX];\r
+\r
 #endif\r
index 3934d2f2eccae31291fb13932fae667adba8884f..9915669c6efdee61584edc5d627ee7ed59c8985e 100644 (file)
@@ -2,7 +2,7 @@
   The internal header file that declared a data structure that is shared\r
   between the SMM IPL and the SMM Core.\r
 \r
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -125,48 +125,4 @@ typedef struct {
   EFI_SMRAM_DESCRIPTOR            *FullSmramRanges;\r
 } SMM_CORE_PRIVATE_DATA;\r
 \r
-//\r
-// Page management\r
-//\r
-\r
-typedef struct {\r
-  LIST_ENTRY  Link;\r
-  UINTN       NumberOfPages;\r
-} FREE_PAGE_LIST;\r
-\r
-extern LIST_ENTRY  mSmmMemoryMap;\r
-\r
-//\r
-// Pool management\r
-//\r
-\r
-//\r
-// MIN_POOL_SHIFT must not be less than 5\r
-//\r
-#define MIN_POOL_SHIFT  6\r
-#define MIN_POOL_SIZE   (1 << MIN_POOL_SHIFT)\r
-\r
-//\r
-// MAX_POOL_SHIFT must not be less than EFI_PAGE_SHIFT - 1\r
-//\r
-#define MAX_POOL_SHIFT  (EFI_PAGE_SHIFT - 1)\r
-#define MAX_POOL_SIZE   (1 << MAX_POOL_SHIFT)\r
-\r
-//\r
-// MAX_POOL_INDEX are calculated by maximum and minimum pool sizes\r
-//\r
-#define MAX_POOL_INDEX  (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)\r
-\r
-typedef struct {\r
-  UINTN        Size;\r
-  BOOLEAN      Available;\r
-} POOL_HEADER;\r
-\r
-typedef struct {\r
-  POOL_HEADER  Header;\r
-  LIST_ENTRY   Link;\r
-} FREE_POOL_HEADER;\r
-\r
-extern LIST_ENTRY  mSmmPoolLists[MAX_POOL_INDEX];\r
-\r
 #endif\r
index 64565e937d30192f36af825387df77e7a29e98f5..ba596cd1b7efd7c937fba74eff79fdce82caa9a1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM\r
 \r
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -1251,7 +1251,8 @@ SmmIplEntry (
     // Free all allocated resources\r
     //\r
     FreePool (gSmmCorePrivate->SmramRanges);\r
-    \r
+    FreePool (gSmmCorePrivate->FullSmramRanges);\r
+\r
     return EFI_UNSUPPORTED;\r
   }\r
   \r
index f90689074769b15b78ffa845915994def7aceb45..72fd37ece5a9fd026a0591b5f5bc76afb8de2f38 100644 (file)
@@ -69,11 +69,20 @@ GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mSmramProfileContext =
   },\r
   &mImageQueue,\r
 };\r
-GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA *mSmramProfileContextPtr;\r
+GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA *mSmramProfileContextPtr = NULL;\r
 \r
 BOOLEAN mSmramReadyToLock;\r
 BOOLEAN mSmramProfileRecordingStatus = FALSE;\r
 \r
+/**\r
+  Dump SMRAM infromation.\r
+\r
+**/\r
+VOID\r
+DumpSmramInfo (\r
+  VOID\r
+  );\r
+\r
 /**\r
   Return SMRAM profile context.\r
 \r