mirror of
https://github.com/torvalds/linux.git
synced 2024-12-16 16:12:52 +00:00
f39650de68
kernel.h is being used as a dump for all kinds of stuff for a long time. Here is the attempt to start cleaning it up by splitting out panic and oops helpers. There are several purposes of doing this: - dropping dependency in bug.h - dropping a loop by moving out panic_notifier.h - unload kernel.h from something which has its own domain At the same time convert users tree-wide to use new headers, although for the time being include new header back to kernel.h to avoid twisted indirected includes for existing users. [akpm@linux-foundation.org: thread_info.h needs limits.h] [andriy.shevchenko@linux.intel.com: ia64 fix] Link: https://lkml.kernel.org/r/20210520130557.55277-1-andriy.shevchenko@linux.intel.com Link: https://lkml.kernel.org/r/20210511074137.33666-1-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Co-developed-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Mike Rapoport <rppt@linux.ibm.com> Acked-by: Corey Minyard <cminyard@mvista.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Kees Cook <keescook@chromium.org> Acked-by: Wei Liu <wei.liu@kernel.org> Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Sebastian Reichel <sre@kernel.org> Acked-by: Luis Chamberlain <mcgrof@kernel.org> Acked-by: Stephen Boyd <sboyd@kernel.org> Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Acked-by: Helge Deller <deller@gmx.de> # parisc Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
86 lines
1.7 KiB
C
86 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
*
|
|
* arch/xtensa/platform-iss/setup.c
|
|
*
|
|
* Platform specific initialization.
|
|
*
|
|
* Authors: Chris Zankel <chris@zankel.net>
|
|
* Joe Taylor <joe@tensilica.com>
|
|
*
|
|
* Copyright 2001 - 2005 Tensilica Inc.
|
|
* Copyright 2017 Cadence Design Systems Inc.
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/notifier.h>
|
|
#include <linux/panic_notifier.h>
|
|
#include <linux/printk.h>
|
|
#include <linux/string.h>
|
|
|
|
#include <asm/platform.h>
|
|
#include <asm/setup.h>
|
|
|
|
#include <platform/simcall.h>
|
|
|
|
|
|
void platform_halt(void)
|
|
{
|
|
pr_info(" ** Called platform_halt() **\n");
|
|
simc_exit(0);
|
|
}
|
|
|
|
void platform_power_off(void)
|
|
{
|
|
pr_info(" ** Called platform_power_off() **\n");
|
|
simc_exit(0);
|
|
}
|
|
|
|
void platform_restart(void)
|
|
{
|
|
/* Flush and reset the mmu, simulate a processor reset, and
|
|
* jump to the reset vector. */
|
|
cpu_reset();
|
|
/* control never gets here */
|
|
}
|
|
|
|
static int
|
|
iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
|
|
{
|
|
simc_exit(1);
|
|
return NOTIFY_DONE;
|
|
}
|
|
|
|
static struct notifier_block iss_panic_block = {
|
|
.notifier_call = iss_panic_event,
|
|
};
|
|
|
|
void __init platform_setup(char **p_cmdline)
|
|
{
|
|
static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata;
|
|
static char cmdline[COMMAND_LINE_SIZE] __initdata;
|
|
int argc = simc_argc();
|
|
int argv_size = simc_argv_size();
|
|
|
|
if (argc > 1) {
|
|
if (argv_size > sizeof(argv)) {
|
|
pr_err("%s: command line too long: argv_size = %d\n",
|
|
__func__, argv_size);
|
|
} else {
|
|
int i;
|
|
|
|
cmdline[0] = 0;
|
|
simc_argv((void *)argv);
|
|
|
|
for (i = 1; i < argc; ++i) {
|
|
if (i > 1)
|
|
strcat(cmdline, " ");
|
|
strcat(cmdline, argv[i]);
|
|
}
|
|
*p_cmdline = cmdline;
|
|
}
|
|
}
|
|
|
|
atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
|
|
}
|