Cinnamon:
  I have two minor comments on usage. Install System table means PRODUCES. 
  Others are good to me.  Reviewed-by: Liming Gao <liming....@intel.com>

1. StatusCodeHandlerRuntimeDxe.inf
   gMemoryStatusCodeRecordGuid                   ## SOMETIMES_CONSUMES   ## HOB 
and ConfigurationTable
==> 
   ## SOMETIMES_CONSUMES   ## HOB
   ## PRODUCES ## SystemTable   
gMemoryStatusCodeRecordGuid

2. StatusCodeHandlerSmm.inf
gMemoryStatusCodeRecordGuid                   ## SOMETIMES_CONSUMES   ## 
SmmConfigurationTable
==>
gMemoryStatusCodeRecordGuid                   ## PRODUCES   ## UNDEFINED  # 
SmmConfigurationTable

Thanks
Liming
> -----Original Message-----
> From: Cinnamon Shia [mailto:cinnamon.s...@hpe.com]
> Sent: Monday, June 27, 2016 3:26 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming....@intel.com>; Tian, Feng <feng.t...@intel.com>;
> Zeng, Star <star.z...@intel.com>; Cinnamon Shia <cinnamon.s...@hpe.com>
> Subject: [PATCH v2] MdeModulePkg/MemoryStatusCode: Expose the DXE
> memory status code table.
> 
> Let data of DXE memory status code can be used by other modules.
> 1. Save the address of DXE memory status code table to
> DxeConfigurationTable.
> 2. Save the address of SMM memory status code table to
> SmmConfigurationTable.
> 3. Move RUNTIME_MEMORY_STATUSCODE_HEADER to its public header file.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Cinnamon Shia <cinnamon.s...@hpe.com>
> ---
>  MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h | 30
> ++++++++++++++++++----
>  .../RuntimeDxe/MemoryStatusCodeWorker.c            | 27 +++++++++++-------
> -
>  .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.h       | 17 ++++--------
>  .../RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf     |  3 ++-
>  .../StatusCodeHandler/Smm/MemoryStatusCodeWorker.c | 21
> ++++++++++-----
>  .../StatusCodeHandler/Smm/StatusCodeHandlerSmm.h   | 18 ++++---------
>  .../StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf |  4 ++-
>  7 files changed, 71 insertions(+), 49 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/Universal/StatusCodeHandler/RuntimeDxe/MemoryStat
> usCodeWorker.c
> b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStat
> usCodeWorker.c
> index 8680497..a306d75 100644
> ---
> a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStat
> usCodeWorker.c
> +++
> b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/MemoryStat
> usCodeWorker.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.
> 
>  **/
> 
> @@ -18,8 +19,9 @@ RUNTIME_MEMORY_STATUSCODE_HEADER
> *mRtMemoryStatusCodeTable;
> 
>  /**
>    Initialize runtime memory status code table as initialization for runtime
> memory status code worker
> -
> +
>    @retval EFI_SUCCESS  Runtime memory status code table successfully
> initialized.
> +  @retval others       Errors from gBS->InstallConfigurationTable().
> 
>  **/
>  EFI_STATUS
> @@ -27,6 +29,8 @@ RtMemoryStatusCodeInitializeWorker (
>    VOID
>    )
>  {
> +  EFI_STATUS                        Status;
> +
>    //
>    // Allocate runtime memory status code pool.
>    //
> @@ -40,15 +44,16 @@ RtMemoryStatusCodeInitializeWorker (
>    mRtMemoryStatusCodeTable->NumberOfRecords  = 0;
>    mRtMemoryStatusCodeTable->MaxRecordsNumber =
>      (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof
> (MEMORY_STATUSCODE_RECORD);
> +  Status = gBS->InstallConfigurationTable
> (&gMemoryStatusCodeRecordGuid, mRtMemoryStatusCodeTable);
> 
> -  return EFI_SUCCESS;
> +  return Status;
>  }
> 
> 
>  /**
>    Report status code into runtime memory. If the runtime pool is full, roll
> back to the
>    first record and overwrite it.
> -
> +
>    @param  CodeType                Indicates the type of status code being
> reported.
>    @param  Value                   Describes the current status of a hardware 
> or
> software entity.
>                                    This included information about the class 
> and subclass that
> is used to
> @@ -59,7 +64,7 @@ RtMemoryStatusCodeInitializeWorker (
>                                    This parameter allows the status code 
> driver to apply
> different rules to
>                                    different callers.
>    @param  Data                    This optional parameter may be used to pass
> additional data.
> -
> +
>    @retval EFI_SUCCESS             Status code successfully recorded in 
> runtime
> memory status code table.
> 
>  **/
> diff --git
> a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeH
> andlerRuntimeDxe.h
> b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeH
> andlerRuntimeDxe.h
> index 2bf3412..a3185f5 100644
> ---
> a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeH
> andlerRuntimeDxe.h
> +++
> b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeH
> andlerRuntimeDxe.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;
> 
>  /**
> @@ -65,7 +57,7 @@ EfiSerialStatusCodeInitializeWorker (
> 
>  /**
>    Convert status code value and extended data to readable ASCII string, send
> string to serial I/O device.
> -
> +
>    @param  CodeType         Indicates the type of status code being reported.
>    @param  Value            Describes the current status of a hardware or
> software entity.
>                             This included information about the class and 
> subclass that is
> used to
> @@ -96,6 +88,7 @@ SerialStatusCodeReportWorker (
>    Initialize runtime memory status code table as initialization for runtime
> memory status code worker
> 
>    @retval EFI_SUCCESS  Runtime memory status code table successfully
> initialized.
> +  @retval others       Errors from gBS->InstallConfigurationTable().
> 
>  **/
>  EFI_STATUS
> @@ -106,7 +99,7 @@ RtMemoryStatusCodeInitializeWorker (
>  /**
>    Report status code into runtime memory. If the runtime pool is full, roll
> back to the
>    first record and overwrite it.
> -
> +
>    @param  CodeType                Indicates the type of status code being
> reported.
>    @param  Value                   Describes the current status of a hardware 
> or
> software entity.
>                                    This included information about the class 
> and subclass that
> is used to
> @@ -117,7 +110,7 @@ RtMemoryStatusCodeInitializeWorker (
>                                    This parameter allows the status code 
> driver to apply
> different rules to
>                                    different callers.
>    @param  Data                    This optional parameter may be used to pass
> additional data.
> -
> +
>    @retval EFI_SUCCESS             Status code successfully recorded in 
> runtime
> memory status code table.
> 
>  **/
> diff --git
> a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeH
> andlerRuntimeDxe.inf
> b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeH
> andlerRuntimeDxe.inf
> index ba22ca4..0c57b61 100644
> ---
> a/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeH
> andlerRuntimeDxe.inf
> +++
> b/MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeH
> andlerRuntimeDxe.inf
> @@ -2,6 +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
> @@ -52,7 +53,7 @@
>    BaseMemoryLib
> 
>  [Guids]
> -  gMemoryStatusCodeRecordGuid                   ## SOMETIMES_CONSUMES   ##
> HOB
> +  gMemoryStatusCodeRecordGuid                   ## SOMETIMES_CONSUMES
> ## HOB and ConfigurationTable
>    gEfiStatusCodeDataTypeStringGuid              ## SOMETIMES_CONSUMES   ##
> UNDEFINED
>    gEfiEventVirtualAddressChangeGuid             ## CONSUMES ## Event
>    gEfiEventExitBootServicesGuid                 ## CONSUMES ## Event
> diff --git
> a/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCode
> Worker.c
> b/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCode
> Worker.c
> index 78d908b..6baf2dd 100644
> ---
> a/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCode
> Worker.c
> +++
> b/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCode
> Worker.c
> @@ -2,11 +2,12 @@
>    Runtime memory status code worker.
> 
>    Copyright (c) 2006 - 2010, 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
>    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.
> 
> @@ -18,15 +19,17 @@ RUNTIME_MEMORY_STATUSCODE_HEADER
> *mSmmMemoryStatusCodeTable;
> 
>  /**
>    Initialize SMM memory status code table as initialization for memory status
> code worker
> -
> -  @retval EFI_SUCCESS  SMM memory status code table successfully
> initialized.
> 
> +  @retval EFI_SUCCESS  SMM memory status code table successfully
> initialized.
> +  @retval others       Errors from gSmst->SmmInstallConfigurationTable().
>  **/
>  EFI_STATUS
>  MemoryStatusCodeInitializeWorker (
>    VOID
>    )
>  {
> +  EFI_STATUS                        Status;
> +
>    //
>    // Allocate SMM memory status code pool.
>    //
> @@ -34,14 +37,20 @@ MemoryStatusCodeInitializeWorker (
>    ASSERT (mSmmMemoryStatusCodeTable != NULL);
> 
>    mSmmMemoryStatusCodeTable->MaxRecordsNumber = (PcdGet16
> (PcdStatusCodeMemorySize) * 1024) / sizeof
> (MEMORY_STATUSCODE_RECORD);
> -  return EFI_SUCCESS;
> +  Status = gSmst->SmmInstallConfigurationTable (
> +                    gSmst,
> +                    &gMemoryStatusCodeRecordGuid,
> +                    &mSmmMemoryStatusCodeTable,
> +                    sizeof (mSmmMemoryStatusCodeTable)
> +                    );
> +  return Status;
>  }
> 
> 
>  /**
>    Report status code into runtime memory. If the runtime pool is full, roll
> back to the
>    first record and overwrite it.
> -
> +
>    @param  CodeType                Indicates the type of status code being
> reported.
>    @param  Value                   Describes the current status of a hardware 
> or
> software entity.
>                                    This included information about the class 
> and subclass that
> is used to
> @@ -52,7 +61,7 @@ MemoryStatusCodeInitializeWorker (
>                                    This parameter allows the status code 
> driver to apply
> different rules to
>                                    different callers.
>    @param  Data                    This optional parameter may be used to pass
> additional data.
> -
> +
>    @retval EFI_SUCCESS             Status code successfully recorded in 
> runtime
> memory status code table.
> 
>  **/
> diff --git
> a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerS
> mm.h
> b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerS
> mm.h
> index ee85a69..1a374c2 100644
> ---
> a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerS
> mm.h
> +++
> b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerS
> mm.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,20 +38,11 @@
>  //
>  #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;
> 
>  /**
>    Locates Serial I/O Protocol as initialization for serial status code 
> worker.
> -
> +
>    @retval EFI_SUCCESS  Serial I/O Protocol is successfully located.
> 
>  **/
> @@ -62,7 +54,7 @@ EfiSerialStatusCodeInitializeWorker (
> 
>  /**
>    Convert status code value and extended data to readable ASCII string, send
> string to serial I/O device.
> -
> +
>    @param  CodeType         Indicates the type of status code being reported.
>    @param  Value            Describes the current status of a hardware or
> software entity.
>                             This included information about the class and 
> subclass that is
> used to
> @@ -103,7 +95,7 @@ MemoryStatusCodeInitializeWorker (
>  /**
>    Report status code into runtime memory. If the runtime pool is full, roll
> back to the
>    first record and overwrite it.
> -
> +
>    @param  CodeType                Indicates the type of status code being
> reported.
>    @param  Value                   Describes the current status of a hardware 
> or
> software entity.
>                                    This included information about the class 
> and subclass that
> is used to
> @@ -114,7 +106,7 @@ MemoryStatusCodeInitializeWorker (
>                                    This parameter allows the status code 
> driver to apply
> different rules to
>                                    different callers.
>    @param  Data                    This optional parameter may be used to pass
> additional data.
> -
> +
>    @retval EFI_SUCCESS             Status code successfully recorded in 
> runtime
> memory status code table.
> 
>  **/
> diff --git
> a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerS
> mm.inf
> b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerS
> mm.inf
> index 1e66fbf..77dbaa3 100644
> ---
> a/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerS
> mm.inf
> +++
> b/MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerS
> mm.inf
> @@ -2,6 +2,7 @@
>  #  Status Code Handler Driver which produces general handlers and hook
> them onto the SMM status code router.
>  #
>  #  Copyright (c) 2009 - 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
> @@ -49,9 +50,10 @@
>    DebugLib
>    MemoryAllocationLib
>    BaseMemoryLib
> -
> +
>  [Guids]
>    gEfiStatusCodeDataTypeStringGuid              ## SOMETIMES_CONSUMES   ##
> UNDEFINED
> +  gMemoryStatusCodeRecordGuid                   ## SOMETIMES_CONSUMES
> ## SmmConfigurationTable
> 
>  [Protocols]
>    gEfiSmmRscHandlerProtocolGuid                 ## CONSUMES
> --
> 2.8.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to