Subject: Re: Motorola PowerStack II / Estrella 300 and options FIRMWORKSBUGS
To: None <port-powerpc@netbsd.org>
From: Jochen Kunz <jkunz@unixag-kl.fh-kl.de>
List: port-powerpc
Date: 11/05/2002 23:17:23
On 2002.11.04 17:33 Wolfgang Solfrank wrote:

> > [some printfs later]
> > sys/arch/powerpc/mpc6xx/pmap.c:pmap_bootstrap():
> >         /*
> >          * Initialize kernel pmap and hardware.
> >          */
> >         for (i =3D 0; i < 16; i++) {
> >                 pmap_kernel()->pm_sr[i] =3D EMPTY_SEGMENT;
> >                 __asm __volatile ("mtsrin %0,%1"
> >                      :: "r"(EMPTY_SEGMENT), "r"(i << ADDR_SR_SHFT));
> >         }
> >=20
> > It hangs at the first execution of the inline ASM instruction.=20
> That's to be expexcted: the kernel is modifying the mmu configuration,
> but OpenFirmware isn't aware of that.
But why is the machine crashing when the MMU is reinitialized? I would
expect a crash at the next call to the OFW. Or is it because the kernel
expects to run still in "real" mode, i.e. MMU turned off, but the MMU is
active and so it crashes as it reloads the segment registers? (PSL_IR
and PSL_DR are 1 at that time.)

> While newer PPC bindings to OFW specify methods for interoperability
> between OFW and the "client" (which is the kernel in our case), the
> implementation in the FirePower machine (and probably in your box,
> too) predate this specification, and thus there is no possibility for=20
> the kernel to tell OFW about the changed mapping.
Aha. The firmware is:
 Open Firmware Revision ID . . . . . . . . . . . . . . . . =3D1.2 RM11
 Open Firmware Revision Date . . . . . . . . . . . . . . . =3DJun 4, 1998
PowerPC Open Firmware                                                  =20
      =20
Version 1.2 RM11   Thu Jun 4 10:20:43 MST 1998                         =20
      =20
Copyright Motorola 1995-96, All Rights Reserved                        =20
      =20
Copyright FirmWorks 1995-96, All Rights Reserved                       =20
      =20

> Therefor, NetBSD/ofppc does it the hard way by preserving the mmu
> configuration found at the start and switching back to this
> configuration whenever entering OFW (and disabling interrupts while=20
> doing so).
And the stuff in sys/arch/powerpc/powerpc/ofwreal.S and
sys/arch/powerpc/mpc6xx/ofw_subr.S is doing this. I noticed that this
MMU state saving is enabled with "options FIRMWORKSBUGS". As there was
done some work in this area lately I suspect that this broke somthing.
1.6 release gets far enough to start init but is unable to get a single
user shell runnning.=20

> End result is that you cannot expect to run OFW routines (including
> the OFW debugger) at arbitrary points while the kernel is running :-(.
I had time to read some parts of "PowerPC Microprocessor Family: The
Programming Environments for 32-Bit Microprocessors" and now that I know
what the mtsrin instruction does and how the MMU works, I got this
presumption myself. =3D> Use the kernel debugger.=20
--=20



tsch=FC=DF,
         Jochen

Homepage: http://www.unixag-kl.fh-kl.de/~jkunz/