ec/lenovo/h8: Add panic method
Add two additional LED IDs. Add Kconfig menu entries to allow selecting the action to execute on death. Overwrite weak die_notify method to notify user on death. Flash all LEDs and play beep code 10 depending on Kconfig options. Successfully tested on: Tested on Lenovo T500. Tested on Lenovo X200. Tested on Lenovo T430, but only LEDs are flashing. Change-Id: Id34d399f154952a48c1f4ccb0c41a238b2d7ccb8 Signed-off-by: Patrick Rudolph <siro@das-labor.org Reviewed-on: https://review.coreboot.org/19695 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
a9117770e9
commit
7f395fe95b
|
@ -9,6 +9,18 @@ config SEABIOS_PS2_TIMEOUT
|
||||||
depends on PAYLOAD_SEABIOS
|
depends on PAYLOAD_SEABIOS
|
||||||
default 3000
|
default 3000
|
||||||
|
|
||||||
|
config H8_BEEP_ON_DEATH
|
||||||
|
bool "Beep on fatal error"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Beep when encountered a fatal error.
|
||||||
|
|
||||||
|
config H8_FLASH_LEDS_ON_DEATH
|
||||||
|
bool "Flash LEDs on fatal error"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Flash all LEDs when encountered a fatal error.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config H8_DOCK_EARLY_INIT
|
config H8_DOCK_EARLY_INIT
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
ifeq ($(CONFIG_EC_LENOVO_H8),y)
|
ifeq ($(CONFIG_EC_LENOVO_H8),y)
|
||||||
|
|
||||||
|
ifneq ($(filter y,$(CONFIG_H8_BEEP_ON_DEATH) $(CONFIG_H8_FLASH_LEDS_ON_DEATH)),)
|
||||||
|
romstage-y += panic.c
|
||||||
|
ramstage-y += panic.c
|
||||||
|
endif
|
||||||
|
|
||||||
ramstage-y += h8.c
|
ramstage-y += h8.c
|
||||||
smm-y += smm.c
|
smm-y += smm.c
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,8 @@ void h8_mainboard_init_dock (void);
|
||||||
#define H8_LED_CONTROL_SUSPEND_LED 0x07
|
#define H8_LED_CONTROL_SUSPEND_LED 0x07
|
||||||
#define H8_LED_CONTROL_DOCK_LED1 0x08
|
#define H8_LED_CONTROL_DOCK_LED1 0x08
|
||||||
#define H8_LED_CONTROL_DOCK_LED2 0x09
|
#define H8_LED_CONTROL_DOCK_LED2 0x09
|
||||||
|
#define H8_LED_CONTROL_ACDC_LED 0x0c
|
||||||
|
#define H8_LED_CONTROL_MUTE_LED 0x0e
|
||||||
|
|
||||||
#define H8_USB_ALWAYS_ON 0x0d
|
#define H8_USB_ALWAYS_ON 0x0d
|
||||||
#define H8_USB_ALWAYS_ON_ENABLE 0x01
|
#define H8_USB_ALWAYS_ON_ENABLE 0x01
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the coreboot project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Patrick Rudolph <siro@das-labor.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
#include <console/console.h>
|
||||||
|
#include <ec/acpi/ec.h>
|
||||||
|
|
||||||
|
#include "h8.h"
|
||||||
|
|
||||||
|
static void h8_panic(void)
|
||||||
|
{
|
||||||
|
if (IS_ENABLED(CONFIG_H8_FLASH_LEDS_ON_DEATH)) {
|
||||||
|
static const u8 leds[] = {
|
||||||
|
H8_LED_CONTROL_POWER_LED,
|
||||||
|
H8_LED_CONTROL_BAT0_LED,
|
||||||
|
H8_LED_CONTROL_BAT1_LED,
|
||||||
|
H8_LED_CONTROL_UBAY_LED,
|
||||||
|
H8_LED_CONTROL_SUSPEND_LED,
|
||||||
|
H8_LED_CONTROL_DOCK_LED1,
|
||||||
|
H8_LED_CONTROL_DOCK_LED2,
|
||||||
|
H8_LED_CONTROL_ACDC_LED,
|
||||||
|
H8_LED_CONTROL_MUTE_LED
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Flash all LEDs */
|
||||||
|
for (size_t i = 0; i < ARRAY_SIZE(leds); i++)
|
||||||
|
ec_write(H8_LED_CONTROL,
|
||||||
|
H8_LED_CONTROL_BLINK | leds[i]);
|
||||||
|
}
|
||||||
|
if (IS_ENABLED(CONFIG_H8_BEEP_ON_DEATH)) {
|
||||||
|
/* Beep 4 Sec. 1250 Hz */
|
||||||
|
ec_write(H8_SOUND_ENABLE1, 4);
|
||||||
|
ec_write(H8_SOUND_REPEAT, 1);
|
||||||
|
ec_write(H8_SOUND_REG, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void die_notify(void)
|
||||||
|
{
|
||||||
|
h8_panic();
|
||||||
|
}
|
Loading…
Reference in New Issue