Subject: Re: the prom: to map or not to map
To: None <netbsd-ports@NetBSD.ORG, jason@sunra.csci.unt.edu>
From: Wolfgang Solfrank <ws@kurt.tools.de>
List: netbsd-ports
Date: 06/10/1997 20:55:12
> netbsd-ports doesn't get much traffic, so here's my contribution :-)
> 
> So how do you decide whether or not to keep the prom mapped in beyond
> the boot stage?

Depends on what the prom can do for you, i.e. whether there are defined
useful interfaces in there.

> For example, it appears the alpha does and i386 doesn't. For the
> i386, the bios is 16 bit code and non-reentrant so I can see that
> being the main reason not to. It appears powerpc does because it
> is currently leveraging that in lieu of device drivers. I thought

The powerpc port is a bit special regarding this:

For one thing it currently uses OpenFirmware, i.e. what you call the prom
(see below why this isn't strictly true) for ALL its I/O.  I.e. the port
currently doesn't have any native device drivers.

The OpenFirmware is non-reentrant, too.  This is taken care of by the
OpenFirmware device drivers by disabling interrupts before jumping to the
firmware routines.

Now for why this isn't the prom: the firmware, upon startup, copies itself
from rom to ram (the speicification requires this, but note that OpenFirmware
on PowerMacs doesn't do it), relocates itself to the ram addresses, and
then runs from the ram image.

Even when I get around to use native deivce drivers for all the devices in
a machine, I will still leave this prom copy in main memory in order to
allow proper exit from the OS into the prom interpreter (the equivalent
of L1-A on Suns).  On my machine, the prom copy occupies about .5 MB of
ram, so that isn't enough to worry about (the machine has 64 MB standard).

> I recently read that mapping in the prom on the alpha took up 2MB
> of real memory. What main value do prom routines provide beyond
> booting? Cache management? just convenient generic code between 
> different models of the same hardware?

For the powerpc port, see above.
-- 
ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) 	+49-228-985800