summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Library
diff options
context:
space:
mode:
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-10 03:41:24 +0000
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-10 03:41:24 +0000
commit19796be36046740f756c46d5e1f14e2548907ed1 (patch)
treed79b6c8b6c1513b889ad2af2d63e4b5f2958cbf8 /IntelFrameworkModulePkg/Library
parent787ef908e48a1dd55864b9feaa5addab386c66b2 (diff)
downloadedk2-platforms-19796be36046740f756c46d5e1f14e2548907ed1.tar.xz
Leverages SMM Status Code Protocol, instead of OemHookStatusCodeLib.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9962 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Library')
-rw-r--r--IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLibInternal.h20
-rw-r--r--IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf11
-rw-r--r--IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c76
3 files changed, 71 insertions, 36 deletions
diff --git a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLibInternal.h b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLibInternal.h
index f241cd1bc9..74318220ff 100644
--- a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLibInternal.h
+++ b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLibInternal.h
@@ -2,7 +2,7 @@
Internal Header file of Report Status Code Library for RUNTIME
DXE Phase.
- Copyright (c) 2006 - 2009, Intel Corporation<BR>
+ Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. 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
@@ -25,13 +25,13 @@
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
-#include <Library/OemHookStatusCodeLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Guid/StatusCodeDataTypeId.h>
#include <Guid/StatusCodeDataTypeDebug.h>
#include <Guid/EventGroup.h>
+#include <Protocol/SmmStatusCode.h>
#include <Protocol/StatusCode.h>
#include <Protocol/SmmBase.h>
@@ -39,22 +39,6 @@
extern EFI_STATUS_CODE_DATA *mStatusCodeData;
/**
- Locate the report status code service.
-
- In SMM, it retrieves OemHookStatusCodeReport() from customized OEM Hook Status Code Lib.
- Otherwise, it first tries to retrieve ReportStatusCode() in Runtime Services Table.
- If not found, it then tries to retrieve ReportStatusCode() API of Report Status Code Protocol.
-
- @return Function pointer to the report status code service.
- NULL is returned if no status code service is available.
-
-**/
-EFI_REPORT_STATUS_CODE
-InternalGetReportStatusCode (
- VOID
- );
-
-/**
Internal worker function that reports a status code through the status code service.
If status code service is not cached, then this function checks if status code service is
diff --git a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
index 94f642b65a..c6a0a4206f 100644
--- a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
+++ b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
@@ -2,10 +2,10 @@
# Report status code library instance which supports logging message in SMM, as well as DXE & runtime phase.
#
# This library instance supports status code report in SMM, as well as DXE & runtime phase.
-# In SMM, it logs message via customized OemHookStatusCodeLib.
+# In SMM, it logs message via SMM Status Code Protocol.
# Otherwise, it logs message to ReportStatusCode() in framework runtime services table or runtime report status code protocol.
#
-# Copyright (c) 2006 - 2009, Intel Corporation.
+# Copyright (c) 2006 - 2010, Intel Corporation.
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -33,7 +33,7 @@
# VALID_ARCHITECTURES = IA32 X64 EBC
#
-[Sources.common]
+[Sources]
ReportStatusCodeLib.c
SmmRuntimeDxeSupport.c
ReportStatusCodeLibInternal.h
@@ -52,7 +52,6 @@
DebugLib
UefiRuntimeServicesTableLib
UefiBootServicesTableLib
- OemHookStatusCodeLib
DevicePathLib
MemoryAllocationLib
@@ -66,8 +65,8 @@
[Protocols]
gEfiStatusCodeRuntimeProtocolGuid ## CONSUMES
gEfiSmmBaseProtocolGuid ## CONSUMES
+ gEfiSmmStatusCodeProtocolGuid ## CONSUMES
-
-[Pcd.common]
+[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask
diff --git a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c
index 089b9c5db2..a5384b444b 100644
--- a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c
+++ b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c
@@ -1,7 +1,7 @@
/** @file
Library constructor & destructor, event handlers, and other internal worker functions.
- Copyright (c) 2006 - 2009, Intel Corporation<BR>
+ Copyright (c) 2006 - 2010, Intel Corporation<BR>
All rights reserved. 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
@@ -14,19 +14,71 @@
#include "ReportStatusCodeLibInternal.h"
-EFI_EVENT mVirtualAddressChangeEvent;
-EFI_EVENT mExitBootServicesEvent;
-EFI_STATUS_CODE_DATA *mStatusCodeData;
-BOOLEAN mInSmm;
-EFI_SMM_BASE_PROTOCOL *mSmmBase;
-EFI_RUNTIME_SERVICES *mInternalRT;
-BOOLEAN mHaveExitedBootServices = FALSE;
-EFI_REPORT_STATUS_CODE mReportStatusCode = NULL;
+EFI_EVENT mVirtualAddressChangeEvent;
+EFI_EVENT mExitBootServicesEvent;
+EFI_STATUS_CODE_DATA *mStatusCodeData;
+BOOLEAN mInSmm;
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+EFI_RUNTIME_SERVICES *mInternalRT;
+BOOLEAN mHaveExitedBootServices = FALSE;
+EFI_REPORT_STATUS_CODE mReportStatusCode = NULL;
+EFI_SMM_STATUS_CODE_PROTOCOL *mSmmStatusCodeProtocol;
+
+/**
+ Locates and caches SMM Status Code Protocol.
+
+**/
+VOID
+SmmStatusCodeInitialize (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (&gEfiSmmStatusCodeProtocolGuid, NULL, (VOID **) &mSmmStatusCodeProtocol);
+ if (EFI_ERROR (Status)) {
+ mSmmStatusCodeProtocol = NULL;
+ }
+}
+
+/**
+ Report status code via SMM Status Code Protocol.
+
+ @param Type 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 classify the entity
+ as well as an operation. For progress codes, the operation is the current activity.
+ For error codes, it is the exception. For debug codes, it is not defined at this time.
+ @param Instance The enumeration of a hardware or software entity within the system.
+ A system may contain multiple entities that match a class/subclass pairing.
+ The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
+ not meaningful, or not relevant. Valid instance numbers start with 1.
+ @param CallerId This optional parameter may be used to identify the caller.
+ 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 Always return EFI_SUCCESS.
+
+**/
+EFI_STATUS
+SmmStatusCodeReport (
+ IN EFI_STATUS_CODE_TYPE Type,
+ IN EFI_STATUS_CODE_VALUE Value,
+ IN UINT32 Instance,
+ IN EFI_GUID *CallerId OPTIONAL,
+ IN EFI_STATUS_CODE_DATA *Data OPTIONAL
+ )
+{
+ if (mSmmStatusCodeProtocol != NULL) {
+ (mSmmStatusCodeProtocol->ReportStatusCode) (mSmmStatusCodeProtocol, Type, Value, Instance, CallerId, Data);
+ }
+ return EFI_SUCCESS;
+}
/**
Locate the report status code service.
- In SMM, it retrieves OemHookStatusCodeReport() from customized OEM Hook Status Code Lib.
+ In SMM, it tries to retrieve SMM Status Code Protocol.
Otherwise, it first tries to retrieve ReportStatusCode() in Runtime Services Table.
If not found, it then tries to retrieve ReportStatusCode() API of Report Status Code Protocol.
@@ -43,7 +95,7 @@ InternalGetReportStatusCode (
EFI_STATUS Status;
if (mInSmm) {
- return (EFI_REPORT_STATUS_CODE) OemHookStatusCodeReport;
+ return (EFI_REPORT_STATUS_CODE) SmmStatusCodeReport;
} else if (mInternalRT != NULL && mInternalRT->Hdr.Revision < 0x20000) {
return ((FRAMEWORK_EFI_RUNTIME_SERVICES*)mInternalRT)->ReportStatusCode;
} else if (!mHaveExitedBootServices) {
@@ -187,7 +239,7 @@ ReportStatusCodeLibConstruct (
(VOID **) &mStatusCodeData
);
ASSERT_EFI_ERROR (Status);
- OemHookStatusCodeInitialize ();
+ SmmStatusCodeInitialize ();
return EFI_SUCCESS;
}
}