blob: 7d9f960dbc989ad62e6bf3a635af6cb51730d399 [file] [log] [blame]
Patrick Georgi864dc3b2020-03-04 13:59:17 +01001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauere8b08ba2013-05-24 15:09:36 -07002
Sam Lewis362a1562020-09-14 21:04:35 +10003#include <cbfs.h>
Gabe Blackc09cf0b2014-02-08 06:30:49 -08004#include <arch/cache.h>
Aaron Durbin04654a22015-03-17 11:43:44 -05005#include <program_loading.h>
Stefan Reinauer52db0b92012-12-07 17:15:04 -08006
Sam Lewis362a1562020-09-14 21:04:35 +10007void boot_linux(void *kernel_ptr, void *fdt_ptr);
8
Aaron Durbinb3847e62015-03-20 15:55:08 -05009void arch_prog_run(struct prog *prog)
Stefan Reinauer52db0b92012-12-07 17:15:04 -080010{
Aaron Durbin3948e532015-03-20 13:00:20 -050011 void (*doit)(void *);
Gabe Blackc09cf0b2014-02-08 06:30:49 -080012
Gabe Blackc09cf0b2014-02-08 06:30:49 -080013 cache_sync_instructions();
Aaron Durbin3948e532015-03-20 13:00:20 -050014
Sam Lewis362a1562020-09-14 21:04:35 +100015 switch (prog_cbfs_type(prog)) {
Julius Werner00572622022-05-26 20:29:42 -070016 case CBFS_TYPE_FIT_PAYLOAD:
Sam Lewis362a1562020-09-14 21:04:35 +100017 /*
18 * We only load Linux payloads from the ramstage, so provide a hint to
19 * the linker that the below functions do not need to be included in
20 * earlier stages.
21 */
22 if (!ENV_RAMSTAGE)
23 break;
24
25 dcache_mmu_disable();
26 boot_linux(prog_entry(prog), prog_entry_arg(prog));
27 break;
28 default:
29 doit = prog_entry(prog);
30 doit(prog_entry_arg(prog));
31 }
Aaron Durbinb3847e62015-03-20 15:55:08 -050032}