2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2013-03-05 14:39:40 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 The Chromium OS Authors.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <initcall.h>
|
2015-07-31 15:31:38 +00:00
|
|
|
#include <efi.h>
|
2013-03-05 14:39:40 +00:00
|
|
|
|
2014-05-20 12:01:43 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
int initcall_run_list(const init_fnc_t init_sequence[])
|
2013-03-05 14:39:40 +00:00
|
|
|
{
|
2014-05-20 12:01:43 +00:00
|
|
|
const init_fnc_t *init_fnc_ptr;
|
2013-03-05 14:39:40 +00:00
|
|
|
|
|
|
|
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
|
2014-05-20 12:01:43 +00:00
|
|
|
unsigned long reloc_ofs = 0;
|
2014-10-02 01:57:22 +00:00
|
|
|
int ret;
|
2014-05-20 12:01:43 +00:00
|
|
|
|
|
|
|
if (gd->flags & GD_FLG_RELOC)
|
|
|
|
reloc_ofs = gd->reloc_off;
|
2015-07-31 15:31:38 +00:00
|
|
|
#ifdef CONFIG_EFI_APP
|
|
|
|
reloc_ofs = (unsigned long)image_base;
|
|
|
|
#endif
|
2014-12-27 22:35:57 +00:00
|
|
|
debug("initcall: %p", (char *)*init_fnc_ptr - reloc_ofs);
|
|
|
|
if (gd->flags & GD_FLG_RELOC)
|
|
|
|
debug(" (relocated to %p)\n", (char *)*init_fnc_ptr);
|
|
|
|
else
|
|
|
|
debug("\n");
|
2014-10-02 01:57:22 +00:00
|
|
|
ret = (*init_fnc_ptr)();
|
|
|
|
if (ret) {
|
|
|
|
printf("initcall sequence %p failed at call %p (err=%d)\n",
|
2014-05-20 12:01:43 +00:00
|
|
|
init_sequence,
|
2014-10-02 01:57:22 +00:00
|
|
|
(char *)*init_fnc_ptr - reloc_ofs, ret);
|
2013-03-05 14:39:40 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|