Subject: Re: how to determine loader address when porting NetBSD using u-boot
To: David Laight <david@l8s.co.uk>
From: Toru Nishimura <locore64@alkyltechnology.com>
List: port-arm
Date: 04/07/2006 15:51:12
David Laight wrote;

> > - SDRAM is located high; sometimes 0x8000'0000, 0xA000'0000 or
> > 0xC000'0000, very strange arrangement.
> > - Most of ARM NetBSD kernel is located vaddr 0xC000'0000.
> 
> Not as bad as booting a certain OS which needs all its DRAM contiguous
> at address zero.  One trick there is to link the ROM code for one
> of its aliased addresses (eg 64MB) and start with an absolute jump
> to that address.  The MMU can then be enabled with the ROM mapped
> physical==virtual and the SDRAM at zero - saves a lot of faffing
> about with all the different page tabes that the 'dance of death' needs.

Yah, I did the MMU double map approach.  (NetBSD does not require to
have contiguous RAM beginning at paddr 0, BTW)  I made homegrown
bootloader code which was derivated from stripped down NetBSD start.S
and the logic has been proven _enoumously useful_ for me. The most
helpful feature is an arrangment to match bootloader vaddr layout with
"struct pmap_devmap" array in machdep.c.  This ensures UART keeps
working during bootloader and even while NetBSD constracts its own
address space layout in initarm().  No comattach() dance is necessary.

Another advantage to turn on MMU early in bootloader is speed gain.  It's
somehow astonishing to see bootloaders do not turn on ARM MMU.  Since
ARM cache is VIVT which can become useful only after MMU gets turned
on.  So, MMU-less ARM bootloader runs very s-l-o-w.

Toru Nishimura/ALKYL Technology