Subject: Re: Calculating virtual address from physical address

From: Matt Porter <[email-masked]>
Date: Fri, 5 May 2006 13:24:41 -0700

On Fri, May 05, 2006 at 09:27:50PM +0200, Sylvain Munaut wrote:
> Chris Dumoulin wrote:
> > I'm using a Virtex II Pro-based board with a PPC405. The board is 
> > hanging somewhere very early in the kernel boot process. I believe it 
> > may be dying at the point where the MMU is enabled. In order to 
> > determine the exact point at which my board hangs, I'm blinking two LEDs 
> > in the assembly code found in arch/ppc/kernel/head_4xx.S, . Currently I 
> > am only able to successfully access the LEDs before the MMU is turned 
> > on, but I can't be sure that I'm calculating the virtual address 
> > properly when I try to access the LED after the MMU is turned on.
> 
> Typical when trying to bring up board ...
> 
> Once the MMU is turned on, you leds register are most likely ... nowhere
> ... i.e.
> if you don't create a mapping your self there is just no virtual address
> that will
> access your leds physical address.
> 
> What I did on some ppc work was tu use a quick BAT mapping to map some leds.
> It's pretty easy to setup. Be aware though that this mapping will get
> wiped out when
> the kernel sets up the BAT for itself.

There are no BATs on 4xx. However, the same conceptual thing can be
done by wiring a fixed TLB entry to cover those LEDs temporarily
during bringup debug.  The temporary TLB entry will be wiped out by
normal tlb misses after things are running whenever the fixed entry
is clobbered by the round robin replacement.

-Matt