]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
1. Clean up DxeNt32OemHookStatusCodeLib.inf and PeiNt32OemHookStatusCodeLib.inf
[mirror_edk2.git] / Nt32Pkg / Library / PeiNt32OemHookStatusCodeLib / Nt32OemHookStatusCodeLib.c
index fcab1036f411cb75663238e3746e66c9cefbf675..599c9c775164bbf38d37f8937ed2ec98d357823d 100644 (file)
 **/\r
 \r
 //\r
 **/\r
 \r
 //\r
-// Include common header file for this module.\r
+// The package level header files this module uses\r
 //\r
 //\r
-#include "CommonHeader.h"\r
+#include <FrameworkPei.h>\r
+#include <WinNtPeim.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Guid/StatusCodeDataTypeId.h>\r
+#include <Ppi/NtThunk.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/OemHookStatusCodeLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+#include <Library/PeiServicesLib.h>\r
 \r
 //\r
 \r
 //\r
-// Cache of WinNtThunk protocol \r
+// Cache of WinNtThunk protocol\r
 //\r
 STATIC\r
 EFI_WIN_NT_THUNK_PROTOCOL   *mWinNt;\r
 \r
 //\r
 //\r
 STATIC\r
 EFI_WIN_NT_THUNK_PROTOCOL   *mWinNt;\r
 \r
 //\r
-// Cache of standard output handle . \r
+// Cache of standard output handle .\r
 //\r
 STATIC\r
 HANDLE                      mStdOut;\r
 //\r
 STATIC\r
 HANDLE                      mStdOut;\r
@@ -47,7 +62,7 @@ OemHookStatusCodeInitialize (
   PEI_NT_THUNK_PPI  *NtThunkPpi;\r
   EFI_STATUS        Status;\r
 \r
   PEI_NT_THUNK_PPI  *NtThunkPpi;\r
   EFI_STATUS        Status;\r
 \r
-  \r
+\r
   //\r
   // Locate NtThunkPpi for retrieving standard output handle\r
   //\r
   //\r
   // Locate NtThunkPpi for retrieving standard output handle\r
   //\r
@@ -61,7 +76,7 @@ OemHookStatusCodeInitialize (
   ASSERT_EFI_ERROR (Status);\r
 \r
   mWinNt  = (EFI_WIN_NT_THUNK_PROTOCOL *) NtThunkPpi->NtThunk ();\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   mWinNt  = (EFI_WIN_NT_THUNK_PROTOCOL *) NtThunkPpi->NtThunk ();\r
-  \r
+\r
 \r
   //\r
   // Cache standard output handle.\r
 \r
   //\r
   // Cache standard output handle.\r
@@ -73,29 +88,29 @@ OemHookStatusCodeInitialize (
 \r
 /**\r
   Report status code to OEM device.\r
 \r
 /**\r
   Report status code to OEM device.\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
   @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
                         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
                         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
                         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
   @return               The function always return EFI_SUCCESS.\r
 \r
 **/\r
   @return               The function always return EFI_SUCCESS.\r
 \r
 **/\r
@@ -154,12 +169,12 @@ OemHookStatusCodeReport (
     // Print DEBUG() information into output buffer.\r
     //\r
     CharCount = AsciiVSPrint (\r
     // Print DEBUG() information into output buffer.\r
     //\r
     CharCount = AsciiVSPrint (\r
-                  Buffer, \r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
-                  Format, \r
+                  Buffer,\r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  Format,\r
                   Marker\r
                   );\r
                   Marker\r
                   );\r
-  } else if (Data != NULL && \r
+  } else if (Data != NULL &&\r
              CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&\r
              (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
     //\r
              CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&\r
              (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
     //\r
@@ -175,18 +190,18 @@ OemHookStatusCodeReport (
     // Print ERROR information into output buffer.\r
     //\r
     CharCount = AsciiSPrint (\r
     // Print ERROR information into output buffer.\r
     //\r
     CharCount = AsciiSPrint (\r
-                  Buffer, \r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
-                  "ERROR: C%x:V%x I%x", \r
-                  CodeType, \r
-                  Value, \r
+                  Buffer,\r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  "ERROR: C%x:V%x I%x",\r
+                  CodeType,\r
+                  Value,\r
                   Instance\r
                   );\r
 \r
     //\r
     // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.\r
     //\r
                   Instance\r
                   );\r
 \r
     //\r
     // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.\r
     //\r
-    \r
+\r
     if (CallerId != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
     if (CallerId != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
@@ -212,19 +227,19 @@ OemHookStatusCodeReport (
                    );\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
     CharCount = AsciiSPrint (\r
                    );\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
     CharCount = AsciiSPrint (\r
-                  Buffer, \r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
-                  "PROGRESS CODE: V%x I%x\n\r", \r
-                  Value, \r
+                  Buffer,\r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  "PROGRESS CODE: V%x I%x\n\r",\r
+                  Value,\r
                   Instance\r
                   );\r
   } else {\r
     CharCount = AsciiSPrint (\r
                   Instance\r
                   );\r
   } else {\r
     CharCount = AsciiSPrint (\r
-                  Buffer, \r
-                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
-                  "Undefined: C%x:V%x I%x\n\r", \r
-                  CodeType, \r
-                  Value, \r
+                  Buffer,\r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  "Undefined: C%x:V%x I%x\n\r",\r
+                  CodeType,\r
+                  Value,\r
                   Instance\r
                   );\r
   }\r
                   Instance\r
                   );\r
   }\r