183d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+ 2c609719bSwdenk /* 3c609719bSwdenk * (C) Copyright 2000 4c609719bSwdenk * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 5c609719bSwdenk */ 6c609719bSwdenk 7a6c7ad2fSwdenk /* #define DEBUG */ 8a6c7ad2fSwdenk 9c609719bSwdenk #include <common.h> 1066ded17dSSimon Glass #include <autoboot.h> 1118d66533SSimon Glass #include <cli.h> 1224b852a7SSimon Glass #include <console.h> 13*f486b9d0SPali Rohár #include <version_string.h> 14bdccc4feSwdenk 15fad63407SHeiko Schocher /* 16fad63407SHeiko Schocher * Board-specific Platform code can reimplement show_boot_progress () if needed 17fad63407SHeiko Schocher */ show_boot_progress(int val)183422299dSJeroen Hofstee__weak void show_boot_progress(int val) {} 19fad63407SHeiko Schocher run_preboot_environment_command(void)201364a0e4SSimon Glassstatic void run_preboot_environment_command(void) 211364a0e4SSimon Glass { 22bc2b4c27SSimon Glass #ifdef CONFIG_PREBOOT 231364a0e4SSimon Glass char *p; 241364a0e4SSimon Glass 2500caae6dSSimon Glass p = env_get("preboot"); 26bc2b4c27SSimon Glass if (p != NULL) { 272cb132adSSimon Glass int prev = 0; 282cb132adSSimon Glass 292cb132adSSimon Glass if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED)) 302cb132adSSimon Glass prev = disable_ctrlc(1); /* disable Ctrl-C checking */ 31bc2b4c27SSimon Glass 32bc2b4c27SSimon Glass run_command_list(p, -1, 0); 33bc2b4c27SSimon Glass 342cb132adSSimon Glass if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED)) 352cb132adSSimon Glass disable_ctrlc(prev); /* restore Ctrl-C checking */ 36bc2b4c27SSimon Glass } 37bc2b4c27SSimon Glass #endif /* CONFIG_PREBOOT */ 381364a0e4SSimon Glass } 391364a0e4SSimon Glass 40affb2156SSimon Glass /* We come here after U-Boot is initialised and ready to process commands */ main_loop(void)411364a0e4SSimon Glassvoid main_loop(void) 421364a0e4SSimon Glass { 43affb2156SSimon Glass const char *s; 44affb2156SSimon Glass 451364a0e4SSimon Glass bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop"); 461364a0e4SSimon Glass 472cb132adSSimon Glass if (IS_ENABLED(CONFIG_VERSION_VARIABLE)) 48382bee57SSimon Glass env_set("ver", version_string); /* set version variable */ 491364a0e4SSimon Glass 50c1bb2cd0SSimon Glass cli_init(); 511364a0e4SSimon Glass 521364a0e4SSimon Glass run_preboot_environment_command(); 53bc2b4c27SSimon Glass 542cb132adSSimon Glass if (IS_ENABLED(CONFIG_UPDATE_TFTP)) 55c7ff5528SLukasz Majewski update_tftp(0UL, NULL, NULL); 56bc2b4c27SSimon Glass 57affb2156SSimon Glass s = bootdelay_process(); 58affb2156SSimon Glass if (cli_process_fdt(&s)) 59affb2156SSimon Glass cli_secure_boot_cmd(s); 60affb2156SSimon Glass 61affb2156SSimon Glass autoboot_command(s); 62c1bb2cd0SSimon Glass 636493ccc7SSimon Glass cli_loop(); 64045e6f0dSSimon Glass panic("No CLI available"); 65c609719bSwdenk } 66