blob: 79f7dde7110a6fc174d1adaaa7fbaa1eefc41d95 [file] [log] [blame]
Julius Werner105f5b72015-01-21 17:39:49 -08001/*
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 Werner105f5b72015-01-21 17:39:49 -080014 */
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
26void elog_add_watchdog_reset(void)
27{
Julius Werner2f37bd62015-02-19 14:51:15 -080028 if (read32(_watchdog_tombstone) == WATCHDOG_TOMBSTONE_MAGIC)
Julius Werner105f5b72015-01-21 17:39:49 -080029 elog_add_event(ELOG_TYPE_ASYNC_HW_TIMER_EXPIRED);
Julius Werner2f37bd62015-02-19 14:51:15 -080030 write32(_watchdog_tombstone, 0);
Julius Werner105f5b72015-01-21 17:39:49 -080031}
32
33void reboot_from_watchdog(void)
34{
35 printk(BIOS_INFO, "Last reset was watchdog, reboot again to reset TPM!\n");
Julius Werner2f37bd62015-02-19 14:51:15 -080036 write32(_watchdog_tombstone, WATCHDOG_TOMBSTONE_MAGIC);
Julius Werner105f5b72015-01-21 17:39:49 -080037 hard_reset();
38}