]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c
Remove CommonHeader.h in StatusCodeDxe.
[mirror_edk2.git] / EdkModulePkg / Universal / StatusCode / Dxe / DataHubStatusCodeWorker.c
index 85e552bac0433924fd5cb39db6de3b21f5670905..737bc8a3a1182dae805e92da46cba68f411fce2c 100644 (file)
@@ -1,18 +1,20 @@
 /** @file\r
   Data Hub status code worker in DXE.\r
 \r
-  Copyright (c) 2006, Intel Corporation                                                         \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
-  http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                            \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  Copyright (c) 2006, Intel Corporation\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
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
   Module Name:  DataHubStatusCodeWorker.c\r
 \r
 **/\r
+\r
+#include <Common/StatusCode.h>\r
 #include "DxeStatusCode.h"\r
 \r
 //\r
@@ -33,15 +35,15 @@ EFI_DATA_HUB_PROTOCOL     *mDataHubProtocol;
 \r
 /**\r
   Return one DATAHUB_STATUSCODE_RECORD space.\r
-  The size of free record pool would be extend, if the pool is empty. \r
+  The size of free record pool would be extend, if the pool is empty.\r
+\r
 \r
\r
   @retval  NULL   Can not allocate free memeory for record.\r
   @retval  !NULL  Point to buffer of record.\r
 \r
 **/\r
 STATIC\r
-DATAHUB_STATUSCODE_RECORD *\r
+DATA_HUB_STATUS_CODE_DATA_RECORD *\r
 AcquireRecordBuffer (\r
   VOID\r
   )\r
@@ -51,7 +53,7 @@ AcquireRecordBuffer (
   LIST_ENTRY                *Node;\r
   UINT32                    Index;\r
 \r
-  CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);\r
+  CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
 \r
   if (!IsListEmpty (&mRecordsBuffer)) {\r
     Node = GetFirstNode (&mRecordsBuffer);\r
@@ -59,7 +61,7 @@ AcquireRecordBuffer (
 \r
     Record = _CR (Node, DATAHUB_STATUSCODE_RECORD, Node);\r
   } else {\r
-    if (CurrentTpl > EFI_TPL_NOTIFY) {\r
+    if (CurrentTpl > TPL_NOTIFY) {\r
       gBS->RestoreTPL (CurrentTpl);\r
       return NULL;\r
     }\r
@@ -70,7 +72,7 @@ AcquireRecordBuffer (
       return NULL;\r
     }\r
 \r
-    CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);\r
+    CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
     for (Index = 1; Index < 16; Index++) {\r
       InsertTailList (&mRecordsBuffer, &Record[Index].Node);\r
     }\r
@@ -81,29 +83,30 @@ AcquireRecordBuffer (
 \r
   gBS->RestoreTPL (CurrentTpl);\r
 \r
-  return Record;\r
+  return (DATA_HUB_STATUS_CODE_DATA_RECORD *) (Record->Data);\r
 }\r
 \r
 \r
 /**\r
-  Retrieve one record from Records FIFO. The record would be removed from FIFO and \r
+  Retrieve one record from Records FIFO. The record would be removed from FIFO and\r
   release to free record buffer.\r
 \r
   @return   !NULL   Point to record, which is ready to be logged.\r
   @return   NULL    the FIFO of record is empty.\r
\r
+\r
 **/\r
 STATIC\r
-DATAHUB_STATUSCODE_RECORD *\r
+DATA_HUB_STATUS_CODE_DATA_RECORD *\r
 RetrieveRecord (\r
   VOID\r
   )\r
 {\r
-  DATAHUB_STATUSCODE_RECORD   *Record = NULL;\r
-  LIST_ENTRY                  *Node;\r
-  EFI_TPL                     CurrentTpl;\r
+  DATA_HUB_STATUS_CODE_DATA_RECORD  *RecordData = NULL;\r
+  DATAHUB_STATUSCODE_RECORD         *Record;\r
+  LIST_ENTRY                        *Node;\r
+  EFI_TPL                           CurrentTpl;\r
 \r
-  CurrentTpl = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);\r
+  CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
 \r
   if (!IsListEmpty (&mRecordsFifo)) {\r
     Node = GetFirstNode (&mRecordsFifo);\r
@@ -112,39 +115,40 @@ RetrieveRecord (
     RemoveEntryList (&Record->Node);\r
     InsertTailList (&mRecordsBuffer, &Record->Node);\r
     Record->Signature = 0;\r
+    RecordData = (DATA_HUB_STATUS_CODE_DATA_RECORD *) Record->Data;\r
   }\r
 \r
   gBS->RestoreTPL (CurrentTpl);\r
 \r
-  return Record;\r
+  return RecordData;\r
 }\r
 \r
 \r
 /**\r
   Report status code into DataHub.\r
\r
+\r
   @param  CodeType      Indicates the type of status code being reported.  Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
\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
-                        Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.  \r
+\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
+                        Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.\r
                         Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
\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
+\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
 \r
 \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  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
                         Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.\r
 \r
 \r
   @param  Data          This optional parameter may be used to pass additional data\r
\r
+\r
   @retval EFI_OUT_OF_RESOURCES   Can not acquire record buffer.\r
   @retval EFI_DEVICE_ERROR       EFI serial device can not work after ExitBootService() is called .\r
   @retval EFI_SUCCESS            Success to cache status code and signal log data event.\r
@@ -159,11 +163,11 @@ DataHubStatusCodeReportWorker (
   IN EFI_STATUS_CODE_DATA     *Data OPTIONAL\r
   )\r
 {\r
-  DATAHUB_STATUSCODE_RECORD  *Record;\r
-  UINT32                     ErrorLevel;\r
-  VA_LIST                    Marker;\r
-  CHAR8                      *Format;\r
-  UINTN                      CharCount;\r
+  DATA_HUB_STATUS_CODE_DATA_RECORD  *Record;\r
+  UINT32                            ErrorLevel;\r
+  VA_LIST                           Marker;\r
+  CHAR8                             *Format;\r
+  UINTN                             CharCount;\r
 \r
   //\r
   // See whether in runtime phase or not.\r
@@ -193,7 +197,7 @@ DataHubStatusCodeReportWorker (
   if (Data != NULL) {\r
     if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
       CharCount = UnicodeVSPrintAsciiFormat (\r
-                    (CHAR16 *) Record->ExtendData,\r
+                    (CHAR16 *) (Record + 1),\r
                     EFI_STATUS_CODE_DATA_MAX_SIZE,\r
                     Format,\r
                     Marker\r
@@ -201,7 +205,7 @@ DataHubStatusCodeReportWorker (
       //\r
       // Change record data type from DebugType to String Type.\r
       //\r
-      CopyGuid (&Record->Data.Type, &gEfiStatusCodeDataTypeStringGuid);\r
+      CopyGuid (&Record->Data.Type, &gEfiStatusCodeDataTypeDebugGuid);\r
       Record->Data.HeaderSize = Data->HeaderSize;\r
       Record->Data.Size = (UINT16) ((CharCount + 1) * sizeof (CHAR16));\r
     } else {\r
@@ -212,8 +216,8 @@ DataHubStatusCodeReportWorker (
 \r
       if (Data->Size > EFI_STATUS_CODE_DATA_MAX_SIZE) {\r
         Record->Data.Size = EFI_STATUS_CODE_DATA_MAX_SIZE;\r
-      } \r
-      CopyMem (Record->ExtendData, Data + 1, Record->Data.Size);\r
+      }\r
+      CopyMem ((VOID *) (Record + 1), Data + 1, Record->Data.Size);\r
     }\r
   }\r
 \r
@@ -239,7 +243,7 @@ LogDataHubEventCallBack (
   IN  VOID          *Context\r
   )\r
 {\r
-  DATAHUB_STATUSCODE_RECORD         *Record;\r
+  DATA_HUB_STATUS_CODE_DATA_RECORD  *Record;\r
   UINT32                            Size;\r
   UINT64                            DataRecordClass;\r
 \r
@@ -255,7 +259,7 @@ LogDataHubEventCallBack (
     //\r
     // Add in the size of the header we added.\r
     //\r
-    Size = sizeof (DATAHUB_STATUSCODE_RECORD) + (UINT32) Record->Data.Size;\r
+    Size = sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + (UINT32) Record->Data.Size;\r
 \r
     if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
       DataRecordClass = EFI_DATA_RECORD_CLASS_PROGRESS_CODE;\r
@@ -276,7 +280,7 @@ LogDataHubEventCallBack (
     //\r
     // Log DataRecord in Data Hub\r
     //\r
-    \r
+\r
     mDataHubProtocol->LogData (\r
                         mDataHubProtocol,\r
                         &gEfiStatusCodeGuid,\r
@@ -293,7 +297,7 @@ LogDataHubEventCallBack (
 /**\r
   Initialize data hubstatus code.\r
   Create a data hub listener.\r
\r
+\r
   @return  The function always return EFI_SUCCESS\r
 \r
 **/\r
@@ -315,8 +319,8 @@ DataHubStatusCodeInitializeWorker (
   // Create a Notify Event to log data in Data Hub\r
   //\r
   Status = gBS->CreateEvent (\r
-                  EFI_EVENT_NOTIFY_SIGNAL,\r
-                  EFI_TPL_CALLBACK,\r
+                  EVT_NOTIFY_SIGNAL,\r
+                  TPL_CALLBACK,\r
                   LogDataHubEventCallBack,\r
                   NULL,\r
                   &mLogDataHubEvent\r