[coreboot-gerrit] Patch set updated for coreboot: AGESA: Add helpers to track heap relocation

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Tue Mar 7 18:05:14 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/18627

-gerrit

commit 8201da4b0212d5219e3b2e6e51fc50b893edfb96
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Thu Nov 24 14:31:07 2016 +0200

    AGESA: Add helpers to track heap relocation
    
    Change-Id: Ib43e59e4d4ee5e48abf7177b36cb06fdae40bde9
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/northbridge/amd/agesa/agesawrapper.c  |  1 +
 src/northbridge/amd/agesa/agesawrapper.h  |  7 +++---
 src/northbridge/amd/agesa/eventlog.c      | 36 ++++++++++++++++++++++++++++++-
 src/northbridge/amd/agesa/state_machine.h |  6 ++++++
 4 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/src/northbridge/amd/agesa/agesawrapper.c b/src/northbridge/amd/agesa/agesawrapper.c
index 0a6f2a3..17fdbea 100644
--- a/src/northbridge/amd/agesa/agesawrapper.c
+++ b/src/northbridge/amd/agesa/agesawrapper.c
@@ -16,6 +16,7 @@
 #include <stdint.h>
 #include <string.h>
 
+#include <northbridge/amd/agesa/state_machine.h>
 #include <northbridge/amd/agesa/agesa_helper.h>
 #include <northbridge/amd/agesa/agesawrapper.h>
 #include <northbridge/amd/agesa/BiosCallOuts.h>
diff --git a/src/northbridge/amd/agesa/agesawrapper.h b/src/northbridge/amd/agesa/agesawrapper.h
index 19bb0be..adc31c1 100644
--- a/src/northbridge/amd/agesa/agesawrapper.h
+++ b/src/northbridge/amd/agesa/agesawrapper.h
@@ -27,10 +27,6 @@ AGESA_STATUS agesawrapper_amdinitlate(void);
 AGESA_STATUS agesawrapper_amdinitpost(void);
 AGESA_STATUS agesawrapper_amdinitmid(void);
 
-void agesawrapper_trace(AGESA_STATUS ret, AMD_CONFIG_PARAMS *StdHeader, const char *func);
-#define AGESA_EVENTLOG(status, stdheader) \
-	agesawrapper_trace(status, stdheader, __func__)
-
 AGESA_STATUS agesawrapper_amdinitresume(void);
 AGESA_STATUS agesawrapper_amdS3Save(void);
 AGESA_STATUS agesawrapper_amds3laterestore(void);
@@ -39,6 +35,9 @@ AGESA_STATUS agesawrapper_amdlaterunaptask (UINT32 Func, UINT32 Data, VOID *Conf
 AGESA_STATUS agesawrapper_fchs3earlyrestore(void);
 AGESA_STATUS agesawrapper_fchs3laterestore(void);
 
+#define AGESA_EVENTLOG(status, stdheader) \
+	agesawrapper_trace(status, stdheader, __func__)
+
 struct OEM_HOOK
 {
 	/* romstage */
diff --git a/src/northbridge/amd/agesa/eventlog.c b/src/northbridge/amd/agesa/eventlog.c
index 0a40672..1deca6c 100644
--- a/src/northbridge/amd/agesa/eventlog.c
+++ b/src/northbridge/amd/agesa/eventlog.c
@@ -15,12 +15,46 @@
 #include <stdint.h>
 #include <string.h>
 
-#include <northbridge/amd/agesa/agesawrapper.h>
+#include <northbridge/amd/agesa/state_machine.h>
 #include <northbridge/amd/agesa/BiosCallOuts.h>
 #include "amdlib.h"
 #include "AGESA.h"
 #include "AMD.h"
 
+#include <heapManager.h>
+
+static const char undefined[] = "undefined";
+
+/* Match order of enum AGESA_STRUCT_NAME. */
+static const char *AgesaFunctionNameStr[] = {
+	"AmdInitRecovery", "AmdCreateStruct", "AmdInitEarly", "AmdInitEnv", "AmdInitLate",
+	"AmdInitMid", "AmdInitPost", "AmdInitReset", "AmdInitResume", "AmdReleaseStruct",
+	"AmdS3LateRestore","AmdS3Save", "AmdGetApicId", "AmdGetPciAddress", "AmdIdentifyCore",
+	"AmdReadEventLog", "AmdGetAvailableExeCacheSize", "AmdLateRunApTask", "AmdIdentifyDimm",
+};
+
+/* heapManager.h */
+static const char *HeapStatusStr[] = {
+	"DoNotExistYet", "LocalCache", "TempMem", "SystemMem", "DoNotExistAnymore","S3Resume"
+};
+
+const char *agesa_struct_name(int state)
+{
+	if ((state < AMD_INIT_RECOVERY) || (state > AMD_IDENTIFY_DIMMS))
+		return undefined;
+
+	int index = state - AMD_INIT_RECOVERY;
+	return AgesaFunctionNameStr[index];
+}
+
+const char *heap_status_name(int status)
+{
+	if ((status < HEAP_DO_NOT_EXIST_YET) || (status > HEAP_S3_RESUME))
+		return undefined;
+
+	int index = status - HEAP_DO_NOT_EXIST_YET;
+	return HeapStatusStr[index];
+}
 
 /*
  * Possible AGESA_STATUS values:
diff --git a/src/northbridge/amd/agesa/state_machine.h b/src/northbridge/amd/agesa/state_machine.h
index 3c78edb..7f0cb85 100644
--- a/src/northbridge/amd/agesa/state_machine.h
+++ b/src/northbridge/amd/agesa/state_machine.h
@@ -17,6 +17,12 @@
 #define _STATE_MACHINE_H_
 
 #include <stdint.h>
+#include <AGESA.h>
+
+/* eventlog */
+const char *agesa_struct_name(int state);
+const char *heap_status_name(int status);
+void agesawrapper_trace(AGESA_STATUS ret, AMD_CONFIG_PARAMS *StdHeader, const char *func);
 
 struct sysinfo
 {



More information about the coreboot-gerrit mailing list