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@chromium.org>
Reviewed-on: http://review.coreboot.org/1739
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 7be443a..748adaf 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -803,6 +803,10 @@
 		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)