init.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000-2009
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. *
  6. * Copy the startup prototype, previously defined in common.h
  7. * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
  8. */
  9. #ifndef __INIT_H_
  10. #define __INIT_H_ 1
  11. #ifndef __ASSEMBLY__ /* put C only stuff in this section */
  12. /*
  13. * Function Prototypes
  14. */
  15. /* common/board_f.c */
  16. void board_init_f(ulong dummy);
  17. /**
  18. * arch_cpu_init() - basic cpu-dependent setup for an architecture
  19. *
  20. * This is called after early malloc is available. It should handle any
  21. * CPU- or SoC- specific init needed to continue the init sequence. See
  22. * board_f.c for where it is called. If this is not provided, a default
  23. * version (which does nothing) will be used.
  24. *
  25. * Return: 0 on success, otherwise error
  26. */
  27. int arch_cpu_init(void);
  28. /**
  29. * arch_cpu_init_dm() - init CPU after driver model is available
  30. *
  31. * This is called immediately after driver model is available before
  32. * relocation. This is similar to arch_cpu_init() but is able to reference
  33. * devices
  34. *
  35. * Return: 0 if OK, -ve on error
  36. */
  37. int arch_cpu_init_dm(void);
  38. /**
  39. * mach_cpu_init() - SoC/machine dependent CPU setup
  40. *
  41. * This is called after arch_cpu_init(). It should handle any
  42. * SoC or machine specific init needed to continue the init sequence. See
  43. * board_f.c for where it is called. If this is not provided, a default
  44. * version (which does nothing) will be used.
  45. *
  46. * Return: 0 on success, otherwise error
  47. */
  48. int mach_cpu_init(void);
  49. /**
  50. * arch_fsp_init() - perform firmware support package init
  51. *
  52. * Where U-Boot relies on binary blobs to handle part of the system init, this
  53. * function can be used to set up the blobs. This is used on some Intel
  54. * platforms.
  55. *
  56. * Return: 0
  57. */
  58. int arch_fsp_init(void);
  59. int dram_init(void);
  60. /**
  61. * dram_init_banksize() - Set up DRAM bank sizes
  62. *
  63. * This can be implemented by boards to set up the DRAM bank information in
  64. * gd->bd->bi_dram(). It is called just before relocation, after dram_init()
  65. * is called.
  66. *
  67. * If this is not provided, a default implementation will try to set up a
  68. * single bank. It will do this if CONFIG_NR_DRAM_BANKS and
  69. * CONFIG_SYS_SDRAM_BASE are set. The bank will have a start address of
  70. * CONFIG_SYS_SDRAM_BASE and the size will be determined by a call to
  71. * get_effective_memsize().
  72. *
  73. * Return: 0 if OK, -ve on error
  74. */
  75. int dram_init_banksize(void);
  76. /**
  77. * arch_reserve_stacks() - Reserve all necessary stacks
  78. *
  79. * This is used in generic board init sequence in common/board_f.c. Each
  80. * architecture could provide this function to tailor the required stacks.
  81. *
  82. * On entry gd->start_addr_sp is pointing to the suggested top of the stack.
  83. * The callee ensures gd->start_add_sp is 16-byte aligned, so architectures
  84. * require only this can leave it untouched.
  85. *
  86. * On exit gd->start_addr_sp and gd->irq_sp should be set to the respective
  87. * positions of the stack. The stack pointer(s) will be set to this later.
  88. * gd->irq_sp is only required, if the architecture needs it.
  89. *
  90. * Return: 0 if no error
  91. */
  92. int arch_reserve_stacks(void);
  93. /**
  94. * init_cache_f_r() - Turn on the cache in preparation for relocation
  95. *
  96. * Return: 0 if OK, -ve on error
  97. */
  98. int init_cache_f_r(void);
  99. #if !CONFIG_IS_ENABLED(CPU)
  100. /**
  101. * print_cpuinfo() - Display information about the CPU
  102. *
  103. * Return: 0 if OK, -ve on error
  104. */
  105. int print_cpuinfo(void);
  106. #endif
  107. int timer_init(void);
  108. int reserve_mmu(void);
  109. int misc_init_f(void);
  110. #if defined(CONFIG_DTB_RESELECT)
  111. int embedded_dtb_select(void);
  112. #endif
  113. /* common/init/board_init.c */
  114. extern ulong monitor_flash_len;
  115. /**
  116. * ulong board_init_f_alloc_reserve - allocate reserved area
  117. * @top: top of the reserve area, growing down.
  118. *
  119. * This function is called by each architecture very early in the start-up
  120. * code to allow the C runtime to reserve space on the stack for writable
  121. * 'globals' such as GD and the malloc arena.
  122. *
  123. * Return: bottom of reserved area
  124. */
  125. ulong board_init_f_alloc_reserve(ulong top);
  126. /**
  127. * board_init_f_init_reserve - initialize the reserved area(s)
  128. * @base: top from which reservation was done
  129. *
  130. * This function is called once the C runtime has allocated the reserved
  131. * area on the stack. It must initialize the GD at the base of that area.
  132. */
  133. void board_init_f_init_reserve(ulong base);
  134. /**
  135. * arch_setup_gd() - Set up the global_data pointer
  136. * @gd_ptr: Pointer to global data
  137. *
  138. * This pointer is special in some architectures and cannot easily be assigned
  139. * to. For example on x86 it is implemented by adding a specific record to its
  140. * Global Descriptor Table! So we we provide a function to carry out this task.
  141. * For most architectures this can simply be:
  142. *
  143. * gd = gd_ptr;
  144. */
  145. void arch_setup_gd(gd_t *gd_ptr);
  146. /* common/board_r.c */
  147. void board_init_r(gd_t *id, ulong dest_addr) __attribute__ ((noreturn));
  148. int cpu_init_r(void);
  149. int last_stage_init(void);
  150. int mac_read_from_eeprom(void);
  151. int set_cpu_clk_info(void);
  152. int update_flash_size(int flash_size);
  153. int arch_early_init_r(void);
  154. void pci_init(void);
  155. int misc_init_r(void);
  156. #if defined(CONFIG_VID)
  157. int init_func_vid(void);
  158. #endif
  159. /* common/board_info.c */
  160. int checkboard(void);
  161. int show_board_info(void);
  162. #endif /* __ASSEMBLY__ */
  163. /* Put only stuff here that the assembler can digest */
  164. #endif /* __INIT_H_ */