blob: d812cc8ccd9413337821be5f9227d00aa943d4f0 [file] [log] [blame]
Lukas Auer5e30e452019-08-21 21:14:44 +02001/* SPDX-License-Identifier: BSD-2-Clause */
2/*
3 * Copyright (c) 2019 Western Digital Corporation or its affiliates.
4 *
5 * Based on include/sbi/{fw_dynamic.h,sbi_scratch.h} from the OpenSBI project.
6 */
7#ifndef OPENSBI_H
8#define OPENSBI_H
9
10/** Expected value of info magic ('OSBI' ascii string in hex) */
11#define FW_DYNAMIC_INFO_MAGIC_VALUE 0x4942534f
12
13/** Maximum supported info version */
Lukas Auerb86f6d12019-12-08 23:28:49 +010014#define FW_DYNAMIC_INFO_VERSION 0x2
Lukas Auer5e30e452019-08-21 21:14:44 +020015
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
20
21enum sbi_scratch_options {
22 /** Disable prints during boot */
23 SBI_SCRATCH_NO_BOOT_PRINTS = (1 << 0),
24};
25
26/** Representation dynamic info passed by previous booting stage */
27struct fw_dynamic_info {
28 /** Info magic */
29 unsigned long magic;
30 /** Info version */
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;
Lukas Auerb86f6d12019-12-08 23:28:49 +010038 /**
39 * Preferred boot HART id
40 *
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.
48 *
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.
52 */
53 unsigned long boot_hart;
Lukas Auer5e30e452019-08-21 21:14:44 +020054} __packed;
55
56#endif