From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] OMAP (4) boot_params
Date: Wed, 3 Apr 2013 17:34:18 +0200 [thread overview]
Message-ID: <20130403173418.36d062c6@lilith> (raw)
In-Reply-To: <8F4057F9-7EDF-494C-BF77-530475D06E7C@prograde.net>
Hi Michael,
On Wed, 3 Apr 2013 10:59:23 -0400, Michael Cashwell
<mboards@prograde.net> wrote:
> >>>> ...Making that:
> >>>>
> >>>> u32 *boot_params_ptr __attribute__ ((section(".data")));
> >>
> >> Yes, that was my thinking too. Surely clearing data after code has set
> >> it can't be right.
> >
> > With all due respect, the documentation can with greater legitimately
> > turn your admonition around and ask that you please refrain from
> > setting BSS or data variables when the C runtime environment has not
> > been set. :)
> >
> > IOW, what is wrong here is writing to a BSS variable before you're
> > allowed to as per the rules under which your code is running.
>
> I think we're in agreement, but it's not my code doing it. The code,
> as it exists in mainline is writing early to space in bss. My change
> avoids that by moving the variable from the default bss to data:
... except, as I said above, at this point your code should not write at
all, be int in BSS or data, until the C environment is set up. So...
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 6715e0d..1d84535
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -42,7 +42,7 @@ DECLARE_GLOBAL_DATA_PTR;
> #define CONFIG_SYS_MONITOR_LEN (200 * 1024)
> #endif
>
> -u32 *boot_params_ptr = NULL;
> +u32 *boot_params_ptr __attribute__ ((section(".data")));
> struct spl_image_info spl_image;
... NAK. Place this in a fixed section that you'll map somewhere else
then in BSS or data.
Also: in the future, avoid pasting a diff directly in a mail to the
u-boot list if it is not a real patch submission, as our patchwork
instance at (http://patchwork.ozlabs.org/project/uboot/list/) will get
confused and record your mail as a legitimate patch.
> /* Define board data structure */
>
> >> OK, here we have an unfortunate name overloading. The boot_params here
> >> is specifically an OMAP handoff from the CPU's internal boot ROM to SPL
> >> and then from SPL to u-boot. (The same code paths are involved.) It's
> >> totally unrelated to the the boot_params passed to the Linux kernel.
> >>
> >> Since it's confusing maybe a renaming is called for as well.
> >
> > Indeed. Plus, if it is shared data, it should definitely be mapped at a
> > fixed memory location or copied from stage to stage (the latter only if
> > the former is impossible)
>
> Yes, I'm exploring that now. The differences between SPL and U-boot are
> subtle.
Actually not that subtle once you get the hang of it: SPL and U-Boot
are built on the same code base; SPL is the minimal, non-interactive,
early boot stage which can be loaded and run by ROM code, while U-Boot
is the full-featured, interactive, too big to boot directly, stage,
which SPL can chain into.
> Best regards,
> -Mike
Amicalement,
--
Albert.
next prev parent reply other threads:[~2013-04-03 15:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 22:39 [U-Boot] OMAP (4) boot_params Michael Cashwell
2013-04-03 5:56 ` Albert ARIBAUD
2013-04-03 13:45 ` Michael Cashwell
2013-04-03 14:36 ` Albert ARIBAUD
2013-04-03 14:59 ` Michael Cashwell
2013-04-03 15:34 ` Albert ARIBAUD [this message]
2013-04-03 16:42 ` Tom Rini
2013-04-04 5:52 ` Wolfgang Denk
2013-04-04 14:18 ` Michael Cashwell
2013-04-08 9:43 ` Sricharan R
2013-04-08 12:42 ` Michael Cashwell
2013-04-04 19:54 ` Tom Rini
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=20130403173418.36d062c6@lilith \
--to=albert.u.boot@aribaud.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox