Julius Werner | 105f5b7 | 2015-01-21 17:39:49 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2015 Google Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Julius Werner | 105f5b7 | 2015-01-21 17:39:49 -0800 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <arch/io.h> |
| 17 | #include <console/console.h> |
| 18 | #include <elog.h> |
| 19 | #include <reset.h> |
| 20 | |
| 21 | #include "chromeos.h" |
| 22 | #include "symbols.h" |
| 23 | |
| 24 | #define WATCHDOG_TOMBSTONE_MAGIC 0x9d2f41a7 |
| 25 | |
| 26 | void elog_add_watchdog_reset(void) |
| 27 | { |
Julius Werner | 2f37bd6 | 2015-02-19 14:51:15 -0800 | [diff] [blame] | 28 | if (read32(_watchdog_tombstone) == WATCHDOG_TOMBSTONE_MAGIC) |
Julius Werner | 105f5b7 | 2015-01-21 17:39:49 -0800 | [diff] [blame] | 29 | elog_add_event(ELOG_TYPE_ASYNC_HW_TIMER_EXPIRED); |
Julius Werner | 2f37bd6 | 2015-02-19 14:51:15 -0800 | [diff] [blame] | 30 | write32(_watchdog_tombstone, 0); |
Julius Werner | 105f5b7 | 2015-01-21 17:39:49 -0800 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | void reboot_from_watchdog(void) |
| 34 | { |
| 35 | printk(BIOS_INFO, "Last reset was watchdog, reboot again to reset TPM!\n"); |
Julius Werner | 2f37bd6 | 2015-02-19 14:51:15 -0800 | [diff] [blame] | 36 | write32(_watchdog_tombstone, WATCHDOG_TOMBSTONE_MAGIC); |
Julius Werner | 105f5b7 | 2015-01-21 17:39:49 -0800 | [diff] [blame] | 37 | hard_reset(); |
| 38 | } |