diff options
Diffstat (limited to 'src/vendorcode')
-rw-r--r-- | src/vendorcode/google/chromeos/Makefile.inc | 4 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/chromeos.h | 6 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/memlayout.h | 4 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/symbols.h | 4 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/watchdog.c | 42 |
5 files changed, 60 insertions, 0 deletions
diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc index 8d0360c725..1a976af1aa 100644 --- a/src/vendorcode/google/chromeos/Makefile.inc +++ b/src/vendorcode/google/chromeos/Makefile.inc @@ -42,6 +42,10 @@ ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c smm-y += fmap.c romstage-y += vpd_decode.c cros_vpd.c ramstage-y += vpd_decode.c cros_vpd.c vpd_mac.c vpd_calibration.c +ifeq ($(CONFIG_ARCH_X86)$(CONFIG_ARCH_MIPS),) +bootblock-y += watchdog.c +ramstage-y += watchdog.c +endif ifeq ($(MOCK_TPM),1) CFLAGS_common += -DMOCK_TPM=1 diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index 1184fa573e..ccbadabc49 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -39,9 +39,15 @@ void init_chromeos(int bootmode); /* functions implemented in elog.c */ void elog_add_boot_reason(void); + +/* functions implemented in watchdog.c */ +void elog_add_watchdog_reset(void); +void reboot_from_watchdog(void); #else static inline void init_chromeos(int bootmode) { } static inline void elog_add_boot_reason(void) { return; } +static inline void elog_add_watchdog_reset(void) { return; } +static inline void reboot_from_watchdog(void) { return; } #endif /* CONFIG_CHROMEOS */ struct romstage_handoff; diff --git a/src/vendorcode/google/chromeos/memlayout.h b/src/vendorcode/google/chromeos/memlayout.h index 140da46bcc..a7ea32e00e 100644 --- a/src/vendorcode/google/chromeos/memlayout.h +++ b/src/vendorcode/google/chromeos/memlayout.h @@ -47,4 +47,8 @@ #define OVERLAP_VERSTAGE_ROMSTAGE(addr, size) ROMSTAGE(addr, size) #endif +#define WATCHDOG_TOMBSTONE(addr, size) \ + REGION(watchdog_tombstone, addr, size, 4) \ + _ = ASSERT(size == 4, "watchdog tombstones should be exactly 4 byte!"); + #endif /* __CHROMEOS_MEMLAYOUT_H */ diff --git a/src/vendorcode/google/chromeos/symbols.h b/src/vendorcode/google/chromeos/symbols.h index 21169f0b3a..77b51b8a67 100644 --- a/src/vendorcode/google/chromeos/symbols.h +++ b/src/vendorcode/google/chromeos/symbols.h @@ -29,4 +29,8 @@ extern u8 _verstage[]; extern u8 _everstage[]; #define _verstage_size (_everstage - _verstage) +extern u8 _watchdog_tombstone[]; +extern u8 _ewatchdog_tombstone[]; +#define _watchdog_tombstone_size (_ewatchdog_tombstone - _watchdog_tombstone) + #endif /* __CHROMEOS_SYMBOLS_H */ diff --git a/src/vendorcode/google/chromeos/watchdog.c b/src/vendorcode/google/chromeos/watchdog.c new file mode 100644 index 0000000000..e4adf8a041 --- /dev/null +++ b/src/vendorcode/google/chromeos/watchdog.c @@ -0,0 +1,42 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2015 Google Inc. + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA + */ + +#include <arch/io.h> +#include <console/console.h> +#include <elog.h> +#include <reset.h> + +#include "chromeos.h" +#include "symbols.h" + +#define WATCHDOG_TOMBSTONE_MAGIC 0x9d2f41a7 + +void elog_add_watchdog_reset(void) +{ + if (readl(_watchdog_tombstone) == WATCHDOG_TOMBSTONE_MAGIC) + elog_add_event(ELOG_TYPE_ASYNC_HW_TIMER_EXPIRED); + writel(0, _watchdog_tombstone); +} + +void reboot_from_watchdog(void) +{ + printk(BIOS_INFO, "Last reset was watchdog, reboot again to reset TPM!\n"); + writel(WATCHDOG_TOMBSTONE_MAGIC, _watchdog_tombstone); + hard_reset(); +} |