This source file includes following definitions.
- sun3x_halt
- sun3x_reboot
- sun3x_prom_write
- sun3x_prom_init
- sun3x_debug_setup
- prom_getintdefault
- prom_getbool
- prom_printf
- prom_halt
- prom_get_idprom
1
2
3
4 #include <linux/types.h>
5 #include <linux/kernel.h>
6 #include <linux/tty.h>
7 #include <linux/console.h>
8 #include <linux/init.h>
9 #include <linux/mm.h>
10 #include <linux/string.h>
11
12 #include <asm/page.h>
13 #include <asm/pgtable.h>
14 #include <asm/setup.h>
15 #include <asm/traps.h>
16 #include <asm/sun3xprom.h>
17 #include <asm/idprom.h>
18 #include <asm/segment.h>
19 #include <asm/sun3ints.h>
20 #include <asm/openprom.h>
21 #include <asm/machines.h>
22
23 void (*sun3x_putchar)(int);
24 int (*sun3x_getchar)(void);
25 int (*sun3x_mayget)(void);
26 int (*sun3x_mayput)(int);
27 void (*sun3x_prom_reboot)(void);
28 e_vector sun3x_prom_abort;
29 struct linux_romvec *romvec;
30
31
32 e_vector *sun3x_prom_vbr;
33
34
35 void sun3x_halt(void)
36 {
37 unsigned long flags;
38
39
40 local_irq_save(flags);
41
42
43 asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
44
45
46
47 sun3_enable_irq(7);
48
49
50 asm volatile ("trap #14");
51
52
53 sun3_disable_irq(7);
54 sun3_enable_irq(5);
55
56 asm volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
57 local_irq_restore(flags);
58 }
59
60 void sun3x_reboot(void)
61 {
62
63 local_irq_disable();
64
65
66 asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
67
68
69 sun3_disable_irq(5);
70 sun3_enable_irq(7);
71
72
73 (*romvec->pv_reboot)("vmlinux");
74 }
75
76 static void sun3x_prom_write(struct console *co, const char *s,
77 unsigned int count)
78 {
79 while (count--) {
80 if (*s == '\n')
81 sun3x_putchar('\r');
82 sun3x_putchar(*s++);
83 }
84 }
85
86
87
88 static struct console sun3x_debug = {
89 .name = "debug",
90 .write = sun3x_prom_write,
91 .flags = CON_PRINTBUFFER,
92 .index = -1,
93 };
94
95 void __init sun3x_prom_init(void)
96 {
97
98
99 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR);
100 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR);
101 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET);
102 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT);
103 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT);
104 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT);
105 romvec = (struct linux_romvec *)SUN3X_PROM_BASE;
106
107 idprom_init();
108
109 if (!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) {
110 pr_warn("Machine reports strange type %02x\n",
111 idprom->id_machtype);
112 pr_warn("Pretending it's a 3/80, but very afraid...\n");
113 idprom->id_machtype = SM_SUN3X | SM_3_80;
114 }
115
116
117
118
119 vectors[VEC_TRAP14] = sun3x_prom_abort;
120 }
121
122 static int __init sun3x_debug_setup(char *arg)
123 {
124
125 if (MACH_IS_SUN3X && !strcmp(arg, "prom"))
126 register_console(&sun3x_debug);
127 return 0;
128 }
129
130 early_param("debug", sun3x_debug_setup);
131
132
133 int prom_getintdefault(int node, char *property, int deflt)
134 {
135 return deflt;
136 }
137
138 int prom_getbool (int node, char *prop)
139 {
140 return 1;
141 }
142
143 void prom_printf(char *fmt, ...)
144 {
145 }
146
147 void prom_halt (void)
148 {
149 sun3x_halt();
150 }
151
152
153
154
155
156 unsigned char
157 prom_get_idprom(char *idbuf, int num_bytes)
158 {
159 int i;
160
161
162 for (i = 0; i < num_bytes; i++)
163 idbuf[i] = ((char *)SUN3X_IDPROM)[i];
164
165 return idbuf[0];
166 }