drm/tests: hdmi: Fix memory leaks in drm_display_mode_from_cea_vic()
[drm/drm-misc.git] / arch / xtensa / platforms / iss / setup.c
blob0f1fe132691e26195d5834cb061be3d0fb9257e7
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
4 * arch/xtensa/platform-iss/setup.c
6 * Platform specific initialization.
8 * Authors: Chris Zankel <chris@zankel.net>
9 * Joe Taylor <joe@tensilica.com>
11 * Copyright 2001 - 2005 Tensilica Inc.
12 * Copyright 2017 Cadence Design Systems Inc.
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/notifier.h>
17 #include <linux/panic_notifier.h>
18 #include <linux/printk.h>
19 #include <linux/reboot.h>
20 #include <linux/string.h>
22 #include <asm/platform.h>
23 #include <asm/setup.h>
25 #include <platform/simcall.h>
28 static int iss_power_off(struct sys_off_data *unused)
30 pr_info(" ** Called platform_power_off() **\n");
31 simc_exit(0);
32 return NOTIFY_DONE;
35 static int iss_restart(struct notifier_block *this,
36 unsigned long event, void *ptr)
38 /* Flush and reset the mmu, simulate a processor reset, and
39 * jump to the reset vector. */
40 cpu_reset();
42 return NOTIFY_DONE;
45 static struct notifier_block iss_restart_block = {
46 .notifier_call = iss_restart,
49 static int
50 iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
52 simc_exit(1);
53 return NOTIFY_DONE;
56 static struct notifier_block iss_panic_block = {
57 .notifier_call = iss_panic_event,
60 void __init platform_setup(char **p_cmdline)
62 static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata;
63 static char cmdline[COMMAND_LINE_SIZE] __initdata;
64 int argc = simc_argc();
65 int argv_size = simc_argv_size();
67 if (argc > 1) {
68 if (argv_size > sizeof(argv)) {
69 pr_err("%s: command line too long: argv_size = %d\n",
70 __func__, argv_size);
71 } else {
72 int i;
74 cmdline[0] = 0;
75 simc_argv((void *)argv);
77 for (i = 1; i < argc; ++i) {
78 if (i > 1)
79 strcat(cmdline, " ");
80 strcat(cmdline, argv[i]);
82 *p_cmdline = cmdline;
86 atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
87 register_restart_handler(&iss_restart_block);
88 register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
89 SYS_OFF_PRIO_PLATFORM,
90 iss_power_off, NULL);