Subject: Re: CVS commit: src/sys/arch/evbmips
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Garrett D'Amore <garrett_damore@tadpole.com>
List: port-evbmips
Date: 02/23/2006 11:23:05
Izumi Tsutsui wrote:
> In article <43FE0445.8030800@tadpole.com>
> garrett_damore@tadpole.com wrote:
>
>   
>> We had this conversation before (Simon and I, that is).  It isn't
>> possible to have a GENERIC kernel.  You *have* to select the board,
>> because you cannot identify all board variants.
>>     
>
> Even so, I would still like to move board_info() into a common file
> and it's better to have a sanity check if only one board is configured
> (then we need #ifdefs like mips/include/cpu.h anyway),
>   
We have a sanity check already -- the link will fail due to multiple
symbol definitions. :-)

The problem is that doing it the other way means I need to add a bunch
of extern declarations (e.g. "extern struct board_info dbau1550_info")
into the machdep code.  To get it really right you need something like this:

#ifdef ALCHEMY_DBAU1550
extern struct board_info dbau1550_info;
#else
...
#endif

Then you also have in the code;

#ifdef ALCHEMY_DBAU1550
return (&dbau1550_info);
#else
...
#endif

I am generally *not* fond of #ifdef jungles, and your proposal creates
two of them.

The other problem with this is that I can imagine having a board
defintion that actually supports a board *family* (where the type of
board is run-time detectable via a register), and then what do you do? 
By having the board_info() function, you can return a different
board_info based on a run-time test that you can't do with CPP macros alone.

    -- Garrett
>   
>> The current set up is
>> what we agreed to.
>>     
>
> ...but I won't strongly object to responsible people since
> it's just my "feeling" ;-)
> ---
> Izumi Tsutsui
>   


-- 
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
http://www.tadpolecomputer.com/
Phone: 951 325-2134  Fax: 951 325-2191