ec/google/wilco: Report BIOS progress to the EC

The EC expects to receive updates about the BIOS boot progress.  This is
used for the EC logging to track system boot completeness.  If the EC is
not informed about BIOS progress it will turn the system off 30 seconds
after the boot starts.

Change-Id: I693c3930117db2b69a119aee0380d6f303c4881c
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/29118
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/ec/google/wilco/chip.c b/src/ec/google/wilco/chip.c
index cc9f030..9a200bd 100644
--- a/src/ec/google/wilco/chip.c
+++ b/src/ec/google/wilco/chip.c
@@ -13,6 +13,7 @@
  * GNU General Public License for more details.
  */
 
+#include <bootstate.h>
 #include <device/pnp.h>
 #include <pc80/keyboard.h>
 #include <stdint.h>
@@ -22,6 +23,27 @@
 #include "ec.h"
 #include "chip.h"
 
+static void wilco_ec_post_complete(void *unused)
+{
+	wilco_ec_send(KB_BIOS_PROGRESS, BIOS_PROGRESS_POST_COMPLETE);
+}
+BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT,
+		      wilco_ec_post_complete, NULL);
+
+static void wilco_ec_post_memory_init(void *unused)
+{
+	wilco_ec_send(KB_BIOS_PROGRESS, BIOS_PROGRESS_MEMORY_INIT);
+}
+BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_EXIT,
+		      wilco_ec_post_memory_init, NULL);
+
+static void wilco_ec_post_video_init(void *unused)
+{
+	wilco_ec_send(KB_BIOS_PROGRESS, BIOS_PROGRESS_VIDEO_INIT);
+}
+BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT,
+		      wilco_ec_post_video_init, NULL);
+
 static void wilco_ec_init(struct device *dev)
 {
 	if (!dev->enabled)