Wed Jul 27 22:04:23 2011 UTC ()
move clearing PSL_IP in ofwmsr back where it was - if we do it too early my
PowerBook 3400c hangs on startup.


(macallan)
diff -r1.9 -r1.10 src/sys/arch/powerpc/oea/ofw_subr.S
diff -r1.24 -r1.25 src/sys/arch/powerpc/oea/ofwoea_machdep.c

cvs diff -r1.9 -r1.10 src/sys/arch/powerpc/oea/ofw_subr.S (expand / switch to unified diff)

--- src/sys/arch/powerpc/oea/ofw_subr.S 2011/06/12 16:35:10 1.9
+++ src/sys/arch/powerpc/oea/ofw_subr.S 2011/07/27 22:04:23 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ofw_subr.S,v 1.9 2011/06/12 16:35:10 matt Exp $ */ 1/* $NetBSD: ofw_subr.S,v 1.10 2011/07/27 22:04:23 macallan 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
@@ -24,61 +24,68 @@ @@ -24,61 +24,68 @@
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 34
35 .local firmstk 35 .local firmstk
36 .globl openfirmware_entry 36 .globl openfirmware_entry
 37 .globl ofwmsr
37 .local ofwsrsave 38 .local ofwsrsave
38 .local OF_buffer 39 .local OF_buffer
39 40
40 .lcomm firmstk,NBPG,16 41 .lcomm firmstk,NBPG,16
41 .lcomm OF_buffer,NBPG,4 42 .lcomm OF_buffer,NBPG,4
42 .comm openfirmware_entry,4,4 /* openfirmware entry point */ 43 .comm openfirmware_entry,4,4 /* openfirmware entry point */
43 .lcomm ofwsrsave,64,4 /* openfirmware SR savearea */ 44 .lcomm ofwsrsave,64,4 /* openfirmware SR savearea */
44 .lcomm ofwmsr,20,4 /* msr & sprg[0-3] used in OF */ 45 .comm ofwmsr,20,4 /* msr & sprg[0-3] used in OF */
45 .comm ofwreal_incharge,4,4 46 .comm ofwreal_incharge,4,4
46 47
47/* 48/*
48 * Called by start to save the initial OFW state so we can restore it 49 * Called by start to save the initial OFW state so we can restore it
49 * when call back to OFW. 50 * when call back to OFW.
50 */ 51 */
51ENTRY_NOPROFILE(ofwinit) 52ENTRY_NOPROFILE(ofwinit)
52#ifdef FIRMWORKSBUGS 53#ifdef FIRMWORKSBUGS
53 mfmsr %r0 54 mfmsr %r0
54 andi. %r0,%r0,PSL_IR|PSL_DR 55 andi. %r0,%r0,PSL_IR|PSL_DR
55 beq 1f 56 beq 1f
56 57
57 li %r8,1 58 li %r8,1
58 lis %r9,ofwreal_incharge@ha 59 lis %r9,ofwreal_incharge@ha
59 stw %r8,ofwreal_incharge@l(%r9) 60 stw %r8,ofwreal_incharge@l(%r9)
60 61
61 mflr %r30 62 mflr %r30
62 bl _C_LABEL(ofwr_init) 63 bl _C_LABEL(ofwr_init)
63 mtlr %r30 64 mtlr %r30
641: 651:
65#endif 66#endif
66 lis %r8,openfirmware_entry@ha 67 lis %r8,openfirmware_entry@ha
67 stw %r5,openfirmware_entry@l(%r8) /* save client interface handler*/ 68 stw %r5,openfirmware_entry@l(%r8) /* save client interface handler*/
68 69
69 mfmsr %r0 70 mfmsr %r0
70 li %r8,PSL_IP 71/*
71 andc %r0,%r0,%r8 /* make sure PSL_IP is off */ 72 * XXX
 73 * doing this here instead of later on in ofwoea_initppc() after setting
 74 * up the console and such makes my PowerBook 3400c hang.
 75 * Probably just another OF 2.0 weirdness
 76 */
 77 /*li %r8,PSL_IP*/
 78 /*andc %r0,%r0,%r8*/ /* make sure PSL_IP is off */
72 lis %r9,ofwmsr@ha 79 lis %r9,ofwmsr@ha
73 stwu %r0,ofwmsr@l(%r9) /* save initial MSR value */ 80 stwu %r0,ofwmsr@l(%r9) /* save initial MSR value */
74 81
75 mfsprg0 %r0 /* save SPRGs */ 82 mfsprg0 %r0 /* save SPRGs */
76 stw %r0,4(%r9) 83 stw %r0,4(%r9)
77 mfsprg1 %r0 84 mfsprg1 %r0
78 stw %r0,8(%r9) 85 stw %r0,8(%r9)
79 mfsprg2 %r0 86 mfsprg2 %r0
80 stw %r0,12(%r9) 87 stw %r0,12(%r9)
81 mfsprg3 %r0 88 mfsprg3 %r0
82 stw %r0,16(%r9) 89 stw %r0,16(%r9)
83 90
84 lis %r8,OF_buffer@ha 91 lis %r8,OF_buffer@ha

cvs diff -r1.24 -r1.25 src/sys/arch/powerpc/oea/ofwoea_machdep.c (expand / switch to unified diff)

--- src/sys/arch/powerpc/oea/ofwoea_machdep.c 2011/07/17 23:23:54 1.24
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c 2011/07/27 22:04:23 1.25
@@ -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 {
109struct pmap ofw_pmap; 109struct pmap ofw_pmap;
110struct ofw_translations ofmap[32]; 110struct ofw_translations ofmap[32];
111char bootpath[256]; 111char bootpath[256];
112char model_name[64]; 112char model_name[64];
113#if NKSYMS || defined(DDB) || defined(MODULAR) 113#if NKSYMS || defined(DDB) || defined(MODULAR)
114void *startsym, *endsym; 114void *startsym, *endsym;
115#endif 115#endif
116#ifdef TIMEBASE_FREQ 116#ifdef TIMEBASE_FREQ
117u_int timebase_freq = TIMEBASE_FREQ; 117u_int timebase_freq = TIMEBASE_FREQ;
118#else 118#else
119u_int timebase_freq = 0; 119u_int timebase_freq = 0;
120#endif 120#endif
121 121
 122extern int ofwmsr;
122extern int chosen; 123extern int chosen;
123extern uint32_t ticks_per_sec; 124extern uint32_t ticks_per_sec;
124extern uint32_t ns_per_tick; 125extern uint32_t ns_per_tick;
125extern uint32_t ticks_per_intr; 126extern uint32_t ticks_per_intr;
126 127
127static int save_ofmap(struct ofw_translations *, int); 128static int save_ofmap(struct ofw_translations *, int);
128static void restore_ofmap(struct ofw_translations *, int); 129static void restore_ofmap(struct ofw_translations *, int);
129static void set_timebase(void); 130static void set_timebase(void);
130 131
131extern void cpu_spinstart(u_int); 132extern void cpu_spinstart(u_int);
132volatile u_int cpu_spinstart_ack, cpu_spinstart_cpunum; 133volatile u_int cpu_spinstart_ack, cpu_spinstart_cpunum;
133 134
134void 135void
@@ -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();