Subject: Resetting a 405GPr
To: None <tech-ports@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: tech-ports
Date: 03/06/2006 23:29:50
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.

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?

-s