blob: e2b8b74b7cd418566466ff308d15f7ebe2cba5bb [file] [log] [blame]
Sjoerd Simons2b22a992015-12-04 23:27:38 +01001/*
2 * linux/lib/vsprintf.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
8/*
9 * Wirzenius wrote this portably, Torvalds fucked it up :-)
10 */
11
12#include <common.h>
13#if !defined(CONFIG_PANIC_HANG)
14#include <command.h>
15#endif
16
17static void panic_finish(void) __attribute__ ((noreturn));
18
19static void panic_finish(void)
20{
21 putc('\n');
22#if defined(CONFIG_PANIC_HANG)
23 hang();
24#else
25 udelay(100000); /* allow messages to go out */
26 do_reset(NULL, 0, 0, NULL);
27#endif
28 while (1)
29 ;
30}
31
32void panic_str(const char *str)
33{
34 puts(str);
35 panic_finish();
36}
37
38void panic(const char *fmt, ...)
39{
40 va_list args;
41 va_start(args, fmt);
42 vprintf(fmt, args);
43 va_end(args);
44 panic_finish();
45}