public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [Bug] ARM: early environment broken
@ 2008-12-08 21:52 Stefan Althoefer
  0 siblings, 0 replies; only message in thread
From: Stefan Althoefer @ 2008-12-08 21:52 UTC (permalink / raw)
  To: u-boot

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-08 21:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-08 21:52 [U-Boot] [Bug] ARM: early environment broken Stefan Althoefer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox