Blame view

common/main.c 1.36 KB
c609719b8   wdenk   Initial revision
1
2
3
4
  /*
   * (C) Copyright 2000
   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
5
   * SPDX-License-Identifier:	GPL-2.0+
c609719b8   wdenk   Initial revision
6
   */
a6c7ad2f6   wdenk   * Fix startup pro...
7
  /* #define	DEBUG	*/
c609719b8   wdenk   Initial revision
8
  #include <common.h>
66ded17df   Simon Glass   Move autoboot cod...
9
  #include <autoboot.h>
18d66533a   Simon Glass   move CLI prototyp...
10
  #include <cli.h>
24b852a7a   Simon Glass   Move console defi...
11
  #include <console.h>
fbcdf32af   Simon Glass   main: Correct hea...
12
  #include <version.h>
bdccc4fed   wdenk   * Map ISP1362 USB...
13

9272a9b4f   Simon Glass   m68k: powerpc: Cl...
14
  DECLARE_GLOBAL_DATA_PTR;
fad634071   Heiko Schocher   make show_boot_pr...
15
16
17
  /*
   * Board-specific Platform code can reimplement show_boot_progress () if needed
   */
3422299dc   Jeroen Hofstee   common: main.c: m...
18
  __weak void show_boot_progress(int val) {}
fad634071   Heiko Schocher   make show_boot_pr...
19

1364a0e48   Simon Glass   Simplify the main...
20
21
  static void run_preboot_environment_command(void)
  {
bc2b4c27d   Simon Glass   main: Move boot_d...
22
  #ifdef CONFIG_PREBOOT
1364a0e48   Simon Glass   Simplify the main...
23
  	char *p;
00caae6d4   Simon Glass   env: Rename geten...
24
  	p = env_get("preboot");
bc2b4c27d   Simon Glass   main: Move boot_d...
25
26
27
28
29
30
31
32
33
34
35
36
  	if (p != NULL) {
  # ifdef CONFIG_AUTOBOOT_KEYED
  		int prev = disable_ctrlc(1);	/* disable Control C checking */
  # endif
  
  		run_command_list(p, -1, 0);
  
  # ifdef CONFIG_AUTOBOOT_KEYED
  		disable_ctrlc(prev);	/* restore Control C checking */
  # endif
  	}
  #endif /* CONFIG_PREBOOT */
1364a0e48   Simon Glass   Simplify the main...
37
  }
affb21562   Simon Glass   main: Make the ex...
38
  /* We come here after U-Boot is initialised and ready to process commands */
1364a0e48   Simon Glass   Simplify the main...
39
40
  void main_loop(void)
  {
affb21562   Simon Glass   main: Make the ex...
41
  	const char *s;
1364a0e48   Simon Glass   Simplify the main...
42
  	bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
1364a0e48   Simon Glass   Simplify the main...
43
  #ifdef CONFIG_VERSION_VARIABLE
382bee57f   Simon Glass   env: Rename seten...
44
  	env_set("ver", version_string);  /* set version variable */
1364a0e48   Simon Glass   Simplify the main...
45
  #endif /* CONFIG_VERSION_VARIABLE */
c1bb2cd0b   Simon Glass   main: Hide the hu...
46
  	cli_init();
1364a0e48   Simon Glass   Simplify the main...
47
48
  
  	run_preboot_environment_command();
bc2b4c27d   Simon Glass   main: Move boot_d...
49
50
  
  #if defined(CONFIG_UPDATE_TFTP)
c7ff55284   Lukasz Majewski   update: tftp: dfu...
51
  	update_tftp(0UL, NULL, NULL);
bc2b4c27d   Simon Glass   main: Move boot_d...
52
  #endif /* CONFIG_UPDATE_TFTP */
affb21562   Simon Glass   main: Make the ex...
53
54
55
56
57
  	s = bootdelay_process();
  	if (cli_process_fdt(&s))
  		cli_secure_boot_cmd(s);
  
  	autoboot_command(s);
c1bb2cd0b   Simon Glass   main: Hide the hu...
58

6493ccc7c   Simon Glass   Split out simple ...
59
  	cli_loop();
045e6f0d4   Simon Glass   Panic when no com...
60
  	panic("No CLI available");
c609719b8   wdenk   Initial revision
61
  }