Subject: Re: Resetting a 405GPr
To: Peter Seebach <seebs@plethora.net>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-ports
Date: 03/07/2006 17:03:03
Peter Seebach wrote:

> I've found the following code in the kernel:
> 
> _C_LABEL(ppc4xx_reset):
>         mfspr   %r3,SPR_DBCR0
>         oris    %r3,%r13,DBCR0_RST_SYSTEM@h
>         mtspr   SPR_DBCR0,%r3
>         ba      0
> 
> This code hangs; not quite consistently, but very often.
> 
> I found this in a Linux kernel:
> 
> _GLOBAL(abort)
>         mfspr   r13,SPRN_DBCR0
>         oris    r13,r13,DBCR0_RST_SYSTEM@h
>         mtspr   SPRN_DBCR0,r13
> 
> These are pretty similar.  However, the Linux kernel reboots.  The exact
> spelling of macro names seems not to matter; they're the same values.  The
> register numbers are a little different, but changing them all to be r13 in
> the NetBSD kernel does nothing.
> 
> What seems to be significant is the "ba 0".  Only I can't see why it matters
> what you have after you try to reset the system.

The only thing I can think of is some sort of prefetch or something, but
that's clutching at straws.  Does putting a few nops after the mtspr
make a difference?

> Presumably, the existing code works on the other 4xx-based systems.  Any
> suggestions on what else might be needed to persuade this to actually reboot,
> as though the reset bits had been loaded into the status register?

I've never noticed a problem rebooting the Walnut (405GP).  It gets used
fairly regularly as it houses my off-line mp3 backup.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/