AGESA: Fix loop condition for eventlog read

Do not evaluate AmdEventParams if AmdReadEventLog() fails.

Change-Id: I2b8afe827ffe6757e64c00ab005d3bb8cc577321
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/18611
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc@marcjonesconsulting.com>
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
This commit is contained in:
Kyösti Mälkki 2017-03-02 13:52:54 +02:00
parent 4f74c89592
commit 49b4a89323
1 changed files with 4 additions and 3 deletions

View File

@ -707,6 +707,7 @@ static void interpret_agesa_eventlog(EVENT_PARAMS *event)
static void amd_readeventlog(AMD_CONFIG_PARAMS *StdHeader)
{
AGESA_STATUS status;
EVENT_PARAMS AmdEventParams;
memset(&AmdEventParams, 0, sizeof(EVENT_PARAMS));
@ -717,8 +718,8 @@ static void amd_readeventlog(AMD_CONFIG_PARAMS *StdHeader)
AmdEventParams.StdHeader.ImageBasePtr = 0;
AmdEventParams.StdHeader.HeapStatus = StdHeader->HeapStatus;
AmdReadEventLog(&AmdEventParams);
while (AmdEventParams.EventClass != 0) {
status = AmdReadEventLog(&AmdEventParams);
while ((status == AGESA_SUCCESS) && (AmdEventParams.EventClass != 0)) {
printk(BIOS_DEBUG,"\nEventLog: EventClass = %x, EventInfo = %x.\n",
(unsigned int)AmdEventParams.EventClass,
(unsigned int)AmdEventParams.EventInfo);
@ -728,7 +729,7 @@ static void amd_readeventlog(AMD_CONFIG_PARAMS *StdHeader)
printk(BIOS_DEBUG," Param3 = %x, Param4 = %x.\n",
(unsigned int)AmdEventParams.DataParam3,
(unsigned int)AmdEventParams.DataParam4);
AmdReadEventLog(&AmdEventParams);
status = AmdReadEventLog(&AmdEventParams);
}
}