Follow up tracker:
authoryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Sep 2006 05:37:49 +0000 (05:37 +0000)
committeryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 1 Sep 2006 05:37:49 +0000 (05:37 +0000)
EDKT236, EDKT237, EDKT232, EDKT229 , EDKT233

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1418 6f19259b-4bc3-4df7-8a09-765794883524

13 files changed:
EdkModulePkg/Include/Library/OemHookStatusCodeLib.h
EdkModulePkg/Include/Library/SerialPortLib.h
EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/OemHookStatusCodeLibNull.c
EdkModulePkg/Universal/StatusCode/Dxe/Common/DxeStatusCodeCommon.c
EdkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c
EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.msa
EdkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c
EdkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c
EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c
EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa
EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c

index 2d172259f5b36f2c9f1fe0a220d1cd88a7277a99..3de7551ceb92141554a7f04407f5ce48dbb8419e 100644 (file)
 \r
   Initialize OEM status code device .\r
 \r
+\r
+  @return    Status of initialization of OEM status code device.\r
\r
 **/\r
-VOID\r
+EFI_STATUS\r
 EFIAPI\r
 OemHookStatusCodeInitialize (\r
   VOID\r
index 8fe04e9a7dda8f147b5b3a9deef6ae356b3641f0..cda5ad17dba0d9d5d4bbc75dda880433b8d8def5 100644 (file)
@@ -22,6 +22,8 @@
 \r
   Programmed hardware of Serial port.\r
 \r
+  @return  Status of Serial Port Device initialization.\r
+\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
index 12988d01bac515803648524b4b4dc406b0071561..98c98cc9d025fd186f701fc3deb5ce0ddfd3226f 100644 (file)
 \r
   Initialize OEM status code device .\r
 \r
+  @return     Always return EFI_SUCCESS.\r
+\r
 **/\r
-VOID\r
+EFI_STATUS\r
 EFIAPI\r
 OemHookStatusCodeInitialize (\r
   VOID\r
   )\r
 {\r
-  return;\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -53,7 +55,7 @@ OemHookStatusCodeInitialize (
 \r
   @param  Data          This optional parameter may be used to pass additional data\r
  \r
-  @return               The function always return EFI_SUCCESS.\r
+  @return               The function always return EFI_UNSUPPORTED.\r
 \r
 **/\r
 EFI_STATUS\r
index 1249284d5dd454dcb77963b56a809bf2834de04c..06a4814375bac22839d2a3604f6403f170b64b82 100644 (file)
@@ -52,7 +52,8 @@ ReportDispatcher (
 \r
 //\r
 // Declaration of status code protocol.\r
-// \r
+//\r
+STATIC\r
 EFI_STATUS_CODE_PROTOCOL  mEfiStatusCodeProtocol  = {\r
   ReportDispatcher\r
 };\r
index 03095c38198378abf82bcb8ec235300036b21345..11793b52aead2a40c5a75776a1875aad8da0c4b1 100644 (file)
 //\r
 // Initialize FIFO to cache records.\r
 //\r
+STATIC \r
 EFI_LOCK                  mFifoLock        = EFI_INITIALIZE_LOCK_VARIABLE  (EFI_TPL_HIGH_LEVEL);\r
+STATIC\r
 LIST_ENTRY                mRecordsFifo     = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsFifo);\r
+STATIC\r
 UINTN                     mNumberOfRecords = 0;\r
-\r
+STATIC\r
 EFI_EVENT                 mLogDataHubEvent;\r
 //\r
 // Cache data hub protocol.\r
 //\r
+STATIC\r
 EFI_DATA_HUB_PROTOCOL     *mDataHubProtocol;\r
 \r
 \r
index e0acb1fd432d64172693e254dfc6f880d6b31eae..c119cf751b59b621f30b10e07505bddb70dce8d6 100644 (file)
@@ -40,6 +40,7 @@ InitializationDispatcherWorker (
   )\r
 {\r
   EFI_PEI_HOB_POINTERS              Hob;\r
+  EFI_STATUS                        Status;\r
   MEMORY_STATUSCODE_PACKET_HEADER   *PacketHeader;\r
   MEMORY_STATUSCODE_RECORD          *Record;\r
   UINTN                             ExpectedPacketIndex = 0;\r
@@ -52,19 +53,24 @@ InitializationDispatcherWorker (
   // if enable UseDataHub, then initialize data hub status code worker.\r
   //\r
   if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
-    EfiSerialStatusCodeInitializeWorker ();\r
+    Status = EfiSerialStatusCodeInitializeWorker ();\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {\r
-    SerialPortInitialize ();\r
+    Status = SerialPortInitialize ();\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {\r
-    RtMemoryStatusCodeInitializeWorker ();\r
+    Status = RtMemoryStatusCodeInitializeWorker ();\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
-    DataHubStatusCodeInitializeWorker ();\r
+    Status = DataHubStatusCodeInitializeWorker ();\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
-    OemHookStatusCodeInitialize ();\r
+    Status = OemHookStatusCodeInitialize ();\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
 \r
   //\r
index 0443847c11453674d4205a6e4d5b15a59f662a97..3eb28b19b9e8d38da0e62af3049ccdd85ba8f8e7 100644 (file)
@@ -119,6 +119,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <GuidCNames Usage="SOMETIMES_CONSUMED">\r
       <GuidCName>gEfiStatusCodeDataTypeStringGuid</GuidCName>\r
     </GuidCNames>\r
+    <GuidCNames Usage="SOMETIMES_CONSUMED">\r
+      <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>\r
+    </GuidCNames>\r
     <GuidCNames Usage="SOMETIMES_CONSUMED">\r
       <GuidCName>gEfiStatusCodeGuid</GuidCName>\r
     </GuidCNames>\r
index 01cc172a46eb100cd8355bd76f1235683b178487..c0c9edd93960b943d4f410b7708e1ab0348be536 100644 (file)
@@ -34,7 +34,9 @@ RtMemoryStatusCodeInitializeWorker (
   //\r
   RtMemoryStatusCodeTable = \r
     (RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocatePool (\r
-                                           sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) + PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024\r
+                                           sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +\r
+                                           PcdGet16 (PcdStatusCodeRuntimeMemorySize) *\r
+                                           1024\r
                                            );\r
 \r
   ASSERT (NULL != RtMemoryStatusCodeTable);\r
@@ -111,7 +113,6 @@ RtMemoryStatusCodeReportWorker (
     RtMemoryStatusCodeTable->RecordIndex = 0;\r
   }\r
 \r
-\r
   return EFI_SUCCESS;\r
 }\r
 \r
index 256ff03b7a2ba7567ad03ef79ed504fa8cb24f78..a5fbf236782a93fbaa78c7d7011f244c96e40ad7 100644 (file)
@@ -15,7 +15,8 @@
 \r
 **/\r
 \r
-EFI_SERIAL_IO_PROTOCOL *SerialIoProtocol;\r
+STATIC\r
+EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;\r
 \r
 /**\r
   Initialize serial status code worker.\r
@@ -33,7 +34,7 @@ EfiSerialStatusCodeInitializeWorker (
   Status = gBS->LocateProtocol (\r
             &gEfiSerialIoProtocolGuid,\r
             NULL,\r
-            (VOID **) &SerialIoProtocol\r
+            (VOID **) &mSerialIoProtocol\r
             );\r
 \r
   ASSERT_EFI_ERROR (Status);\r
@@ -67,7 +68,8 @@ EfiSerialStatusCodeInitializeWorker (
 \r
   @param  Data          This optional parameter may be used to pass additional data\r
  \r
-  @return               The function always return EFI_SUCCESS.\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
 **/\r
 EFI_STATUS\r
@@ -89,6 +91,11 @@ SerialStatusCodeReportWorker (
   VA_LIST         Marker;\r
   EFI_DEBUG_INFO  *DebugInfo;\r
 \r
+\r
+  if (FeaturePcdGet (PcdStatusCodeUseEfiSerial) && EfiAtRuntime ()) {\r
+    return EFI_DEVICE_ERROR;\r
+  }\r
+\r
   Buffer[0] = '\0';\r
 \r
   if (Data != NULL &&\r
@@ -130,10 +137,18 @@ SerialStatusCodeReportWorker (
     //\r
     // Print ERROR information into output buffer.\r
     //\r
-    CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "ERROR: C%x:V%x I%x", CodeType, Value, Instance);\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
+                  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
+    // Make sure we don't try to print values that weren't \r
+    // intended to be printed, especially NULL GUID pointers.\r
     //\r
     \r
     if (CallerId != NULL) {\r
@@ -145,7 +160,7 @@ SerialStatusCodeReportWorker (
                      );\r
     }\r
 \r
-    if (Data) {\r
+    if (Data != NULL) {\r
       CharCount += AsciiSPrint (\r
                      &Buffer[CharCount - 1],\r
                      (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
@@ -160,9 +175,22 @@ SerialStatusCodeReportWorker (
                    "\n\r"\r
                    );\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
-    CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "PROGRESS CODE: V%x I%x\n\r", Value, Instance);\r
+    CharCount = AsciiSPrint (\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 (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "Undefined: C%x:V%x I%x\n\r", CodeType, Value, Instance);\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
+                  Instance\r
+                  );\r
   }\r
 \r
 \r
@@ -173,8 +201,8 @@ SerialStatusCodeReportWorker (
     SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {\r
-    SerialIoProtocol->Write (\r
-      SerialIoProtocol,\r
+    mSerialIoProtocol->Write (\r
+      mSerialIoProtocol,\r
       &CharCount,\r
       Buffer\r
       );\r
index bffcd3d71fca3d46a332beefa4d0baa1a06b054c..5614d80c6a7feb3dde41a9e341fc6a1b3936ed2a 100644 (file)
@@ -20,7 +20,7 @@
 \r
   @param   PacketIndex    Index of records packet. \r
  \r
-  @return                 The function always return EFI_SUCCESS\r
+  @return                 Always return pointer of memory status code packet.\r
 \r
 **/\r
 MEMORY_STATUSCODE_PACKET_HEADER *\r
@@ -36,7 +36,10 @@ CreateMemoryStatusCodePacket (
   PacketHeader =\r
     (MEMORY_STATUSCODE_PACKET_HEADER *) BuildGuidHob (\r
                                           &gMemoryStatusCodeRecordGuid, \r
-                                          (PcdGet16 (PcdStatusCodeMemorySize) * 1024) + sizeof (MEMORY_STATUSCODE_PACKET_HEADER));\r
+                                          PcdGet16 (PcdStatusCodeMemorySize) * \r
+                                          1024 +\r
+                                          sizeof (MEMORY_STATUSCODE_PACKET_HEADER)\r
+                                          );\r
   ASSERT (PacketHeader != NULL);\r
 \r
   PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024)/ sizeof (MEMORY_STATUSCODE_RECORD);\r
index 3de5f58cf395f51f5b23a403c85efff7d6edbaf9..bbe16c70cb9fcbcfc2f4fddf1b269e48e1e68e47 100644 (file)
@@ -19,8 +19,8 @@
 \r
 /**\r
   Report status code to all supported device.\r
- * \r
- * \r
+  \r
+  \r
   @param  PeiServices\r
 \r
   @param  Type          Indicates the type of status code being reported.  \r
@@ -53,11 +53,12 @@ ReportDispatcher (
   IN EFI_STATUS_CODE_DATA     *Data OPTIONAL\r
   );\r
 \r
-\r
+STATIC\r
 EFI_PEI_PROGRESS_CODE_PPI     mStatusCodePpi           = { \r
   ReportDispatcher\r
   };\r
 \r
+STATIC\r
 EFI_PEI_PPI_DESCRIPTOR        mStatusCodePpiDescriptor = {\r
   EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
   &gEfiPeiStatusCodePpiGuid,\r
@@ -66,8 +67,8 @@ EFI_PEI_PPI_DESCRIPTOR        mStatusCodePpiDescriptor = {
 \r
 /**\r
   Report status code to all supported device.\r
- * \r
- * \r
+  \r
+  \r
   @param  PeiServices\r
 \r
   @param  CodeType      Indicates the type of status code being reported.  \r
@@ -154,13 +155,16 @@ PeiStatusCodeDriverEntry (
   // if enable UseOEM, then initialize Oem status code.\r
   //\r
   if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
-    SerialPortInitialize();\r
+    Status = SerialPortInitialize();\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
-    MemoryStatusCodeInitializeWorker ();\r
+    Status = MemoryStatusCodeInitializeWorker ();\r
+    ASSERT_EFI_ERROR  (Status);\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
-    OemHookStatusCodeInitialize ();\r
+    Status = OemHookStatusCodeInitialize ();\r
+    ASSERT_EFI_ERROR  (Status);\r
   }\r
 \r
   //\r
index 91579b8c9a1e0091762311d0466309c3d06e0736..100b52a74dea276ba1febb6ddf425432ac131a8e 100644 (file)
@@ -75,6 +75,9 @@
     <GuidCNames Usage="SOMETIMES_CONSUMED">\r
       <GuidCName>gMemoryStatusCodeRecordGuid</GuidCName>\r
     </GuidCNames>\r
+    <GuidCNames Usage="SOMETIMES_CONSUMED">\r
+      <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>\r
+    </GuidCNames>\r
   </Guids>\r
   <Externs>\r
     <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
index 3f4ed2ecaf22357b828d7a9c1903261a919478f2..a5dbfa404b31707276a5adbd01a10638347c65f4 100644 (file)
@@ -103,7 +103,14 @@ SerialStatusCodeReportWorker (
     //\r
     // Print ERROR information into output buffer.\r
     //\r
-    CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "ERROR: C%x:V%x I%x", CodeType, Value, Instance);\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
+                  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
@@ -133,9 +140,22 @@ SerialStatusCodeReportWorker (
                    "\n\r"\r
                    );\r
   } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
-    CharCount = AsciiSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "PROGRESS CODE: V%x I%x\n\r", Value, Instance);\r
+    CharCount = AsciiSPrint (\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 (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, "Undefined: C%x:V%x I%x\n\r", CodeType, Value, Instance);\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
+                  Instance\r
+                  );\r
   }\r
 \r
   //\r