habanalabs: create common folder
[linux-2.6-microblaze.git] / drivers / misc / habanalabs / include / common / hl_boot_if.h
1 /* SPDX-License-Identifier: GPL-2.0
2  *
3  * Copyright 2018-2020 HabanaLabs, Ltd.
4  * All Rights Reserved.
5  *
6  */
7
8 #ifndef HL_BOOT_IF_H
9 #define HL_BOOT_IF_H
10
11 #define LKD_HARD_RESET_MAGIC            0xED7BD694
12 #define HL_POWER9_HOST_MAGIC            0x1DA30009
13
14 #define BOOT_FIT_SRAM_OFFSET            0x200000
15
16 /*
17  * CPU error bits in BOOT_ERROR registers
18  *
19  * CPU_BOOT_ERR0_DRAM_INIT_FAIL         DRAM initialization failed.
20  *                                      DRAM is not reliable to use.
21  *
22  * CPU_BOOT_ERR0_FIT_CORRUPTED          FIT data integrity verification of the
23  *                                      image provided by the host has failed.
24  *
25  * CPU_BOOT_ERR0_TS_INIT_FAIL           Thermal Sensor initialization failed.
26  *                                      Boot continues as usual, but keep in
27  *                                      mind this is a warning.
28  *
29  * CPU_BOOT_ERR0_DRAM_SKIPPED           DRAM initialization has been skipped.
30  *                                      Skipping DRAM initialization has been
31  *                                      requested (e.g. strap, command, etc.)
32  *                                      and FW skipped the DRAM initialization.
33  *                                      Host can initialize the DRAM.
34  *
35  * CPU_BOOT_ERR0_BMC_WAIT_SKIPPED       Waiting for BMC data will be skipped.
36  *                                      Meaning the BMC data might not be
37  *                                      available until reset.
38  *
39  * CPU_BOOT_ERR0_NIC_DATA_NOT_RDY       NIC data from BMC is not ready.
40  *                                      BMC has not provided the NIC data yet.
41  *                                      Once provided this bit will be cleared.
42  *
43  * CPU_BOOT_ERR0_NIC_FW_FAIL            NIC FW loading failed.
44  *                                      The NIC FW loading and initialization
45  *                                      failed. This means NICs are not usable.
46  *
47  * CPU_BOOT_ERR0_ENABLED                Error registers enabled.
48  *                                      This is a main indication that the
49  *                                      running FW populates the error
50  *                                      registers. Meaning the error bits are
51  *                                      not garbage, but actual error statuses.
52  */
53 #define CPU_BOOT_ERR0_DRAM_INIT_FAIL            (1 << 0)
54 #define CPU_BOOT_ERR0_FIT_CORRUPTED             (1 << 1)
55 #define CPU_BOOT_ERR0_TS_INIT_FAIL              (1 << 2)
56 #define CPU_BOOT_ERR0_DRAM_SKIPPED              (1 << 3)
57 #define CPU_BOOT_ERR0_BMC_WAIT_SKIPPED          (1 << 4)
58 #define CPU_BOOT_ERR0_NIC_DATA_NOT_RDY          (1 << 5)
59 #define CPU_BOOT_ERR0_NIC_FW_FAIL               (1 << 6)
60 #define CPU_BOOT_ERR0_ENABLED                   (1 << 31)
61
62 enum cpu_boot_status {
63         CPU_BOOT_STATUS_NA = 0,         /* Default value after reset of chip */
64         CPU_BOOT_STATUS_IN_WFE = 1,
65         CPU_BOOT_STATUS_DRAM_RDY = 2,
66         CPU_BOOT_STATUS_SRAM_AVAIL = 3,
67         CPU_BOOT_STATUS_IN_BTL = 4,     /* BTL is H/W FSM */
68         CPU_BOOT_STATUS_IN_PREBOOT = 5,
69         CPU_BOOT_STATUS_IN_SPL,         /* deprecated - not reported */
70         CPU_BOOT_STATUS_IN_UBOOT = 7,
71         CPU_BOOT_STATUS_DRAM_INIT_FAIL, /* deprecated - will be removed */
72         CPU_BOOT_STATUS_FIT_CORRUPTED,  /* deprecated - will be removed */
73         /* U-Boot console prompt activated, commands are not processed */
74         CPU_BOOT_STATUS_UBOOT_NOT_READY = 10,
75         /* Finished NICs init, reported after DRAM and NICs */
76         CPU_BOOT_STATUS_NIC_FW_RDY = 11,
77         CPU_BOOT_STATUS_TS_INIT_FAIL,   /* deprecated - will be removed */
78         CPU_BOOT_STATUS_DRAM_SKIPPED,   /* deprecated - will be removed */
79         CPU_BOOT_STATUS_BMC_WAITING_SKIPPED, /* deprecated - will be removed */
80         /* Last boot loader progress status, ready to receive commands */
81         CPU_BOOT_STATUS_READY_TO_BOOT = 15,
82         CPU_BOOT_STATUS_WAITING_FOR_BOOT_FIT = 16,
83 };
84
85 enum kmd_msg {
86         KMD_MSG_NA = 0,
87         KMD_MSG_GOTO_WFE,
88         KMD_MSG_FIT_RDY,
89         KMD_MSG_SKIP_BMC,
90 };
91
92 enum cpu_msg_status {
93         CPU_MSG_CLR = 0,
94         CPU_MSG_OK,
95         CPU_MSG_ERR,
96 };
97
98 #endif /* HL_BOOT_IF_H */