]>
Commit | Line | Data |
---|---|---|
2874c5fd | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
7282bee7 CZ |
2 | /* |
3 | * | |
4 | * arch/xtensa/platform-iss/setup.c | |
5 | * | |
6 | * Platform specific initialization. | |
7 | * | |
8 | * Authors: Chris Zankel <chris@zankel.net> | |
9 | * Joe Taylor <joe@tensilica.com> | |
10 | * | |
11 | * Copyright 2001 - 2005 Tensilica Inc. | |
fbe22d28 | 12 | * Copyright 2017 Cadence Design Systems Inc. |
7282bee7 | 13 | */ |
57c8a661 | 14 | #include <linux/memblock.h> |
7282bee7 CZ |
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> | |
7282bee7 CZ |
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> | |
28 | ||
29 | #include <asm/platform.h> | |
30 | #include <asm/bootparam.h> | |
3ced9730 | 31 | #include <asm/setup.h> |
7282bee7 | 32 | |
feec273a MF |
33 | #include <platform/simcall.h> |
34 | ||
7282bee7 CZ |
35 | |
36 | void __init platform_init(bp_tag_t* bootparam) | |
37 | { | |
7282bee7 CZ |
38 | } |
39 | ||
40 | void platform_halt(void) | |
41 | { | |
23753171 | 42 | pr_info(" ** Called platform_halt() **\n"); |
feec273a | 43 | simc_exit(0); |
7282bee7 CZ |
44 | } |
45 | ||
46 | void platform_power_off(void) | |
47 | { | |
23753171 | 48 | pr_info(" ** Called platform_power_off() **\n"); |
feec273a | 49 | simc_exit(0); |
7282bee7 CZ |
50 | } |
51 | void platform_restart(void) | |
52 | { | |
53 | /* Flush and reset the mmu, simulate a processor reset, and | |
54 | * jump to the reset vector. */ | |
4f205687 | 55 | cpu_reset(); |
7282bee7 CZ |
56 | /* control never gets here */ |
57 | } | |
58 | ||
7282bee7 CZ |
59 | void platform_heartbeat(void) |
60 | { | |
7282bee7 CZ |
61 | } |
62 | ||
7282bee7 CZ |
63 | static int |
64 | iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr) | |
65 | { | |
feec273a | 66 | simc_exit(1); |
7282bee7 CZ |
67 | return NOTIFY_DONE; |
68 | } | |
69 | ||
70 | static struct notifier_block iss_panic_block = { | |
3ced9730 | 71 | .notifier_call = iss_panic_event, |
7282bee7 CZ |
72 | }; |
73 | ||
74 | void __init platform_setup(char **p_cmdline) | |
75 | { | |
ef439d49 MF |
76 | static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata; |
77 | static char cmdline[COMMAND_LINE_SIZE] __initdata; | |
fbe22d28 MF |
78 | int argc = simc_argc(); |
79 | int argv_size = simc_argv_size(); | |
80 | ||
81 | if (argc > 1) { | |
ef439d49 MF |
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; | |
fbe22d28 | 87 | |
ef439d49 MF |
88 | cmdline[0] = 0; |
89 | simc_argv((void *)argv); | |
fbe22d28 | 90 | |
ef439d49 MF |
91 | for (i = 1; i < argc; ++i) { |
92 | if (i > 1) | |
93 | strcat(cmdline, " "); | |
94 | strcat(cmdline, argv[i]); | |
95 | } | |
96 | *p_cmdline = cmdline; | |
fbe22d28 | 97 | } |
fbe22d28 MF |
98 | } |
99 | ||
e041c683 | 100 | atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block); |
7282bee7 | 101 | } |