summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/SmmReportStatusCodeLib
diff options
context:
space:
mode:
authorKun Qin <kun.q@outlook.com>2020-12-17 13:38:50 -0800
committerKun Qin <kun.q@outlook.com>2021-02-01 10:01:03 -0800
commit5625c1fdf7258888fc26ddebe8353d3e5240701b (patch)
tree053caf18d3a81d0e01394757750c89800399e3f8 /MdeModulePkg/Library/SmmReportStatusCodeLib
parente35fce8adadb4141c05d5365abc56e9bd96b9fce (diff)
downloadedk2-5625c1fdf7258888fc26ddebe8353d3e5240701b.tar.gz
edk2-5625c1fdf7258888fc26ddebe8353d3e5240701b.tar.bz2
edk2-5625c1fdf7258888fc26ddebe8353d3e5240701b.zip
MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm
This change added support of StandaloneMm for ReportStatusCodeLib. It adds a new instance of ReportStatusCodeLib for MM_STANDALONE type, and abstracts the references of gMmst and gSmst functionalities into separate files in order to link in proper Service Table for SMM core/drivers. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Kun Qin <kun.q@outlook.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Library/SmmReportStatusCodeLib')
-rw-r--r--MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c16
-rw-r--r--MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.h36
-rw-r--r--MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibStandaloneMm.c38
-rw-r--r--MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibTraditional.c38
-rw-r--r--MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf4
-rw-r--r--MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportStatusCodeLib.inf53
6 files changed, 177 insertions, 8 deletions
diff --git a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c
index 3a1772538c..fb1769db92 100644
--- a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c
+++ b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.c
@@ -1,5 +1,5 @@
/** @file
- Report Status Code Library for SMM Phase.
+ Report Status Code Library for MM Phase.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -8,7 +8,7 @@
#include <Library/ReportStatusCodeLib.h>
#include <Library/DebugLib.h>
-#include <Library/SmmServicesTableLib.h>
+#include <Library/MmServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/PcdLib.h>
@@ -16,10 +16,12 @@
#include <Guid/StatusCodeDataTypeId.h>
#include <Guid/StatusCodeDataTypeDebug.h>
-#include <Protocol/SmmStatusCode.h>
+#include <Protocol/MmStatusCode.h>
-EFI_SMM_REPORT_STATUS_CODE mReportStatusCode = NULL;
-EFI_SMM_STATUS_CODE_PROTOCOL *mStatusCodeProtocol = NULL;
+#include "ReportStatusCodeLib.h"
+
+EFI_MM_REPORT_STATUS_CODE mReportStatusCode = NULL;
+EFI_MM_STATUS_CODE_PROTOCOL *mStatusCodeProtocol = NULL;
/**
@@ -29,14 +31,14 @@ EFI_SMM_STATUS_CODE_PROTOCOL *mStatusCodeProtocol = NULL;
NULL is returned if no status code service is available.
**/
-EFI_SMM_REPORT_STATUS_CODE
+EFI_MM_REPORT_STATUS_CODE
InternalGetReportStatusCode (
VOID
)
{
EFI_STATUS Status;
- Status = gSmst->SmmLocateProtocol (&gEfiSmmStatusCodeProtocolGuid, NULL, (VOID**)&mStatusCodeProtocol);
+ Status = InternalLocateProtocol (&gEfiMmStatusCodeProtocolGuid, NULL, (VOID**)&mStatusCodeProtocol);
if (!EFI_ERROR (Status) && mStatusCodeProtocol != NULL) {
return mStatusCodeProtocol->ReportStatusCode;
}
diff --git a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.h b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.h
new file mode 100644
index 0000000000..2820e40dde
--- /dev/null
+++ b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLib.h
@@ -0,0 +1,36 @@
+/** @file
+ Report Status Code Library for MM Phase.
+
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _MM_RSC_LIB_H_
+#define _MM_RSC_LIB_H_
+
+/**
+ Returns the first protocol instance that matches the given protocol.
+
+ @param[in] Protocol Provides the protocol to search for.
+ @param[in] Registration Optional registration key returned from
+ RegisterProtocolNotify().
+ @param[out] Interface On return, a pointer to the first interface that matches Protocol and
+ Registration.
+
+ @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in
+ Interface.
+ @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and
+ Registration.
+ @retval EFI_INVALID_PARAMETER Interface is NULL.
+ Protocol is NULL.
+
+**/
+EFI_STATUS
+InternalLocateProtocol (
+ IN EFI_GUID *Protocol,
+ IN VOID *Registration, OPTIONAL
+ OUT VOID **Interface
+ );
+
+#endif // _MM_RSC_LIB_H_
diff --git a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibStandaloneMm.c b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibStandaloneMm.c
new file mode 100644
index 0000000000..a4c428dc88
--- /dev/null
+++ b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibStandaloneMm.c
@@ -0,0 +1,38 @@
+/** @file
+ Abstraction layer for MM service table used by MM ReportStatusCodeLib.
+
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiMm.h>
+
+#include <Library/MmServicesTableLib.h>
+
+/**
+ Returns the first protocol instance that matches the given protocol.
+
+ @param[in] Protocol Provides the protocol to search for.
+ @param[in] Registration Optional registration key returned from
+ RegisterProtocolNotify().
+ @param[out] Interface On return, a pointer to the first interface that matches Protocol and
+ Registration.
+
+ @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in
+ Interface.
+ @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and
+ Registration.
+ @retval EFI_INVALID_PARAMETER Interface is NULL.
+ Protocol is NULL.
+
+**/
+EFI_STATUS
+InternalLocateProtocol (
+ IN EFI_GUID *Protocol,
+ IN VOID *Registration, OPTIONAL
+ OUT VOID **Interface
+ )
+{
+ return gMmst->MmLocateProtocol (Protocol, Registration, Interface);
+}
diff --git a/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibTraditional.c b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibTraditional.c
new file mode 100644
index 0000000000..603e222f55
--- /dev/null
+++ b/MdeModulePkg/Library/SmmReportStatusCodeLib/ReportStatusCodeLibTraditional.c
@@ -0,0 +1,38 @@
+/** @file
+ Abstraction layer for SMM service table used by SMM ReportStatusCodeLib.
+
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiMm.h>
+
+#include <Library/SmmServicesTableLib.h>
+
+/**
+ Returns the first protocol instance that matches the given protocol.
+
+ @param[in] Protocol Provides the protocol to search for.
+ @param[in] Registration Optional registration key returned from
+ RegisterProtocolNotify().
+ @param[out] Interface On return, a pointer to the first interface that matches Protocol and
+ Registration.
+
+ @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in
+ Interface.
+ @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and
+ Registration.
+ @retval EFI_INVALID_PARAMETER Interface is NULL.
+ Protocol is NULL.
+
+**/
+EFI_STATUS
+InternalLocateProtocol (
+ IN EFI_GUID *Protocol,
+ IN VOID *Registration, OPTIONAL
+ OUT VOID **Interface
+ )
+{
+ return gSmst->SmmLocateProtocol (Protocol, Registration, Interface);
+}
diff --git a/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf b/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
index 72496bfaba..02dce09a19 100644
--- a/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
+++ b/MdeModulePkg/Library/SmmReportStatusCodeLib/SmmReportStatusCodeLib.inf
@@ -28,6 +28,8 @@
[Sources]
ReportStatusCodeLib.c
+ ReportStatusCodeLib.h
+ ReportStatusCodeLibTraditional.c
[Packages]
MdePkg/MdePkg.dec
@@ -45,7 +47,7 @@
gEfiStatusCodeDataTypeDebugGuid ## SOMETIMES_CONSUMES ## UNDEFINED
[Protocols]
- gEfiSmmStatusCodeProtocolGuid ## CONSUMES
+ gEfiMmStatusCodeProtocolGuid ## CONSUMES
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask ## CONSUMES
diff --git a/MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportStatusCodeLib.inf b/MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportStatusCodeLib.inf
new file mode 100644
index 0000000000..866e09249a
--- /dev/null
+++ b/MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportStatusCodeLib.inf
@@ -0,0 +1,53 @@
+## @file
+# Standalone MM report status code library.
+#
+# Retrieve status code and report status code in MM phase.
+#
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = StandaloneMmReportStatusCodeLib
+ FILE_GUID = 17C7FC8C-8C5D-497E-9C0E-C21255B30E04
+ MODULE_TYPE = MM_STANDALONE
+ VERSION_STRING = 1.0
+ PI_SPECIFICATION_VERSION = 0x00010032
+ LIBRARY_CLASS = ReportStatusCodeLib|MM_STANDALONE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ ReportStatusCodeLib.c
+ ReportStatusCodeLib.h
+ ReportStatusCodeLibStandaloneMm.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ PcdLib
+ BaseMemoryLib
+ MmServicesTableLib
+ DebugLib
+ MemoryAllocationLib
+
+[Guids]
+ gEfiStatusCodeSpecificDataGuid ## SOMETIMES_CONSUMES ## UNDEFINED
+ gEfiStatusCodeDataTypeDebugGuid ## SOMETIMES_CONSUMES ## UNDEFINED
+
+[Protocols]
+ gEfiMmStatusCodeProtocolGuid ## CONSUMES
+
+[Pcd]
+ gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask ## CONSUMES