[U-Boot] passing info from SPL to U-Boot
Heiko Schocher
hs at denx.de
Tue Mar 12 08:21:36 UTC 2019
Hello Simon, Tom,
I am just stumbeld on an am437x basd board over the problem to pass
the bootmode from SPL to U-Boot. On am437x the bootmode info get
overwritten from SPL stack, and I need this info in U-Boot.
Hack would be to move SPL stack to another address, but we loose
than 0xa000 size for stack ... I do not want to go this way..
I thought gd info is passed from SPL to U-Boot, but this is not the case!
Looking into
...
75 bic r0, r0, #7 /* 8-byte alignment for ABI compliance */
76 mov sp, r0
77 bl board_init_f_alloc_reserve
78 mov sp, r0
79 /* set up gd here, outside any C code */
80 mov r9, r0
81 bl board_init_f_init_reserve
and common/init/board_init.c:
99 void board_init_f_init_reserve(ulong base)
100 {
101 struct global_data *gd_ptr;
102
103 /*
104 * clear GD entirely and set it up.
105 * Use gd_ptr, as gd may not be properly set yet.
106 */
107
108 gd_ptr = (struct global_data *)base;
109 /* zero the area */
110 memset(gd_ptr, '\0', sizeof(*gd));
111 /* set GD unless architecture did it already */
112 #if !defined(CONFIG_ARM)
113 arch_setup_gd(gd_ptr);
114 #endif
gd is always initialized with zeros, no chance for passing infos from
SPL to U-Boot...
I really thought, that gd_t was intentionally designed for passing data
between different U-Boot states, but looking into gd_t definiton in
include/asm-generic/global_data.h it is a big ifdef mess and not useable
as an "API" between TPL/SPL and U-Boot ...
I thought also, that SPL detects for example ramsize and than passes
this info to U-Boot ...
But Ok, I found "common/init/handoff.c" which seems now the way to go, but:
./common/board_f.c
281 static int setup_spl_handoff(void)
282 {
283 #if CONFIG_IS_ENABLED(HANDOFF)
284 gd->spl_handoff = bloblist_find(BLOBLISTT_SPL_HANDOFF,
285 sizeof(struct spl_handoff));
286 debug("Found SPL hand-off info %p\n", gd->spl_handoff);
287 #endif
288
289 return 0;
290 }
There is gd->spl_handoff used ... how could this work at least on arm,
if gd is set to zeros on init ?
Do I miss something obvious?
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de
More information about the U-Boot
mailing list