]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Leverages SMM Status Code Protocol, instead of OemHookStatusCodeLib.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 10 Feb 2010 03:41:24 +0000 (03:41 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 10 Feb 2010 03:41:24 +0000 (03:41 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9962 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLibInternal.h
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c

index f241cd1bc92839ce1ce9483dd45ae04451552597..74318220ffa43fb75dde4ea93cf33f737b7c71d2 100644 (file)
@@ -2,7 +2,7 @@
   Internal Header file of Report Status Code Library for RUNTIME\r
   DXE Phase.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2010, Intel Corporation<BR>\r
   All rights reserved. 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
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DevicePathLib.h>\r
-#include <Library/OemHookStatusCodeLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 \r
 #include <Guid/StatusCodeDataTypeId.h>\r
 #include <Guid/StatusCodeDataTypeDebug.h>\r
 #include <Guid/EventGroup.h>\r
 \r
+#include <Protocol/SmmStatusCode.h>\r
 #include <Protocol/StatusCode.h>\r
 #include <Protocol/SmmBase.h>\r
 \r
 \r
 extern EFI_STATUS_CODE_DATA    *mStatusCodeData;\r
 \r
-/**\r
-  Locate the report status code service.\r
-\r
-  In SMM, it retrieves OemHookStatusCodeReport() from customized OEM Hook Status Code Lib.\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
-  @return   Function pointer to the report status code service.\r
-            NULL is returned if no status code service is available.\r
-\r
-**/\r
-EFI_REPORT_STATUS_CODE\r
-InternalGetReportStatusCode (\r
-  VOID\r
-  );\r
-\r
 /**\r
   Internal worker function that reports a status code through the status code service.\r
 \r
index 94f642b65a0a8009aa7c55d1c0cb5ee223364ceb..c6a0a4206f72c706fa2cfd86d596653fe3563667 100644 (file)
@@ -2,10 +2,10 @@
 #  Report status code library instance which supports logging message in SMM, as well as DXE & runtime phase.\r
 #\r
 #  This library instance supports status code report in SMM, as well as DXE & runtime phase.\r
-#  In SMM, it logs message via customized OemHookStatusCodeLib.\r
+#  In SMM, it logs message via SMM Status Code Protocol.\r
 #  Otherwise, it logs message to ReportStatusCode() in framework runtime services table or runtime report status code protocol.\r
 #\r
-#  Copyright (c) 2006 - 2009, Intel Corporation.\r
+#  Copyright (c) 2006 - 2010, Intel Corporation.\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -33,7 +33,7 @@
 #  VALID_ARCHITECTURES           = IA32 X64 EBC\r
 #\r
 \r
-[Sources.common]\r
+[Sources]\r
   ReportStatusCodeLib.c\r
   SmmRuntimeDxeSupport.c\r
   ReportStatusCodeLibInternal.h\r
@@ -52,7 +52,6 @@
   DebugLib\r
   UefiRuntimeServicesTableLib\r
   UefiBootServicesTableLib\r
-  OemHookStatusCodeLib\r
   DevicePathLib\r
   MemoryAllocationLib\r
 \r
@@ -66,8 +65,8 @@
 [Protocols]\r
   gEfiStatusCodeRuntimeProtocolGuid             ## CONSUMES\r
   gEfiSmmBaseProtocolGuid                       ## CONSUMES\r
+  gEfiSmmStatusCodeProtocolGuid                 ## CONSUMES\r
 \r
-\r
-[Pcd.common]\r
+[Pcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask\r
 \r
index 089b9c5db2a1d143503a5f5b99f95ecfaf0e8b2a..a5384b444b3d93891f1044960e5d20cad6a9cdf1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Library constructor & destructor, event handlers, and other internal worker functions.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2010, Intel Corporation<BR>\r
   All rights reserved. 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
 \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