AGESA: Refactor eventlog read loop
Also avoid infinite loop. Change-Id: I7571f9efdc2bf0335788136b8c56e9290581d748 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/20695 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
0e01c4841d
commit
0a7cab8de8
|
@ -739,11 +739,44 @@ static void interpret_agesa_eventlog(EVENT_PARAMS *event)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void amd_readeventlog(AMD_CONFIG_PARAMS *StdHeader)
|
static void show_event(EVENT_PARAMS *Event)
|
||||||
|
{
|
||||||
|
printk(BIOS_DEBUG,"\nEventLog: EventClass = %x, EventInfo = %x.\n",
|
||||||
|
(unsigned int)Event->EventClass,
|
||||||
|
(unsigned int)Event->EventInfo);
|
||||||
|
printk(BIOS_DEBUG," Param1 = %x, Param2 = %x.\n",
|
||||||
|
(unsigned int)Event->DataParam1,
|
||||||
|
(unsigned int)Event->DataParam2);
|
||||||
|
printk(BIOS_DEBUG," Param3 = %x, Param4 = %x.\n",
|
||||||
|
(unsigned int)Event->DataParam3,
|
||||||
|
(unsigned int)Event->DataParam4);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MAX_LOG_ENTRIES 100
|
||||||
|
|
||||||
|
static void amd_flush_eventlog(EVENT_PARAMS *Event)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
AGESA_STATUS status = AmdReadEventLog(Event);
|
||||||
|
if (status != AGESA_SUCCESS)
|
||||||
|
return;
|
||||||
|
if (Event->EventClass == 0)
|
||||||
|
return;
|
||||||
|
show_event(Event);
|
||||||
|
} while (++i < MAX_LOG_ENTRIES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void agesawrapper_trace(AGESA_STATUS ret, AMD_CONFIG_PARAMS *StdHeader,
|
||||||
|
const char *func)
|
||||||
{
|
{
|
||||||
AGESA_STATUS status;
|
|
||||||
EVENT_PARAMS AmdEventParams;
|
EVENT_PARAMS AmdEventParams;
|
||||||
|
|
||||||
|
printk(BIOS_DEBUG, "%s() returned %s\n", func, decodeAGESA_STATUS(ret));
|
||||||
|
if (ret == AGESA_SUCCESS)
|
||||||
|
return;
|
||||||
|
|
||||||
memset(&AmdEventParams, 0, sizeof(EVENT_PARAMS));
|
memset(&AmdEventParams, 0, sizeof(EVENT_PARAMS));
|
||||||
|
|
||||||
AmdEventParams.StdHeader.AltImageBasePtr = 0;
|
AmdEventParams.StdHeader.AltImageBasePtr = 0;
|
||||||
|
@ -752,25 +785,22 @@ static void amd_readeventlog(AMD_CONFIG_PARAMS *StdHeader)
|
||||||
AmdEventParams.StdHeader.ImageBasePtr = 0;
|
AmdEventParams.StdHeader.ImageBasePtr = 0;
|
||||||
AmdEventParams.StdHeader.HeapStatus = StdHeader->HeapStatus;
|
AmdEventParams.StdHeader.HeapStatus = StdHeader->HeapStatus;
|
||||||
|
|
||||||
status = AmdReadEventLog(&AmdEventParams);
|
amd_flush_eventlog(&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);
|
|
||||||
printk(BIOS_DEBUG," Param1 = %x, Param2 = %x.\n",
|
|
||||||
(unsigned int)AmdEventParams.DataParam1,
|
|
||||||
(unsigned int)AmdEventParams.DataParam2);
|
|
||||||
printk(BIOS_DEBUG," Param3 = %x, Param4 = %x.\n",
|
|
||||||
(unsigned int)AmdEventParams.DataParam3,
|
|
||||||
(unsigned int)AmdEventParams.DataParam4);
|
|
||||||
status = AmdReadEventLog(&AmdEventParams);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AGESA_STATUS agesawrapper_amdreadeventlog (UINT8 HeapStatus)
|
||||||
void agesawrapper_trace(AGESA_STATUS ret, AMD_CONFIG_PARAMS *StdHeader, const char *func)
|
|
||||||
{
|
{
|
||||||
printk(BIOS_DEBUG, "%s() returned %s\n", func, decodeAGESA_STATUS(ret));
|
EVENT_PARAMS AmdEventParams;
|
||||||
if (ret != AGESA_SUCCESS)
|
|
||||||
amd_readeventlog(StdHeader);
|
memset(&AmdEventParams, 0, sizeof(EVENT_PARAMS));
|
||||||
|
|
||||||
|
AmdEventParams.StdHeader.AltImageBasePtr = 0;
|
||||||
|
AmdEventParams.StdHeader.CalloutPtr = &GetBiosCallout;
|
||||||
|
AmdEventParams.StdHeader.Func = 0;
|
||||||
|
AmdEventParams.StdHeader.ImageBasePtr = 0;
|
||||||
|
AmdEventParams.StdHeader.HeapStatus = HeapStatus;
|
||||||
|
|
||||||
|
amd_flush_eventlog(&AmdEventParams);
|
||||||
|
|
||||||
|
return AGESA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
const char *agesa_struct_name(int state);
|
const char *agesa_struct_name(int state);
|
||||||
const char *heap_status_name(int status);
|
const char *heap_status_name(int status);
|
||||||
void agesawrapper_trace(AGESA_STATUS ret, AMD_CONFIG_PARAMS *StdHeader, const char *func);
|
void agesawrapper_trace(AGESA_STATUS ret, AMD_CONFIG_PARAMS *StdHeader, const char *func);
|
||||||
|
AGESA_STATUS agesawrapper_amdreadeventlog(UINT8 HeapStatus);
|
||||||
|
|
||||||
struct sysinfo
|
struct sysinfo
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,8 +22,8 @@ subdirs-$(CONFIG_NORTHBRIDGE_AMD_PI_00660F01) += 00660F01
|
||||||
romstage-y += agesawrapper.c
|
romstage-y += agesawrapper.c
|
||||||
ramstage-y += agesawrapper.c
|
ramstage-y += agesawrapper.c
|
||||||
|
|
||||||
romstage-y += ../agesa/def_callouts.c
|
romstage-y += ../agesa/def_callouts.c ../agesa/eventlog.c
|
||||||
ramstage-y += ../agesa/def_callouts.c ../agesa/acpi_tables.c
|
ramstage-y += ../agesa/def_callouts.c ../agesa/eventlog.c ../agesa/acpi_tables.c
|
||||||
|
|
||||||
romstage-y += ramtop.c
|
romstage-y += ramtop.c
|
||||||
ramstage-y += ramtop.c
|
ramstage-y += ramtop.c
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <cpuRegisters.h>
|
#include <cpuRegisters.h>
|
||||||
#include <FchPlatform.h>
|
#include <FchPlatform.h>
|
||||||
#include <heapManager.h>
|
#include <heapManager.h>
|
||||||
|
#include <northbridge/amd/agesa/state_machine.h>
|
||||||
#include <northbridge/amd/pi/agesawrapper.h>
|
#include <northbridge/amd/pi/agesawrapper.h>
|
||||||
#include <northbridge/amd/agesa/BiosCallOuts.h>
|
#include <northbridge/amd/agesa/BiosCallOuts.h>
|
||||||
|
|
||||||
|
@ -315,32 +316,6 @@ AGESA_STATUS agesawrapper_amdlaterunaptask (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
AGESA_STATUS agesawrapper_amdreadeventlog (UINT8 HeapStatus)
|
|
||||||
{
|
|
||||||
AGESA_STATUS Status;
|
|
||||||
EVENT_PARAMS AmdEventParams;
|
|
||||||
|
|
||||||
LibAmdMemFill (&AmdEventParams,
|
|
||||||
0,
|
|
||||||
sizeof(EVENT_PARAMS),
|
|
||||||
&(AmdEventParams.StdHeader));
|
|
||||||
|
|
||||||
AmdEventParams.StdHeader.AltImageBasePtr = 0;
|
|
||||||
AmdEventParams.StdHeader.CalloutPtr = &GetBiosCallout;
|
|
||||||
AmdEventParams.StdHeader.Func = 0;
|
|
||||||
AmdEventParams.StdHeader.ImageBasePtr = 0;
|
|
||||||
AmdEventParams.StdHeader.HeapStatus = HeapStatus;
|
|
||||||
Status = AmdReadEventLog (&AmdEventParams);
|
|
||||||
while (AmdEventParams.EventClass != 0) {
|
|
||||||
printk(BIOS_DEBUG,"\nEventLog: EventClass = %x, EventInfo = %x.\n", (unsigned int)AmdEventParams.EventClass,(unsigned int)AmdEventParams.EventInfo);
|
|
||||||
printk(BIOS_DEBUG," Param1 = %x, Param2 = %x.\n",(unsigned int)AmdEventParams.DataParam1, (unsigned int)AmdEventParams.DataParam2);
|
|
||||||
printk(BIOS_DEBUG," Param3 = %x, Param4 = %x.\n",(unsigned int)AmdEventParams.DataParam3, (unsigned int)AmdEventParams.DataParam4);
|
|
||||||
Status = AmdReadEventLog (&AmdEventParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
const void *agesawrapper_locate_module (const CHAR8 name[8])
|
const void *agesawrapper_locate_module (const CHAR8 name[8])
|
||||||
{
|
{
|
||||||
const void* agesa;
|
const void* agesa;
|
||||||
|
|
|
@ -38,7 +38,6 @@ AGESA_STATUS agesawrapper_amdinitenv(void);
|
||||||
AGESA_STATUS agesawrapper_amdinitlate(void);
|
AGESA_STATUS agesawrapper_amdinitlate(void);
|
||||||
AGESA_STATUS agesawrapper_amdinitpost(void);
|
AGESA_STATUS agesawrapper_amdinitpost(void);
|
||||||
AGESA_STATUS agesawrapper_amdinitmid(void);
|
AGESA_STATUS agesawrapper_amdinitmid(void);
|
||||||
AGESA_STATUS agesawrapper_amdreadeventlog(UINT8 HeapStatus);
|
|
||||||
void agesawrapper_setlateinitptr (void *Late);
|
void agesawrapper_setlateinitptr (void *Late);
|
||||||
void *agesawrapper_getlateinitptr(int pick);
|
void *agesawrapper_getlateinitptr(int pick);
|
||||||
AGESA_STATUS agesawrapper_amdlaterunaptask(UINT32 Func, UINTN Data, void *ConfigPtr);
|
AGESA_STATUS agesawrapper_amdlaterunaptask(UINT32 Func, UINTN Data, void *ConfigPtr);
|
||||||
|
|
Loading…
Reference in New Issue