Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 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 |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef __INIT_H_ |
| 11 | #define __INIT_H_ 1 |
| 12 | |
| 13 | #ifndef __ASSEMBLY__ /* put C only stuff in this section */ |
| 14 | |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 15 | #include <linux/types.h> |
| 16 | |
Simon Glass | 3f36974 | 2021-12-29 11:57:43 -0700 | [diff] [blame] | 17 | /* |
| 18 | * In case of the EFI app the UEFI firmware provides the low-level |
| 19 | * initialisation. |
| 20 | */ |
| 21 | #ifdef CONFIG_EFI |
Simon Glass | da25eff | 2019-12-28 10:44:56 -0700 | [diff] [blame] | 22 | #define ll_boot_init() false |
| 23 | #else |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 24 | #include <asm/global_data.h> |
| 25 | |
Simon Glass | 0b2f191 | 2020-04-26 09:12:57 -0600 | [diff] [blame] | 26 | #define ll_boot_init() (!(gd->flags & GD_FLG_SKIP_LL_INIT)) |
Simon Glass | da25eff | 2019-12-28 10:44:56 -0700 | [diff] [blame] | 27 | #endif |
| 28 | |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 29 | /* |
| 30 | * Function Prototypes |
| 31 | */ |
| 32 | |
| 33 | /* common/board_f.c */ |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 34 | void board_init_f(ulong dummy); |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * arch_cpu_init() - basic cpu-dependent setup for an architecture |
| 38 | * |
| 39 | * This is called after early malloc is available. It should handle any |
| 40 | * CPU- or SoC- specific init needed to continue the init sequence. See |
| 41 | * board_f.c for where it is called. If this is not provided, a default |
| 42 | * version (which does nothing) will be used. |
| 43 | * |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 44 | * Return: 0 on success, otherwise error |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 45 | */ |
| 46 | int arch_cpu_init(void); |
| 47 | |
| 48 | /** |
| 49 | * mach_cpu_init() - SoC/machine dependent CPU setup |
| 50 | * |
| 51 | * This is called after arch_cpu_init(). It should handle any |
| 52 | * SoC or machine specific init needed to continue the init sequence. See |
| 53 | * board_f.c for where it is called. If this is not provided, a default |
| 54 | * version (which does nothing) will be used. |
| 55 | * |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 56 | * Return: 0 on success, otherwise error |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 57 | */ |
| 58 | int mach_cpu_init(void); |
| 59 | |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 60 | /** |
Simon Glass | 564a4a0 | 2019-12-06 21:42:20 -0700 | [diff] [blame] | 61 | * arch_fsp_init() - perform post-relocation firmware support package init |
| 62 | * |
| 63 | * Where U-Boot relies on binary blobs to handle part of the system init, this |
| 64 | * function can be used to set up the blobs. This is used on some Intel |
| 65 | * platforms. |
| 66 | * |
| 67 | * Return: 0 |
| 68 | */ |
| 69 | int arch_fsp_init_r(void); |
| 70 | |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 71 | int dram_init(void); |
| 72 | |
| 73 | /** |
| 74 | * dram_init_banksize() - Set up DRAM bank sizes |
| 75 | * |
| 76 | * This can be implemented by boards to set up the DRAM bank information in |
| 77 | * gd->bd->bi_dram(). It is called just before relocation, after dram_init() |
| 78 | * is called. |
| 79 | * |
| 80 | * If this is not provided, a default implementation will try to set up a |
| 81 | * single bank. It will do this if CONFIG_NR_DRAM_BANKS and |
Tom Rini | bb4dd96 | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 82 | * CFG_SYS_SDRAM_BASE are set. The bank will have a start address of |
| 83 | * CFG_SYS_SDRAM_BASE and the size will be determined by a call to |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 84 | * get_effective_memsize(). |
| 85 | * |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 86 | * Return: 0 if OK, -ve on error |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 87 | */ |
| 88 | int dram_init_banksize(void); |
| 89 | |
Simon Glass | 8e16b1e | 2019-12-28 10:45:05 -0700 | [diff] [blame] | 90 | long get_ram_size(long *base, long size); |
| 91 | phys_size_t get_effective_memsize(void); |
| 92 | |
Simon Glass | 0ffd9db | 2019-12-28 10:45:06 -0700 | [diff] [blame] | 93 | int testdram(void); |
| 94 | |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 95 | /** |
Ovidiu Panait | bbce5f3 | 2022-09-13 21:31:28 +0300 | [diff] [blame] | 96 | * arch_setup_dest_addr() - Fix up initial reloc address |
| 97 | * |
| 98 | * This is called in generic board init sequence in common/board_f.c at the end |
| 99 | * of the setup_dest_addr() initcall. Each architecture could provide this |
| 100 | * function to make adjustments to the initial reloc address. |
| 101 | * |
| 102 | * If an implementation is not provided, it will just be a nop stub. |
| 103 | * |
| 104 | * Return: 0 if OK |
| 105 | */ |
| 106 | int arch_setup_dest_addr(void); |
| 107 | |
| 108 | /** |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 109 | * arch_reserve_stacks() - Reserve all necessary stacks |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 110 | * |
| 111 | * This is used in generic board init sequence in common/board_f.c. Each |
| 112 | * architecture could provide this function to tailor the required stacks. |
| 113 | * |
| 114 | * On entry gd->start_addr_sp is pointing to the suggested top of the stack. |
| 115 | * The callee ensures gd->start_add_sp is 16-byte aligned, so architectures |
| 116 | * require only this can leave it untouched. |
| 117 | * |
| 118 | * On exit gd->start_addr_sp and gd->irq_sp should be set to the respective |
| 119 | * positions of the stack. The stack pointer(s) will be set to this later. |
| 120 | * gd->irq_sp is only required, if the architecture needs it. |
| 121 | * |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 122 | * Return: 0 if no error |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 123 | */ |
| 124 | int arch_reserve_stacks(void); |
| 125 | |
Patrick Delaunay | 18c5064 | 2018-03-13 13:57:04 +0100 | [diff] [blame] | 126 | /** |
Ovidiu Panait | 2a2941b | 2020-03-29 20:57:41 +0300 | [diff] [blame] | 127 | * arch_reserve_mmu() - Reserve memory for MMU TLB table |
| 128 | * |
| 129 | * Architecture-specific routine for reserving memory for the MMU TLB table. |
| 130 | * This is used in generic board init sequence in common/board_f.c. |
| 131 | * |
| 132 | * If an implementation is not provided, it will just be a nop stub. |
| 133 | * |
| 134 | * Return: 0 if OK |
| 135 | */ |
| 136 | int arch_reserve_mmu(void); |
| 137 | |
| 138 | /** |
Ovidiu Panait | 3d0b040 | 2020-07-24 14:12:15 +0300 | [diff] [blame] | 139 | * arch_setup_bdinfo() - Architecture dependent boardinfo setup |
| 140 | * |
| 141 | * Architecture-specific routine for populating various boardinfo fields of |
| 142 | * gd->bd. It is called during the generic board init sequence. |
| 143 | * |
| 144 | * If an implementation is not provided, it will just be a nop stub. |
| 145 | * |
| 146 | * Return: 0 if OK |
| 147 | */ |
| 148 | int arch_setup_bdinfo(void); |
| 149 | |
| 150 | /** |
Ovidiu Panait | 0c5e9a0 | 2020-07-24 14:12:14 +0300 | [diff] [blame] | 151 | * setup_bdinfo() - Generic boardinfo setup |
| 152 | * |
| 153 | * Routine for populating various generic boardinfo fields of |
| 154 | * gd->bd. It is called during the generic board init sequence. |
| 155 | * |
| 156 | * Return: 0 if OK |
| 157 | */ |
| 158 | int setup_bdinfo(void); |
| 159 | |
Dzmitry Sankouski | a346306 | 2022-02-22 21:49:52 +0300 | [diff] [blame] | 160 | #if defined(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR) || \ |
| 161 | defined(CONFIG_SAVE_PREV_BL_FDT_ADDR) |
| 162 | /** |
| 163 | * save_prev_bl_data - Save prev bl data in env vars. |
| 164 | * |
| 165 | * When u-boot is chain-loaded, save previous bootloader data, |
| 166 | * like initramfs address to environment variables. |
| 167 | * |
| 168 | * Return: 0 if ok; -ENODATA on error |
| 169 | */ |
| 170 | int save_prev_bl_data(void); |
| 171 | #endif |
| 172 | |
Ovidiu Panait | 0c5e9a0 | 2020-07-24 14:12:14 +0300 | [diff] [blame] | 173 | /** |
Ovidiu Panait | c14c0f9 | 2020-11-28 10:43:09 +0200 | [diff] [blame] | 174 | * cpu_secondary_init_r() - CPU-specific secondary initialization |
| 175 | * |
| 176 | * After non-volatile devices, environment and cpu code are setup, have |
| 177 | * another round to deal with any initialization that might require |
| 178 | * full access to the environment or loading of some image (firmware) |
| 179 | * from a non-volatile device. |
| 180 | * |
| 181 | * It is called during the generic post-relocation init sequence. |
| 182 | * |
| 183 | * Return: 0 if OK |
| 184 | */ |
| 185 | int cpu_secondary_init_r(void); |
| 186 | |
| 187 | /** |
Ovidiu Panait | a45c6e1 | 2020-11-28 10:43:11 +0200 | [diff] [blame] | 188 | * pci_ep_init() - Initialize pci endpoint devices |
| 189 | * |
| 190 | * It is called during the generic post-relocation init sequence. |
| 191 | * |
| 192 | * Return: 0 if OK |
| 193 | */ |
| 194 | int pci_ep_init(void); |
| 195 | |
| 196 | /** |
Ovidiu Panait | e353edb | 2020-11-28 10:43:12 +0200 | [diff] [blame] | 197 | * pci_init() - Enumerate pci devices |
| 198 | * |
| 199 | * It is called during the generic post-relocation init sequence to enumerate |
| 200 | * pci buses. This is needed, for instance, in the case of DM PCI-based |
| 201 | * Ethernet devices, which will not be detected without having the enumeration |
| 202 | * performed earlier. |
| 203 | * |
| 204 | * Return: 0 if OK |
| 205 | */ |
| 206 | int pci_init(void); |
| 207 | |
| 208 | /** |
Patrick Delaunay | 18c5064 | 2018-03-13 13:57:04 +0100 | [diff] [blame] | 209 | * init_cache_f_r() - Turn on the cache in preparation for relocation |
| 210 | * |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 211 | * Return: 0 if OK, -ve on error |
Patrick Delaunay | 18c5064 | 2018-03-13 13:57:04 +0100 | [diff] [blame] | 212 | */ |
| 213 | int init_cache_f_r(void); |
| 214 | |
Mario Six | 97bbb60 | 2018-08-06 10:23:41 +0200 | [diff] [blame] | 215 | #if !CONFIG_IS_ENABLED(CPU) |
| 216 | /** |
| 217 | * print_cpuinfo() - Display information about the CPU |
| 218 | * |
| 219 | * Return: 0 if OK, -ve on error |
| 220 | */ |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 221 | int print_cpuinfo(void); |
Mario Six | 97bbb60 | 2018-08-06 10:23:41 +0200 | [diff] [blame] | 222 | #endif |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 223 | int timer_init(void); |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 224 | |
Patrick Delaunay | a0a2b21 | 2018-03-13 13:57:00 +0100 | [diff] [blame] | 225 | #if defined(CONFIG_DTB_RESELECT) |
| 226 | int embedded_dtb_select(void); |
| 227 | #endif |
| 228 | |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 229 | /* common/init/board_init.c */ |
| 230 | extern ulong monitor_flash_len; |
| 231 | |
| 232 | /** |
| 233 | * ulong board_init_f_alloc_reserve - allocate reserved area |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 234 | * @top: top of the reserve area, growing down. |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 235 | * |
| 236 | * This function is called by each architecture very early in the start-up |
| 237 | * code to allow the C runtime to reserve space on the stack for writable |
| 238 | * 'globals' such as GD and the malloc arena. |
| 239 | * |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 240 | * Return: bottom of reserved area |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 241 | */ |
| 242 | ulong board_init_f_alloc_reserve(ulong top); |
| 243 | |
| 244 | /** |
| 245 | * board_init_f_init_reserve - initialize the reserved area(s) |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 246 | * @base: top from which reservation was done |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 247 | * |
| 248 | * This function is called once the C runtime has allocated the reserved |
| 249 | * area on the stack. It must initialize the GD at the base of that area. |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 250 | */ |
| 251 | void board_init_f_init_reserve(ulong base); |
| 252 | |
Simon Glass | 6980b6b | 2019-11-14 12:57:45 -0700 | [diff] [blame] | 253 | struct global_data; |
| 254 | |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 255 | /** |
| 256 | * arch_setup_gd() - Set up the global_data pointer |
Mario Six | 86c45a4 | 2018-08-06 10:23:40 +0200 | [diff] [blame] | 257 | * @gd_ptr: Pointer to global data |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 258 | * |
| 259 | * This pointer is special in some architectures and cannot easily be assigned |
| 260 | * to. For example on x86 it is implemented by adding a specific record to its |
| 261 | * Global Descriptor Table! So we we provide a function to carry out this task. |
| 262 | * For most architectures this can simply be: |
| 263 | * |
| 264 | * gd = gd_ptr; |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 265 | */ |
Simon Glass | 6980b6b | 2019-11-14 12:57:45 -0700 | [diff] [blame] | 266 | void arch_setup_gd(struct global_data *gd_ptr); |
Patrick Delaunay | 98c8bbc | 2018-03-13 13:57:01 +0100 | [diff] [blame] | 267 | |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 268 | /* common/board_r.c */ |
Simon Glass | 6980b6b | 2019-11-14 12:57:45 -0700 | [diff] [blame] | 269 | void board_init_r(struct global_data *id, ulong dest_addr) |
| 270 | __attribute__ ((noreturn)); |
Patrick Delaunay | b76e7cf | 2018-03-13 13:57:02 +0100 | [diff] [blame] | 271 | |
| 272 | int cpu_init_r(void); |
Patrick Delaunay | b76e7cf | 2018-03-13 13:57:02 +0100 | [diff] [blame] | 273 | int mac_read_from_eeprom(void); |
Artur Rojek | 06a1e2a | 2023-10-18 16:00:56 +0200 | [diff] [blame] | 274 | |
| 275 | /** |
| 276 | * serial_read_from_eeprom - read the serial number from EEPROM |
| 277 | * |
| 278 | * This function reads the serial number from the EEPROM and sets the |
| 279 | * appropriate environment variable. |
| 280 | * |
| 281 | * The environment variable is only set if it has not been set |
| 282 | * already. This ensures that any user-saved variables are never |
| 283 | * overwritten. |
| 284 | * |
| 285 | * This function must be called after relocation. |
| 286 | */ |
| 287 | int serial_read_from_eeprom(int devnum); |
Patrick Delaunay | b76e7cf | 2018-03-13 13:57:02 +0100 | [diff] [blame] | 288 | int set_cpu_clk_info(void); |
| 289 | int update_flash_size(int flash_size); |
| 290 | int arch_early_init_r(void); |
Patrick Delaunay | b76e7cf | 2018-03-13 13:57:02 +0100 | [diff] [blame] | 291 | int misc_init_r(void); |
Patrick Delaunay | b76e7cf | 2018-03-13 13:57:02 +0100 | [diff] [blame] | 292 | |
Patrick Delaunay | b1d2344 | 2018-03-13 13:57:03 +0100 | [diff] [blame] | 293 | /* common/board_info.c */ |
| 294 | int checkboard(void); |
Simon Glass | bbd9f35 | 2023-11-12 19:58:21 -0700 | [diff] [blame] | 295 | |
| 296 | /** |
| 297 | * show_board_info() - Show board information |
| 298 | * |
| 299 | * Check sysinfo for board information. Failing that if the root node of the DTB |
| 300 | * has a "model" property, show it. |
| 301 | * |
| 302 | * Then call checkboard(). |
| 303 | * |
| 304 | * Return 0 if OK, -ve on error |
| 305 | */ |
Patrick Delaunay | b1d2344 | 2018-03-13 13:57:03 +0100 | [diff] [blame] | 306 | int show_board_info(void); |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 307 | |
Simon Glass | 6980b6b | 2019-11-14 12:57:45 -0700 | [diff] [blame] | 308 | /** |
Heinrich Schuchardt | aaafaea | 2023-08-14 08:44:26 +0200 | [diff] [blame] | 309 | * board_get_usable_ram_top() - get uppermost address for U-Boot relocation |
Simon Glass | 6980b6b | 2019-11-14 12:57:45 -0700 | [diff] [blame] | 310 | * |
Heinrich Schuchardt | aaafaea | 2023-08-14 08:44:26 +0200 | [diff] [blame] | 311 | * Some systems have reserved memory areas in high memory. By implementing this |
| 312 | * function boards can indicate the highest address value to be used when |
| 313 | * relocating U-Boot. The returned address is exclusive (i.e. 1 byte above the |
| 314 | * last usable address). |
| 315 | * |
| 316 | * Due to overflow on systems with 32bit phys_addr_t a value 0 is used instead |
| 317 | * of 4GiB. |
Simon Glass | 6980b6b | 2019-11-14 12:57:45 -0700 | [diff] [blame] | 318 | * |
Heinrich Schuchardt | aaafaea | 2023-08-14 08:44:26 +0200 | [diff] [blame] | 319 | * @total_size: monitor length in bytes (size of U-Boot code) |
| 320 | * Return: uppermost address for U-Boot relocation |
Simon Glass | 6980b6b | 2019-11-14 12:57:45 -0700 | [diff] [blame] | 321 | */ |
Heinrich Schuchardt | 51a9aac | 2023-08-12 20:16:58 +0200 | [diff] [blame] | 322 | phys_addr_t board_get_usable_ram_top(phys_size_t total_size); |
Simon Glass | 6980b6b | 2019-11-14 12:57:45 -0700 | [diff] [blame] | 323 | |
Simon Glass | a7b5130 | 2019-11-14 12:57:46 -0700 | [diff] [blame] | 324 | int board_early_init_f(void); |
| 325 | |
| 326 | /* manipulate the U-Boot fdt before its relocation */ |
| 327 | int board_fix_fdt(void *rw_fdt_blob); |
| 328 | int board_late_init(void); |
| 329 | int board_postclk_init(void); /* after clocks/timebase, before env/serial */ |
| 330 | int board_early_init_r(void); |
| 331 | |
Ovidiu Panait | 2c82391 | 2020-11-28 10:43:18 +0200 | [diff] [blame] | 332 | /** |
| 333 | * arch_initr_trap() - Init traps |
| 334 | * |
| 335 | * Arch specific routine for initializing traps. It is called during the |
| 336 | * generic board init sequence, after relocation. |
| 337 | * |
| 338 | * Return: 0 if OK |
| 339 | */ |
| 340 | int arch_initr_trap(void); |
Simon Glass | 537ecc9 | 2019-11-14 12:57:48 -0700 | [diff] [blame] | 341 | |
Simon Glass | a5037e2 | 2019-12-28 10:44:39 -0700 | [diff] [blame] | 342 | /** |
Ovidiu Panait | 7dbb021 | 2022-01-01 19:13:29 +0200 | [diff] [blame] | 343 | * init_addr_map() |
| 344 | * |
| 345 | * Initialize non-identity virtual-physical memory mappings for 32bit CPUs. |
| 346 | * It is called during the generic board init sequence, after relocation. |
| 347 | * |
| 348 | * Return: 0 if OK |
| 349 | */ |
| 350 | int init_addr_map(void); |
| 351 | |
| 352 | /** |
Simon Glass | a5037e2 | 2019-12-28 10:44:39 -0700 | [diff] [blame] | 353 | * main_loop() - Enter the main loop of U-Boot |
| 354 | * |
| 355 | * This normally runs the command line. |
| 356 | */ |
| 357 | void main_loop(void); |
| 358 | |
Simon Glass | 284f71b | 2019-12-28 10:44:45 -0700 | [diff] [blame] | 359 | #if defined(CONFIG_ARM) |
| 360 | void relocate_code(ulong addr_moni); |
| 361 | #else |
| 362 | void relocate_code(ulong start_addr_sp, struct global_data *new_gd, |
| 363 | ulong relocaddr) |
| 364 | __attribute__ ((noreturn)); |
| 365 | #endif |
| 366 | |
Simon Glass | 7e24663 | 2020-05-10 14:16:55 -0600 | [diff] [blame] | 367 | /* Print a numeric value (for use in arch_print_bdinfo()) */ |
Bin Meng | 1ae7a0c | 2021-01-31 20:36:05 +0800 | [diff] [blame] | 368 | void bdinfo_print_num_l(const char *name, ulong value); |
| 369 | void bdinfo_print_num_ll(const char *name, unsigned long long value); |
Simon Glass | 7e24663 | 2020-05-10 14:16:55 -0600 | [diff] [blame] | 370 | |
Simon Glass | 3a12725 | 2023-03-10 12:47:14 -0800 | [diff] [blame] | 371 | /* Print a string value (for use in arch_print_bdinfo()) */ |
| 372 | void bdinfo_print_str(const char *name, const char *str); |
| 373 | |
Simon Glass | 7e24663 | 2020-05-10 14:16:55 -0600 | [diff] [blame] | 374 | /* Print a clock speed in MHz */ |
| 375 | void bdinfo_print_mhz(const char *name, unsigned long hz); |
| 376 | |
Ovidiu Panait | 608c11e | 2022-08-29 20:02:04 +0300 | [diff] [blame] | 377 | /** |
| 378 | * bdinfo_print_size - print size variables in bdinfo format |
| 379 | * @name: string to print before the size |
| 380 | * @size: size to print |
| 381 | * |
| 382 | * Helper function for displaying size variables as properly formatted bdinfo |
| 383 | * entries. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB", |
| 384 | * "xxx GiB", etc. as needed; |
| 385 | * |
| 386 | * For use in arch_print_bdinfo(). |
| 387 | */ |
| 388 | void bdinfo_print_size(const char *name, uint64_t size); |
| 389 | |
Simon Glass | a83ab16 | 2020-05-10 14:16:56 -0600 | [diff] [blame] | 390 | /* Show arch-specific information for the 'bd' command */ |
| 391 | void arch_print_bdinfo(void); |
| 392 | |
Andy Shevchenko | e3b3ad9 | 2021-11-08 21:03:38 +0300 | [diff] [blame] | 393 | int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); |
| 394 | |
Patrick Delaunay | c6bfcd5 | 2018-03-09 18:28:12 +0100 | [diff] [blame] | 395 | #endif /* __ASSEMBLY__ */ |
| 396 | /* Put only stuff here that the assembler can digest */ |
| 397 | |
| 398 | #endif /* __INIT_H_ */ |