<p>Martin Roth <strong>merged</strong> this change.</p><p><a href="https://review.coreboot.org/19695">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  build bot (Jenkins): Verified
  Martin Roth: Looks good to me, approved

Objections:
  Nico Huber: I would prefer that you didn't submit this

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ec/lenovo/h8: Add panic method<br><br>Add two additional LED IDs.<br>Add Kconfig menu entries to allow selecting the action<br>to execute on death.<br>Overwrite weak die_notify method to notify user on death.<br>Flash all LEDs and play beep code 10 depending on Kconfig<br>options.<br><br>Successfully tested on:<br>Tested on Lenovo T500.<br>Tested on Lenovo X200.<br><br>Tested on Lenovo T430, but only LEDs are flashing.<br><br>Change-Id: Id34d399f154952a48c1f4ccb0c41a238b2d7ccb8<br>Signed-off-by: Patrick Rudolph <siro@das-labor.org<br>Reviewed-on: https://review.coreboot.org/19695<br>Tested-by: build bot (Jenkins) <no-reply@coreboot.org><br>Reviewed-by: Martin Roth <martinroth@google.com><br>---<br>M src/ec/lenovo/h8/Kconfig<br>M src/ec/lenovo/h8/Makefile.inc<br>M src/ec/lenovo/h8/h8.h<br>A src/ec/lenovo/h8/panic.c<br>4 files changed, 70 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/ec/lenovo/h8/Kconfig b/src/ec/lenovo/h8/Kconfig<br>index 98e8e30..190f4a9 100644<br>--- a/src/ec/lenovo/h8/Kconfig<br>+++ b/src/ec/lenovo/h8/Kconfig<br>@@ -9,6 +9,18 @@<br>  depends on PAYLOAD_SEABIOS<br>    default 3000<br> <br>+config H8_BEEP_ON_DEATH<br>+    bool "Beep on fatal error"<br>+ default y<br>+    help<br>+   Beep when encountered a fatal error.<br>+<br>+config H8_FLASH_LEDS_ON_DEATH<br>+    bool "Flash LEDs on fatal error"<br>+   default y<br>+    help<br>+   Flash all LEDs when encountered a fatal error.<br>+<br> endif<br> <br> config H8_DOCK_EARLY_INIT<br>diff --git a/src/ec/lenovo/h8/Makefile.inc b/src/ec/lenovo/h8/Makefile.inc<br>index da9cee1..c37a6e1 100644<br>--- a/src/ec/lenovo/h8/Makefile.inc<br>+++ b/src/ec/lenovo/h8/Makefile.inc<br>@@ -1,5 +1,10 @@<br> ifeq ($(CONFIG_EC_LENOVO_H8),y)<br> <br>+ifneq ($(filter y,$(CONFIG_H8_BEEP_ON_DEATH) $(CONFIG_H8_FLASH_LEDS_ON_DEATH)),)<br>+romstage-y += panic.c<br>+ramstage-y += panic.c<br>+endif<br>+<br> ramstage-y += h8.c<br> smm-y += smm.c<br> <br>diff --git a/src/ec/lenovo/h8/h8.h b/src/ec/lenovo/h8/h8.h<br>index 42d279f..9d4b186 100644<br>--- a/src/ec/lenovo/h8/h8.h<br>+++ b/src/ec/lenovo/h8/h8.h<br>@@ -71,6 +71,8 @@<br> #define H8_LED_CONTROL_SUSPEND_LED      0x07<br> #define H8_LED_CONTROL_DOCK_LED1 0x08<br> #define H8_LED_CONTROL_DOCK_LED2 0x09<br>+#define H8_LED_CONTROL_ACDC_LED          0x0c<br>+#define H8_LED_CONTROL_MUTE_LED          0x0e<br> <br> #define H8_USB_ALWAYS_ON              0x0d<br> #define H8_USB_ALWAYS_ON_ENABLE          0x01<br>diff --git a/src/ec/lenovo/h8/panic.c b/src/ec/lenovo/h8/panic.c<br>new file mode 100644<br>index 0000000..fbe0dc0<br>--- /dev/null<br>+++ b/src/ec/lenovo/h8/panic.c<br>@@ -0,0 +1,51 @@<br>+/*<br>+ * This file is part of the coreboot project.<br>+ *<br>+ * Copyright (C) 2017 Patrick Rudolph <siro@das-labor.org><br>+ *<br>+ * This program is free software; you can redistribute it and/or modify<br>+ * it under the terms of the GNU General Public License as published by<br>+ * the Free Software Foundation; version 2 of the License.<br>+ *<br>+ * This program is distributed in the hope that it will be useful,<br>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+ * GNU General Public License for more details.<br>+ */<br>+#include <console/console.h><br>+#include <ec/acpi/ec.h><br>+<br>+#include "h8.h"<br>+<br>+static void h8_panic(void)<br>+{<br>+    if (IS_ENABLED(CONFIG_H8_FLASH_LEDS_ON_DEATH)) {<br>+             static const u8 leds[] = {<br>+                   H8_LED_CONTROL_POWER_LED,<br>+                    H8_LED_CONTROL_BAT0_LED,<br>+                     H8_LED_CONTROL_BAT1_LED,<br>+                     H8_LED_CONTROL_UBAY_LED,<br>+                     H8_LED_CONTROL_SUSPEND_LED,<br>+                  H8_LED_CONTROL_DOCK_LED1,<br>+                    H8_LED_CONTROL_DOCK_LED2,<br>+                    H8_LED_CONTROL_ACDC_LED,<br>+                     H8_LED_CONTROL_MUTE_LED<br>+              };<br>+<br>+                /* Flash all LEDs */<br>+         for (size_t i = 0; i < ARRAY_SIZE(leds); i++)<br>+                     ec_write(H8_LED_CONTROL,<br>+                              H8_LED_CONTROL_BLINK | leds[i]);<br>+    }<br>+    if (IS_ENABLED(CONFIG_H8_BEEP_ON_DEATH)) {<br>+           /* Beep 4 Sec. 1250 Hz */<br>+            ec_write(H8_SOUND_ENABLE1, 4);<br>+               ec_write(H8_SOUND_REPEAT, 1);<br>+                ec_write(H8_SOUND_REG, 10);<br>+  }<br>+}<br>+<br>+void die_notify(void)<br>+{<br>+ h8_panic();<br>+}<br></pre><p>To view, visit <a href="https://review.coreboot.org/19695">change 19695</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/19695"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Id34d399f154952a48c1f4ccb0c41a238b2d7ccb8 </div>
<div style="display:none"> Gerrit-Change-Number: 19695 </div>
<div style="display:none"> Gerrit-PatchSet: 11 </div>
<div style="display:none"> Gerrit-Owner: Patrick Rudolph <siro@das-labor.org> </div>
<div style="display:none"> Gerrit-Reviewer: Alexander Couzens <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz> </div>
<div style="display:none"> Gerrit-Reviewer: Martin Roth <martinroth@google.com> </div>
<div style="display:none"> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> </div>
<div style="display:none"> Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org> </div>
<div style="display:none"> Gerrit-Reviewer: Paul Menzel <paulepanter@users.sourceforge.net> </div>
<div style="display:none"> Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org> </div>