2 * Copyright (C) 2014 Google, Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
15 #include <linux/kernel.h>
16 #include <linux/spinlock.h>
17 #include <linux/pstore_ram.h>
19 #include "fiq_watchdog.h"
20 #include "fiq_debugger_priv.h"
22 static DEFINE_RAW_SPINLOCK(fiq_watchdog_lock
);
24 static void fiq_watchdog_printf(struct fiq_debugger_output
*output
,
32 len
= vscnprintf(buf
, sizeof(buf
), fmt
, ap
);
35 ramoops_console_write_buf(buf
, len
);
38 struct fiq_debugger_output fiq_watchdog_output
= {
39 .printf
= fiq_watchdog_printf
,
42 void fiq_watchdog_triggered(const struct pt_regs
*regs
, void *svc_sp
)
47 raw_spin_lock(&fiq_watchdog_lock
);
49 len
= scnprintf(msg
, sizeof(msg
), "watchdog fiq cpu %d\n",
50 THREAD_INFO(svc_sp
)->cpu
);
51 ramoops_console_write_buf(msg
, len
);
53 fiq_debugger_dump_stacktrace(&fiq_watchdog_output
, regs
, 100, svc_sp
);
55 raw_spin_unlock(&fiq_watchdog_lock
);