]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Rollback the changing on replacing MAX_EXTENDED_DATA_SIZE by EFI_STATUS_CODE_DATA_...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 23 Nov 2010 07:50:31 +0000 (07:50 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 23 Nov 2010 07:50:31 +0000 (07:50 +0000)
   use MAX_EXTENDED_DATA_SIZE as before.
2. Use DEBUG error message instead of ASSERT(FASLE) when extended data is too large
3. Expand 1 for buffer array size to avoid potential issue.

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

MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
MdeModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c

index 06bdd5458300710fa5f6422f6d48e31ac169b06c..ce843cc47f46129d2d897577db8810dd5309ea75 100644 (file)
 #include <Guid/StatusCodeDataTypeId.h>\r
 #include <Guid/StatusCodeDataTypeDebug.h>\r
 \r
+//\r
+// Define the maximum extended data size that is supported when a status code is\r
+// reported at TPL_HIGH_LEVEL.\r
+//\r
+#define MAX_EXTENDED_DATA_SIZE  0x200\r
+\r
 EFI_STATUS_CODE_PROTOCOL  *mReportStatusCodeLibStatusCodeProtocol = NULL;\r
 \r
 /**\r
@@ -485,7 +491,7 @@ ReportStatusCodeEx (
   EFI_STATUS            Status;\r
   EFI_STATUS_CODE_DATA  *StatusCodeData;\r
   EFI_TPL               Tpl;\r
-  UINT64                Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)];\r
+  UINT64                Buffer[(MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)) + 1];\r
 \r
   ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r
   ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
@@ -512,12 +518,12 @@ ReportStatusCodeEx (
     //\r
     // If a buffer could not be allocated, then see if the local variable Buffer can be used\r
     //\r
-    if (ExtendedDataSize > (EFI_STATUS_CODE_DATA_MAX_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {\r
+    if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {\r
       //\r
       // The local variable Buffer not large enough to hold the extended data associated\r
       // with the status code being reported.\r
       //\r
-      ASSERT (FALSE);\r
+      DEBUG ((EFI_D_ERROR, "Status code extended data is too large to be reported!\n"));\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
     StatusCodeData = (EFI_STATUS_CODE_DATA  *)Buffer;\r
index 70737ba4f69bf1ce63c1ac8139fe6bf7b5710f5e..d41d4e981df326342fe954ba3f723c48a0513b61 100644 (file)
 #include <Library/OemHookStatusCodeLib.h>\r
 #include <Library/PcdLib.h>\r
 \r
+//\r
+// Define the maximum extended data size that is supported in the PEI phase\r
+//\r
+#define MAX_EXTENDED_DATA_SIZE  0x200\r
+\r
 /**\r
   Internal worker function that reports a status code through the PEI Status Code Service or\r
   OEM Hook Status Code Library.\r
@@ -453,7 +458,7 @@ ReportStatusCodeEx (
   )\r
 {\r
   EFI_STATUS_CODE_DATA  *StatusCodeData;\r
-  UINT64                Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)];\r
+  UINT64                Buffer[(MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)) + 1];\r
 \r
   //\r
   // If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r
@@ -464,12 +469,12 @@ ReportStatusCodeEx (
   //\r
   ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r
 \r
-  if (ExtendedDataSize > (EFI_STATUS_CODE_DATA_MAX_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {\r
+  if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {\r
     //\r
     // The local variable Buffer not large enough to hold the extended data associated\r
     // with the status code being reported.\r
     //\r
-    ASSERT (FALSE);\r
+    DEBUG ((EFI_D_ERROR, "Status code extended data is too large to be reported!\n"));\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
   StatusCodeData = (EFI_STATUS_CODE_DATA  *) Buffer;\r