treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / xtensa / platforms / iss / setup.c
blobe28dd53d7df52f6edc796a70e97b5362936bff7e
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/memblock.h>
15 #include <linux/stddef.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/errno.h>
19 #include <linux/reboot.h>
20 #include <linux/kdev_t.h>
21 #include <linux/types.h>
22 #include <linux/major.h>
23 #include <linux/blkdev.h>
24 #include <linux/console.h>
25 #include <linux/delay.h>
26 #include <linux/stringify.h>
27 #include <linux/notifier.h>
29 #include <asm/platform.h>
30 #include <asm/bootparam.h>
31 #include <asm/setup.h>
33 #include <platform/simcall.h>
36 void __init platform_init(bp_tag_t* bootparam)
40 void platform_halt(void)
42 pr_info(" ** Called platform_halt() **\n");
43 simc_exit(0);
46 void platform_power_off(void)
48 pr_info(" ** Called platform_power_off() **\n");
49 simc_exit(0);
51 void platform_restart(void)
53 /* Flush and reset the mmu, simulate a processor reset, and
54 * jump to the reset vector. */
55 cpu_reset();
56 /* control never gets here */
59 void platform_heartbeat(void)
63 static int
64 iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
66 simc_exit(1);
67 return NOTIFY_DONE;
70 static struct notifier_block iss_panic_block = {
71 .notifier_call = iss_panic_event,
74 void __init platform_setup(char **p_cmdline)
76 static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata;
77 static char cmdline[COMMAND_LINE_SIZE] __initdata;
78 int argc = simc_argc();
79 int argv_size = simc_argv_size();
81 if (argc > 1) {
82 if (argv_size > sizeof(argv)) {
83 pr_err("%s: command line too long: argv_size = %d\n",
84 __func__, argv_size);
85 } else {
86 int i;
88 cmdline[0] = 0;
89 simc_argv((void *)argv);
91 for (i = 1; i < argc; ++i) {
92 if (i > 1)
93 strcat(cmdline, " ");
94 strcat(cmdline, argv[i]);
96 *p_cmdline = cmdline;
100 atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);