[coreboot-gerrit] Change in coreboot[master]: soc/amd/common: Make reading AGESA event log static

Marshall Dawson (Code Review) gerrit at coreboot.org
Fri Dec 15 01:38:08 CET 2017


Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/22884


Change subject: soc/amd/common: Make reading AGESA event log static
......................................................................

soc/amd/common: Make reading AGESA event log static

The function agesawrapper_amdreadeventlog() is only called from within
agesawrapper.c.  Make it a static function and:
 * shorten the name to help keep lines within 80 columns
 * convert initializers to C99
 * break the call from the callers' if() statements
 * streamline the printk formatting

BUG=b:70671442
TEST=Build and run Kahlee, check console log

Change-Id: I402c75e4d65a592b9d1557c5852df03e48e206b9
Signed-off-by: Marshall Dawson <marshalldawson3rd at gmail.com>
---
M src/soc/amd/common/block/include/amdblocks/agesawrapper.h
M src/soc/amd/common/block/pi/agesawrapper.c
2 files changed, 40 insertions(+), 31 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/22884/1

diff --git a/src/soc/amd/common/block/include/amdblocks/agesawrapper.h b/src/soc/amd/common/block/include/amdblocks/agesawrapper.h
index 08ac596..d16e9ff 100644
--- a/src/soc/amd/common/block/include/amdblocks/agesawrapper.h
+++ b/src/soc/amd/common/block/include/amdblocks/agesawrapper.h
@@ -40,7 +40,6 @@
 AGESA_STATUS agesawrapper_amdinitlate(void);
 AGESA_STATUS agesawrapper_amdinitpost(void);
 AGESA_STATUS agesawrapper_amdinitmid(void);
-AGESA_STATUS agesawrapper_amdreadeventlog(UINT8 HeapStatus);
 void *agesawrapper_getlateinitptr(int pick);
 AGESA_STATUS agesawrapper_amdlaterunaptask(UINT32 Func, UINTN Data,
 							void *ConfigPtr);
diff --git a/src/soc/amd/common/block/pi/agesawrapper.c b/src/soc/amd/common/block/pi/agesawrapper.c
index cc57207..b9931d2 100644
--- a/src/soc/amd/common/block/pi/agesawrapper.c
+++ b/src/soc/amd/common/block/pi/agesawrapper.c
@@ -40,6 +40,34 @@
 static void *AcpiCrat;
 #endif /* #ifndef __PRE_RAM__ */
 
+static AGESA_STATUS agesawrapper_readeventlog(UINT8 HeapStatus)
+{
+	AGESA_STATUS Status;
+	EVENT_PARAMS AmdEventParams = {
+		.StdHeader.CalloutPtr = &GetBiosCallout,
+		.StdHeader.HeapStatus = HeapStatus,
+	};
+
+	Status = AmdReadEventLog(&AmdEventParams);
+	if (AmdEventParams.EventClass)
+		printk(BIOS_DEBUG, "AGESA Event Log:\n");
+
+	while (AmdEventParams.EventClass != 0) {
+		printk(BIOS_DEBUG, "  Class = %x, Info = %x,"
+				" Param1 = 0x%x, Param2 = 0x%x"
+				" Param3 = 0x%x, Param4 = 0x%x\n",
+				(u32)AmdEventParams.EventClass,
+				(u32)AmdEventParams.EventInfo,
+				(u32)AmdEventParams.DataParam1,
+				(u32)AmdEventParams.DataParam2,
+				(u32)AmdEventParams.DataParam3,
+				(u32)AmdEventParams.DataParam4);
+		Status = AmdReadEventLog(&AmdEventParams);
+	}
+
+	return Status;
+}
+
 AGESA_STATUS agesawrapper_amdinitreset(void)
 {
 	AGESA_STATUS status;
@@ -68,7 +96,8 @@
 	status = AmdInitReset(&AmdResetParams);
 	timestamp_add_now(TS_AGESA_INIT_RESET_DONE);
 
-	if (status != AGESA_SUCCESS) agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus);
+	if (status != AGESA_SUCCESS)
+		agesawrapper_readeventlog(AmdParamStruct.StdHeader.HeapStatus);
 	AmdReleaseStruct (&AmdParamStruct);
 	return status;
 }
@@ -98,7 +127,8 @@
 	status = AmdInitEarly ((AMD_EARLY_PARAMS *)AmdParamStruct.NewStructPtr);
 	timestamp_add_now(TS_AGESA_INIT_EARLY_DONE);
 
-	if (status != AGESA_SUCCESS) agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus);
+	if (status != AGESA_SUCCESS)
+		agesawrapper_readeventlog(AmdParamStruct.StdHeader.HeapStatus);
 	AmdReleaseStruct (&AmdParamStruct);
 
 	return status;
@@ -169,7 +199,8 @@
 			(unsigned long)(PostParams->MemConfig.UmaBase) << 16
 	);
 
-	if (status != AGESA_SUCCESS) agesawrapper_amdreadeventlog(PostParams->StdHeader.HeapStatus);
+	if (status != AGESA_SUCCESS)
+		agesawrapper_readeventlog(PostParams->StdHeader.HeapStatus);
 	AmdReleaseStruct (&AmdParamStruct);
 
 	return status;
@@ -203,7 +234,8 @@
 	status = AmdInitEnv (EnvParam);
 	timestamp_add_now(TS_AGESA_INIT_ENV_DONE);
 
-	if (status != AGESA_SUCCESS) agesawrapper_amdreadeventlog(EnvParam->StdHeader.HeapStatus);
+	if (status != AGESA_SUCCESS)
+		agesawrapper_readeventlog(EnvParam->StdHeader.HeapStatus);
 	/* Initialize Subordinate Bus Number and Secondary Bus Number
 	 * In platform BIOS this address is allocated by PCI enumeration code
 	 Modify D1F0x18
@@ -274,7 +306,8 @@
 	status = AmdInitMid ((AMD_MID_PARAMS *)AmdParamStruct.NewStructPtr);
 	timestamp_add_now(TS_AGESA_INIT_MID_DONE);
 
-	if (status != AGESA_SUCCESS) agesawrapper_amdreadeventlog(AmdParamStruct.StdHeader.HeapStatus);
+	if (status != AGESA_SUCCESS)
+		agesawrapper_readeventlog(AmdParamStruct.StdHeader.HeapStatus);
 	AmdReleaseStruct (&AmdParamStruct);
 
 	return status;
@@ -306,7 +339,7 @@
 	timestamp_add_now(TS_AGESA_INIT_LATE_DONE);
 
 	if (Status != AGESA_SUCCESS) {
-		agesawrapper_amdreadeventlog(AmdLateParams->StdHeader.HeapStatus);
+		agesawrapper_readeventlog(AmdLateParams->StdHeader.HeapStatus);
 		ASSERT(Status == AGESA_SUCCESS);
 	}
 
@@ -351,31 +384,8 @@
 
 	Status = AmdLateRunApTask (&ApExeParams);
 	if (Status != AGESA_SUCCESS) {
-		/* agesawrapper_amdreadeventlog(); */
+		/* agesawrapper_readeventlog(); */
 		ASSERT(Status == AGESA_SUCCESS);
-	}
-
-	return Status;
-}
-
-AGESA_STATUS agesawrapper_amdreadeventlog (UINT8 HeapStatus)
-{
-	AGESA_STATUS Status;
-	EVENT_PARAMS AmdEventParams;
-
-	memset(&AmdEventParams, 0, sizeof(AmdEventParams));
-
-	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;

-- 
To view, visit https://review.coreboot.org/22884
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I402c75e4d65a592b9d1557c5852df03e48e206b9
Gerrit-Change-Number: 22884
Gerrit-PatchSet: 1
Gerrit-Owner: Marshall Dawson <marshalldawson3rd at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20171215/92463895/attachment-0001.html>


More information about the coreboot-gerrit mailing list