summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2010-11-26 01:59:11 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2010-11-26 01:59:11 +0000
commitdca1a39f6e825270661cb8d3eb7fbeb4fd911b17 (patch)
tree64ca3effed5bc38d9176137995e710dcd2959814
parent879ef7662b7d6e82a44e96f2be8bcc3a608b6e34 (diff)
downloadedk2-dca1a39f6e825270661cb8d3eb7fbeb4fd911b17.tar.gz
edk2-dca1a39f6e825270661cb8d3eb7fbeb4fd911b17.tar.bz2
edk2-dca1a39f6e825270661cb8d3eb7fbeb4fd911b17.zip
Sync sync patch r11083, r11084 from main trunk.
1. Rollback the changing on replacing MAX_EXTENDED_DATA_SIZE by EFI_STATUS_CODE_DATA_MAX_SIZE, 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/branches/UDK2010@11095 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c12
-rw-r--r--IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c1
-rw-r--r--MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c12
-rw-r--r--MdeModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c11
4 files changed, 27 insertions, 9 deletions
diff --git a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
index 90e631e5dd..e9c5223305 100644
--- a/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
+++ b/IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
@@ -28,6 +28,12 @@
#include <Guid/StatusCodeDataTypeDebug.h>
#include <Protocol/StatusCode.h>
+//
+// Define the maximum extended data size that is supported when a status code is
+// reported at TPL_HIGH_LEVEL.
+//
+#define MAX_EXTENDED_DATA_SIZE 0x200
+
EFI_REPORT_STATUS_CODE mReportStatusCode = NULL;
/**
@@ -488,7 +494,7 @@ ReportStatusCodeEx (
EFI_STATUS Status;
EFI_STATUS_CODE_DATA *StatusCodeData;
EFI_TPL Tpl;
- UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)];
+ UINT64 Buffer[(MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)) + 1];
ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
@@ -515,12 +521,12 @@ ReportStatusCodeEx (
//
// If a buffer could not be allocated, then see if the local variable Buffer can be used
//
- if (ExtendedDataSize > (EFI_STATUS_CODE_DATA_MAX_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {
+ if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {
//
// The local variable Buffer not large enough to hold the extended data associated
// with the status code being reported.
//
- ASSERT (FALSE);
+ DEBUG ((EFI_D_ERROR, "Status code extended data is too large to be reported!\n"));
return EFI_OUT_OF_RESOURCES;
}
StatusCodeData = (EFI_STATUS_CODE_DATA *)Buffer;
diff --git a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
index 165fc4abca..2006794529 100644
--- a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
+++ b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLib.c
@@ -394,6 +394,7 @@ ReportStatusCodeEx (
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
if (ExtendedDataSize > EFI_STATUS_CODE_DATA_MAX_SIZE) {
+ DEBUG ((EFI_D_ERROR, "Status code extended data is too large to be reported!\n"));
return EFI_OUT_OF_RESOURCES;
}
diff --git a/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c b/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
index ae24f487d3..6aba84ecdb 100644
--- a/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
+++ b/MdeModulePkg/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
@@ -25,6 +25,12 @@
#include <Guid/StatusCodeDataTypeId.h>
#include <Guid/StatusCodeDataTypeDebug.h>
+//
+// Define the maximum extended data size that is supported when a status code is
+// reported at TPL_HIGH_LEVEL.
+//
+#define MAX_EXTENDED_DATA_SIZE 0x200
+
EFI_STATUS_CODE_PROTOCOL *mReportStatusCodeLibStatusCodeProtocol = NULL;
/**
@@ -485,7 +491,7 @@ ReportStatusCodeEx (
EFI_STATUS Status;
EFI_STATUS_CODE_DATA *StatusCodeData;
EFI_TPL Tpl;
- UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)];
+ UINT64 Buffer[(MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)) + 1];
ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
@@ -512,12 +518,12 @@ ReportStatusCodeEx (
//
// If a buffer could not be allocated, then see if the local variable Buffer can be used
//
- if (ExtendedDataSize > (EFI_STATUS_CODE_DATA_MAX_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {
+ if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {
//
// The local variable Buffer not large enough to hold the extended data associated
// with the status code being reported.
//
- ASSERT (FALSE);
+ DEBUG ((EFI_D_ERROR, "Status code extended data is too large to be reported!\n"));
return EFI_OUT_OF_RESOURCES;
}
StatusCodeData = (EFI_STATUS_CODE_DATA *)Buffer;
diff --git a/MdeModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c b/MdeModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
index 3c2b2130b5..7c2eb1509c 100644
--- a/MdeModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
+++ b/MdeModulePkg/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
@@ -23,6 +23,11 @@
#include <Library/OemHookStatusCodeLib.h>
#include <Library/PcdLib.h>
+//
+// Define the maximum extended data size that is supported in the PEI phase
+//
+#define MAX_EXTENDED_DATA_SIZE 0x200
+
/**
Internal worker function that reports a status code through the PEI Status Code Service or
OEM Hook Status Code Library.
@@ -453,7 +458,7 @@ ReportStatusCodeEx (
)
{
EFI_STATUS_CODE_DATA *StatusCodeData;
- UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)];
+ UINT64 Buffer[(MAX_EXTENDED_DATA_SIZE / sizeof (UINT64)) + 1];
//
// If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().
@@ -464,12 +469,12 @@ ReportStatusCodeEx (
//
ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));
- if (ExtendedDataSize > (EFI_STATUS_CODE_DATA_MAX_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {
+ if (ExtendedDataSize > (MAX_EXTENDED_DATA_SIZE - sizeof (EFI_STATUS_CODE_DATA))) {
//
// The local variable Buffer not large enough to hold the extended data associated
// with the status code being reported.
//
- ASSERT (FALSE);
+ DEBUG ((EFI_D_ERROR, "Status code extended data is too large to be reported!\n"));
return EFI_OUT_OF_RESOURCES;
}
StatusCodeData = (EFI_STATUS_CODE_DATA *)Buffer;