mm: remove include/linux/bootmem.h
[linux-2.6-block.git] / arch / xtensa / platforms / iss / setup.c
CommitLineData
7282bee7
CZ
1/*
2 *
3 * arch/xtensa/platform-iss/setup.c
4 *
5 * Platform specific initialization.
6 *
7 * Authors: Chris Zankel <chris@zankel.net>
8 * Joe Taylor <joe@tensilica.com>
9 *
10 * Copyright 2001 - 2005 Tensilica Inc.
fbe22d28 11 * Copyright 2017 Cadence Design Systems Inc.
7282bee7
CZ
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 */
57c8a661 19#include <linux/memblock.h>
7282bee7
CZ
20#include <linux/stddef.h>
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/errno.h>
24#include <linux/reboot.h>
7282bee7
CZ
25#include <linux/kdev_t.h>
26#include <linux/types.h>
27#include <linux/major.h>
28#include <linux/blkdev.h>
29#include <linux/console.h>
30#include <linux/delay.h>
31#include <linux/stringify.h>
32#include <linux/notifier.h>
33
34#include <asm/platform.h>
35#include <asm/bootparam.h>
3ced9730 36#include <asm/setup.h>
7282bee7 37
feec273a
MF
38#include <platform/simcall.h>
39
7282bee7
CZ
40
41void __init platform_init(bp_tag_t* bootparam)
42{
7282bee7
CZ
43}
44
45void platform_halt(void)
46{
23753171 47 pr_info(" ** Called platform_halt() **\n");
feec273a 48 simc_exit(0);
7282bee7
CZ
49}
50
51void platform_power_off(void)
52{
23753171 53 pr_info(" ** Called platform_power_off() **\n");
feec273a 54 simc_exit(0);
7282bee7
CZ
55}
56void platform_restart(void)
57{
58 /* Flush and reset the mmu, simulate a processor reset, and
59 * jump to the reset vector. */
4f205687 60 cpu_reset();
7282bee7
CZ
61 /* control never gets here */
62}
63
7282bee7
CZ
64void platform_heartbeat(void)
65{
7282bee7
CZ
66}
67
7282bee7
CZ
68static int
69iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
70{
feec273a 71 simc_exit(1);
7282bee7
CZ
72 return NOTIFY_DONE;
73}
74
75static struct notifier_block iss_panic_block = {
3ced9730 76 .notifier_call = iss_panic_event,
7282bee7
CZ
77};
78
79void __init platform_setup(char **p_cmdline)
80{
ef439d49
MF
81 static void *argv[COMMAND_LINE_SIZE / sizeof(void *)] __initdata;
82 static char cmdline[COMMAND_LINE_SIZE] __initdata;
fbe22d28
MF
83 int argc = simc_argc();
84 int argv_size = simc_argv_size();
85
86 if (argc > 1) {
ef439d49
MF
87 if (argv_size > sizeof(argv)) {
88 pr_err("%s: command line too long: argv_size = %d\n",
89 __func__, argv_size);
90 } else {
91 int i;
fbe22d28 92
ef439d49
MF
93 cmdline[0] = 0;
94 simc_argv((void *)argv);
fbe22d28 95
ef439d49
MF
96 for (i = 1; i < argc; ++i) {
97 if (i > 1)
98 strcat(cmdline, " ");
99 strcat(cmdline, argv[i]);
100 }
101 *p_cmdline = cmdline;
fbe22d28 102 }
fbe22d28
MF
103 }
104
e041c683 105 atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
7282bee7 106}