| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ofwoea_machdep.c,v 1.24 2011/07/17 23:23:54 dyoung Exp $ */ | | 1 | /* $NetBSD: ofwoea_machdep.c,v 1.25 2011/07/27 22:04:23 macallan Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Tim Rightnour | | 8 | * by Tim Rightnour |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.24 2011/07/17 23:23:54 dyoung Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.25 2011/07/27 22:04:23 macallan Exp $"); |
34 | | | 34 | |
35 | #include "opt_ppcarch.h" | | 35 | #include "opt_ppcarch.h" |
36 | #include "opt_compat_netbsd.h" | | 36 | #include "opt_compat_netbsd.h" |
37 | #include "opt_ddb.h" | | 37 | #include "opt_ddb.h" |
38 | #include "opt_kgdb.h" | | 38 | #include "opt_kgdb.h" |
39 | #include "opt_ipkdb.h" | | 39 | #include "opt_ipkdb.h" |
40 | #include "opt_modular.h" | | 40 | #include "opt_modular.h" |
41 | | | 41 | |
42 | #include <sys/param.h> | | 42 | #include <sys/param.h> |
43 | #include <sys/buf.h> | | 43 | #include <sys/buf.h> |
44 | #include <sys/boot_flag.h> | | 44 | #include <sys/boot_flag.h> |
45 | #include <sys/extent.h> | | 45 | #include <sys/extent.h> |
46 | #include <sys/kernel.h> | | 46 | #include <sys/kernel.h> |
| @@ -109,26 +109,27 @@ struct ofw_translations { | | | @@ -109,26 +109,27 @@ struct ofw_translations { |
109 | struct pmap ofw_pmap; | | 109 | struct pmap ofw_pmap; |
110 | struct ofw_translations ofmap[32]; | | 110 | struct ofw_translations ofmap[32]; |
111 | char bootpath[256]; | | 111 | char bootpath[256]; |
112 | char model_name[64]; | | 112 | char model_name[64]; |
113 | #if NKSYMS || defined(DDB) || defined(MODULAR) | | 113 | #if NKSYMS || defined(DDB) || defined(MODULAR) |
114 | void *startsym, *endsym; | | 114 | void *startsym, *endsym; |
115 | #endif | | 115 | #endif |
116 | #ifdef TIMEBASE_FREQ | | 116 | #ifdef TIMEBASE_FREQ |
117 | u_int timebase_freq = TIMEBASE_FREQ; | | 117 | u_int timebase_freq = TIMEBASE_FREQ; |
118 | #else | | 118 | #else |
119 | u_int timebase_freq = 0; | | 119 | u_int timebase_freq = 0; |
120 | #endif | | 120 | #endif |
121 | | | 121 | |
| | | 122 | extern int ofwmsr; |
122 | extern int chosen; | | 123 | extern int chosen; |
123 | extern uint32_t ticks_per_sec; | | 124 | extern uint32_t ticks_per_sec; |
124 | extern uint32_t ns_per_tick; | | 125 | extern uint32_t ns_per_tick; |
125 | extern uint32_t ticks_per_intr; | | 126 | extern uint32_t ticks_per_intr; |
126 | | | 127 | |
127 | static int save_ofmap(struct ofw_translations *, int); | | 128 | static int save_ofmap(struct ofw_translations *, int); |
128 | static void restore_ofmap(struct ofw_translations *, int); | | 129 | static void restore_ofmap(struct ofw_translations *, int); |
129 | static void set_timebase(void); | | 130 | static void set_timebase(void); |
130 | | | 131 | |
131 | extern void cpu_spinstart(u_int); | | 132 | extern void cpu_spinstart(u_int); |
132 | volatile u_int cpu_spinstart_ack, cpu_spinstart_cpunum; | | 133 | volatile u_int cpu_spinstart_ack, cpu_spinstart_cpunum; |
133 | | | 134 | |
134 | void | | 135 | void |
| @@ -191,26 +192,33 @@ ofwoea_initppc(u_int startkernel, u_int | | | @@ -191,26 +192,33 @@ ofwoea_initppc(u_int startkernel, u_int |
191 | #if defined (PPC_OEA64_BRIDGE) && defined (PPC_OEA) | | 192 | #if defined (PPC_OEA64_BRIDGE) && defined (PPC_OEA) |
192 | if (oeacpufeat & OEACPU_64_BRIDGE) | | 193 | if (oeacpufeat & OEACPU_64_BRIDGE) |
193 | pmap_setup64bridge(); | | 194 | pmap_setup64bridge(); |
194 | else | | 195 | else |
195 | pmap_setup32(); | | 196 | pmap_setup32(); |
196 | #endif | | 197 | #endif |
197 | | | 198 | |
198 | oea_init(pic_ext_intr); | | 199 | oea_init(pic_ext_intr); |
199 | | | 200 | |
200 | ofmaplen = save_ofmap(NULL, 0); | | 201 | ofmaplen = save_ofmap(NULL, 0); |
201 | if (ofmaplen > 0) | | 202 | if (ofmaplen > 0) |
202 | save_ofmap(ofmap, ofmaplen); | | 203 | save_ofmap(ofmap, ofmaplen); |
203 | | | 204 | |
| | | 205 | /* |
| | | 206 | * XXX |
| | | 207 | * we need to do this here instead of earlier on in ofwinit() for some reason |
| | | 208 | * At least some versions of Apple OF 2.0.1 hang if we do this earlier |
| | | 209 | */ |
| | | 210 | ofwmsr &= ~PSL_IP; |
| | | 211 | |
204 | /* Parse the args string */ | | 212 | /* Parse the args string */ |
205 | if (args) { | | 213 | if (args) { |
206 | strcpy(bootpath, args); | | 214 | strcpy(bootpath, args); |
207 | args = bootpath; | | 215 | args = bootpath; |
208 | while (*++args && *args != ' '); | | 216 | while (*++args && *args != ' '); |
209 | if (*args) { | | 217 | if (*args) { |
210 | *args++ = 0; | | 218 | *args++ = 0; |
211 | while (*args) | | 219 | while (*args) |
212 | BOOT_FLAG(*args++, boothowto); | | 220 | BOOT_FLAG(*args++, boothowto); |
213 | } | | 221 | } |
214 | } | | 222 | } |
215 | | | 223 | |
216 | uvm_setpagesize(); | | 224 | uvm_setpagesize(); |