1 /* 2 * Copyright (c) 2022, MediaTek Inc. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <common/debug.h> 8 #include <lib/utils_def.h> 9 #include <lib/mtk_init/mtk_init.h> 10 11 INIT_CALL_TABLE(EXPAND_AS_EXTERN); 12 extern struct initcall __MTK_PLAT_INITCALL_END__[]; 13 14 struct initcall *initcall_list[] = { 15 INIT_CALL_TABLE(EXPAND_AS_SYMBOL_ARR) 16 __MTK_PLAT_INITCALL_END__ 17 }; 18 mtk_init_one_level(uint32_t level)19void mtk_init_one_level(uint32_t level) 20 { 21 const struct initcall *entry; 22 int error; 23 24 if (level >= MTK_INIT_LVL_MAX) { 25 ERROR("invalid level:%u\n", level); 26 panic(); 27 } 28 29 INFO("init calling level:%u\n", level); 30 for (entry = initcall_list[level]; 31 (entry != NULL) && (entry < initcall_list[level + 1]); 32 entry++) { 33 INFO("calling %s\n", entry->name); 34 error = entry->fn(); 35 if (error != 0) { 36 ERROR("init %s fail, errno:%d\n", entry->name, error); 37 } 38 } 39 } 40