Revision: 17598
          http://sourceforge.net/p/edk2/code/17598
Author:   lzeng14
Date:     2015-06-09 09:41:50 +0000 (Tue, 09 Jun 2015)
Log Message:
-----------
MdeModulePkg PiSmmCore: Free FullSmramRanges at error condition.

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 <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/16335

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
    trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
    trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
    trunk/edk2/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c

Modified: trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
===================================================================
--- trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h  2015-06-09 09:41:02 UTC 
(rev 17597)
+++ trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h  2015-06-09 09:41:50 UTC 
(rev 17598)
@@ -2,7 +2,7 @@
   The internal header file includes the common header files, defines
   internal structure and functions used by SmmCore module.
 
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 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        
@@ -909,16 +909,51 @@
   VOID
   );
 
-/**
-  Dump SMRAM infromation.
-
-**/
-VOID
-DumpSmramInfo (
-  VOID
-  );
-
 extern UINTN                    mFullSmramRangeCount;
 extern EFI_SMRAM_DESCRIPTOR     *mFullSmramRanges;
 
+//
+// Page management
+//
+
+typedef struct {
+  LIST_ENTRY  Link;
+  UINTN       NumberOfPages;
+} FREE_PAGE_LIST;
+
+extern LIST_ENTRY  mSmmMemoryMap;
+
+//
+// Pool management
+//
+
+//
+// MIN_POOL_SHIFT must not be less than 5
+//
+#define MIN_POOL_SHIFT  6
+#define MIN_POOL_SIZE   (1 << MIN_POOL_SHIFT)
+
+//
+// MAX_POOL_SHIFT must not be less than EFI_PAGE_SHIFT - 1
+//
+#define MAX_POOL_SHIFT  (EFI_PAGE_SHIFT - 1)
+#define MAX_POOL_SIZE   (1 << MAX_POOL_SHIFT)
+
+//
+// MAX_POOL_INDEX are calculated by maximum and minimum pool sizes
+//
+#define MAX_POOL_INDEX  (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
+
+typedef struct {
+  UINTN        Size;
+  BOOLEAN      Available;
+} POOL_HEADER;
+
+typedef struct {
+  POOL_HEADER  Header;
+  LIST_ENTRY   Link;
+} FREE_POOL_HEADER;
+
+extern LIST_ENTRY  mSmmPoolLists[MAX_POOL_INDEX];
+
 #endif

Modified: trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
===================================================================
--- trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h       
2015-06-09 09:41:02 UTC (rev 17597)
+++ trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h       
2015-06-09 09:41:50 UTC (rev 17598)
@@ -2,7 +2,7 @@
   The internal header file that declared a data structure that is shared
   between the SMM IPL and the SMM Core.
 
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 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        
@@ -125,48 +125,4 @@
   EFI_SMRAM_DESCRIPTOR            *FullSmramRanges;
 } SMM_CORE_PRIVATE_DATA;
 
-//
-// Page management
-//
-
-typedef struct {
-  LIST_ENTRY  Link;
-  UINTN       NumberOfPages;
-} FREE_PAGE_LIST;
-
-extern LIST_ENTRY  mSmmMemoryMap;
-
-//
-// Pool management
-//
-
-//
-// MIN_POOL_SHIFT must not be less than 5
-//
-#define MIN_POOL_SHIFT  6
-#define MIN_POOL_SIZE   (1 << MIN_POOL_SHIFT)
-
-//
-// MAX_POOL_SHIFT must not be less than EFI_PAGE_SHIFT - 1
-//
-#define MAX_POOL_SHIFT  (EFI_PAGE_SHIFT - 1)
-#define MAX_POOL_SIZE   (1 << MAX_POOL_SHIFT)
-
-//
-// MAX_POOL_INDEX are calculated by maximum and minimum pool sizes
-//
-#define MAX_POOL_INDEX  (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
-
-typedef struct {
-  UINTN        Size;
-  BOOLEAN      Available;
-} POOL_HEADER;
-
-typedef struct {
-  POOL_HEADER  Header;
-  LIST_ENTRY   Link;
-} FREE_POOL_HEADER;
-
-extern LIST_ENTRY  mSmmPoolLists[MAX_POOL_INDEX];
-
 #endif

Modified: trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c   2015-06-09 09:41:02 UTC 
(rev 17597)
+++ trunk/edk2/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c   2015-06-09 09:41:50 UTC 
(rev 17598)
@@ -1,7 +1,7 @@
 /** @file
   SMM IPL that produces SMM related runtime protocols and load the SMM Core 
into SMRAM
 
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 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        
@@ -1251,7 +1251,8 @@
     // Free all allocated resources
     //
     FreePool (gSmmCorePrivate->SmramRanges);
-    
+    FreePool (gSmmCorePrivate->FullSmramRanges);
+
     return EFI_UNSUPPORTED;
   }
   

Modified: trunk/edk2/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c 2015-06-09 
09:41:02 UTC (rev 17597)
+++ trunk/edk2/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c 2015-06-09 
09:41:50 UTC (rev 17598)
@@ -69,12 +69,21 @@
   },
   &mImageQueue,
 };
-GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA 
*mSmramProfileContextPtr;
+GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA 
*mSmramProfileContextPtr = NULL;
 
 BOOLEAN mSmramReadyToLock;
 BOOLEAN mSmramProfileRecordingStatus = FALSE;
 
 /**
+  Dump SMRAM infromation.
+
+**/
+VOID
+DumpSmramInfo (
+  VOID
+  );
+
+/**
   Return SMRAM profile context.
 
   @return SMRAM profile context.


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to