1 // SPDX-License-Identifier: GPL-2.0+
4 * Texas Instruments, <www.ti.com>
6 * Aneesh V <aneesh@ti.com>
11 #include <binman_sym.h>
16 #include <asm/u-boot.h>
19 #include <u-boot/crc.h>
25 #include <linux/compiler.h>
26 #include <fdt_support.h>
27 #include <bootcount.h>
30 DECLARE_GLOBAL_DATA_PTR;
32 #ifndef CONFIG_SYS_UBOOT_START
33 #define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE
35 #ifndef CONFIG_SYS_MONITOR_LEN
36 /* Unknown U-Boot size, let's assume it will not be more than 200 KB */
37 #define CONFIG_SYS_MONITOR_LEN (200 * 1024)
40 u32 *boot_params_ptr = NULL;
42 /* See spl.h for information about this */
43 binman_sym_declare(ulong, u_boot_any, image_pos);
45 /* Define board data structure */
46 static bd_t bdata __attribute__ ((section(".data")));
49 * Board-specific Platform code can reimplement show_boot_progress () if needed
51 __weak void show_boot_progress(int val) {}
53 #if defined(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF)
54 /* weak, default platform-specific function to initialize dram banks */
55 __weak int dram_init_banksize(void)
62 * Default function to determine if u-boot or the OS should
63 * be started. This implementation always returns 1.
65 * Please implement your own board specific funcion to do this.
68 * 0 to not start u-boot
69 * positive if u-boot should start
71 #ifdef CONFIG_SPL_OS_BOOT
72 __weak int spl_start_uboot(void)
75 "Please implement spl_start_uboot() for your board\n");
76 puts(SPL_TPL_PROMPT "Direct Linux boot not active!\n");
81 * Weak default function for arch specific zImage check. Return zero
82 * and fill start and end address if image is recognized.
84 int __weak bootz_setup(ulong image, ulong *start, ulong *end)
90 /* Weak default function for arch/board-specific fixups to the spl_image_info */
91 void __weak spl_perform_fixups(struct spl_image_info *spl_image)
95 void spl_fixup_fdt(void)
97 #if defined(CONFIG_SPL_OF_LIBFDT) && defined(CONFIG_SYS_SPL_ARGS_ADDR)
98 void *fdt_blob = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
101 err = fdt_check_header(fdt_blob);
103 printf("fdt_root: %s\n", fdt_strerror(err));
107 /* fixup the memory dt node */
108 err = fdt_shrink_to_minimum(fdt_blob, 0);
110 printf(SPL_TPL_PROMPT "fdt_shrink_to_minimum err - %d\n", err);
114 err = arch_fixup_fdt(fdt_blob);
116 printf(SPL_TPL_PROMPT "arch_fixup_fdt err - %d\n", err);
123 * Weak default function for board specific cleanup/preparation before
124 * Linux boot. Some boards/platforms might not need it, so just provide
125 * an empty stub here.
127 __weak void spl_board_prepare_for_linux(void)
132 __weak void spl_board_prepare_for_boot(void)
137 __weak struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
139 return (struct image_header *)(CONFIG_SYS_TEXT_BASE + offset);
142 void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
144 ulong u_boot_pos = binman_sym(ulong, u_boot_any, image_pos);
146 spl_image->size = CONFIG_SYS_MONITOR_LEN;
149 * Binman error cases: address of the end of the previous region or the
150 * start of the image's entry area (usually 0) if there is no previous
153 if (u_boot_pos && u_boot_pos != BINMAN_SYM_MISSING) {
154 /* Binman does not support separated entry addresses */
155 spl_image->entry_point = u_boot_pos;
156 spl_image->load_addr = u_boot_pos;
158 spl_image->entry_point = CONFIG_SYS_UBOOT_START;
159 spl_image->load_addr = CONFIG_SYS_TEXT_BASE;
161 spl_image->os = IH_OS_U_BOOT;
162 spl_image->name = "U-Boot";
165 #ifdef CONFIG_SPL_LOAD_FIT_FULL
166 /* Parse and load full fitImage in SPL */
167 static int spl_load_fit_image(struct spl_image_info *spl_image,
168 const struct image_header *header)
170 bootm_headers_t images;
171 const char *fit_uname_config = NULL;
172 const char *fit_uname_fdt = FIT_FDT_PROP;
174 ulong fw_data = 0, dt_data = 0, img_data = 0;
175 ulong fw_len = 0, dt_len = 0, img_len = 0;
176 int idx, conf_noffset;
179 #ifdef CONFIG_SPL_FIT_SIGNATURE
182 ret = fit_image_load(&images, (ulong)header,
183 NULL, &fit_uname_config,
184 IH_ARCH_DEFAULT, IH_TYPE_STANDALONE, -1,
185 FIT_LOAD_REQUIRED, &fw_data, &fw_len);
189 spl_image->size = fw_len;
190 spl_image->entry_point = fw_data;
191 spl_image->load_addr = fw_data;
192 spl_image->os = IH_OS_U_BOOT;
193 spl_image->name = "U-Boot";
195 debug(SPL_TPL_PROMPT "payload image: %32s load addr: 0x%lx size: %d\n",
196 spl_image->name, spl_image->load_addr, spl_image->size);
198 #ifdef CONFIG_SPL_FIT_SIGNATURE
201 ret = fit_image_load(&images, (ulong)header,
202 &fit_uname_fdt, &fit_uname_config,
203 IH_ARCH_DEFAULT, IH_TYPE_FLATDT, -1,
204 FIT_LOAD_OPTIONAL, &dt_data, &dt_len);
206 spl_image->fdt_addr = (void *)dt_data;
208 conf_noffset = fit_conf_get_node((const void *)header,
210 if (conf_noffset <= 0)
214 uname = fdt_stringlist_get((const void *)header, conf_noffset,
215 FIT_LOADABLE_PROP, idx,
219 #ifdef CONFIG_SPL_FIT_SIGNATURE
222 ret = fit_image_load(&images, (ulong)header,
223 &uname, &fit_uname_config,
224 IH_ARCH_DEFAULT, IH_TYPE_LOADABLE, -1,
225 FIT_LOAD_OPTIONAL_NON_ZERO,
226 &img_data, &img_len);
235 int spl_parse_image_header(struct spl_image_info *spl_image,
236 const struct image_header *header)
238 #ifdef CONFIG_SPL_LOAD_FIT_FULL
239 int ret = spl_load_fit_image(spl_image, header);
244 if (image_get_magic(header) == IH_MAGIC) {
245 #ifdef CONFIG_SPL_LEGACY_IMAGE_SUPPORT
246 u32 header_size = sizeof(struct image_header);
248 #ifdef CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK
249 /* check uImage header CRC */
250 if (!image_check_hcrc(header)) {
251 puts("SPL: Image header CRC check failed!\n");
256 if (spl_image->flags & SPL_COPY_PAYLOAD_ONLY) {
258 * On some system (e.g. powerpc), the load-address and
259 * entry-point is located at address 0. We can't load
260 * to 0-0x40. So skip header in this case.
262 spl_image->load_addr = image_get_load(header);
263 spl_image->entry_point = image_get_ep(header);
264 spl_image->size = image_get_data_size(header);
266 spl_image->entry_point = image_get_load(header);
267 /* Load including the header */
268 spl_image->load_addr = spl_image->entry_point -
270 spl_image->size = image_get_data_size(header) +
273 #ifdef CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK
274 /* store uImage data length and CRC to check later */
275 spl_image->dcrc_data = image_get_load(header);
276 spl_image->dcrc_length = image_get_data_size(header);
277 spl_image->dcrc = image_get_dcrc(header);
280 spl_image->os = image_get_os(header);
281 spl_image->name = image_get_name(header);
283 "payload image: %32s load addr: 0x%lx size: %d\n",
284 spl_image->name, spl_image->load_addr, spl_image->size);
286 /* LEGACY image not supported */
287 debug("Legacy boot image support not enabled, proceeding to other boot methods\n");
291 #ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE
293 * CONFIG_SPL_PANIC_ON_RAW_IMAGE is defined when the
294 * code which loads images in SPL cannot guarantee that
295 * absolutely all read errors will be reported.
296 * An example is the LPC32XX MLC NAND driver, which
297 * will consider that a completely unreadable NAND block
298 * is bad, and thus should be skipped silently.
300 panic("** no mkimage signature but raw image not supported");
303 #ifdef CONFIG_SPL_OS_BOOT
306 if (!bootz_setup((ulong)header, &start, &end)) {
307 spl_image->name = "Linux";
308 spl_image->os = IH_OS_LINUX;
309 spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
310 spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
311 spl_image->size = end - start;
313 "payload zImage, load addr: 0x%lx size: %d\n",
314 spl_image->load_addr, spl_image->size);
319 #ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT
320 /* Signature not found - assume u-boot.bin */
321 debug("mkimage signature not found - ih_magic = %x\n",
323 spl_set_header_raw_uboot(spl_image);
325 /* RAW image not supported, proceed to other boot methods. */
326 debug("Raw boot image support not enabled, proceeding to other boot methods\n");
334 __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
336 typedef void __noreturn (*image_entry_noargs_t)(void);
338 image_entry_noargs_t image_entry =
339 (image_entry_noargs_t)spl_image->entry_point;
341 debug("image entry point: 0x%lx\n", spl_image->entry_point);
345 #if CONFIG_IS_ENABLED(HANDOFF)
347 * Set up the SPL hand-off information
349 * This is initially empty (zero) but can be written by
351 static int setup_spl_handoff(void)
353 struct spl_handoff *ho;
355 ho = bloblist_ensure(BLOBLISTT_SPL_HANDOFF, sizeof(struct spl_handoff));
362 __weak int handoff_arch_save(struct spl_handoff *ho)
367 static int write_spl_handoff(void)
369 struct spl_handoff *ho;
372 ho = bloblist_find(BLOBLISTT_SPL_HANDOFF, sizeof(struct spl_handoff));
375 handoff_save_dram(ho);
376 ret = handoff_arch_save(ho);
379 debug(SPL_TPL_PROMPT "Wrote SPL handoff\n");
384 static inline int setup_spl_handoff(void) { return 0; }
385 static inline int write_spl_handoff(void) { return 0; }
389 static int spl_common_init(bool setup_malloc)
393 #if CONFIG_VAL(SYS_MALLOC_F_LEN)
395 #ifdef CONFIG_MALLOC_F_ADDR
396 gd->malloc_base = CONFIG_MALLOC_F_ADDR;
398 gd->malloc_limit = CONFIG_VAL(SYS_MALLOC_F_LEN);
402 ret = bootstage_init(u_boot_first_phase());
404 debug("%s: Failed to set up bootstage: ret=%d\n", __func__,
408 #ifdef CONFIG_BOOTSTAGE_STASH
409 if (!u_boot_first_phase()) {
410 const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR,
411 CONFIG_BOOTSTAGE_STASH_SIZE);
413 ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE);
415 debug("%s: Failed to unstash bootstage: ret=%d\n",
418 #endif /* CONFIG_BOOTSTAGE_STASH */
419 bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_START_TPL :
420 BOOTSTAGE_ID_START_SPL, SPL_TPL_NAME);
421 #if CONFIG_IS_ENABLED(LOG)
424 debug("%s: Failed to set up logging\n", __func__);
428 if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
429 ret = fdtdec_setup();
431 debug("fdtdec_setup() returned error %d\n", ret);
435 if (CONFIG_IS_ENABLED(DM)) {
436 bootstage_start(BOOTSTATE_ID_ACCUM_DM_SPL,
437 spl_phase() == PHASE_TPL ? "dm tpl" : "dm_spl");
438 /* With CONFIG_SPL_OF_PLATDATA, bring in all devices */
439 ret = dm_init_and_scan(!CONFIG_IS_ENABLED(OF_PLATDATA));
440 bootstage_accum(BOOTSTATE_ID_ACCUM_DM_SPL);
442 debug("dm_init_and_scan() returned error %d\n", ret);
450 void spl_set_bd(void)
453 * NOTE: On some platforms (e.g. x86) bdata may be in flash and not
460 int spl_early_init(void)
464 debug("%s\n", __func__);
466 ret = spl_common_init(true);
469 gd->flags |= GD_FLG_SPL_EARLY_INIT;
477 bool setup_malloc = !(IS_ENABLED(CONFIG_SPL_STACK_R) &&
478 IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIMPLE));
480 debug("%s\n", __func__);
482 if (!(gd->flags & GD_FLG_SPL_EARLY_INIT)) {
483 ret = spl_common_init(setup_malloc);
487 gd->flags |= GD_FLG_SPL_INIT;
492 #ifndef BOOT_DEVICE_NONE
493 #define BOOT_DEVICE_NONE 0xdeadbeef
496 __weak void board_boot_order(u32 *spl_boot_list)
498 spl_boot_list[0] = spl_boot_device();
501 static struct spl_image_loader *spl_ll_find_loader(uint boot_device)
503 struct spl_image_loader *drv =
504 ll_entry_start(struct spl_image_loader, spl_image_loader);
506 ll_entry_count(struct spl_image_loader, spl_image_loader);
507 struct spl_image_loader *entry;
509 for (entry = drv; entry != drv + n_ents; entry++) {
510 if (boot_device == entry->boot_device)
518 static int spl_load_image(struct spl_image_info *spl_image,
519 struct spl_image_loader *loader)
522 struct spl_boot_device bootdev;
524 bootdev.boot_device = loader->boot_device;
525 bootdev.boot_device_name = NULL;
527 ret = loader->load_image(spl_image, &bootdev);
528 #ifdef CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK
529 if (!ret && spl_image->dcrc_length) {
531 ulong dcrc = crc32_wd(0, (unsigned char *)spl_image->dcrc_data,
532 spl_image->dcrc_length, CHUNKSZ_CRC32);
533 if (dcrc != spl_image->dcrc) {
534 puts("SPL: Image data CRC check failed!\n");
543 * boot_from_devices() - Try loading a booting U-Boot from a list of devices
545 * @spl_image: Place to put the image details if successful
546 * @spl_boot_list: List of boot devices to try
547 * @count: Number of elements in spl_boot_list
548 * @return 0 if OK, -ve on error
550 static int boot_from_devices(struct spl_image_info *spl_image,
551 u32 spl_boot_list[], int count)
555 for (i = 0; i < count && spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
556 struct spl_image_loader *loader;
558 loader = spl_ll_find_loader(spl_boot_list[i]);
559 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
561 printf("Trying to boot from %s\n", loader->name);
563 puts(SPL_TPL_PROMPT "Unsupported Boot Device!\n");
565 if (loader && !spl_load_image(spl_image, loader)) {
566 spl_image->boot_device = spl_boot_list[i];
574 #if defined(CONFIG_SPL_FRAMEWORK_BOARD_INIT_F)
575 void board_init_f(ulong dummy)
577 if (CONFIG_IS_ENABLED(OF_CONTROL)) {
580 ret = spl_early_init();
582 debug("spl_early_init() failed: %d\n", ret);
587 if (CONFIG_IS_ENABLED(SERIAL_SUPPORT))
588 preloader_console_init();
592 void board_init_r(gd_t *dummy1, ulong dummy2)
594 u32 spl_boot_list[] = {
601 struct spl_image_info spl_image;
604 debug(">>" SPL_TPL_PROMPT "board_init_r()\n");
608 #if defined(CONFIG_SYS_SPL_MALLOC_START)
609 mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
610 CONFIG_SYS_SPL_MALLOC_SIZE);
611 gd->flags |= GD_FLG_FULL_MALLOC_INIT;
613 if (!(gd->flags & GD_FLG_SPL_INIT)) {
617 #if !defined(CONFIG_PPC) && !defined(CONFIG_ARCH_MX6)
619 * timer_init() does not exist on PPC systems. The timer is initialized
620 * and enabled (decrementer) in interrupt_init() here.
624 if (CONFIG_IS_ENABLED(BLOBLIST)) {
625 ret = bloblist_init();
627 debug("%s: Failed to set up bloblist: ret=%d\n",
629 puts(SPL_TPL_PROMPT "Cannot set up bloblist\n");
633 if (CONFIG_IS_ENABLED(HANDOFF)) {
636 ret = setup_spl_handoff();
638 puts(SPL_TPL_PROMPT "Cannot set up SPL handoff\n");
643 #if CONFIG_IS_ENABLED(BOARD_INIT)
647 #if defined(CONFIG_SPL_WATCHDOG_SUPPORT) && CONFIG_IS_ENABLED(WDT)
651 if (IS_ENABLED(CONFIG_SPL_OS_BOOT) || CONFIG_IS_ENABLED(HANDOFF))
652 dram_init_banksize();
656 memset(&spl_image, '\0', sizeof(spl_image));
657 #ifdef CONFIG_SYS_SPL_ARGS_ADDR
658 spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
660 spl_image.boot_device = BOOT_DEVICE_NONE;
661 board_boot_order(spl_boot_list);
663 if (boot_from_devices(&spl_image, spl_boot_list,
664 ARRAY_SIZE(spl_boot_list))) {
665 puts(SPL_TPL_PROMPT "failed to boot from all boot devices\n");
669 spl_perform_fixups(&spl_image);
670 if (CONFIG_IS_ENABLED(HANDOFF)) {
671 ret = write_spl_handoff();
673 printf(SPL_TPL_PROMPT
674 "SPL hand-off write failed (err=%d)\n", ret);
676 if (CONFIG_IS_ENABLED(BLOBLIST)) {
677 ret = bloblist_finish();
679 printf("Warning: Failed to finish bloblist (ret=%d)\n",
683 #ifdef CONFIG_CPU_V7M
684 spl_image.entry_point |= 0x1;
686 switch (spl_image.os) {
688 debug("Jumping to U-Boot\n");
690 #if CONFIG_IS_ENABLED(ATF)
691 case IH_OS_ARM_TRUSTED_FIRMWARE:
692 debug("Jumping to U-Boot via ARM Trusted Firmware\n");
693 spl_invoke_atf(&spl_image);
696 #if CONFIG_IS_ENABLED(OPTEE)
698 debug("Jumping to U-Boot via OP-TEE\n");
699 spl_optee_entry(NULL, NULL, spl_image.fdt_addr,
700 (void *)spl_image.entry_point);
703 #if CONFIG_IS_ENABLED(OPENSBI)
705 debug("Jumping to U-Boot via RISC-V OpenSBI\n");
706 spl_invoke_opensbi(&spl_image);
709 #ifdef CONFIG_SPL_OS_BOOT
711 debug("Jumping to Linux\n");
713 spl_board_prepare_for_linux();
714 jump_to_image_linux(&spl_image);
717 debug("Unsupported OS image.. Jumping nevertheless..\n");
719 #if CONFIG_VAL(SYS_MALLOC_F_LEN) && !defined(CONFIG_SYS_SPL_MALLOC_SIZE)
720 debug("SPL malloc() used 0x%lx bytes (%ld KB)\n", gd->malloc_ptr,
721 gd->malloc_ptr / 1024);
723 bootstage_mark_name(spl_phase() == PHASE_TPL ? BOOTSTAGE_ID_END_TPL :
724 BOOTSTAGE_ID_END_SPL, "end " SPL_TPL_NAME);
725 #ifdef CONFIG_BOOTSTAGE_STASH
726 ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
727 CONFIG_BOOTSTAGE_STASH_SIZE);
729 debug("Failed to stash bootstage: err=%d\n", ret);
732 debug("loaded - jumping to U-Boot...\n");
733 spl_board_prepare_for_boot();
734 jump_to_image_no_args(&spl_image);
737 #ifdef CONFIG_SPL_SERIAL_SUPPORT
739 * This requires UART clocks to be enabled. In order for this to work the
740 * caller must ensure that the gd pointer is valid.
742 void preloader_console_init(void)
744 gd->baudrate = CONFIG_BAUDRATE;
746 serial_init(); /* serial communications setup */
748 gd->have_console = 1;
750 #if CONFIG_IS_ENABLED(BANNER_PRINT)
751 puts("\nU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - "
752 U_BOOT_TIME " " U_BOOT_TZ ")\n");
754 #ifdef CONFIG_SPL_DISPLAY_PRINT
761 * This function is called before the stack is changed from initial stack to
762 * relocated stack. It tries to dump the stack size used
764 __weak void spl_relocate_stack_check(void)
766 #if CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)
767 ulong init_sp = gd->start_addr_sp;
768 ulong stack_bottom = init_sp - CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK);
769 u8 *ptr = (u8 *)stack_bottom;
772 for (i = 0; i < CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK); i++) {
773 if (*ptr != CONFIG_VAL(SYS_STACK_F_CHECK_BYTE))
777 printf("SPL initial stack usage: %lu bytes\n",
778 CONFIG_VAL(SIZE_LIMIT_PROVIDE_STACK) - i);
783 * spl_relocate_stack_gd() - Relocate stack ready for board_init_r() execution
785 * Sometimes board_init_f() runs with a stack in SRAM but we want to use SDRAM
786 * for the main board_init_r() execution. This is typically because we need
787 * more stack space for things like the MMC sub-system.
789 * This function calculates the stack position, copies the global_data into
790 * place, sets the new gd (except for ARM, for which setting GD within a C
791 * function may not always work) and returns the new stack position. The
792 * caller is responsible for setting up the sp register and, in the case
793 * of ARM, setting up gd.
795 * All of this is done using the same layout and alignments as done in
796 * board_init_f_init_reserve() / board_init_f_alloc_reserve().
798 * @return new stack location, or 0 to use the same stack
800 ulong spl_relocate_stack_gd(void)
802 #ifdef CONFIG_SPL_STACK_R
804 ulong ptr = CONFIG_SPL_STACK_R_ADDR;
806 if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE))
807 spl_relocate_stack_check();
809 #if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_VAL(SYS_MALLOC_F_LEN)
810 if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
811 debug("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n",
812 gd->malloc_ptr, gd->malloc_ptr / 1024);
813 ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
814 gd->malloc_base = ptr;
815 gd->malloc_limit = CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
819 /* Get stack position: use 8-byte alignment for ABI compliance */
820 ptr = CONFIG_SPL_STACK_R_ADDR - roundup(sizeof(gd_t),16);
821 new_gd = (gd_t *)ptr;
822 memcpy(new_gd, (void *)gd, sizeof(gd_t));
823 #if CONFIG_IS_ENABLED(DM)
824 dm_fixup_for_gd_move(new_gd);
826 #if !defined(CONFIG_ARM) && !defined(CONFIG_RISCV)
835 #if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_SPL_BOOTCOUNT_LIMIT)
836 void bootcount_store(ulong a)
840 ulong bootcount_load(void)