]>
Commit | Line | Data |
---|---|---|
c8a311d9 SG |
1 | /* |
2 | * Copyright (c) 2013 The Chromium OS Authors. | |
3 | * | |
1a459660 | 4 | * SPDX-License-Identifier: GPL-2.0+ |
c8a311d9 SG |
5 | */ |
6 | ||
7 | #include <common.h> | |
8 | #include <initcall.h> | |
9 | ||
2f43f854 SG |
10 | DECLARE_GLOBAL_DATA_PTR; |
11 | ||
12 | int initcall_run_list(const init_fnc_t init_sequence[]) | |
c8a311d9 | 13 | { |
2f43f854 | 14 | const init_fnc_t *init_fnc_ptr; |
c8a311d9 SG |
15 | |
16 | for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { | |
2f43f854 | 17 | unsigned long reloc_ofs = 0; |
aacc6c5d | 18 | int ret; |
2f43f854 SG |
19 | |
20 | if (gd->flags & GD_FLG_RELOC) | |
21 | reloc_ofs = gd->reloc_off; | |
e38d1cb2 AB |
22 | debug("initcall: %p", (char *)*init_fnc_ptr - reloc_ofs); |
23 | if (gd->flags & GD_FLG_RELOC) | |
24 | debug(" (relocated to %p)\n", (char *)*init_fnc_ptr); | |
25 | else | |
26 | debug("\n"); | |
aacc6c5d SG |
27 | ret = (*init_fnc_ptr)(); |
28 | if (ret) { | |
29 | printf("initcall sequence %p failed at call %p (err=%d)\n", | |
2f43f854 | 30 | init_sequence, |
aacc6c5d | 31 | (char *)*init_fnc_ptr - reloc_ofs, ret); |
c8a311d9 SG |
32 | return -1; |
33 | } | |
34 | } | |
35 | return 0; | |
36 | } |