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@gmail.com> Reviewed-on: https://review.coreboot.org/18543 Tested-by: build bot (Jenkins) Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
This commit is contained in:
parent
49b4a89323
commit
bfa72ce23b
|
@ -117,6 +117,8 @@ AmdReadEventLog (
|
||||||
|
|
||||||
ASSERT (Event != NULL);
|
ASSERT (Event != NULL);
|
||||||
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
||||||
|
if (Status != AGESA_SUCCESS)
|
||||||
|
return Status;
|
||||||
|
|
||||||
Event->EventClass = LogEvent.EventClass;
|
Event->EventClass = LogEvent.EventClass;
|
||||||
Event->EventInfo = LogEvent.EventInfo;
|
Event->EventInfo = LogEvent.EventInfo;
|
||||||
|
@ -205,6 +207,9 @@ PutEventLog (
|
||||||
AgesaEventAlloc = NULL;
|
AgesaEventAlloc = NULL;
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
Index = AgesaEventAlloc->WriteRecordPtr;
|
Index = AgesaEventAlloc->WriteRecordPtr;
|
||||||
|
|
||||||
// Add the new event log data into a circular buffer
|
// Add the new event log data into a circular buffer
|
||||||
|
@ -267,6 +272,8 @@ GetEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return AGESA_BOUNDS_CHK;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
@ -324,6 +331,8 @@ PeekEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
|
|
@ -121,6 +121,8 @@ AmdReadEventLog (
|
||||||
ASSERT (Event != NULL);
|
ASSERT (Event != NULL);
|
||||||
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
||||||
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
||||||
|
if (Status != AGESA_SUCCESS)
|
||||||
|
return Status;
|
||||||
|
|
||||||
Event->EventClass = LogEvent.EventClass;
|
Event->EventClass = LogEvent.EventClass;
|
||||||
Event->EventInfo = LogEvent.EventInfo;
|
Event->EventInfo = LogEvent.EventInfo;
|
||||||
|
@ -219,6 +221,9 @@ PutEventLog (
|
||||||
AgesaEventAlloc = NULL;
|
AgesaEventAlloc = NULL;
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
Index = AgesaEventAlloc->WriteRecordPtr;
|
Index = AgesaEventAlloc->WriteRecordPtr;
|
||||||
|
|
||||||
// Add the new event log data into a circular buffer
|
// Add the new event log data into a circular buffer
|
||||||
|
@ -281,6 +286,8 @@ GetEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return AGESA_BOUNDS_CHK;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
@ -338,6 +345,8 @@ PeekEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
|
|
@ -124,6 +124,8 @@ AmdReadEventLog (
|
||||||
ASSERT (Event != NULL);
|
ASSERT (Event != NULL);
|
||||||
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
||||||
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
||||||
|
if (Status != AGESA_SUCCESS)
|
||||||
|
return Status;
|
||||||
|
|
||||||
Event->EventClass = LogEvent.EventClass;
|
Event->EventClass = LogEvent.EventClass;
|
||||||
Event->EventInfo = LogEvent.EventInfo;
|
Event->EventInfo = LogEvent.EventInfo;
|
||||||
|
@ -222,6 +224,9 @@ PutEventLog (
|
||||||
AgesaEventAlloc = NULL;
|
AgesaEventAlloc = NULL;
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
Index = AgesaEventAlloc->WriteRecordPtr;
|
Index = AgesaEventAlloc->WriteRecordPtr;
|
||||||
|
|
||||||
// Add the new event log data into a circular buffer
|
// Add the new event log data into a circular buffer
|
||||||
|
@ -284,6 +289,8 @@ GetEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return AGESA_BOUNDS_CHK;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
@ -341,6 +348,8 @@ PeekEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
|
|
@ -122,6 +122,8 @@ AmdReadEventLog (
|
||||||
ASSERT (Event != NULL);
|
ASSERT (Event != NULL);
|
||||||
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
||||||
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
||||||
|
if (Status != AGESA_SUCCESS)
|
||||||
|
return Status;
|
||||||
|
|
||||||
Event->EventClass = LogEvent.EventClass;
|
Event->EventClass = LogEvent.EventClass;
|
||||||
Event->EventInfo = LogEvent.EventInfo;
|
Event->EventInfo = LogEvent.EventInfo;
|
||||||
|
@ -220,6 +222,9 @@ PutEventLog (
|
||||||
AgesaEventAlloc = NULL;
|
AgesaEventAlloc = NULL;
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
Index = AgesaEventAlloc->WriteRecordPtr;
|
Index = AgesaEventAlloc->WriteRecordPtr;
|
||||||
|
|
||||||
// Add the new event log data into a circular buffer
|
// Add the new event log data into a circular buffer
|
||||||
|
@ -282,6 +287,8 @@ GetEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return AGESA_BOUNDS_CHK;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
@ -339,6 +346,8 @@ PeekEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
|
|
@ -121,6 +121,8 @@ AmdReadEventLog (
|
||||||
ASSERT (Event != NULL);
|
ASSERT (Event != NULL);
|
||||||
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
||||||
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
||||||
|
if (Status != AGESA_SUCCESS)
|
||||||
|
return Status;
|
||||||
|
|
||||||
Event->EventClass = LogEvent.EventClass;
|
Event->EventClass = LogEvent.EventClass;
|
||||||
Event->EventInfo = LogEvent.EventInfo;
|
Event->EventInfo = LogEvent.EventInfo;
|
||||||
|
@ -219,6 +221,9 @@ PutEventLog (
|
||||||
AgesaEventAlloc = NULL;
|
AgesaEventAlloc = NULL;
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
Index = AgesaEventAlloc->WriteRecordPtr;
|
Index = AgesaEventAlloc->WriteRecordPtr;
|
||||||
|
|
||||||
// Add the new event log data into a circular buffer
|
// Add the new event log data into a circular buffer
|
||||||
|
@ -281,6 +286,8 @@ GetEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return AGESA_BOUNDS_CHK;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
@ -338,6 +345,8 @@ PeekEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
|
|
@ -121,6 +121,8 @@ AmdReadEventLog (
|
||||||
ASSERT (Event != NULL);
|
ASSERT (Event != NULL);
|
||||||
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
Event->StdHeader.HeapBasePtr = HeapGetBaseAddress (&Event->StdHeader);
|
||||||
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
Status = GetEventLog (&LogEvent, &Event->StdHeader);
|
||||||
|
if (Status != AGESA_SUCCESS)
|
||||||
|
return Status;
|
||||||
|
|
||||||
Event->EventClass = LogEvent.EventClass;
|
Event->EventClass = LogEvent.EventClass;
|
||||||
Event->EventInfo = LogEvent.EventInfo;
|
Event->EventInfo = LogEvent.EventInfo;
|
||||||
|
@ -219,6 +221,9 @@ PutEventLog (
|
||||||
AgesaEventAlloc = NULL;
|
AgesaEventAlloc = NULL;
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
Index = AgesaEventAlloc->WriteRecordPtr;
|
Index = AgesaEventAlloc->WriteRecordPtr;
|
||||||
|
|
||||||
// Add the new event log data into a circular buffer
|
// Add the new event log data into a circular buffer
|
||||||
|
@ -281,6 +286,8 @@ GetEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return AGESA_BOUNDS_CHK;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
@ -338,6 +345,8 @@ PeekEventLog (
|
||||||
|
|
||||||
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
GetEventLogHeapPointer (&AgesaEventAlloc, StdHeader);
|
||||||
ASSERT (AgesaEventAlloc != NULL);
|
ASSERT (AgesaEventAlloc != NULL);
|
||||||
|
if (AgesaEventAlloc == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
if ((AgesaEventAlloc->ReadRecordPtr == AgesaEventAlloc->WriteRecordPtr) &&
|
||||||
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
(AgesaEventAlloc->ReadWriteFlag == 1)) {
|
||||||
|
|
Loading…
Reference in New Issue