Let data of DXE memory status code can be used by other modules.
1. Add a dynamic PCD to save the address of DXE memory status code table.
2. Move RUNTIME_MEMORY_STATUSCODE_HEADER to its public header file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <[email protected]>
---
 MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h | 30 ++++++++++++++++++----
 MdeModulePkg/MdeModulePkg.dec                      |  5 ++++
 .../RuntimeDxe/MemoryStatusCodeWorker.c            | 16 +++++++-----
 .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.h       | 10 +-------
 .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf     |  3 ++-
 .../StatusCodeHandler/Smm/StatusCodeHandlerSmm.h   | 10 +-------
 6 files changed, 43 insertions(+), 31 deletions(-)

diff --git a/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h 
b/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h
index d6c3243..27d39e1 100644
--- a/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h
+++ b/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h
@@ -2,13 +2,14 @@
   GUID used to identify status code records HOB that originate from the PEI 
status code.    
   
 Copyright (c) 2006 - 2010, 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 that accompanies this 
distribution.  
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+This program and the accompanying materials are licensed and made available 
under
+the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php.                                
            
+http://opensource.org/licenses/bsd-license.php.
 
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,          
           
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.  
           
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
@@ -56,6 +57,25 @@ typedef struct {
 } MEMORY_STATUSCODE_PACKET_HEADER;
 
 ///
+/// A header structure that is followed by an array of records that contain 
the 
+/// parameters passed into the ReportStatusCode() service in the DXE Services 
Table.
+///
+typedef struct {
+  ///
+  /// The index pointing to the last recored being stored.
+  ///
+  UINT32   RecordIndex;
+  ///
+  /// The number of records being stored.
+  ///
+  UINT32   NumberOfRecords;
+  ///
+  /// The maximum number of records that can be stored.
+  ///
+  UINT32   MaxRecordsNumber;
+} RUNTIME_MEMORY_STATUSCODE_HEADER;
+
+///
 /// A structure that contains the parameters passed into the 
ReportStatusCode() 
 /// service in the PEI Services Table.
 ///
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 27efb37..ed2062d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1601,5 +1601,10 @@
   # @ValidList  0x80000001 | 0x0
   
gEfiMdeModulePkgTokenSpaceGuid.PcdIdentifyMappingPageTablePtr|0x0|UINT64|0x00030002
 
+  ## This dynamic PCD hold an address to point to the DXE memory status code 
table.
+  # @Prompt DXE Memory Status Code Table pointer.
+  # @ValidList  0x80000001 | 0x0
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeMemoryStatusCodeTablePtr|0x0|UINT64|0x00030003
+
 [UserExtensions.TianoCore."ExtraFiles"]
   MdeModulePkgExtra.uni
diff --git 
a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c 
b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c
index 8680497..93e08d6 100644
--- 
a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c
+++ 
b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStatusCodeWorker.c
@@ -2,13 +2,14 @@
   Runtime memory status code worker.
 
   Copyright (c) 2006 - 2009, 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        
-  http://opensource.org/licenses/bsd-license.php                               
             
-                                                                               
             
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,        
             
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.             
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
@@ -40,6 +41,7 @@ RtMemoryStatusCodeInitializeWorker (
   mRtMemoryStatusCodeTable->NumberOfRecords  = 0;
   mRtMemoryStatusCodeTable->MaxRecordsNumber = 
     (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof 
(MEMORY_STATUSCODE_RECORD);
+  PcdSet64S (PcdDxeMemoryStatusCodeTablePtr, 
(UINT64)(UINTN)mRtMemoryStatusCodeTable);
 
   return EFI_SUCCESS;
 }
diff --git 
a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
 
b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
index 2bf3412..d736566 100644
--- 
a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
+++ 
b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.h
@@ -2,6 +2,7 @@
   Internal include file for Status Code Handler Driver.
 
   Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<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,15 +41,6 @@
 //
 #define MAX_DEBUG_MESSAGE_LENGTH 0x100
 
-//
-// Runtime memory status code worker definition
-//
-typedef struct {
-  UINT32   RecordIndex;
-  UINT32   NumberOfRecords;
-  UINT32   MaxRecordsNumber;
-} RUNTIME_MEMORY_STATUSCODE_HEADER;
-
 extern RUNTIME_MEMORY_STATUSCODE_HEADER  *mRtMemoryStatusCodeTable;
 
 /**
diff --git 
a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
 
b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
index ba22ca4..44d6dc5 100644
--- 
a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
+++ 
b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
@@ -2,7 +2,7 @@
 #  Status Code Handler Driver which produces general handlers and hook them 
onto the DXE status code router.
 #
 #  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-#
+#  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
@@ -67,6 +67,7 @@
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize |128| 
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory   ## SOMETIMES_CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdDxeMemoryStatusCodeTablePtr
 
 [Depex]
   gEfiRscHandlerProtocolGuid
diff --git 
a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.h 
b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.h
index ee85a69..a35a0f0 100644
--- a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.h
+++ b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.h
@@ -2,6 +2,7 @@
   Internal include file for Status Code Handler Driver.
 
   Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<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
@@ -37,15 +38,6 @@
 //
 #define MAX_DEBUG_MESSAGE_LENGTH 0x100
 
-//
-// Runtime memory status code worker definition
-//
-typedef struct {
-  UINT32   RecordIndex;
-  UINT32   NumberOfRecords;
-  UINT32   MaxRecordsNumber;
-} RUNTIME_MEMORY_STATUSCODE_HEADER;
-
 extern RUNTIME_MEMORY_STATUSCODE_HEADER  *mSmmMemoryStatusCodeTable;
 
 /**
-- 
2.8.3.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to