Re: [Ppcboot-users] adding to board.c
Murray Jensen <Murray.Jensen <at> cmst.csiro.au>
2000-10-02 05:33:16 GMT
On Thu, 28 Sep 2000 10:29:54 +0100, "Rob Taylor" <robt <at> flyingpig.com> writes:
>I've been thinking on this. I think that what you're suggesting would be rather
>an overkill.
I suspected as much - but I'm still not certain it is.
>(our linker scripts are messy enough already ;)
I didn't think the linker scripts were messy. Aren't they very simple?
The objection I thought that would be raised is that the linker scripts
shouldn't be deciding the order of execution of code - this should be
in the domain of the program source code.
I thought of another way. Have something similar to the Linux/PPC struct
machdep_calls ppc_md. i.e. define a list of possible platform dependent
function calls which get called at various stages by the common board_init_f
and board_init_r routines. Thus this:
if ((dram_size = initdram (board_type)) > 0) {...
changes to this:
if ((dram_size = (*ppc_md.initdram) (board_type)) > 0) {...
The first thing the monitor does is call a platform dependent function to
initialise this structure, or it could be statically defined as initialised
data.
Optional calls would look like this:
if (ppc_md.preserial != NULL)
(*ppc_md.preserial)();
and on your platform, the preserial function would initialise the winbond
thingy. All other boards would leave this NULL.
>Perhaps a better solution would be to have
>board_init_f, board_init_r in the per-board directories, but take out code
>that's common to all boards and have these as functions that the boards
>initialisation code calls in it's own board_init_f.
This is a good idea also, and I actually did this in the early days, but I
found that there was a lot of duplicated code in each of the board dependent
directories, plus it was a pretty major change to the current source code.
>P.S.
>
>while I'm here, I was just thinking that perhaps placing cpu directories under
> a
>'cpus' directory and the board directories under a 'boards' directory would be
> a
>helpful organisational tool. whaddya reckon?
This is also a good idea. Perhaps the following:
arch/
ppc/
boards/
cpus/
common/ <= same as current top level "ppc" dir
then you could have:
arch/
alpha/
boards/
cpus/
common/
etc. again, taking the lead from the linux kernel. Or you could just have:
arch/
ppc/
cogent/
common/ <= same as current top level "ppc" dir
etx094/
fads/
mpc8xx/
mpc8260/
tqm8xx/
because the extra directory level would be perhaps going too far.
Let's keep the discussion rolling - this is all good stuff. Cheers!
Murray...
--
--
Murray Jensen, CSIRO Manufacturing Sci & Tech, Phone: +61 3 9662 7763
Locked Bag No. 9, Preston, Vic, 3072, Australia. Fax: +61 3 9662 7853
Internet: Murray.Jensen <at> cmst.csiro.au (old address was mjj <at> mlb.dmt.csiro.au)