]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - include/initcall.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2011 The Chromium OS Authors.
9 typedef int (*init_fnc_t
)(void);
15 DECLARE_GLOBAL_DATA_PTR
;
17 static inline int initcall_run_list(const init_fnc_t init_sequence
[])
19 const init_fnc_t
*init_fnc_ptr
;
21 for (init_fnc_ptr
= init_sequence
; *init_fnc_ptr
; ++init_fnc_ptr
) {
22 unsigned long reloc_ofs
= 0;
25 if (gd
->flags
& GD_FLG_RELOC
)
26 reloc_ofs
= gd
->reloc_off
;
28 reloc_ofs
= (unsigned long)image_base
;
30 debug("initcall: %p", (char *)*init_fnc_ptr
- reloc_ofs
);
31 if (gd
->flags
& GD_FLG_RELOC
)
32 debug(" (relocated to %p)\n", (char *)*init_fnc_ptr
);
35 ret
= (*init_fnc_ptr
)();
37 printf("initcall sequence %p failed at call %p (err=%d)\n",
39 (char *)*init_fnc_ptr
- reloc_ofs
, ret
);