[coreboot-gerrit] Patch set updated for coreboot: AGESA: Make eventlog more tolerant to failures

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Wed Mar 8 06:42:51 CET 2017


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18543

-gerrit

commit a94aa7686b3f381d876c1bec08d3e53237f59bd5
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Thu Mar 2 13:52:54 2017 +0200

    AGESA: Make eventlog more tolerant to failures
    
    We have been forced to build AGESA with ASSERT() as non-fatal
    for some board, as hitting those errors is not uncommon.
    
    For the cases touched here, abort eventlog operations early
    to avoid further errors and dereference of null pointers.
    
    Change-Id: I1a09ad55d998502ad19273cfcd8d6588d85d5e0c
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/vendorcode/amd/agesa/f10/Proc/CPU/cpuEventLog.c   | 9 +++++++++
 src/vendorcode/amd/agesa/f12/Proc/CPU/cpuEventLog.c   | 9 +++++++++
 src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c   | 9 +++++++++
 src/vendorcode/amd/agesa/f15/Proc/CPU/cpuEventLog.c   | 9 +++++++++
 src/vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEventLog.c | 9 +++++++++
 src/vendorcode/amd/agesa/f16kb/Proc/CPU/cpuEventLog.c | 9 +++++++++
 6 files changed, 54 insertions(+)

diff --git a/src/vendorcode/amd/agesa/f10/Proc/CPU/cpuEventLog.c b/src/vendorcode/amd/agesa/f10/Proc/CPU/cpuEventLog.c
index 4c70418..efb3f93 100644
--- a/src/vendorcode/amd/agesa/f10/Proc/CPU/cpuEventLog.c
+++ b/src/vendorcode/amd/agesa/f10/Proc/CPU/cpuEventLog.c
@@ -117,6 +117,8 @@ AmdReadEventLog (
 
   ASSERT (Event != NULL);
   Status = GetEventLog (&LogEvent, &Event->StdHeader);
+  if (Status != AGESA_SUCCESS)
+    return Status;
 
   Event->EventClass = LogEvent.EventClass;
   Event->EventInfo = LogEvent.EventInfo;
@@ -205,6 +207,9 @@ PutEventLog (
   AgesaEventAlloc = NULL;
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return;
+
   Index = AgesaEventAlloc->WriteRecordPtr;
 
   // Add the new event log data into a circular buffer
@@ -267,6 +272,8 @@ GetEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return AGESA_BOUNDS_CHK;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
@@ -324,6 +331,8 @@ PeekEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return FALSE;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
diff --git a/src/vendorcode/amd/agesa/f12/Proc/CPU/cpuEventLog.c b/src/vendorcode/amd/agesa/f12/Proc/CPU/cpuEventLog.c
index 7df5764..1beb48e 100644
--- a/src/vendorcode/amd/agesa/f12/Proc/CPU/cpuEventLog.c
+++ b/src/vendorcode/amd/agesa/f12/Proc/CPU/cpuEventLog.c
@@ -121,6 +121,8 @@ AmdReadEventLog (
   ASSERT (Event != NULL);
   Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
   Status = GetEventLog (&LogEvent, &Event->StdHeader);
+  if (Status != AGESA_SUCCESS)
+    return Status;
 
   Event->EventClass = LogEvent.EventClass;
   Event->EventInfo = LogEvent.EventInfo;
@@ -219,6 +221,9 @@ PutEventLog (
   AgesaEventAlloc = NULL;
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return;
+
   Index = AgesaEventAlloc->WriteRecordPtr;
 
   // Add the new event log data into a circular buffer
@@ -281,6 +286,8 @@ GetEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return AGESA_BOUNDS_CHK;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
@@ -338,6 +345,8 @@ PeekEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return FALSE;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
diff --git a/src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c b/src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c
index 74a72a9..841c39f 100644
--- a/src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c
+++ b/src/vendorcode/amd/agesa/f14/Proc/CPU/cpuEventLog.c
@@ -124,6 +124,8 @@ AmdReadEventLog (
   ASSERT (Event != NULL);
   Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
   Status = GetEventLog (&LogEvent, &Event->StdHeader);
+  if (Status != AGESA_SUCCESS)
+    return Status;
 
   Event->EventClass = LogEvent.EventClass;
   Event->EventInfo = LogEvent.EventInfo;
@@ -222,6 +224,9 @@ PutEventLog (
   AgesaEventAlloc = NULL;
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return;
+
   Index = AgesaEventAlloc->WriteRecordPtr;
 
   // Add the new event log data into a circular buffer
@@ -284,6 +289,8 @@ GetEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return AGESA_BOUNDS_CHK;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
@@ -341,6 +348,8 @@ PeekEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return FALSE;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
diff --git a/src/vendorcode/amd/agesa/f15/Proc/CPU/cpuEventLog.c b/src/vendorcode/amd/agesa/f15/Proc/CPU/cpuEventLog.c
index 1810764..0634657 100644
--- a/src/vendorcode/amd/agesa/f15/Proc/CPU/cpuEventLog.c
+++ b/src/vendorcode/amd/agesa/f15/Proc/CPU/cpuEventLog.c
@@ -122,6 +122,8 @@ AmdReadEventLog (
   ASSERT (Event != NULL);
   Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
   Status = GetEventLog (&LogEvent, &Event->StdHeader);
+  if (Status != AGESA_SUCCESS)
+    return Status;
 
   Event->EventClass = LogEvent.EventClass;
   Event->EventInfo = LogEvent.EventInfo;
@@ -220,6 +222,9 @@ PutEventLog (
   AgesaEventAlloc = NULL;
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return;
+
   Index = AgesaEventAlloc->WriteRecordPtr;
 
   // Add the new event log data into a circular buffer
@@ -282,6 +287,8 @@ GetEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return AGESA_BOUNDS_CHK;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
@@ -339,6 +346,8 @@ PeekEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return FALSE;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
diff --git a/src/vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEventLog.c b/src/vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEventLog.c
index 169de7d..b0f0e41 100644
--- a/src/vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEventLog.c
+++ b/src/vendorcode/amd/agesa/f15tn/Proc/CPU/cpuEventLog.c
@@ -121,6 +121,8 @@ AmdReadEventLog (
   ASSERT (Event != NULL);
   Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
   Status = GetEventLog (&LogEvent, &Event->StdHeader);
+  if (Status != AGESA_SUCCESS)
+    return Status;
 
   Event->EventClass = LogEvent.EventClass;
   Event->EventInfo = LogEvent.EventInfo;
@@ -219,6 +221,9 @@ PutEventLog (
   AgesaEventAlloc = NULL;
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return;
+
   Index = AgesaEventAlloc->WriteRecordPtr;
 
   // Add the new event log data into a circular buffer
@@ -281,6 +286,8 @@ GetEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return AGESA_BOUNDS_CHK;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
@@ -338,6 +345,8 @@ PeekEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return FALSE;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
diff --git a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/cpuEventLog.c b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/cpuEventLog.c
index ad3fa39..f591e8a 100644
--- a/src/vendorcode/amd/agesa/f16kb/Proc/CPU/cpuEventLog.c
+++ b/src/vendorcode/amd/agesa/f16kb/Proc/CPU/cpuEventLog.c
@@ -121,6 +121,8 @@ AmdReadEventLog (
   ASSERT (Event != NULL);
   Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
   Status = GetEventLog (&LogEvent, &Event->StdHeader);
+  if (Status != AGESA_SUCCESS)
+    return Status;
 
   Event->EventClass = LogEvent.EventClass;
   Event->EventInfo = LogEvent.EventInfo;
@@ -219,6 +221,9 @@ PutEventLog (
   AgesaEventAlloc = NULL;
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return;
+
   Index = AgesaEventAlloc->WriteRecordPtr;
 
   // Add the new event log data into a circular buffer
@@ -281,6 +286,8 @@ GetEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return AGESA_BOUNDS_CHK;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {
@@ -338,6 +345,8 @@ PeekEventLog (
 
   GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
   ASSERT (AgesaEventAlloc != NULL);
+  if (AgesaEventAlloc == NULL)
+    return FALSE;
 
   if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
       (AgesaEventAlloc->ReadWriteFlag == 1)) {



More information about the coreboot-gerrit mailing list