Subject: Re: [MPC7448] machdep_calls

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 19 Aug 2008 07:11:14 +1000

On Mon, 2008-08-18 at 13:35 +0200, Sébastien Chrétien wrote:
> Can somebody explain me the aim of the function  "setup_arch" in the
> machine_call structure ?

This is where most of your arch code gets a chance to initialize before
most of the core is.

The generic core linux code calls the architecture setup_arch() very
early during boot, before most other initializations. The powerpc
architecture code performs various early initialisations there, on
32-bit that includes unflattening the device-tree, looking for legacy
serial ports, etc... and initializing bootmem.

It then calls ppc_md.setup_arch to give the platform a chance to perform
other platform specific early initializations before the rest of the
kernel starts initializing.

This is very early, ie, for memory allocation you can only use bootmem
for example. Interrupts haven't been initialized or switched on yet,
etc...

This is typically the place where your arch code will setup it's SMP ops
if any, will discover the fixed PCI host bridges, and initialize low
level HW components that need early initialization.

Ben.

> 2008/8/18, Sébastien Chrétien <[email-masked]>:
>         Ok I am going to copy some examples.
>         
>         2008/8/18, Benjamin Herrenschmidt <[email-masked]>:
>                 On Mon, 2008-08-18 at 10:45 +0200, Sébastien Chrétien
>                 wrote:
>                 > Hello,
>                 >
>                 > I am developping a Linux for my PPC Board. I must
>                 write a
>                 > define_machine structure (marchdep_calls). Where can
>                 I find some
>                 > Information about functions of this structure ?
>                 
>                 
>                 It isn't well documented unfortunately. Best is to
>                 look at what others
>                 do... and then find your way through.
>                 
>                 I agree somebody should write dome doco one day ... in
>                 the meantime,
>                 feel free to ask questions here.
>                 
>                 Cheers,
>                 Ben.
>                 
>                 
>         
>