]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine code for PeiReportStatusCodeLib.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 May 2009 07:43:45 +0000 (07:43 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 May 2009 07:43:45 +0000 (07:43 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8306 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
IntelFrameworkModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c

index da30f256d96b98d66790f38ff06c6ae1d5f3a122..871a8e6f0dd03507a082a35390a03e58aae33388 100644 (file)
@@ -1,7 +1,10 @@
 #/** @file\r
-#  Report status code library\r
+#  Instance of Report Status Code Library for PEI Phase.\r
+#\r
+#  Instance of Report Status Code Library for PEI Phase. It first tries to report status\r
+#  code via PEI Status Code Service. If the service is not available, it then tries calling\r
+#  OEM Hook Status Code Library.\r
 #\r
-#  ReportStatusCodeLib for PEIM which depends upon Pei Services table\r
 #  Copyright (c) 2006 - 2009, Intel Corporation.\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
   MODULE_TYPE                    = PEIM\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = ReportStatusCodeLib|SEC PEIM PEI_CORE\r
-  EFI_SPECIFICATION_VERSION      = 0x00020000\r
   \r
 #\r
 # The following information is for reference only and not required by the build tools.\r
 #\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC (EBC is for build only)\r
 #\r
 \r
 [Sources.common]\r
@@ -48,8 +50,8 @@
 \r
 \r
 [Guids]\r
-  gEfiStatusCodeSpecificDataGuid                # ALWAYS_CONSUMED\r
-  gEfiStatusCodeDataTypeDebugGuid               # ALWAYS_CONSUMED\r
+  gEfiStatusCodeSpecificDataGuid                ## CONSUMES\r
+  gEfiStatusCodeDataTypeDebugGuid               ## CONSUMES\r
 \r
 \r
 [Pcd.common]\r
index 4f0901b1d2b629cd24d722fb93490f211849d453..3099c4785cce0c8609fb1c8b997f4465438afd89 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Report Status Code Library for PEI Phase.\r
+  Instance of Report Status Code Library for PEI Phase.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
+  Copyright (c) 2006 - 2009, Intel Corporation<BR>\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
 #define MAX_EXTENDED_DATA_SIZE  0x200\r
 \r
 /**\r
-  Internal worker function that reports a status code through the Status Code Protocol\r
+  Internal worker function that reports a status code through the PEI Status Code Service or\r
+  OEM Hook Status Code Library.\r
 \r
-  This function checks to see if a Status Code Protocol is present in the handle\r
-  database.  If a Status Code Protocol is not present, then EFI_UNSUPPORTED is\r
-  returned.  If a Status Code Protocol is present, then it is cached in gStatusCode,\r
-  and the ReportStatusCode() service of the Status Code Protocol is called passing in\r
-  Type, Value, Instance, CallerId, and Data.  The result of this call is returned.\r
+  This function first tries to report status code via PEI Status Code Service. If the service\r
+  is not available, it then tries calling OEM Hook Status Code Library.\r
 \r
   @param  Type              Status code type.\r
   @param  Value             Status code value.\r
@@ -50,9 +48,9 @@
   @param  Data              Pointer to the extended data buffer.  This is an\r
                             optional parameter that may be NULL.\r
 \r
-  @retval  EFI_SUCCESS           The status code was reported.\r
-  @retval  EFI_OUT_OF_RESOURCES  There were not enough resources to report the status code.\r
-  @retval  EFI_UNSUPPORTED       Status Code Protocol is not available.\r
+  @retval EFI_SUCCESS       The status code was reported.\r
+  @retval EFI_UNSUPPORTED   Status code type is not supported.\r
+  @retval Others            Failed to report status code.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -68,10 +66,10 @@ InternalReportStatusCode (
   EFI_STATUS              Status;\r
 \r
   if ((ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r
-    (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ||\r
-    (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE)) {\r
+      (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ||\r
+      (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE)) {\r
     PeiServices = GetPeiServicesTablePointer ();\r
-    Status =  (*PeiServices)->ReportStatusCode (\r
+    Status = (*PeiServices)->ReportStatusCode (\r
                                PeiServices,\r
                                Type,\r
                                Value,\r
@@ -130,7 +128,7 @@ CodeTypeToPostCode (
   // Convert Value to an 8 bit post code\r
   //\r
   if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r
-      ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE)       ) {\r
+      ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE)) {\r
     *PostCode  = (UINT8) ((((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5) |\r
                           (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f));\r
     return TRUE;\r
@@ -342,6 +340,9 @@ ReportStatusCodeWithDevicePath (
   )\r
 {\r
   ASSERT (DevicePath != NULL);\r
+  //\r
+  // EFI_UNSUPPORTED is returned for device path is not supported in PEI phase.\r
+  //\r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
@@ -458,7 +459,13 @@ ReportStatusCodeEx (
   EFI_STATUS_CODE_DATA  *StatusCodeData;\r
   UINT64                Buffer[MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)];\r
 \r
+  //\r
+  // If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r
+  //\r
   ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r
+  //\r
+  // If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().\r
+  //\r
   ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
 \r
   if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {\r
@@ -499,7 +506,7 @@ ReportProgressCodeEnabled (
   VOID\r
   )\r
 {\r
-  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -521,7 +528,7 @@ ReportErrorCodeEnabled (
   VOID\r
   )\r
 {\r
-  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r
 }\r
 \r
 \r
@@ -543,5 +550,5 @@ ReportDebugCodeEnabled (
   VOID\r
   )\r
 {\r
-  return (BOOLEAN) ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
+  return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
 }\r