Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / arch / xtensa / platform-iss / setup.c
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.
11  *
12  * This program is free software; you can redistribute  it and/or modify it
13  * under  the terms of  the GNU General  Public License as published by the
14  * Free Software Foundation;  either version 2 of the  License, or (at your
15  * option) any later version.
16  *
17  */
18 #include <linux/stddef.h>
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/errno.h>
22 #include <linux/reboot.h>
23 #include <linux/pci.h>
24 #include <linux/kdev_t.h>
25 #include <linux/types.h>
26 #include <linux/major.h>
27 #include <linux/blkdev.h>
28 #include <linux/console.h>
29 #include <linux/delay.h>
30 #include <linux/stringify.h>
31 #include <linux/notifier.h>
32
33 #include <asm/platform.h>
34 #include <asm/bootparam.h>
35
36
37 void __init platform_init(bp_tag_t* bootparam)
38 {
39
40 }
41
42 void platform_halt(void)
43 {
44         printk (" ** Called platform_halt(), looping forever! **\n");
45         while (1);
46 }
47
48 void platform_power_off(void)
49 {
50         printk (" ** Called platform_power_off(), looping forever! **\n");
51         while (1);
52 }
53 void platform_restart(void)
54 {
55         /* Flush and reset the mmu, simulate a processor reset, and
56          * jump to the reset vector. */
57
58         __asm__ __volatile__("movi      a2, 15\n\t"
59                              "wsr       a2, " __stringify(ICOUNTLEVEL) "\n\t"
60                              "movi      a2, 0\n\t"
61                              "wsr       a2, " __stringify(ICOUNT) "\n\t"
62                              "wsr       a2, " __stringify(IBREAKENABLE) "\n\t"
63                              "wsr       a2, " __stringify(LCOUNT) "\n\t"
64                              "movi      a2, 0x1f\n\t"
65                              "wsr       a2, " __stringify(PS) "\n\t"
66                              "isync\n\t"
67                              "jx        %0\n\t"
68                              :
69                              : "a" (XCHAL_RESET_VECTOR_VADDR)
70                              : "a2");
71
72         /* control never gets here */
73 }
74
75 extern void iss_net_poll(void);
76
77 const char twirl[]="|/-\\|/-\\";
78
79 void platform_heartbeat(void)
80 {
81 #if 0
82         static int i = 0, j = 0;
83
84         if (--i < 0) {
85                 i = 99;
86                 printk("\r%c\r", twirl[j++]);
87                 if (j == 8)
88                         j = 0;
89         }
90 #endif
91 }
92
93
94
95 static int
96 iss_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
97 {
98         __asm__ __volatile__("movi a2, -1; simcall\n");
99         return NOTIFY_DONE;
100 }
101
102 static struct notifier_block iss_panic_block = {
103         iss_panic_event,
104         NULL,
105         0
106 };
107
108 void __init platform_setup(char **p_cmdline)
109 {
110         atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
111 }