1 /* SPDX-License-Identifier: BSD-2-Clause */
3 * Copyright (c) 2019 Western Digital Corporation or its affiliates.
5 * Based on include/sbi/{fw_dynamic.h,sbi_scratch.h} from the OpenSBI project.
10 /** Expected value of info magic ('OSBI' ascii string in hex) */
11 #define FW_DYNAMIC_INFO_MAGIC_VALUE 0x4942534f
13 /** Maximum supported info version */
14 #define FW_DYNAMIC_INFO_VERSION 0x2
16 /** Possible next mode values */
17 #define FW_DYNAMIC_INFO_NEXT_MODE_U 0x0
18 #define FW_DYNAMIC_INFO_NEXT_MODE_S 0x1
19 #define FW_DYNAMIC_INFO_NEXT_MODE_M 0x3
21 enum sbi_scratch_options {
22 /** Disable prints during boot */
23 SBI_SCRATCH_NO_BOOT_PRINTS = (1 << 0),
26 /** Representation dynamic info passed by previous booting stage */
27 struct fw_dynamic_info {
31 unsigned long version;
32 /** Next booting stage address */
33 unsigned long next_addr;
34 /** Next booting stage mode */
35 unsigned long next_mode;
36 /** Options for OpenSBI library */
37 unsigned long options;
39 * Preferred boot HART id
41 * It is possible that the previous booting stage uses same link
42 * address as the FW_DYNAMIC firmware. In this case, the relocation
43 * lottery mechanism can potentially overwrite the previous booting
44 * stage while other HARTs are still running in the previous booting
45 * stage leading to boot-time crash. To avoid this boot-time crash,
46 * the previous booting stage can specify last HART that will jump
47 * to the FW_DYNAMIC firmware as the preferred boot HART.
49 * To avoid specifying a preferred boot HART, the previous booting
50 * stage can set it to -1UL which will force the FW_DYNAMIC firmware
51 * to use the relocation lottery mechanism.
53 unsigned long boot_hart;