Re: Resetting a 405GPr

[email protected] (Peter Seebach) Tue, 07 Mar 2006 00:14:41 -0600
Newsgroups gmane.os.netbsd.devel.ports
Message-ID <[email protected]>
In message <[email protected]>, Simon Burge 
writes:
>> _C_LABEL(ppc4xx_reset):
>>         mfspr   %r3,SPR_DBCR0
>>         oris    %r3,%r13,DBCR0_RST_SYSTEM@h
>>         mtspr   SPR_DBCR0,%r3
>>         ba      0

A followup:  I am pretty convinced this code should be wrong.  Not that
the right code works.

Line 1: mfspr   %r3,SPR_DBCR0
	Load DBCR0 into r3
Line 2: oris    %r3,%r13,DBCR0_RST_SYSTEM@h
	Or the top half of DBCR0_RST_SYSTEM with the leftmost bits of r13 into
	r3.
Line 3: mtspr   SPR_DBCR0,%r3
	Load r3 into DBCR0

The first operation has no effect, because we immediately smash it with
whatever random garbage happened to be in r13.

>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?

Hmm.  I'll try that next.

The one thing I've noticed is that, if I drop into the debugger first, it
works.  I am not entirely sure why.  It looks like DDB is oring in 0x48000000
before it runs, but I don't THINK that should matter, and I'm pretty sure
that Linux isn't doing it.

But... Nope, no effect from nops, or from anything else I can find.

-s