blob: d9cf2e5a08e796c8003a8ae25f02aff19bd98c6a [file] [log] [blame]
Angel Pons5f249e62020-04-04 18:51:01 +02001/* SPDX-License-Identifier: GPL-2.0-only */
David Hendricks8cbd5692017-12-01 20:49:48 -08002
3#include <arch/exception.h>
4#include <console/console.h>
5#include <delay.h>
6#include <program_loading.h>
7#include <symbols.h>
8#include <timestamp.h>
9#include <soc/bootblock.h>
10
David Hendricks8cbd5692017-12-01 20:49:48 -080011__attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ }
12__attribute__((weak)) void bootblock_soc_early_init(void) { /* do nothing */ }
13__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
14__attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
15
David Hendricks8cbd5692017-12-01 20:49:48 -080016/* C code entry point for the boot block */
17void bootblock_main(const uint64_t reg_x0,
David Hendricks8cbd5692017-12-01 20:49:48 -080018 const uint64_t reg_pc)
19{
David Hendricks8cbd5692017-12-01 20:49:48 -080020 init_timer();
21
David Hendricks8cbd5692017-12-01 20:49:48 -080022 /* Initialize timestamps if we have TIMESTAMP region in memlayout.ld. */
Julius Wernercd49cce2019-03-05 16:53:33 -080023 if (CONFIG(COLLECT_TIMESTAMPS) && REGION_SIZE(timestamp) > 0)
Elyes HAOUAS5417c842019-04-23 22:17:34 +020024 timestamp_init(timestamp_get());
David Hendricks8cbd5692017-12-01 20:49:48 -080025
26 bootblock_soc_early_init();
27 bootblock_mainboard_early_init();
28
Julius Wernercd49cce2019-03-05 16:53:33 -080029 if (CONFIG(BOOTBLOCK_CONSOLE)) {
David Hendricks8cbd5692017-12-01 20:49:48 -080030 console_init();
31 exception_init();
32
33 if (reg_x0)
34 printk(BIOS_ERR,
35 "BOOTBLOCK: RST Boot Failure Code %lld\n",
36 reg_x0);
David Hendricks8cbd5692017-12-01 20:49:48 -080037 }
38
39 bootblock_soc_init();
40 bootblock_mainboard_init();
41
42 run_romstage();
43}