linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Lee HongWoo <hongwoo7@gmail.com>
Cc: Linuxppc-dev@lists.ozlabs.org
Subject: Re: Question about linux boot procedure (head_64.S)
Date: Wed, 02 Sep 2009 10:47:09 +1000	[thread overview]
Message-ID: <1251852430.5834.9.camel@concordia> (raw)
In-Reply-To: <5e2889710909010358v907022cs708dfc0dd3ed7fd0@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

On Tue, 2009-09-01 at 19:58 +0900, Lee HongWoo wrote:
> Hi ~ 
> 
> This is a boot flow of linux kernel under the arch/powerpc/kernel and
> I'm using pasemi cpu. 
> 
> __start  (in head_64.S) 
>   ---> __start_initialization_multiplatform (in head_64.S) 
>     ---> __boot_from_prom (in head_64.S) 
>        ---> prom_init ( in prom_init.c) 
>          ---> __start ???
> 
> And I don't understand where __start is called, because I can find
> __start only in head_64.S. 
> If it calls __start in head_64.S, it's a recursive call. 
> 
> Can anybody explain about this precedure ? 

It calls __start() with different arguments. They are checked in
__start_initialization_multiplatform:

308         /*
309          * Are we booted from a PROM Of-type client-interface ?             
310          */
311         cmpldi  cr0,r5,0
312         beq     1f
313         b       .__boot_from_prom               /* yes -> prom */


The first time through __start we are running under OF. The kernel can
detect this based on the arguments it is passed (r5 in particular).

prom_init() deals with talking to OF and flattening the OF device tree.
We then call back into __start but this time r5 is 0:

2555         __start(hdr, kbase, 0);                                            

So the second time through we don't call into prom_init(), instead the
kernel continues using the flattened device tree.

The startup is structured this way so that the kernel can boot either
from OF (in which case we call prom_init()), or directly with a
flattened device tree.

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2009-09-02  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-01 10:58 Question about linux boot procedure (head_64.S) Lee HongWoo
2009-09-01 17:32 ` Geoff Levand
2009-09-02  0:25   ` Lee HongWoo
2009-09-02  1:19     ` Geoff Levand
2009-09-02  0:47 ` Michael Ellerman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-09-01 11:27 Lee HongWoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1251852430.5834.9.camel@concordia \
    --to=michael@ellerman.id.au \
    --cc=Linuxppc-dev@lists.ozlabs.org \
    --cc=hongwoo7@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).