User Tools

Site Tools


u-boot_boot_sequence

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
u-boot_boot_sequence [2019/12/27 17:53]
rpjday [common/board_f.c]
u-boot_boot_sequence [2019/12/28 08:33] (current)
rpjday [1.]
Line 19: Line 19:
 ===== arch/​arm/​lib/​crt0_64.S [ENTRY(_main)] ===== ===== arch/​arm/​lib/​crt0_64.S [ENTRY(_main)] =====
  
-==== 1. ====+==== Prologue ​====
  
 <​code>​ <​code>​
Line 25: Line 25:
  * start-up where a C runtime environment is needed. Its entry point  * start-up where a C runtime environment is needed. Its entry point
  * is _main and is branched into from the target'​s start.S file.  * is _main and is branched into from the target'​s start.S file.
- * +</​code>​ 
- * _main execution sequence is: + 
- *+==== 1. ==== 
 + 
 +<​code>​
  * 1. Set up initial environment for calling board_init_f().  * 1. Set up initial environment for calling board_init_f().
  ​* ​   This environment only provides a stack and a place to store  ​* ​   This environment only provides a stack and a place to store
Line 212: Line 214:
 </​code>​ </​code>​
  
-<​code>​ +===== common/​board_r.c =====
- +
-</​code>​ +
- +
-===== common/​board_r.c ​(only most common) ​===== +
- +
-==== initr_dm() [C] ==== +
-==== board_init() [A,B] ==== +
- +
-==== board_early_init_r() (not for Zynq) ==== +
- +
-==== arch_early_init_r() [A] ==== +
- +
-  * arch/​arm/​mach-zynq/​cpu.c +
-  * arch/​arm/​mach-zynq/​spl.c+
  
 <​code>​ <​code>​
-#if defined(CONFIG_ARCH_EARLY_INIT_R) +void board_init_r(gd_t *new_gdulong dest_addr)
-int arch_early_init_r(void+
-+
-#if (defined(CONFIG_FPGA) && !defined(CONFIG_SPL_BUILD)) || \ +
-    (defined(CONFIG_SPL_FPGA_SUPPORT) && defined(CONFIG_SPL_BUILD)) +
-        int cpu_id = cpu_desc_id();​ +
- +
-        if (cpu_id < 0) +
-                return 0; +
- +
-        fpga.size = zynq_fpga_descs[cpu_id].fpga_size;​ +
-        fpga.name = zynq_fpga_descs[cpu_id].devicename;​ +
-        fpga_init();​ +
-        fpga_add(fpga_xilinx,​ &​fpga);​ +
-#endif +
-        return 0; +
-+
-#endif +
-</​code>​ +
- +
-==== initr_mmc() [C] ==== +
- +
-<​code>​ +
-#ifdef CONFIG_MMC +
-static int initr_mmc(void) +
-+
-        puts("​MMC: ​  "​);​ +
-        mmc_initialize(gd->​bd);​ +
-        return 0; +
-+
-#endif +
-</​code>​ +
- +
-==== initr_env() [C] ==== +
- +
-<​code>​ +
-static int initr_env(void) +
-+
-        /initialize environment */ +
-        if (should_load_env()) +
-                env_relocate();​ +
-        else +
-                set_default_env(NULL0); +
-#ifdef CONFIG_OF_CONTROL +
-        env_set_hex("​fdtcontroladdr",​ +
-                    (unsigned long)map_to_sysmem(gd->​fdt_blob));​ +
-#endif +
- +
-        /* Initialize from environment */ +
-        load_addr = env_get_ulong("​loadaddr",​ 16, load_addr);​ +
- +
-        return 0; +
-+
-</​code>​ +
- +
-==== show_board_info() [C] ==== +
- +
-From ''​common/​board_info.c'':​ +
- +
-<​code>​ +
-int __weak checkboard(void) +
-+
-        return 0; +
-+
- +
-/* +
- * If the root node of the DTB has a "​model"​ property, show it. +
- * Then call checkboard(). +
- */ +
-int __weak show_board_info(void) +
-+
-#ifdef CONFIG_OF_CONTROL +
-        DECLARE_GLOBAL_DATA_PTR;​ +
-        const char *model; +
- +
-        model = fdt_getprop(gd->​fdt_blob,​ 0, "​model",​ NULL); +
- +
-        if (model) +
-                printf("​Model:​ %s\n", model); +
-#endif +
- +
-        return checkboard();​ +
-+
-</​code>​ +
- +
- +
-For ''​zynqmp.c'':​ +
- +
-<​code>​ +
-int checkboard(void) +
-+
-        puts("​Board:​ Xilinx ZynqMP\n"​);​ +
-        return 0; +
-+
-</​code>​ +
- +
-==== arch_misc_init() ==== +
- +
-Some arches and boards, not Zynq. +
- +
-<​code>​ +
-#ifdef CONFIG_ARCH_MISC_INIT +
-        arch_misc_init,​ +
-#endif +
-</​code>​ +
- +
-==== misc_init_r() ==== +
- +
-<​code>​ +
-#ifdef CONFIG_MISC_INIT_R +
-        misc_init_r,​ +
-#endif +
-</​code>​ +
- +
-==== initr_enable_interrupts() ==== +
- +
-<​code>​ +
-#ifdef CONFIG_ARM +
-static int initr_enable_interrupts(void) +
-+
-        enable_interrupts();​ +
-        return 0; +
-+
-#endif +
-</​code>​ +
- +
-From ''​arch/​arm/​lib/​interrupts.c'':​ +
- +
-<​code>​ +
-int interrupt_init (void)+
 { {
         /*         /*
-         ​* ​setup up stacks if necessary+         ​* ​Set up the new global data pointer. So far only x86 does this 
 +         * here. 
 +         * TODO(sjg@chromium.org):​ Consider doing this for all archs, or 
 +         * dropping the new_gd parameter.
          */          */
-        IRQ_STACK_START_IN = gd->​irq_sp + 8;+#if CONFIG_IS_ENABLED(X86_64) 
 +        arch_setup_gd(new_gd); 
 +#endif
  
-        return 0; +#ifdef CONFIG_NEEDS_MANUAL_RELOC 
-+        int i;
- +
-void enable_interrupts (void) +
-{ +
-        ​return; +
-+
-int disable_interrupts (void) +
-+
-        return 0; +
-+
-</​code>​ +
- +
-==== initr_ethaddr() [C] ==== +
- +
-<​code>​ +
-#ifdef CONFIG_CMD_NET +
-        initr_ethaddr,​+
 #endif #endif
-</​code>​ 
- 
-<​code>​ 
-#ifdef CONFIG_CMD_NET 
-static int initr_ethaddr(void) 
-{ 
-        bd_t *bd = gd->bd; 
  
-        /* kept around for legacy kernels only ... ignore the next section */ +#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64
-        eth_env_get_enetaddr("​ethaddr",​ bd->​bi_enetaddr)+        ​gd = new_gd;
-#ifdef CONFIG_HAS_ETH1 +
-        ​eth_env_get_enetaddr("​eth1addr",​ bd->​bi_enet1addr);+
 #endif #endif
-#ifdef CONFIG_HAS_ETH2 +        gd->flags &= ~GD_FLG_LOG_READY;
-        eth_env_get_enetaddr("​eth2addr",​ bd->bi_enet2addr); +
-#endif +
-#ifdef CONFIG_HAS_ETH3 +
-        eth_env_get_enetaddr("​eth3addr",​ bd->​bi_enet3addr);​ +
-#endif +
-#ifdef CONFIG_HAS_ETH4 +
-        eth_env_get_enetaddr("​eth4addr",​ bd->​bi_enet4addr);​ +
-#endif +
-#ifdef CONFIG_HAS_ETH5 +
-        eth_env_get_enetaddr("​eth5addr",​ bd->​bi_enet5addr);​ +
-#endif +
-        return 0; +
-+
-#endif /* CONFIG_CMD_NET */ +
-</​code>​+
  
-==== board_late_init() [B] ==== +#ifdef CONFIG_NEEDS_MANUAL_RELOC 
- +        for (i 0; i < ARRAY_SIZE(init_sequence_r); i++) 
-(Defined in board/​xilinx/​zynq/​board.c.) +                init_sequence_r[i+gd->reloc_off;
- +
-<code> +
-#ifdef CONFIG_BOARD_LATE_INIT +
-        board_late_init,​+
 #endif #endif
-</​code>​ 
  
-==== initr_net() ====+        if (initcall_run_list(init_sequence_r)) 
 +                hang();
  
-<​code>​ +        /* NOTREACHED - run_main_loop() does not return */ 
-#ifdef CONFIG_CMD_NET +        ​hang();
-static int initr_net(void) +
-{ +
-        ​puts("​Net: ​  "​); +
-        eth_initialize();​ +
-#if defined(CONFIG_RESET_PHY_R) +
-        debug("​Reset Ethernet PHY\n"​);​ +
-        reset_phy();​ +
-#endif +
-        return 0; +
-+
-#endif+
 </​code>​ </​code>​
- 
u-boot_boot_sequence.1577469229.txt.gz · Last modified: 2019/12/27 17:53 by rpjday