]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h
Code Scrub for Status Code Runtime Dxe driver.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Dxe / DxeStatusCode.h
index 4004deb484c8386b36aeb4467675c699a0707d86..8fb5488a05f3cb3596f12d3af63481bebf38171d 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
+  Internal include file of Status Code Runtime DXE Driver.\r
 \r
-  Copyright (c) 2006, Intel Corporation\r
+  Copyright (c) 2006 - 2009, 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
@@ -11,8 +12,8 @@
 \r
 **/\r
 \r
-#ifndef __DXE_STATUS_CODE_H__\r
-#define __DXE_STATUS_CODE_H__\r
+#ifndef __STATUS_CODE_RUNTIME_DXE_H__\r
+#define __STATUS_CODE_RUNTIME_DXE_H__\r
 \r
 \r
 #include <FrameworkDxe.h>\r
 //\r
 // Data hub worker definition\r
 //\r
-#define MAX_NUMBER_DATAHUB_RECORDS                1000\r
-#define DATAHUB_BYTES_PER_RECORD                  EFI_STATUS_CODE_DATA_MAX_SIZE\r
-#define EMPTY_RECORD_TAG                          0xFF\r
 #define DATAHUB_STATUS_CODE_SIGNATURE             SIGNATURE_32 ('B', 'D', 'H', 'S')\r
 \r
-//\r
-// Address type of pointer.\r
-// The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture\r
-// Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,\r
-//\r
-typedef enum {\r
-  PHYSICAL_MODE,\r
-  VIRTUAL_MODE\r
-} PROCESSOR_MODE;\r
-\r
 typedef struct {\r
   UINTN       Signature;\r
   LIST_ENTRY  Node;\r
-\r
-  UINT8       Data[sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];\r
+  UINT8       Data[sizeof(DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];\r
 } DATAHUB_STATUSCODE_RECORD;\r
 \r
 \r
@@ -76,25 +63,43 @@ typedef struct {
   UINT32   MaxRecordsNumber;\r
 } RUNTIME_MEMORY_STATUSCODE_HEADER;\r
 \r
+extern RUNTIME_MEMORY_STATUSCODE_HEADER  *mRtMemoryStatusCodeTable;\r
 \r
-typedef struct {\r
-  //\r
-  // Report operation nest status.\r
-  // If it is set, then the report operation has nested.\r
-  //\r
-  UINT32                            StatusCodeNestStatus;\r
-  //\r
-  // Runtime status code management header, the records buffer is following it.\r
-  //\r
-  RUNTIME_MEMORY_STATUSCODE_HEADER  *RtMemoryStatusCodeTable[2];\r
-} DXE_STATUS_CODE_CONTROLLER;\r
+/**\r
+  Report status code to all supported device.\r
 \r
+  This function implements EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().\r
+  It calls into the workers which dispatches the platform specific listeners.\r
 \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\r
+                           classify the entity as well as an operation.\r
+  @param  Instance         The enumeration of a hardware or software entity within\r
+                           the system. 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\r
+                           different callers.\r
+  @param  Data             This optional parameter may be used to pass additional data.\r
 \r
-  Dispatch initialization request to sub status code devices based on\r
-  customized feature flags.\r
+  @retval EFI_SUCCESS      The function completed successfully\r
+  @retval EFI_DEVICE_ERROR The function should not be completed due to a device error.\r
 \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ReportDispatcher (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\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
+/**\r
+  Dispatch initialization request to sub status code devices based on \r
+  customized feature flags.\r
\r
 **/\r
 VOID\r
 InitializationDispatcherWorker (\r
@@ -103,9 +108,9 @@ InitializationDispatcherWorker (
 \r
 \r
 /**\r
-  Initialize serial status code worker.\r
-\r
-  @return  The function always return EFI_SUCCESS\r
+  Locates Serial I/O Protocol as initialization for serial status code worker.\r
\r
+  @retval EFI_SUCCESS  Serial I/O Protocol is successfully located.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -116,31 +121,21 @@ EfiSerialStatusCodeInitializeWorker (
 \r
 /**\r
   Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\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
-                        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
-                        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
-                        Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.\r
-\r
-\r
-  @param  Data          This optional parameter may be used to pass additional data\r
-\r
-  @retval EFI_SUCCESS         Success to report status code to serial I/O.\r
-  @retval EFI_DEVICE_ERROR    EFI serial device can not work after ExitBootService() is called .\r
\r
+  @param  CodeType         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\r
+                           classify the entity as well as an operation.\r
+  @param  Instance         The enumeration of a hardware or software entity within\r
+                           the system. 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\r
+                           different callers.\r
+  @param  Data             This optional parameter may be used to pass additional data.\r
+\r
+  @retval EFI_SUCCESS      Status code reported to serial I/O successfully.\r
+  @retval EFI_DEVICE_ERROR EFI serial device cannot work after ExitBootService() is called.\r
+  @retval EFI_DEVICE_ERROR EFI serial device cannot work with TPL higher than TPL_CALLBACK.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -153,9 +148,9 @@ SerialStatusCodeReportWorker (
   );\r
 \r
 /**\r
-  Initialize runtime memory status code.\r
-\r
-  @return  The function always return EFI_SUCCESS\r
+  Initialize runtime memory status code table as initialization for runtime memory status code worker\r
\r
+  @retval EFI_SUCCESS  Runtime memory status code table successfully initialized.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -164,42 +159,34 @@ RtMemoryStatusCodeInitializeWorker (
   );\r
 \r
 /**\r
-  Report status code into runtime memory. If the runtime pool is full, roll back to the\r
+  Report status code into runtime memory. If the runtime pool is full, roll back to the \r
   first record and overwrite it.\r
-\r
-  @param  RtMemoryStatusCodeTable\r
-                        Point to Runtime memory table header.\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
-                        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
-                        not meaningful, or not relevant.  Valid instance numbers start with 1.\r
-\r
-  @return               The function always return EFI_SUCCESS.\r
\r
+  @param  CodeType                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\r
+                                  classify the entity as well as an operation.\r
+  @param  Instance                The enumeration of a hardware or software entity within\r
+                                  the system. 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\r
+                                  different callers.\r
\r
+  @retval EFI_SUCCESS             Status code successfully recorded in runtime memory status code table.\r
 \r
 **/\r
 EFI_STATUS\r
 RtMemoryStatusCodeReportWorker (\r
-  RUNTIME_MEMORY_STATUSCODE_HEADER      *RtMemoryStatusCodeTable,\r
   IN EFI_STATUS_CODE_TYPE               CodeType,\r
   IN EFI_STATUS_CODE_VALUE              Value,\r
   IN UINT32                             Instance\r
   );\r
 \r
 /**\r
-  Initialize data hubstatus code.\r
-  Create a data hub listener.\r
+  Locate Data Hub Protocol and create event for logging data\r
+  as initialization for data hub status code worker.\r
 \r
-  @return  The function always return EFI_SUCCESS\r
+  @retval EFI_SUCCESS  Initialization is successful.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -211,31 +198,21 @@ DataHubStatusCodeInitializeWorker (
 /**\r
   Report status code into DataHub.\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
-                        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
-                        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
-                        Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0 Specification.\r
-\r
-\r
-  @param  Data          This optional parameter may be used to pass additional data\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
+  @param  CodeType             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\r
+                               classify the entity as well as an operation.\r
+  @param  Instance             The enumeration of a hardware or software entity within\r
+                               the system. 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\r
+                               different callers.\r
+  @param  Data                 This optional parameter may be used to pass additional data.\r
+\r
+  @retval EFI_SUCCESS          The function completed successfully.\r
+  @retval EFI_DEVICE_ERROR     Function is reentered.\r
+  @retval EFI_DEVICE_ERROR     Function is called at runtime.\r
+  @retval EFI_OUT_OF_RESOURCES Fail to allocate memory for free record buffer.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -248,9 +225,15 @@ DataHubStatusCodeReportWorker (
   );\r
 \r
 \r
-//\r
-// Declaration for callback Event.\r
-//\r
+/**\r
+  Virtual address change notification call back. It converts global pointer\r
+  to virtual address.\r
+\r
+  @param  Event         Event whose notification function is being invoked.\r
+  @param  Context       Pointer to the notification function's context, which is\r
+                        always zero in current implementation.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 VirtualAddressChangeCallBack (\r
@@ -258,18 +241,4 @@ VirtualAddressChangeCallBack (
   IN VOID       *Context\r
   );\r
 \r
-//\r
-// Declaration for original Entry Point.\r
-//\r
-EFI_STATUS\r
-EFIAPI\r
-DxeStatusCodeDriverEntry (\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
-  );\r
-\r
-//\r
-// declaration of DXE status code controller.\r
-//\r
-extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode;\r
 #endif\r