Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Mar 2015 14:49:20 -0800
From:      Mark Millard <markmi@dsl-only.net>
To:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, Nathan Whitehorn <nwhitehorn@freebsd.org>, Justin Hibbits <chmeeedalf@gmail.com>
Subject:   Why official powerpc64 FreeBSD's PowerMac G5 booting sometimes works and sometimes hangs
Message-ID:  <21F3006A-19DA-44F7-8F37-F5FFE8555715@dsl-only.net>
In-Reply-To: <B55BECD6-5B1E-49F1-A152-9BFC85974BE1@dsl-only.net>
References:  <EF1EC459-BC46-42D5-9C3D-ABCBEF90AC44@dsl-only.net> <B55BECD6-5B1E-49F1-A152-9BFC85974BE1@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Various PowerMac G5 configurations have variable behavior when booting: =
sometimes hanging up and other times booting fine. This is one of the =
things that any proposed fix had to be able to explain beyond just =
seeming to work: How does the fix remove a source of uncontrolled =
variability? Just what is varying that is to be avoided?

Sometimes ofmsr on the PowerMac G5 Quad-Core that I most frequently use =
looks like (ofmsr addresses specific to my build of the time):

(kgdb) x/5gx 0xc3b328
0xc3b328 <ofmsr>:	0x1000000000003030 0x0000000000000001
0xc3b338 <ofmsr+16>:	0x0000000001c35ec0 0x0000000000000000
0xc3b348 <ofmsr+32>:	0x000000007ff7e800

So ofmsr[1]=3D=3D1. Other times ofmsr for the same build looks like:

(kgdb) x/5gx 0xc3b328
0xc3b328 <ofmsr>:	0x1000000000003030 0x0000000000000000
0xc3b338 <ofmsr+16>:	0x0000000001c35ec0 0x0000000000000000
0xc3b348 <ofmsr+32>:	0x000000007ff7e800

So ofwmsr[1]=3D=3D0.

So far I've not observed any other ofmsr[1] values. I'll keep monitoring =
for a while.=20

ofmsr[1] is the source of the boot-to-boot variability in what is copied =
to SPRG0 before ofwcall in official FreeBSD powerpc64 builds for my =
testing contexts. This copy to SPRG0 happens via openfirmware_core and =
its use of ofw_sprg_prepare.

Leaving the FreeBSD SPRG0 value in place (ignoring ofwmsr[1]) when =
preparing to call  ofwcall sidesteps this particular uncontrolled =
variability. The result is highly reliable booting for the G5's I'm =
testing on: no hangs so far.

Thus instead of:

	__asm __volatile("mfsprg0 %0\n\t"
			 "mtsprg0 %1\n\t"
			 "mtsprg1 %2\n\t"
			 "mtsprg2 %3\n\t"
			 "mtsprg3 %4\n\t"
			 : "=3D&r"(ofw_sprg0_save)
			 : "r"(ofmsr[1]),
			 "r"(ofmsr[2]),
			 "r"(ofmsr[3]),
			 "r"(ofmsr[4]));

in my builds I'm using code that does:

	__asm __volatile("mfsprg0 %0\n\t"
			 "mtsprg1 %1\n\t"
			 "mtsprg2 %2\n\t"
			 "mtsprg3 %3\n\t"
			 : "=3D&r"(ofw_sprg0_save)
			 : "r"(ofmsr[2]),
			 "r"(ofmsr[3]),
			 "r"(ofmsr[4]));


=3D=3D=3D
Mark Millard
markmi at dsl-only.net





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?21F3006A-19DA-44F7-8F37-F5FFE8555715>