Discussion:
[edk2] [PATCH 0/3] Minor enhancement to memory profile feature.
Star Zeng
2015-06-09 02:10:32 UTC
Permalink
Cc: Jiewen Yao <***@intel.com>
Star Zeng (3):
MdeModulePkg DxeCore: Call UnregisterMemoryProfileImage correctly.
MdeModulePkg PiSmmCore: Free FullSmramRanges at error condition.
EdkCompatibilityPkg SmmBaseHelper: Unregister profile image correctly.

.../Compatibility/SmmBaseHelper/SmmBaseHelper.c | 5 +-
.../SmmBaseHelper/SmramProfileRecord.c | 3 +-
MdeModulePkg/Core/Dxe/Image/Image.c | 7 ++-
MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 55 ++++++++++++++++++----
MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h | 46 +-----------------
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 5 +-
MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 11 ++++-
7 files changed, 68 insertions(+), 64 deletions(-)
--
1.9.5.msysgit.0


------------------------------------------------------------------------------
Star Zeng
2015-06-09 02:10:35 UTC
Permalink
Call UnregisterSmramProfileImage() before image buffer freed.

Cc: Jiewen Yao <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <***@intel.com>
---
EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c | 5 ++---
EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
index 2b94e4d..1d16449 100644
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
@@ -11,7 +11,7 @@

SmmHandlerEntry() will receive untrusted input and do validation.

- Copyright (c) 2009 - 2013, 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
@@ -34,7 +34,6 @@
#include <Library/MemoryAllocationLib.h>
#include <Library/SynchronizationLib.h>
#include <Library/CpuLib.h>
-#include <Library/PcdLib.h>
#include <Guid/SmmBaseThunkCommunication.h>
#include <Protocol/SmmBaseHelperReady.h>
#include <Protocol/SmmCpu.h>
@@ -734,10 +733,10 @@ LoadImage (
RegisterSmramProfileImage (FilePath, DstBuffer, PageCount);
Status = gBS->StartImage (*ImageHandle, NULL, NULL);
if (EFI_ERROR (Status)) {
+ UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);
mLoadPe32Image->UnLoadPeImage (mLoadPe32Image, *ImageHandle);
*ImageHandle = NULL;
FreePages ((VOID *)(UINTN)DstBuffer, PageCount);
- UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);
}
}

diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
index 84eba48..a1797ea 100644
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 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
@@ -20,6 +20,7 @@
#include <Library/DevicePathLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
#include <Protocol/SmmCommunication.h>

#include <Guid/MemoryProfile.h>
--
1.9.5.msysgit.0


------------------------------------------------------------------------------
Ard Biesheuvel
2015-06-09 18:01:32 UTC
Permalink
Post by Star Zeng
Call UnregisterSmramProfileImage() before image buffer freed.
Contributed-under: TianoCore Contribution Agreement 1.0
---
EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c | 5 ++---
EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
index 2b94e4d..1d16449 100644
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
@@ -11,7 +11,7 @@
SmmHandlerEntry() will receive untrusted input and do validation.
- Copyright (c) 2009 - 2013, 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
@@ -34,7 +34,6 @@
#include <Library/MemoryAllocationLib.h>
#include <Library/SynchronizationLib.h>
#include <Library/CpuLib.h>
-#include <Library/PcdLib.h>
What is this change for? It is not mentioned in the commit log.
Post by Star Zeng
#include <Guid/SmmBaseThunkCommunication.h>
#include <Protocol/SmmBaseHelperReady.h>
#include <Protocol/SmmCpu.h>
@@ -734,10 +733,10 @@ LoadImage (
RegisterSmramProfileImage (FilePath, DstBuffer, PageCount);
Status = gBS->StartImage (*ImageHandle, NULL, NULL);
if (EFI_ERROR (Status)) {
+ UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);
mLoadPe32Image->UnLoadPeImage (mLoadPe32Image, *ImageHandle);
*ImageHandle = NULL;
FreePages ((VOID *)(UINTN)DstBuffer, PageCount);
- UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);
}
}
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
index 84eba48..a1797ea 100644
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
@@ -1,6 +1,6 @@
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 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
@@ -20,6 +20,7 @@
#include <Library/DevicePathLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
And this one?
Post by Star Zeng
#include <Protocol/SmmCommunication.h>
#include <Guid/MemoryProfile.h>
--
1.9.5.msysgit.0
------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Zeng, Star
2015-06-10 00:56:24 UTC
Permalink
It is because the PCD PcdMemoryProfilePropertyMask is only essentially used in SmramProfileRecord.c.
So move the include PcdLib.h from SmmBaseHelper.c to SmramProfileRecord.c.

Thanks,
Star
-----Original Message-----
From: Ard Biesheuvel [mailto:***@linaro.org]
Sent: Wednesday, June 10, 2015 2:02 AM
To: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] [PATCH 3/3] EdkCompatibilityPkg SmmBaseHelper: Unregister profile image correctly.
Post by Star Zeng
Call UnregisterSmramProfileImage() before image buffer freed.
Contributed-under: TianoCore Contribution Agreement 1.0
---
EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c | 5 ++---
EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git
a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
index 2b94e4d..1d16449 100644
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmmBaseHelper.c
@@ -11,7 +11,7 @@
SmmHandlerEntry() will receive untrusted input and do validation.
- Copyright (c) 2009 - 2013, 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
<Library/MemoryAllocationLib.h> #include
<Library/SynchronizationLib.h> #include <Library/CpuLib.h> -#include
<Library/PcdLib.h>
What is this change for? It is not mentioned in the commit log.
Post by Star Zeng
#include <Guid/SmmBaseThunkCommunication.h>
#include <Protocol/SmmBaseHelperReady.h> #include
RegisterSmramProfileImage (FilePath, DstBuffer, PageCount);
Status = gBS->StartImage (*ImageHandle, NULL, NULL);
if (EFI_ERROR (Status)) {
+ UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);
mLoadPe32Image->UnLoadPeImage (mLoadPe32Image, *ImageHandle);
*ImageHandle = NULL;
FreePages ((VOID *)(UINTN)DstBuffer, PageCount);
- UnregisterSmramProfileImage (FilePath, DstBuffer, PageCount);
}
}
diff --git
a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
index 84eba48..a1797ea 100644
---
a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileRecord.c
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/SmramProfileReco
+++ rd.c
@@ -1,6 +1,6 @@
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 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
#include <Library/BaseMemoryLib.h> #include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
And this one?
Post by Star Zeng
#include <Protocol/SmmCommunication.h>
#include <Guid/MemoryProfile.h>
--
1.9.5.msysgit.0
----------------------------------------------------------------------
-------- _______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Star Zeng
2015-06-09 02:10:33 UTC
Permalink
Use if (Image->Started) condition judgement before call to
UnregisterMemoryProfileImage() in CoreUnloadAndCloseImage().

Cc: Jiewen Yao <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <***@intel.com>
---
MdeModulePkg/Core/Dxe/Image/Image.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index 33686a6..ea6b2c6 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -1,7 +1,7 @@
/** @file
Core image handling services to load and unload PeImage.

-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
@@ -858,6 +858,10 @@ CoreUnloadAndCloseImage (
HandleBuffer = NULL;
ProtocolGuidArray = NULL;

+ if (Image->Started) {
+ UnregisterMemoryProfileImage (Image);
+ }
+
if (Image->Ebc != NULL) {
//
// If EBC protocol exists we must perform cleanups for this image.
@@ -1854,7 +1858,6 @@ CoreUnloadImage (
Status = EFI_INVALID_PARAMETER;
goto Done;
}
- UnregisterMemoryProfileImage (Image);

if (Image->Started) {
//
--
1.9.5.msysgit.0


------------------------------------------------------------------------------
Star Zeng
2015-06-09 02:10:34 UTC
Permalink
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.

Cc: Jiewen Yao <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <***@intel.com>
---
MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 55 ++++++++++++++++++----
MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h | 46 +-----------------
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 5 +-
MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 11 ++++-
4 files changed, 59 insertions(+), 58 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
index 41e8f83..afac9e2 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
@@ -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 @@ SmramProfileReadyToLock (
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
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h b/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
index 3934d2f..9915669 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
@@ -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 @@ typedef struct {
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
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 64565e9..ba596cd 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -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 @@ SmmIplEntry (
// Free all allocated resources
//
FreePool (gSmmCorePrivate->SmramRanges);
-
+ FreePool (gSmmCorePrivate->FullSmramRanges);
+
return EFI_UNSUPPORTED;
}

diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
index f906890..72fd37e 100644
--- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
+++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
@@ -69,12 +69,21 @@ GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mSmramProfileContext =
},
&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.
--
1.9.5.msysgit.0


------------------------------------------------------------------------------
Yao, Jiewen
2015-06-09 02:12:50 UTC
Permalink
Thanks for fixing it.

Reviewed-by: Jiewen Yao <***@intel.com>

Thank you
Yao Jiewen

-----Original Message-----
From: Zeng, Star
Sent: Tuesday, June 09, 2015 10:11 AM
To: edk2-***@lists.sourceforge.net
Cc: Yao, Jiewen
Subject: [PATCH 2/3] 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.

Cc: Jiewen Yao <***@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <***@intel.com>
---
MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 55 ++++++++++++++++++----
MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h | 46 +-----------------
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 5 +-
MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 11 ++++-
4 files changed, 59 insertions(+), 58 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
index 41e8f83..afac9e2 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
@@ -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 @@ SmramProfileReadyToLock (
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
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h b/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
index 3934d2f..9915669 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCorePrivateData.h
@@ -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 @@ typedef struct {
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
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 64565e9..ba596cd 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -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 @@ SmmIplEntry (
// Free all allocated resources
//
FreePool (gSmmCorePrivate->SmramRanges);
-
+ FreePool (gSmmCorePrivate->FullSmramRanges);
+
return EFI_UNSUPPORTED;
}

diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
index f906890..72fd37e 100644
--- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
+++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
@@ -69,12 +69,21 @@ GLOBAL_REMOVE_IF_UNREFERENCED MEMORY_PROFILE_CONTEXT_DATA mSmramProfileContext =
},
&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.
--
1.9.5.msysgit.0


------------------------------------------------------------------------------
Loading...