[coreboot] Patch set updated for coreboot: 47ed81b elog: add extended management engine event

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Wed Nov 7 19:58:52 CET 2012


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1739

-gerrit

commit 47ed81b10b5e452ab624d3fde3538fc3a2bd16be
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Sat Sep 1 14:00:23 2012 -0700

    elog: add extended management engine event
    
    We are seeing ME disabled and ME error events on some devices
    and this extended info can help with debug.
    
    Also fix a potential issue where if the log does manage to get
    completely full it will never try to shrink it because the only
    call to shrink the log happens after a successful event write.
    Add a check at elog init time to shrink the log size.
    
    Change-Id: Ib81dc231f6a004b341900374e6c07962cc292031
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/drivers/elog/elog.c                |  4 ++++
 src/include/elog.h                     | 10 +++++++++
 src/southbridge/intel/bd82x6x/me.c     | 28 +++++++++++++++--------
 src/southbridge/intel/bd82x6x/me_8.x.c | 41 +++++++++++++++++++++-------------
 4 files changed, 59 insertions(+), 24 deletions(-)

diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 1219883..10208f4 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -780,6 +780,10 @@ int elog_init(void)
 		elog_add_event_word(ELOG_TYPE_LOG_CLEAR,
 				    elog_get_flash()->total_size);
 
+	/* Shrink the log if we are getting too full */
+	if (elog_get_mem()->next_event_offset >= CONFIG_ELOG_FULL_THRESHOLD)
+		elog_shrink();
+
 #if CONFIG_ELOG_BOOT_COUNT && !defined(__SMM__)
 	/* Log boot count event except in S3 resume */
 	if (acpi_slp_type != 3)
diff --git a/src/include/elog.h b/src/include/elog.h
index 52a74ed..fa9a05c 100644
--- a/src/include/elog.h
+++ b/src/include/elog.h
@@ -108,6 +108,16 @@ struct elog_event_data_wake {
 
 /* Management Engine Events */
 #define ELOG_TYPE_MANAGEMENT_ENGINE       0xa2
+#define ELOG_TYPE_MANAGEMENT_ENGINE_EXT   0xa4
+struct elog_event_data_me_extended {
+	u8 current_working_state;
+	u8 operation_state;
+	u8 operation_mode;
+	u8 error_code;
+	u8 progress_code;
+	u8 current_pmevent;
+	u8 current_state;
+} __attribute__ ((packed));
 
 /* Last post code from previous boot */
 #define ELOG_TYPE_LAST_POST_CODE          0xa3
diff --git a/src/southbridge/intel/bd82x6x/me.c b/src/southbridge/intel/bd82x6x/me.c
index 3b7f342..b9aff37 100644
--- a/src/southbridge/intel/bd82x6x/me.c
+++ b/src/southbridge/intel/bd82x6x/me.c
@@ -568,10 +568,6 @@ static me_bios_path intel_me_path(device_t dev)
 	/* Check and dump status */
 	intel_me_status(&hfs, &gmes);
 
-	/* Check for valid firmware */
-	if (hfs.fpt_bad)
-		return ME_ERROR_BIOS_PATH;
-
 	/* Check Current Working State */
 	switch (hfs.working_state) {
 	case ME_HFS_CWS_NORMAL:
@@ -598,10 +594,27 @@ static me_bios_path intel_me_path(device_t dev)
 		break;
 	}
 
-	/* Check for any error code */
-	if (hfs.error_code)
+	/* Check for any error code and valid firmware */
+	if (hfs.error_code || hfs.fpt_bad)
 		path = ME_ERROR_BIOS_PATH;
 
+#if CONFIG_ELOG
+	if (path != ME_NORMAL_BIOS_PATH) {
+		struct elog_event_data_me_extended data = {
+			.current_working_state = hfs.working_state,
+			.operation_state       = hfs.operation_state,
+			.operation_mode        = hfs.operation_mode,
+			.error_code            = hfs.error_code,
+			.progress_code         = gmes.progress_code,
+			.current_pmevent       = gmes.current_pmevent,
+			.current_state         = gmes.current_state,
+		};
+		elog_add_event_byte(ELOG_TYPE_MANAGEMENT_ENGINE, path);
+		elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT,
+				   &data, sizeof(data));
+	}
+#endif
+
 	return path;
 }
 
@@ -728,9 +741,6 @@ static void intel_me_init(device_t dev)
 	case ME_RECOVERY_BIOS_PATH:
 	case ME_DISABLE_BIOS_PATH:
 	case ME_FIRMWARE_UPDATE_BIOS_PATH:
-#if CONFIG_ELOG
-		elog_add_event_byte(ELOG_TYPE_MANAGEMENT_ENGINE, path);
-#endif
 		break;
 	}
 }
diff --git a/src/southbridge/intel/bd82x6x/me_8.x.c b/src/southbridge/intel/bd82x6x/me_8.x.c
index 9461d61..b71f7ea 100644
--- a/src/southbridge/intel/bd82x6x/me_8.x.c
+++ b/src/southbridge/intel/bd82x6x/me_8.x.c
@@ -549,20 +549,10 @@ static me_bios_path intel_me_path(device_t dev)
 	/* Check and dump status */
 	intel_me_status(&hfs, &gmes);
 
-	/* Check for valid firmware */
-	if (hfs.fpt_bad)
-		return ME_ERROR_BIOS_PATH;
-
 	/* Check Current Working State */
 	switch (hfs.working_state) {
 	case ME_HFS_CWS_NORMAL:
 		path = ME_NORMAL_BIOS_PATH;
-		/* check if the MBP is ready */
-		if (!gmes.mbp_rdy) {
-			printk(BIOS_CRIT, "%s: mbp is not ready!\n",
-			       __FUNCTION__);
-			return ME_ERROR_BIOS_PATH;
-		}
 		break;
 	case ME_HFS_CWS_REC:
 		path = ME_RECOVERY_BIOS_PATH;
@@ -585,10 +575,34 @@ static me_bios_path intel_me_path(device_t dev)
 		break;
 	}
 
-	/* Check for any error code */
-	if (hfs.error_code)
+	/* Check for any error code and valid firmware and MBP */
+	if (hfs.error_code || hfs.fpt_bad)
 		path = ME_ERROR_BIOS_PATH;
 
+	/* Check if the MBP is ready */
+	if (!gmes.mbp_rdy) {
+		printk(BIOS_CRIT, "%s: mbp is not ready!\n",
+		       __FUNCTION__);
+		path = ME_ERROR_BIOS_PATH;
+	}
+
+#if CONFIG_ELOG
+	if (path != ME_NORMAL_BIOS_PATH) {
+		struct elog_event_data_me_extended data = {
+			.current_working_state = hfs.working_state,
+			.operation_state       = hfs.operation_state,
+			.operation_mode        = hfs.operation_mode,
+			.error_code            = hfs.error_code,
+			.progress_code         = gmes.progress_code,
+			.current_pmevent       = gmes.current_pmevent,
+			.current_state         = gmes.current_state,
+		};
+		elog_add_event_byte(ELOG_TYPE_MANAGEMENT_ENGINE, path);
+		elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT,
+				   &data, sizeof(data));
+	}
+#endif
+
 	return path;
 }
 
@@ -731,9 +745,6 @@ static void intel_me_init(device_t dev)
 	case ME_RECOVERY_BIOS_PATH:
 	case ME_DISABLE_BIOS_PATH:
 	case ME_FIRMWARE_UPDATE_BIOS_PATH:
-#if CONFIG_ELOG
-		elog_add_event_byte(ELOG_TYPE_MANAGEMENT_ENGINE, path);
-#endif
 		break;
 	}
 }




More information about the coreboot mailing list