]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c
Reviewed the code comments in the Include/Protocol directory for typos, grammar issue...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / Pei / MemoryStausCodeWorker.c
index 195e3e2183304d58f6de3452ad01e528d4f3e10c..446f70f8fe4064d8ca5ac8defe75e8e7294a35ba 100644 (file)
@@ -1,36 +1,28 @@
 /** @file\r
-  Memory status code worker in PEI.\r
+  PEI memory status code worker.\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 - 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
+  http://opensource.org/licenses/bsd-license.php\r
 \r
-  Module Name:  MemoryStatusCodeWorker.c\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
 **/\r
 \r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-#include "PeiStatusCode.h"\r
+#include "StatusCodePei.h"\r
 \r
 /**\r
-  Create one memory status code GUID'ed HOB, use PacketIndex \r
-  to identify the packet.\r
+  Worker function to create one memory status code GUID'ed HOB,\r
+  using PacketIndex to identify the packet.\r
+\r
+  @param   PacketIndex    Index of records packet.\r
 \r
-  @param   PacketIndex    Index of records packet. \r
\r
-  @return                 Always return pointer of memory status code packet.\r
+  @return  Pointer to the memory status code packet.\r
 \r
 **/\r
-STATIC\r
 MEMORY_STATUSCODE_PACKET_HEADER *\r
 CreateMemoryStatusCodePacket (\r
   UINT16 PacketIndex\r
@@ -41,30 +33,23 @@ CreateMemoryStatusCodePacket (
   //\r
   // Build GUID'ed HOB with PCD defined size.\r
   //\r
-  PacketHeader =\r
-    (MEMORY_STATUSCODE_PACKET_HEADER *) BuildGuidHob (\r
-                                          &gMemoryStatusCodeRecordGuid, \r
-                                          PcdGet16 (PcdStatusCodeMemorySize) * \r
-                                          1024 +\r
-                                          sizeof (MEMORY_STATUSCODE_PACKET_HEADER)\r
-                                          );\r
+  PacketHeader = BuildGuidHob (\r
+                   &gMemoryStatusCodeRecordGuid,\r
+                   PcdGet16 (PcdStatusCodeMemorySize) * 1024 + sizeof (MEMORY_STATUSCODE_PACKET_HEADER)\r
+                   );\r
   ASSERT (PacketHeader != NULL);\r
 \r
-  PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024)/ sizeof (MEMORY_STATUSCODE_RECORD);\r
+  PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);\r
   PacketHeader->PacketIndex      = PacketIndex;\r
   PacketHeader->RecordIndex      = 0;\r
 \r
   return PacketHeader;\r
 }\r
 \r
-\r
-\r
 /**\r
-  Initialize memory status code.\r
-  Create one GUID'ed HOB with PCD defined size. If create required size \r
-  GUID'ed HOB failed, then ASSERT().\r
\r
-  @return           The function always return EFI_SUCCESS\r
+  Create the first memory status code GUID'ed HOB as initialization for memory status code worker.\r
+\r
+  @retval EFI_SUCCESS  The GUID'ed HOB is created successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -82,23 +67,24 @@ MemoryStatusCodeInitializeWorker (
 \r
 \r
 /**\r
-  Report status code into GUID'ed HOB..\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
+  Report status code into GUID'ed HOB.\r
+\r
+  This function reports status code into GUID'ed HOB. If not all packets are full, then\r
+  write status code into available entry. Otherwise, create a new packet for it.\r
+\r
+  @param  CodeType         Indicates the type of status code being reported.\r
+  @param  Value            Describes the current status of a hardware or\r
+                           software entity. This includes information about the class and\r
+                           subclass that is used to classify the entity as well as an operation.\r
+                           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\r
+                           the system. A system may contain multiple entities that match a class/subclass\r
+                           pairing. The instance differentiates between them. An instance of 0 indicates\r
+                           that instance information is unavailable, not meaningful, or not relevant.\r
+                           Valid instance numbers start with 1.\r
+\r
+  @retval EFI_SUCCESS      The function always return EFI_SUCCESS.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -111,11 +97,14 @@ MemoryStatusCodeReportWorker (
 \r
   EFI_PEI_HOB_POINTERS              Hob;\r
   MEMORY_STATUSCODE_PACKET_HEADER   *PacketHeader;\r
-  MEMORY_STATUSCODE_RECORD          *Record     = NULL;\r
-  UINT16                            PacketIndex = 0;;\r
+  MEMORY_STATUSCODE_RECORD          *Record;\r
+  UINT16                            PacketIndex;\r
+\r
+  Record      = NULL;\r
+  PacketIndex = 0;\r
 \r
   //\r
-  // Journal GUID'ed HOBs to find empty record entry, if found, then save status code in it.\r
+  // Journal GUID'ed HOBs to find empty record entry. if found, then save status code in it.\r
   // otherwise, create a new GUID'ed HOB.\r
   //\r
   Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);\r
@@ -138,13 +127,13 @@ MemoryStatusCodeReportWorker (
     Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);\r
   }\r
 \r
-  if (NULL == Record) {\r
+  if (Record == NULL) {\r
     //\r
-    // In order to save status code , create new packet. \r
+    // No available entry found, so create new packet.\r
     //\r
     PacketHeader = CreateMemoryStatusCodePacket (PacketIndex);\r
 \r
-    Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1); \r
+    Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);\r
     Record = &Record[PacketHeader->RecordIndex++];\r
   }\r
 \r
@@ -154,3 +143,4 @@ MemoryStatusCodeReportWorker (
 \r
   return EFI_SUCCESS;\r
 }\r
+\r