]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c
Update the copyright notice format
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / SmmRuntimeDxeReportStatusCodeLibFramework / SmmRuntimeDxeSupport.c
index 089b9c5db2a1d143503a5f5b99f95ecfaf0e8b2a..1197e7c6166c1b542ebed9008ded1a4d53fc51c2 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Library constructor & destructor, event handlers, and other internal worker functions.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
 \r
 #include "ReportStatusCodeLibInternal.h"\r
 \r
-EFI_EVENT               mVirtualAddressChangeEvent;\r
-EFI_EVENT               mExitBootServicesEvent;\r
-EFI_STATUS_CODE_DATA    *mStatusCodeData;\r
-BOOLEAN                 mInSmm;\r
-EFI_SMM_BASE_PROTOCOL   *mSmmBase;\r
-EFI_RUNTIME_SERVICES    *mInternalRT;\r
-BOOLEAN                 mHaveExitedBootServices = FALSE;\r
-EFI_REPORT_STATUS_CODE  mReportStatusCode = NULL;\r
+EFI_EVENT                     mVirtualAddressChangeEvent;\r
+EFI_EVENT                     mExitBootServicesEvent;\r
+EFI_STATUS_CODE_DATA          *mStatusCodeData;\r
+BOOLEAN                       mInSmm;\r
+EFI_SMM_BASE_PROTOCOL         *mSmmBase;\r
+EFI_RUNTIME_SERVICES          *mInternalRT;\r
+BOOLEAN                       mHaveExitedBootServices = FALSE;\r
+EFI_REPORT_STATUS_CODE        mReportStatusCode = NULL;\r
+EFI_SMM_STATUS_CODE_PROTOCOL  *mSmmStatusCodeProtocol;\r
+\r
+/**\r
+  Locates and caches SMM Status Code Protocol.\r
\r
+**/\r
+VOID\r
+SmmStatusCodeInitialize (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS Status;\r
+\r
+  Status = gBS->LocateProtocol (&gEfiSmmStatusCodeProtocolGuid, NULL, (VOID **) &mSmmStatusCodeProtocol);\r
+  if (EFI_ERROR (Status)) {\r
+    mSmmStatusCodeProtocol = NULL;\r
+  }\r
+}\r
+\r
+/**\r
+  Report status code via SMM Status Code Protocol.\r
\r
+  @param  Type          Indicates the type of status code being reported.\r
+  @param  Value         Describes the current status of a hardware or software entity.  \r
+                        This included information about the class and subclass that is used to classify the entity \r
+                        as well as an operation.  For progress codes, the operation is the current activity. \r
+                        For error codes, it is the exception.  For debug codes, it is not defined at this time. \r
+  @param  Instance      The enumeration of a hardware or software entity within the system.  \r
+                        A system may contain multiple entities that match a class/subclass pairing. \r
+                        The instance differentiates between them.  An instance of 0 indicates that instance information is unavailable, \r
+                        not meaningful, or not relevant.  Valid instance numbers start with 1.\r
+  @param  CallerId      This optional parameter may be used to identify the caller. \r
+                        This parameter allows the status code driver to apply different rules to different callers. \r
+  @param  Data          This optional parameter may be used to pass additional data\r
\r
+  @retval EFI_SUCCESS   Always return EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+SmmStatusCodeReport (\r
+  IN EFI_STATUS_CODE_TYPE     Type,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 *CallerId OPTIONAL,\r
+  IN EFI_STATUS_CODE_DATA     *Data     OPTIONAL\r
+  )\r
+{\r
+  if (mSmmStatusCodeProtocol != NULL) {\r
+    (mSmmStatusCodeProtocol->ReportStatusCode) (mSmmStatusCodeProtocol, Type, Value, Instance, CallerId, Data);\r
+  }\r
+  return EFI_SUCCESS;\r
+}\r
 \r
 /**\r
   Locate the report status code service.\r
 \r
-  In SMM, it retrieves OemHookStatusCodeReport() from customized OEM Hook Status Code Lib.\r
+  In SMM, it tries to retrieve SMM Status Code Protocol.\r
   Otherwise, it first tries to retrieve ReportStatusCode() in Runtime Services Table.\r
   If not found, it then tries to retrieve ReportStatusCode() API of Report Status Code Protocol.\r
 \r
@@ -43,7 +95,7 @@ InternalGetReportStatusCode (
   EFI_STATUS                Status;\r
 \r
   if (mInSmm) {\r
-    return (EFI_REPORT_STATUS_CODE) OemHookStatusCodeReport;\r
+    return (EFI_REPORT_STATUS_CODE) SmmStatusCodeReport;\r
   } else if (mInternalRT != NULL && mInternalRT->Hdr.Revision < 0x20000) {\r
     return ((FRAMEWORK_EFI_RUNTIME_SERVICES*)mInternalRT)->ReportStatusCode;\r
   } else if (!mHaveExitedBootServices) {\r
@@ -187,7 +239,7 @@ ReportStatusCodeLibConstruct (
                            (VOID **) &mStatusCodeData\r
                            );\r
       ASSERT_EFI_ERROR (Status);\r
-      OemHookStatusCodeInitialize ();\r
+      SmmStatusCodeInitialize ();\r
       return EFI_SUCCESS;\r
     }\r
   }\r