From owner-freebsd-ppc@freebsd.org Wed Sep 21 06:46:56 2016 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10956BE3BFB for ; Wed, 21 Sep 2016 06:46:56 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-37.reflexion.net [208.70.210.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9358C26 for ; Wed, 21 Sep 2016 06:46:54 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 29036 invoked from network); 21 Sep 2016 06:46:44 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 21 Sep 2016 06:46:44 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v8.00.0) with SMTP; Wed, 21 Sep 2016 02:46:44 -0400 (EDT) Received: (qmail 25548 invoked from network); 21 Sep 2016 06:46:44 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 21 Sep 2016 06:46:44 -0000 Received: from [192.168.0.105] (ip70-189-131-151.lv.lv.cox.net [70.189.131.151]) by iron2.pdx.net (Postfix) with ESMTPSA id 7B462EC8839; Tue, 20 Sep 2016 23:46:52 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: svn commit: r306065 - in head/sys vs. PowerMacs: Nathan's trail patch included but inappropriate? Date: Tue, 20 Sep 2016 23:46:51 -0700 Message-Id: Cc: FreeBSD PowerPC ML , svn-src-head@freebsd.org To: Justin Hibbits , Nathan Whitehorn Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2016 06:46:56 -0000 The following from = https://lists.freebsd.org/pipermail/svn-src-head/2016-September/091934.htm= l seems in include a patch that Nathan made for testing on = PowerMac/iMac/Xserve G5's that failed the PowerMac7,3 test that was = tried by Jukka A. Ukkonen. > Modified: head/sys/powerpc/ofw/ofw_machdep.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/powerpc/ofw/ofw_machdep.c Wed Sep 21 02:27:23 2016 = (r306064) > +++ head/sys/powerpc/ofw/ofw_machdep.c Wed Sep 21 02:28:39 2016 = (r306065) > @@ -99,6 +99,7 @@ ofw_restore_trap_vec(char *restore_trap_ > /* > * Saved SPRG0-3 from OpenFirmware. Will be restored prior to the = callback. > */ > +#ifndef __powerpc64__ > register_t ofw_sprg0_save; > =20 > static __inline void > @@ -140,6 +141,8 @@ ofw_sprg_restore(void) > } > #endif > =20 > +#endif > + > static int > parse_ofw_memory(phandle_t node, const char *prop, struct mem_region = *output) > { > @@ -344,11 +347,12 @@ OF_initial_setup(void *fdt_ptr, void *ju > ofmsr[0] =3D mfmsr(); > #ifdef __powerpc64__ > ofmsr[0] &=3D ~PSL_SF; > - #endif > + #else > __asm __volatile("mfsprg0 %0" : "=3D&r"(ofmsr[1])); > __asm __volatile("mfsprg1 %0" : "=3D&r"(ofmsr[2])); > __asm __volatile("mfsprg2 %0" : "=3D&r"(ofmsr[3])); > __asm __volatile("mfsprg3 %0" : "=3D&r"(ofmsr[4])); > + #endif > openfirmware_entry =3D openfirm; > =20 > if (ofmsr[0] & PSL_DR) > @@ -440,7 +444,9 @@ openfirmware_core(void *args) > */ > oldmsr =3D intr_disable(); > =20 > +#ifndef __powerpc64__ > ofw_sprg_prepare(); > +#endif > =20 > /* Save trap vectors */ > ofw_save_trap_vec(save_trap_of); > @@ -463,7 +469,9 @@ openfirmware_core(void *args) > /* Restore trap vecotrs */ > ofw_restore_trap_vec(save_trap_of); > =20 > +#ifndef __powerpc64__ > ofw_sprg_restore(); > +#endif > =20 > intr_restore(oldmsr); Part of the ofw_sprg_prepare() and ofw_sprg_restore() activity is = required for PowerMac G5's to boot: the save of the FreeBSD sprg0 value = and its later restore back to sprg0. (Established by other testing after = Nathan's patch was tried.) My guess is that this code was accidentally included in -r306065, not = intentionally included. [There is the separate issue that avoiding restoring the Open Firmware = sprg0 value before calling into Open Firmware (leaving the FreeBSD value = in place) helps PowerMac G5's boot more reliably by allowing correct = handling some SLB faults that sometimes occur.] =3D=3D=3D Mark Millard markmi at dsl-only.net