Commit 2f43f85460453f928005e06915892167addbd49a

Authored by Simon Glass
Committed by Minkyu Kang
1 parent a9cf6da925

initcall: Improve debugging support

Add the ability to display the code offset of an initcall even after it
is relocated. This makes it much easier to relate initcalls back to the
U-Boot System.map file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>

Showing 2 changed files with 13 additions and 6 deletions Side-by-side Diff

... ... @@ -6,5 +6,5 @@
6 6  
7 7 typedef int (*init_fnc_t)(void);
8 8  
9   -int initcall_run_list(init_fnc_t init_sequence[]);
  9 +int initcall_run_list(const init_fnc_t init_sequence[]);
... ... @@ -7,15 +7,22 @@
7 7 #include <common.h>
8 8 #include <initcall.h>
9 9  
10   -int initcall_run_list(init_fnc_t init_sequence[])
  10 +DECLARE_GLOBAL_DATA_PTR;
  11 +
  12 +int initcall_run_list(const init_fnc_t init_sequence[])
11 13 {
12   - init_fnc_t *init_fnc_ptr;
  14 + const init_fnc_t *init_fnc_ptr;
13 15  
14 16 for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
15   - debug("initcall: %p\n", *init_fnc_ptr);
  17 + unsigned long reloc_ofs = 0;
  18 +
  19 + if (gd->flags & GD_FLG_RELOC)
  20 + reloc_ofs = gd->reloc_off;
  21 + debug("initcall: %p\n", (char *)*init_fnc_ptr - reloc_ofs);
16 22 if ((*init_fnc_ptr)()) {
17   - debug("initcall sequence %p failed at call %p\n",
18   - init_sequence, *init_fnc_ptr);
  23 + printf("initcall sequence %p failed at call %p\n",
  24 + init_sequence,
  25 + (char *)*init_fnc_ptr - reloc_ofs);
19 26 return -1;
20 27 }
21 28 }