All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Althoefer <stefan.althoefer@web.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [Bug] ARM: early environment broken
Date: Mon, 08 Dec 2008 22:52:32 +0100	[thread overview]
Message-ID: <ghk4t9$d9b$1@ger.gmane.org> (raw)

Hi,

---+ Problem

in git u-boot(-arm) early access to environment (e.g. during
serial_init) is broken (for CONFIG_ENV_IS_IN_EEPROM).

---+ Reason

---- start_armboot()----
	__asm__ __volatile__("": : :"memory");

	memset ((void*)gd, 0, sizeof (gd_t));
	gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
	memset (gd->bd, 0, sizeof (bd_t));

	gd->flags |= GD_FLG_RELOC;

	monitor_flash_len = _bss_start - _armboot_start;

	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
		if ((*init_fnc_ptr)() != 0) {
			hang ();
		}
	}

        <snip>

	/* initialize environment */
	env_relocate ();
----------------------

Relocation is finished and indicated in flags before init_sequence is
executed.

env_eeprom::env_init() - as called by init_sequence - however initializes
EEPROM environment assuming it is not relocated.

On the other hand env_common::env_get_char() does evaluate gd->flags to
check whether relocation has been performed.

That is, until env_relocate() is called (see code sniplett) nothing
can be read from the environment.


---+ Suggestion

I assume that there is good reason to set "gd->flags |= GD_FLG_RELOC;"
exactly where it is.

env_relocate() should be added to init_functions, just after env_init().
This should not break other architectures where things might be
different.

                 reply	other threads:[~2008-12-08 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='ghk4t9$d9b$1@ger.gmane.org' \
    --to=stefan.althoefer@web.de \
    --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.