From: Albert ARIBAUD <albert.aribaud@free.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] calling pci_init before relocation?
Date: Mon, 31 Jan 2011 00:01:24 +0100 [thread overview]
Message-ID: <4D45EDC4.9020605@free.fr> (raw)
In-Reply-To: <4D45EA43.3070108@discworld.dascon.de>
Le 30/01/2011 23:46, Michael Schwingen a ?crit :
> Am 01/30/2011 11:07 PM, schrieb Albert ARIBAUD:
>> Hi Michael,
>>
>> Le 30/01/2011 22:39, Michael Schwingen a ?crit :
>>> Hi,
>>>
>>> ist it allowed to call pci_init before relocation?
>>>
>>> The code looks like this is not supposed to happen. However, on ARM,
>>> arm_pci_init (which calls pci_init in turn) is called from
>>> init_sequence, which happens before relocation.
>>>
>>> Am I overlooking some way in which this can actually work? Are there
>>> boards using this?
>>>
>>> If I move pci_init down into board_init_r, I can get PCI working on
>>> IXP42x, but I am worried if this will cause problems on other boards.
>> I cannot see a reason why pci_init should not work before relocation as
>> long as it does not read or write BSS variables or write non-const
>> initialized data -- or overflow the (admittedly limited) C stack.
> Because it does just that - from drivers/pci/pci.c:
>
> static struct pci_controller* hose_head;
>
> void pci_init(void)
> {
> [...]
> hose_head = NULL;
>
> /* now call board specific pci_init()... */
> pci_init_board();
> }
>
> pci_init_board will then call code that ends up calling
> pci_register_hose, which adds elements into the list at hose_head.
Tough luck -- BTW, how does this code allocate the memory? The heap is
obviously not going to work before relocation.
>> Are you asking because you discovered that pci_init does not work when
>> called from board_init_f? If so, did you determine exactly what goes wrong?
> The system hangs during early init, and does not get past relocation.
>
> Note that I can only *test* PCI on IXP42x, however, this is common code,
> so I do not see how this could behave different on other ARM systems.
>
> If I interpret the code correct, the PCI code is called from
> board_init_r on PowerPC platforms.
Hmm... Now let's reverse the question: why should PCI be initialized
before relocation? At this point the only goal of the init_board_f code
is to get the RAM working for relocation, and the only useful device is
the serial console. Does pci_init() help for either RAM or console?
> cu
> Michael
Amicalement,
--
Albert.
next prev parent reply other threads:[~2011-01-30 23:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-30 21:39 [U-Boot] calling pci_init before relocation? Michael Schwingen
2011-01-30 22:07 ` Albert ARIBAUD
2011-01-30 22:46 ` Michael Schwingen
2011-01-30 23:01 ` Albert ARIBAUD [this message]
2011-01-31 8:45 ` Heiko Schocher
2011-01-31 10:46 ` Wolfgang Denk
2011-02-01 7:35 ` Michael Schwingen
2011-02-01 8:04 ` Heiko Schocher
2011-01-31 9:45 ` Michael Schwingen
2011-01-31 10:42 ` Wolfgang Denk
2011-01-31 11:11 ` Michael Schwingen
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=4D45EDC4.9020605@free.fr \
--to=albert.aribaud@free.fr \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.