xref: /OK3568_Linux_fs/kernel/drivers/platform/mellanox/mlxbf-bootctl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (c) 2019, Mellanox Technologies. All rights reserved.
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #ifndef __MLXBF_BOOTCTL_H__
7*4882a593Smuzhiyun #define __MLXBF_BOOTCTL_H__
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun /*
10*4882a593Smuzhiyun  * Request that the on-chip watchdog be enabled, or disabled, after
11*4882a593Smuzhiyun  * the next chip soft reset. This call does not affect the current
12*4882a593Smuzhiyun  * status of the on-chip watchdog. If non-zero, the argument
13*4882a593Smuzhiyun  * specifies the watchdog interval in seconds. If zero, the watchdog
14*4882a593Smuzhiyun  * will not be enabled after the next soft reset. Non-zero errors are
15*4882a593Smuzhiyun  * returned as documented below.
16*4882a593Smuzhiyun  */
17*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SET_POST_RESET_WDOG	0x82000000
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun /*
20*4882a593Smuzhiyun  * Query the status which has been requested for the on-chip watchdog
21*4882a593Smuzhiyun  * after the next chip soft reset. Returns the interval as set by
22*4882a593Smuzhiyun  * MLXBF_BOOTCTL_SET_POST_RESET_WDOG.
23*4882a593Smuzhiyun  */
24*4882a593Smuzhiyun #define MLXBF_BOOTCTL_GET_POST_RESET_WDOG	0x82000001
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun /*
27*4882a593Smuzhiyun  * Request that a specific boot action be taken at the next soft
28*4882a593Smuzhiyun  * reset. By default, the boot action is set by external chip pins,
29*4882a593Smuzhiyun  * which are sampled on hard reset. Note that the boot action
30*4882a593Smuzhiyun  * requested by this call will persist on subsequent resets unless
31*4882a593Smuzhiyun  * this service, or the MLNX_SET_SECOND_RESET_ACTION service, is
32*4882a593Smuzhiyun  * invoked. See below for the available MLNX_BOOT_xxx parameter
33*4882a593Smuzhiyun  * values. Non-zero errors are returned as documented below.
34*4882a593Smuzhiyun  */
35*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SET_RESET_ACTION		0x82000002
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun /*
38*4882a593Smuzhiyun  * Return the specific boot action which will be taken at the next
39*4882a593Smuzhiyun  * soft reset. Returns the reset action (see below for the parameter
40*4882a593Smuzhiyun  * values for MLXBF_BOOTCTL_SET_RESET_ACTION).
41*4882a593Smuzhiyun  */
42*4882a593Smuzhiyun #define MLXBF_BOOTCTL_GET_RESET_ACTION		0x82000003
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun /*
45*4882a593Smuzhiyun  * Request that a specific boot action be taken at the soft reset
46*4882a593Smuzhiyun  * after the next soft reset. For a specified valid boot mode, the
47*4882a593Smuzhiyun  * effect of this call is identical to that of invoking
48*4882a593Smuzhiyun  * MLXBF_BOOTCTL_SET_RESET_ACTION after the next chip soft reset; in
49*4882a593Smuzhiyun  * particular, after that reset, the action for the now next reset can
50*4882a593Smuzhiyun  * be queried with MLXBF_BOOTCTL_GET_RESET_ACTION and modified with
51*4882a593Smuzhiyun  * MLXBF_BOOTCTL_SET_RESET_ACTION. You may also specify the parameter as
52*4882a593Smuzhiyun  * MLNX_BOOT_NONE, which is equivalent to specifying that no call to
53*4882a593Smuzhiyun  * MLXBF_BOOTCTL_SET_RESET_ACTION be taken after the next chip soft reset.
54*4882a593Smuzhiyun  * This call does not affect the action to be taken at the next soft
55*4882a593Smuzhiyun  * reset. Non-zero errors are returned as documented below.
56*4882a593Smuzhiyun  */
57*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION	0x82000004
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun /*
60*4882a593Smuzhiyun  * Return the specific boot action which will be taken at the soft
61*4882a593Smuzhiyun  * reset after the next soft reset; this will be one of the valid
62*4882a593Smuzhiyun  * actions for MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION.
63*4882a593Smuzhiyun  */
64*4882a593Smuzhiyun #define MLXBF_BOOTCTL_GET_SECOND_RESET_ACTION	0x82000005
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun /*
67*4882a593Smuzhiyun  * Return the fuse status of the current chip. The caller should specify
68*4882a593Smuzhiyun  * with the second argument if the state of the lifecycle fuses or the
69*4882a593Smuzhiyun  * version of secure boot fuse keys left should be returned.
70*4882a593Smuzhiyun  */
71*4882a593Smuzhiyun #define MLXBF_BOOTCTL_GET_TBB_FUSE_STATUS	0x82000006
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun /* Reset eMMC by programming the RST_N register. */
74*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SET_EMMC_RST_N		0x82000007
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun #define MLXBF_BOOTCTL_GET_DIMM_INFO		0x82000008
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun /* SMC function IDs for SiP Service queries */
79*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SIP_SVC_CALL_COUNT	0x8200ff00
80*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SIP_SVC_UID		0x8200ff01
81*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SIP_SVC_VERSION		0x8200ff03
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun /* ARM Standard Service Calls version numbers */
84*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SVC_VERSION_MAJOR		0x0
85*4882a593Smuzhiyun #define MLXBF_BOOTCTL_SVC_VERSION_MINOR		0x2
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun /* Number of svc calls defined. */
88*4882a593Smuzhiyun #define MLXBF_BOOTCTL_NUM_SVC_CALLS 12
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun /* Valid reset actions for MLXBF_BOOTCTL_SET_RESET_ACTION. */
91*4882a593Smuzhiyun #define MLXBF_BOOTCTL_EXTERNAL	0 /* Not boot from eMMC */
92*4882a593Smuzhiyun #define MLXBF_BOOTCTL_EMMC	1 /* From primary eMMC boot partition */
93*4882a593Smuzhiyun #define MLNX_BOOTCTL_SWAP_EMMC	2 /* Swap eMMC boot partitions and reboot */
94*4882a593Smuzhiyun #define MLXBF_BOOTCTL_EMMC_LEGACY	3 /* From primary eMMC in legacy mode */
95*4882a593Smuzhiyun 
96*4882a593Smuzhiyun /* Valid arguments for requesting the fuse status. */
97*4882a593Smuzhiyun #define MLXBF_BOOTCTL_FUSE_STATUS_LIFECYCLE	0 /* Return lifecycle status. */
98*4882a593Smuzhiyun #define MLXBF_BOOTCTL_FUSE_STATUS_KEYS	1 /* Return secure boot key status */
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun /* Additional value to disable the MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION. */
101*4882a593Smuzhiyun #define MLXBF_BOOTCTL_NONE	0x7fffffff /* Don't change next boot action */
102*4882a593Smuzhiyun 
103*4882a593Smuzhiyun #endif /* __MLXBF_BOOTCTL_H__ */
104