18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2019, Mellanox Technologies. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __MLXBF_BOOTCTL_H__
78c2ecf20Sopenharmony_ci#define __MLXBF_BOOTCTL_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/*
108c2ecf20Sopenharmony_ci * Request that the on-chip watchdog be enabled, or disabled, after
118c2ecf20Sopenharmony_ci * the next chip soft reset. This call does not affect the current
128c2ecf20Sopenharmony_ci * status of the on-chip watchdog. If non-zero, the argument
138c2ecf20Sopenharmony_ci * specifies the watchdog interval in seconds. If zero, the watchdog
148c2ecf20Sopenharmony_ci * will not be enabled after the next soft reset. Non-zero errors are
158c2ecf20Sopenharmony_ci * returned as documented below.
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SET_POST_RESET_WDOG	0x82000000
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * Query the status which has been requested for the on-chip watchdog
218c2ecf20Sopenharmony_ci * after the next chip soft reset. Returns the interval as set by
228c2ecf20Sopenharmony_ci * MLXBF_BOOTCTL_SET_POST_RESET_WDOG.
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_GET_POST_RESET_WDOG	0x82000001
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/*
278c2ecf20Sopenharmony_ci * Request that a specific boot action be taken at the next soft
288c2ecf20Sopenharmony_ci * reset. By default, the boot action is set by external chip pins,
298c2ecf20Sopenharmony_ci * which are sampled on hard reset. Note that the boot action
308c2ecf20Sopenharmony_ci * requested by this call will persist on subsequent resets unless
318c2ecf20Sopenharmony_ci * this service, or the MLNX_SET_SECOND_RESET_ACTION service, is
328c2ecf20Sopenharmony_ci * invoked. See below for the available MLNX_BOOT_xxx parameter
338c2ecf20Sopenharmony_ci * values. Non-zero errors are returned as documented below.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SET_RESET_ACTION		0x82000002
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/*
388c2ecf20Sopenharmony_ci * Return the specific boot action which will be taken at the next
398c2ecf20Sopenharmony_ci * soft reset. Returns the reset action (see below for the parameter
408c2ecf20Sopenharmony_ci * values for MLXBF_BOOTCTL_SET_RESET_ACTION).
418c2ecf20Sopenharmony_ci */
428c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_GET_RESET_ACTION		0x82000003
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * Request that a specific boot action be taken at the soft reset
468c2ecf20Sopenharmony_ci * after the next soft reset. For a specified valid boot mode, the
478c2ecf20Sopenharmony_ci * effect of this call is identical to that of invoking
488c2ecf20Sopenharmony_ci * MLXBF_BOOTCTL_SET_RESET_ACTION after the next chip soft reset; in
498c2ecf20Sopenharmony_ci * particular, after that reset, the action for the now next reset can
508c2ecf20Sopenharmony_ci * be queried with MLXBF_BOOTCTL_GET_RESET_ACTION and modified with
518c2ecf20Sopenharmony_ci * MLXBF_BOOTCTL_SET_RESET_ACTION. You may also specify the parameter as
528c2ecf20Sopenharmony_ci * MLNX_BOOT_NONE, which is equivalent to specifying that no call to
538c2ecf20Sopenharmony_ci * MLXBF_BOOTCTL_SET_RESET_ACTION be taken after the next chip soft reset.
548c2ecf20Sopenharmony_ci * This call does not affect the action to be taken at the next soft
558c2ecf20Sopenharmony_ci * reset. Non-zero errors are returned as documented below.
568c2ecf20Sopenharmony_ci */
578c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION	0x82000004
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/*
608c2ecf20Sopenharmony_ci * Return the specific boot action which will be taken at the soft
618c2ecf20Sopenharmony_ci * reset after the next soft reset; this will be one of the valid
628c2ecf20Sopenharmony_ci * actions for MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION.
638c2ecf20Sopenharmony_ci */
648c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_GET_SECOND_RESET_ACTION	0x82000005
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/*
678c2ecf20Sopenharmony_ci * Return the fuse status of the current chip. The caller should specify
688c2ecf20Sopenharmony_ci * with the second argument if the state of the lifecycle fuses or the
698c2ecf20Sopenharmony_ci * version of secure boot fuse keys left should be returned.
708c2ecf20Sopenharmony_ci */
718c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_GET_TBB_FUSE_STATUS	0x82000006
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/* Reset eMMC by programming the RST_N register. */
748c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SET_EMMC_RST_N		0x82000007
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_GET_DIMM_INFO		0x82000008
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/* SMC function IDs for SiP Service queries */
798c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SIP_SVC_CALL_COUNT	0x8200ff00
808c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SIP_SVC_UID		0x8200ff01
818c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SIP_SVC_VERSION		0x8200ff03
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* ARM Standard Service Calls version numbers */
848c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SVC_VERSION_MAJOR		0x0
858c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_SVC_VERSION_MINOR		0x2
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* Number of svc calls defined. */
888c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_NUM_SVC_CALLS 12
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci/* Valid reset actions for MLXBF_BOOTCTL_SET_RESET_ACTION. */
918c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_EXTERNAL	0 /* Not boot from eMMC */
928c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_EMMC	1 /* From primary eMMC boot partition */
938c2ecf20Sopenharmony_ci#define MLNX_BOOTCTL_SWAP_EMMC	2 /* Swap eMMC boot partitions and reboot */
948c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_EMMC_LEGACY	3 /* From primary eMMC in legacy mode */
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/* Valid arguments for requesting the fuse status. */
978c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_FUSE_STATUS_LIFECYCLE	0 /* Return lifecycle status. */
988c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_FUSE_STATUS_KEYS	1 /* Return secure boot key status */
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci/* Additional value to disable the MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION. */
1018c2ecf20Sopenharmony_ci#define MLXBF_BOOTCTL_NONE	0x7fffffff /* Don't change next boot action */
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#endif /* __MLXBF_BOOTCTL_H__ */
104