| @@ -1,359 +1,354 @@ | | | @@ -1,359 +1,354 @@ |
1 | /* $NetBSD: machdep.c,v 1.98 2009/11/27 03:23:05 rmind Exp $ */ | | 1 | /* $NetBSD: machdep.c,v 1.99 2010/10/30 06:11:18 kiyohara Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | | 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. |
5 | * Copyright (C) 1995, 1996 TooLs GmbH. | | 5 | * Copyright (C) 1995, 1996 TooLs GmbH. |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
15 | * documentation and/or other materials provided with the distribution. | | 15 | * documentation and/or other materials provided with the distribution. |
16 | * 3. All advertising materials mentioning features or use of this software | | 16 | * 3. All advertising materials mentioning features or use of this software |
17 | * must display the following acknowledgement: | | 17 | * must display the following acknowledgement: |
18 | * This product includes software developed by TooLs GmbH. | | 18 | * This product includes software developed by TooLs GmbH. |
19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | | 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products |
20 | * derived from this software without specific prior written permission. | | 20 | * derived from this software without specific prior written permission. |
21 | * | | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | | 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | | 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.98 2009/11/27 03:23:05 rmind Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.99 2010/10/30 06:11:18 kiyohara Exp $"); |
36 | | | 36 | |
37 | #include "opt_compat_netbsd.h" | | 37 | #include "opt_compat_netbsd.h" |
38 | #include "opt_ddb.h" | | 38 | #include "opt_ddb.h" |
39 | #include "opt_ipkdb.h" | | 39 | #include "opt_ipkdb.h" |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/buf.h> | | 42 | #include <sys/buf.h> |
43 | #include <sys/conf.h> | | 43 | #include <sys/conf.h> |
44 | #include <sys/device.h> | | 44 | #include <sys/device.h> |
45 | #include <sys/exec.h> | | 45 | #include <sys/exec.h> |
46 | #include <sys/extent.h> | | 46 | #include <sys/extent.h> |
47 | #include <sys/kernel.h> | | 47 | #include <sys/kernel.h> |
48 | #include <sys/malloc.h> | | 48 | #include <sys/malloc.h> |
49 | #include <sys/mbuf.h> | | 49 | #include <sys/mbuf.h> |
50 | #include <sys/mount.h> | | 50 | #include <sys/mount.h> |
51 | #include <sys/msgbuf.h> | | 51 | #include <sys/msgbuf.h> |
52 | #include <sys/proc.h> | | 52 | #include <sys/proc.h> |
53 | #include <sys/reboot.h> | | 53 | #include <sys/reboot.h> |
54 | #include <sys/syscallargs.h> | | 54 | #include <sys/syscallargs.h> |
55 | #include <sys/syslog.h> | | 55 | #include <sys/syslog.h> |
56 | #include <sys/systm.h> | | 56 | #include <sys/systm.h> |
57 | #include <sys/ksyms.h> | | 57 | #include <sys/ksyms.h> |
58 | | | 58 | |
59 | #include <uvm/uvm_extern.h> | | 59 | #include <uvm/uvm_extern.h> |
60 | | | 60 | |
61 | #include <net/netisr.h> | | 61 | #include <net/netisr.h> |
62 | | | 62 | |
63 | #include <machine/bootinfo.h> | | 63 | #include <machine/bootinfo.h> |
64 | #include <machine/autoconf.h> | | 64 | #include <machine/autoconf.h> |
65 | #define _POWERPC_BUS_DMA_PRIVATE | | 65 | #define _POWERPC_BUS_DMA_PRIVATE |
66 | #include <machine/bus.h> | | 66 | #include <machine/bus.h> |
67 | #include <machine/intr.h> | | 67 | #include <machine/intr.h> |
68 | #include <machine/pmap.h> | | 68 | #include <machine/pmap.h> |
69 | #include <machine/powerpc.h> | | 69 | #include <machine/powerpc.h> |
70 | #include <machine/trap.h> | | 70 | #include <machine/trap.h> |
71 | | | 71 | |
72 | #include <powerpc/oea/bat.h> | | 72 | #include <powerpc/oea/bat.h> |
73 | #include <powerpc/pic/picvar.h> | | 73 | #include <powerpc/pic/picvar.h> |
74 | | | 74 | |
75 | #include <dev/cons.h> | | 75 | #include <dev/cons.h> |
76 | | | 76 | |
77 | #include "ksyms.h" | | 77 | #include "ksyms.h" |
78 | | | 78 | |
79 | #include "vga.h" | | 79 | #include "vga.h" |
80 | #if (NVGA > 0) | | 80 | #if (NVGA > 0) |
81 | #include <dev/ic/mc6845reg.h> | | 81 | #include <dev/ic/mc6845reg.h> |
82 | #include <dev/ic/pcdisplayvar.h> | | 82 | #include <dev/ic/pcdisplayvar.h> |
83 | #include <dev/ic/vgareg.h> | | 83 | #include <dev/ic/vgareg.h> |
84 | #include <dev/ic/vgavar.h> | | 84 | #include <dev/ic/vgavar.h> |
85 | #endif | | 85 | #endif |
86 | | | 86 | |
87 | #include "pckbc.h" | | 87 | #include "pckbc.h" |
88 | #if (NPCKBC > 0) | | 88 | #if (NPCKBC > 0) |
89 | #include <dev/isa/isareg.h> | | 89 | #include <dev/isa/isareg.h> |
90 | #include <dev/ic/i8042reg.h> | | 90 | #include <dev/ic/i8042reg.h> |
91 | #include <dev/ic/pckbcvar.h> | | 91 | #include <dev/ic/pckbcvar.h> |
92 | #include <dev/pckbport/pckbportvar.h> | | 92 | #include <dev/pckbport/pckbportvar.h> |
93 | #endif | | 93 | #endif |
94 | | | 94 | |
95 | #include "com.h" | | 95 | #include "com.h" |
96 | #if (NCOM > 0) | | 96 | #if (NCOM > 0) |
97 | #include <sys/termios.h> | | 97 | #include <sys/termios.h> |
98 | #include <dev/ic/comreg.h> | | 98 | #include <dev/ic/comreg.h> |
99 | #include <dev/ic/comvar.h> | | 99 | #include <dev/ic/comvar.h> |
100 | #endif | | 100 | #endif |
101 | | | 101 | |
102 | /* | | 102 | /* |
103 | * Global variables used here and there | | 103 | * Global variables used here and there |
104 | */ | | 104 | */ |
105 | char bootinfo[BOOTINFO_MAXSIZE]; | | 105 | char bootinfo[BOOTINFO_MAXSIZE]; |
106 | paddr_t bebox_mb_reg; /* BeBox MotherBoard register */ | | 106 | paddr_t bebox_mb_reg; /* BeBox MotherBoard register */ |
107 | #define OFMEMREGIONS 32 | | 107 | #define OFMEMREGIONS 32 |
108 | struct mem_region physmemr[OFMEMREGIONS], availmemr[OFMEMREGIONS]; | | 108 | struct mem_region physmemr[OFMEMREGIONS], availmemr[OFMEMREGIONS]; |
109 | char bootpath[256]; | | 109 | char bootpath[256]; |
110 | paddr_t avail_end; /* XXX temporary */ | | 110 | paddr_t avail_end; /* XXX temporary */ |
111 | struct pic_ops *isa_pic; | | 111 | struct pic_ops *isa_pic; |
112 | int isa_pcmciamask = 0x8b28; /* XXXX */ | | 112 | int isa_pcmciamask = 0x8b28; /* XXXX */ |
113 | extern int primary_pic; | | 113 | extern int primary_pic; |
114 | void initppc(u_long, u_long, u_int, void *); | | 114 | void initppc(u_long, u_long, u_int, void *); |
115 | static void disable_device(const char *); | | 115 | static void disable_device(const char *); |
116 | void setup_bebox_intr(void); | | 116 | void setup_bebox_intr(void); |
117 | | | 117 | |
118 | extern void *startsym, *endsym; | | 118 | extern void *startsym, *endsym; |
119 | | | 119 | |
120 | void | | 120 | void |
121 | initppc(u_long startkernel, u_long endkernel, u_int args, void *btinfo) | | 121 | initppc(u_long startkernel, u_long endkernel, u_int args, void *btinfo) |
122 | { | | 122 | { |
123 | /* | | 123 | /* |
124 | * copy bootinfo | | 124 | * copy bootinfo |
125 | */ | | 125 | */ |
126 | memcpy(bootinfo, btinfo, sizeof (bootinfo)); | | 126 | memcpy(bootinfo, btinfo, sizeof (bootinfo)); |
127 | | | 127 | |
128 | /* | | 128 | /* |
129 | * BeBox memory region set | | 129 | * BeBox memory region set |
130 | */ | | 130 | */ |
131 | { | | 131 | { |
132 | struct btinfo_memory *meminfo; | | 132 | struct btinfo_memory *meminfo; |
133 | | | 133 | |
134 | meminfo = | | 134 | meminfo = |
135 | (struct btinfo_memory *)lookup_bootinfo(BTINFO_MEMORY); | | 135 | (struct btinfo_memory *)lookup_bootinfo(BTINFO_MEMORY); |
136 | if (!meminfo) | | 136 | if (!meminfo) |
137 | panic("not found memory information in bootinfo"); | | 137 | panic("not found memory information in bootinfo"); |
138 | physmemr[0].start = 0; | | 138 | physmemr[0].start = 0; |
139 | physmemr[0].size = meminfo->memsize & ~PGOFSET; | | 139 | physmemr[0].size = meminfo->memsize & ~PGOFSET; |
140 | availmemr[0].start = (endkernel + PGOFSET) & ~PGOFSET; | | 140 | availmemr[0].start = (endkernel + PGOFSET) & ~PGOFSET; |
141 | availmemr[0].size = meminfo->memsize - availmemr[0].start; | | 141 | availmemr[0].size = meminfo->memsize - availmemr[0].start; |
142 | } | | 142 | } |
143 | avail_end = physmemr[0].start + physmemr[0].size; /* XXX temporary */ | | 143 | avail_end = physmemr[0].start + physmemr[0].size; /* XXX temporary */ |
144 | | | 144 | |
145 | /* | | 145 | /* |
146 | * Get CPU clock | | 146 | * Get CPU clock |
147 | */ | | 147 | */ |
148 | { | | 148 | { |
149 | struct btinfo_clock *clockinfo; | | 149 | struct btinfo_clock *clockinfo; |
150 | extern u_long ticks_per_sec, ns_per_tick; | | 150 | extern u_long ticks_per_sec, ns_per_tick; |
151 | | | 151 | |
152 | clockinfo = | | 152 | clockinfo = |
153 | (struct btinfo_clock *)lookup_bootinfo(BTINFO_CLOCK); | | 153 | (struct btinfo_clock *)lookup_bootinfo(BTINFO_CLOCK); |
154 | if (!clockinfo) | | 154 | if (!clockinfo) |
155 | panic("not found clock information in bootinfo"); | | 155 | panic("not found clock information in bootinfo"); |
156 | ticks_per_sec = clockinfo->ticks_per_sec; | | 156 | ticks_per_sec = clockinfo->ticks_per_sec; |
157 | ns_per_tick = 1000000000 / ticks_per_sec; | | 157 | ns_per_tick = 1000000000 / ticks_per_sec; |
158 | } | | 158 | } |
159 | | | 159 | |
160 | | | | |
161 | /* | | | |
162 | * boothowto | | | |
163 | */ | | | |
164 | /* boothowto = args; */ | | | |
165 | prep_initppc(startkernel, endkernel, args); | | 160 | prep_initppc(startkernel, endkernel, args); |
166 | } | | 161 | } |
167 | | | 162 | |
168 | /* | | 163 | /* |
169 | * Machine dependent startup code. | | 164 | * Machine dependent startup code. |
170 | */ | | 165 | */ |
171 | void | | 166 | void |
172 | cpu_startup(void) | | 167 | cpu_startup(void) |
173 | { | | 168 | { |
174 | /* | | 169 | /* |
175 | * BeBox Mother Board's Register Mapping | | 170 | * BeBox Mother Board's Register Mapping |
176 | */ | | 171 | */ |
177 | bebox_mb_reg = (vaddr_t) mapiodev(BEBOX_INTR_REG, PAGE_SIZE); | | 172 | bebox_mb_reg = (vaddr_t) mapiodev(BEBOX_INTR_REG, PAGE_SIZE); |
178 | if (!bebox_mb_reg) | | 173 | if (!bebox_mb_reg) |
179 | panic("cpu_startup: no room for interrupt register"); | | 174 | panic("cpu_startup: no room for interrupt register"); |
180 | | | 175 | |
181 | /* | | 176 | /* |
182 | * Do common VM initialization | | 177 | * Do common VM initialization |
183 | */ | | 178 | */ |
184 | oea_startup(NULL); | | 179 | oea_startup(NULL); |
185 | | | 180 | |
186 | pic_init(); | | 181 | pic_init(); |
187 | isa_pic = setup_i8259(); | | 182 | isa_pic = setup_i8259(); |
188 | setup_bebox_intr(); | | 183 | setup_bebox_intr(); |
189 | primary_pic = 1; | | 184 | primary_pic = 1; |
190 | | | 185 | |
191 | /* | | 186 | /* |
192 | * set up i8259 as a cascade on BeInterruptController irq 26. | | 187 | * set up i8259 as a cascade on BeInterruptController irq 26. |
193 | */ | | 188 | */ |
194 | intr_establish(16 + 26, IST_LEVEL, IPL_NONE, pic_handle_intr, isa_pic); | | 189 | intr_establish(16 + 26, IST_LEVEL, IPL_NONE, pic_handle_intr, isa_pic); |
195 | | | 190 | |
196 | oea_install_extint(pic_ext_intr); | | 191 | oea_install_extint(pic_ext_intr); |
197 | | | 192 | |
198 | /* | | 193 | /* |
199 | * Now that we have VM, malloc's are OK in bus_space. | | 194 | * Now that we have VM, malloc's are OK in bus_space. |
200 | */ | | 195 | */ |
201 | bus_space_mallocok(); | | 196 | bus_space_mallocok(); |
202 | | | 197 | |
203 | /* | | 198 | /* |
204 | * Now allow hardware interrupts. | | 199 | * Now allow hardware interrupts. |
205 | */ | | 200 | */ |
206 | { | | 201 | { |
207 | int msr; | | 202 | int msr; |
208 | | | 203 | |
209 | splraise(-1); | | 204 | splraise(-1); |
210 | __asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0" | | 205 | __asm volatile ("mfmsr %0; ori %0,%0,%1; mtmsr %0" |
211 | : "=r"(msr) : "K"(PSL_EE)); | | 206 | : "=r"(msr) : "K"(PSL_EE)); |
212 | } | | 207 | } |
213 | } | | 208 | } |
214 | | | 209 | |
215 | /* | | 210 | /* |
216 | * lookup_bootinfo: | | 211 | * lookup_bootinfo: |
217 | * Look up information in bootinfo of boot loader. | | 212 | * Look up information in bootinfo of boot loader. |
218 | */ | | 213 | */ |
219 | void * | | 214 | void * |
220 | lookup_bootinfo(int type) | | 215 | lookup_bootinfo(int type) |
221 | { | | 216 | { |
222 | struct btinfo_common *bt; | | 217 | struct btinfo_common *bt; |
223 | struct btinfo_common *help = (struct btinfo_common *)bootinfo; | | 218 | struct btinfo_common *help = (struct btinfo_common *)bootinfo; |
224 | | | 219 | |
225 | do { | | 220 | do { |
226 | bt = help; | | 221 | bt = help; |
227 | if (bt->type == type) | | 222 | if (bt->type == type) |
228 | return (help); | | 223 | return (help); |
229 | help = (struct btinfo_common *)((char*)help + bt->next); | | 224 | help = (struct btinfo_common *)((char*)help + bt->next); |
230 | } while (bt->next && | | 225 | } while (bt->next && |
231 | (size_t)help < (size_t)bootinfo + sizeof (bootinfo)); | | 226 | (size_t)help < (size_t)bootinfo + sizeof (bootinfo)); |
232 | | | 227 | |
233 | return (NULL); | | 228 | return (NULL); |
234 | } | | 229 | } |
235 | | | 230 | |
236 | static void | | 231 | static void |
237 | disable_device(const char *name) | | 232 | disable_device(const char *name) |
238 | { | | 233 | { |
239 | extern struct cfdata cfdata[]; | | 234 | extern struct cfdata cfdata[]; |
240 | int i; | | 235 | int i; |
241 | | | 236 | |
242 | for (i = 0; cfdata[i].cf_name != NULL; i++) | | 237 | for (i = 0; cfdata[i].cf_name != NULL; i++) |
243 | if (strcmp(cfdata[i].cf_name, name) == 0) { | | 238 | if (strcmp(cfdata[i].cf_name, name) == 0) { |
244 | if (cfdata[i].cf_fstate == FSTATE_NOTFOUND) | | 239 | if (cfdata[i].cf_fstate == FSTATE_NOTFOUND) |
245 | cfdata[i].cf_fstate = FSTATE_DNOTFOUND; | | 240 | cfdata[i].cf_fstate = FSTATE_DNOTFOUND; |
246 | else if (cfdata[i].cf_fstate == FSTATE_STAR) | | 241 | else if (cfdata[i].cf_fstate == FSTATE_STAR) |
247 | cfdata[i].cf_fstate = FSTATE_DSTAR; | | 242 | cfdata[i].cf_fstate = FSTATE_DSTAR; |
248 | } | | 243 | } |
249 | } | | 244 | } |
250 | | | 245 | |
251 | /* | | 246 | /* |
252 | * consinit | | 247 | * consinit |
253 | * Initialize system console. | | 248 | * Initialize system console. |
254 | */ | | 249 | */ |
255 | void | | 250 | void |
256 | consinit(void) | | 251 | consinit(void) |
257 | { | | 252 | { |
258 | struct btinfo_console *consinfo; | | 253 | struct btinfo_console *consinfo; |
259 | static int initted; | | 254 | static int initted; |
260 | | | 255 | |
261 | if (initted) | | 256 | if (initted) |
262 | return; | | 257 | return; |
263 | initted = 1; | | 258 | initted = 1; |
264 | | | 259 | |
265 | consinfo = (struct btinfo_console *)lookup_bootinfo(BTINFO_CONSOLE); | | 260 | consinfo = (struct btinfo_console *)lookup_bootinfo(BTINFO_CONSOLE); |
266 | if (!consinfo) | | 261 | if (!consinfo) |
267 | panic("not found console information in bootinfo"); | | 262 | panic("not found console information in bootinfo"); |
268 | | | 263 | |
269 | /* | | 264 | /* |
270 | * We need to disable genfb or vga, because foo_match() return | | 265 | * We need to disable genfb or vga, because foo_match() return |
271 | * the same value. | | 266 | * the same value. |
272 | */ | | 267 | */ |
273 | if (!strcmp(consinfo->devname, "be")) { | | 268 | if (!strcmp(consinfo->devname, "be")) { |
274 | /* | | 269 | /* |
275 | * We use Framebuffer for initialized by BootROM of BeBox. | | 270 | * We use Framebuffer for initialized by BootROM of BeBox. |
276 | * In this case, our console will be attached more late. | | 271 | * In this case, our console will be attached more late. |
277 | */ | | 272 | */ |
278 | #if (NPCKBC > 0) | | 273 | #if (NPCKBC > 0) |
279 | pckbc_cnattach(&genppc_isa_io_space_tag, IO_KBD, KBCMDP, | | 274 | pckbc_cnattach(&genppc_isa_io_space_tag, IO_KBD, KBCMDP, |
280 | PCKBC_KBD_SLOT); | | 275 | PCKBC_KBD_SLOT); |
281 | #endif | | 276 | #endif |
282 | disable_device("vga"); | | 277 | disable_device("vga"); |
283 | return; | | 278 | return; |
284 | } | | 279 | } |
285 | | | 280 | |
286 | disable_device("genfb"); | | 281 | disable_device("genfb"); |
287 | | | 282 | |
288 | #if (NVGA > 0) | | 283 | #if (NVGA > 0) |
289 | if (!strcmp(consinfo->devname, "vga")) { | | 284 | if (!strcmp(consinfo->devname, "vga")) { |
290 | vga_cnattach(&prep_io_space_tag, &prep_mem_space_tag, -1, 1); | | 285 | vga_cnattach(&prep_io_space_tag, &prep_mem_space_tag, -1, 1); |
291 | #if (NPCKBC > 0) | | 286 | #if (NPCKBC > 0) |
292 | pckbc_cnattach(&genppc_isa_io_space_tag, IO_KBD, KBCMDP, | | 287 | pckbc_cnattach(&genppc_isa_io_space_tag, IO_KBD, KBCMDP, |
293 | PCKBC_KBD_SLOT); | | 288 | PCKBC_KBD_SLOT); |
294 | #endif | | 289 | #endif |
295 | return; | | 290 | return; |
296 | } | | 291 | } |
297 | #endif | | 292 | #endif |
298 | | | 293 | |
299 | #if (NCOM > 0) | | 294 | #if (NCOM > 0) |
300 | if (!strcmp(consinfo->devname, "com")) { | | 295 | if (!strcmp(consinfo->devname, "com")) { |
301 | bus_space_tag_t tag = &genppc_isa_io_space_tag; | | 296 | bus_space_tag_t tag = &genppc_isa_io_space_tag; |
302 | | | 297 | |
303 | if(comcnattach(tag, consinfo->addr, consinfo->speed, | | 298 | if(comcnattach(tag, consinfo->addr, consinfo->speed, |
304 | COM_FREQ, COM_TYPE_NORMAL, | | 299 | COM_FREQ, COM_TYPE_NORMAL, |
305 | ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8))) | | 300 | ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8))) |
306 | panic("can't init serial console"); | | 301 | panic("can't init serial console"); |
307 | return; | | 302 | return; |
308 | } | | 303 | } |
309 | #endif | | 304 | #endif |
310 | panic("invalid console device %s", consinfo->devname); | | 305 | panic("invalid console device %s", consinfo->devname); |
311 | } | | 306 | } |
312 | | | 307 | |
313 | /* | | 308 | /* |
314 | * Halt or reboot the machine after syncing/dumping according to howto. | | 309 | * Halt or reboot the machine after syncing/dumping according to howto. |
315 | */ | | 310 | */ |
316 | void | | 311 | void |
317 | cpu_reboot(int howto, char *what) | | 312 | cpu_reboot(int howto, char *what) |
318 | { | | 313 | { |
319 | static int syncing; | | 314 | static int syncing; |
320 | static char str[256]; | | 315 | static char str[256]; |
321 | char *ap = str, *ap1 = ap; | | 316 | char *ap = str, *ap1 = ap; |
322 | | | 317 | |
323 | boothowto = howto; | | 318 | boothowto = howto; |
324 | if (!cold && !(howto & RB_NOSYNC) && !syncing) { | | 319 | if (!cold && !(howto & RB_NOSYNC) && !syncing) { |
325 | syncing = 1; | | 320 | syncing = 1; |
326 | vfs_shutdown(); /* sync */ | | 321 | vfs_shutdown(); /* sync */ |
327 | resettodr(); /* set wall clock */ | | 322 | resettodr(); /* set wall clock */ |
328 | } | | 323 | } |
329 | splhigh(); | | 324 | splhigh(); |
330 | if (howto & RB_HALT) { | | 325 | if (howto & RB_HALT) { |
331 | doshutdownhooks(); | | 326 | doshutdownhooks(); |
332 | pmf_system_shutdown(boothowto); | | 327 | pmf_system_shutdown(boothowto); |
333 | printf("halted\n\n"); | | 328 | printf("halted\n\n"); |
334 | | | 329 | |
335 | } | | 330 | } |
336 | if (!cold && (howto & RB_DUMP)) | | 331 | if (!cold && (howto & RB_DUMP)) |
337 | oea_dumpsys(); | | 332 | oea_dumpsys(); |
338 | doshutdownhooks(); | | 333 | doshutdownhooks(); |
339 | pmf_system_shutdown(boothowto); | | 334 | pmf_system_shutdown(boothowto); |
340 | printf("rebooting\n\n"); | | 335 | printf("rebooting\n\n"); |
341 | if (what && *what) { | | 336 | if (what && *what) { |
342 | if (strlen(what) > sizeof str - 5) | | 337 | if (strlen(what) > sizeof str - 5) |
343 | printf("boot string too large, ignored\n"); | | 338 | printf("boot string too large, ignored\n"); |
344 | else { | | 339 | else { |
345 | strcpy(str, what); | | 340 | strcpy(str, what); |
346 | ap1 = ap = str + strlen(str); | | 341 | ap1 = ap = str + strlen(str); |
347 | *ap++ = ' '; | | 342 | *ap++ = ' '; |
348 | } | | 343 | } |
349 | } | | 344 | } |
350 | *ap++ = '-'; | | 345 | *ap++ = '-'; |
351 | if (howto & RB_SINGLE) | | 346 | if (howto & RB_SINGLE) |
352 | *ap++ = 's'; | | 347 | *ap++ = 's'; |
353 | if (howto & RB_KDB) | | 348 | if (howto & RB_KDB) |
354 | *ap++ = 'd'; | | 349 | *ap++ = 'd'; |
355 | *ap++ = 0; | | 350 | *ap++ = 0; |
356 | if (ap[-2] == '-') | | 351 | if (ap[-2] == '-') |
357 | *ap1 = 0; | | 352 | *ap1 = 0; |
358 | while (1); | | 353 | while (1); |
359 | } | | 354 | } |