Subject: compile vs run-time dependencies?
To: None <port-mips@netbsd.org, tech-embed@netbsd.org>
From: Garrett D'Amore <garrett@damore.org>
List: tech-embed
Date: 10/15/2005 08:52:42
I have a question:

The Alchemy parts I am working on (these are MIPS-based SoCs) have quite 
a few differences from one part to the next.  (Differences in what 
devices are available, where they are located, and in some cases 
differences in the details of certain registers for those devices.)

My question is whether to adjust to these differences based on 
compile-time #ifdef's and macros, or whether to include run-time checks 
based on the processor ID.

 From my perspective, there is little value in run-time checks for this, 
and frankly since a lot of the details can be handled by constant 
redefinitions in header files, compile-time checks will lead (I believe) 
to cleaner code.

The drawback is that you need different kernels for different SoCs.

As these parts not used in general purpose computers (that I'm aware of, 
at least), I don't see a lot of value in supporting a generic kernel 
that can port from one chip to another.  However, I invite comment on this.

(The current alchemy support does it at run-time, however, for a variety 
of reasons, I don't think this support is adequate for the Au1550 parts, 
and frankly, a lot of the details for some devices like AC'97 and PCI 
interrupt routing are board specific and cannot be determined at 
run-time anyway.)

Thanks!

    -- Garrett