162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2019, Mellanox Technologies. All rights reserved. 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef __MLXBF_BOOTCTL_H__ 762306a36Sopenharmony_ci#define __MLXBF_BOOTCTL_H__ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci/* 1062306a36Sopenharmony_ci * Request that the on-chip watchdog be enabled, or disabled, after 1162306a36Sopenharmony_ci * the next chip soft reset. This call does not affect the current 1262306a36Sopenharmony_ci * status of the on-chip watchdog. If non-zero, the argument 1362306a36Sopenharmony_ci * specifies the watchdog interval in seconds. If zero, the watchdog 1462306a36Sopenharmony_ci * will not be enabled after the next soft reset. Non-zero errors are 1562306a36Sopenharmony_ci * returned as documented below. 1662306a36Sopenharmony_ci */ 1762306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SET_POST_RESET_WDOG 0x82000000 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/* 2062306a36Sopenharmony_ci * Query the status which has been requested for the on-chip watchdog 2162306a36Sopenharmony_ci * after the next chip soft reset. Returns the interval as set by 2262306a36Sopenharmony_ci * MLXBF_BOOTCTL_SET_POST_RESET_WDOG. 2362306a36Sopenharmony_ci */ 2462306a36Sopenharmony_ci#define MLXBF_BOOTCTL_GET_POST_RESET_WDOG 0x82000001 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* 2762306a36Sopenharmony_ci * Request that a specific boot action be taken at the next soft 2862306a36Sopenharmony_ci * reset. By default, the boot action is set by external chip pins, 2962306a36Sopenharmony_ci * which are sampled on hard reset. Note that the boot action 3062306a36Sopenharmony_ci * requested by this call will persist on subsequent resets unless 3162306a36Sopenharmony_ci * this service, or the MLNX_SET_SECOND_RESET_ACTION service, is 3262306a36Sopenharmony_ci * invoked. See below for the available MLNX_BOOT_xxx parameter 3362306a36Sopenharmony_ci * values. Non-zero errors are returned as documented below. 3462306a36Sopenharmony_ci */ 3562306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SET_RESET_ACTION 0x82000002 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci/* 3862306a36Sopenharmony_ci * Return the specific boot action which will be taken at the next 3962306a36Sopenharmony_ci * soft reset. Returns the reset action (see below for the parameter 4062306a36Sopenharmony_ci * values for MLXBF_BOOTCTL_SET_RESET_ACTION). 4162306a36Sopenharmony_ci */ 4262306a36Sopenharmony_ci#define MLXBF_BOOTCTL_GET_RESET_ACTION 0x82000003 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci/* 4562306a36Sopenharmony_ci * Request that a specific boot action be taken at the soft reset 4662306a36Sopenharmony_ci * after the next soft reset. For a specified valid boot mode, the 4762306a36Sopenharmony_ci * effect of this call is identical to that of invoking 4862306a36Sopenharmony_ci * MLXBF_BOOTCTL_SET_RESET_ACTION after the next chip soft reset; in 4962306a36Sopenharmony_ci * particular, after that reset, the action for the now next reset can 5062306a36Sopenharmony_ci * be queried with MLXBF_BOOTCTL_GET_RESET_ACTION and modified with 5162306a36Sopenharmony_ci * MLXBF_BOOTCTL_SET_RESET_ACTION. You may also specify the parameter as 5262306a36Sopenharmony_ci * MLNX_BOOT_NONE, which is equivalent to specifying that no call to 5362306a36Sopenharmony_ci * MLXBF_BOOTCTL_SET_RESET_ACTION be taken after the next chip soft reset. 5462306a36Sopenharmony_ci * This call does not affect the action to be taken at the next soft 5562306a36Sopenharmony_ci * reset. Non-zero errors are returned as documented below. 5662306a36Sopenharmony_ci */ 5762306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION 0x82000004 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci/* 6062306a36Sopenharmony_ci * Return the specific boot action which will be taken at the soft 6162306a36Sopenharmony_ci * reset after the next soft reset; this will be one of the valid 6262306a36Sopenharmony_ci * actions for MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION. 6362306a36Sopenharmony_ci */ 6462306a36Sopenharmony_ci#define MLXBF_BOOTCTL_GET_SECOND_RESET_ACTION 0x82000005 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci/* 6762306a36Sopenharmony_ci * Return the fuse status of the current chip. The caller should specify 6862306a36Sopenharmony_ci * with the second argument if the state of the lifecycle fuses or the 6962306a36Sopenharmony_ci * version of secure boot fuse keys left should be returned. 7062306a36Sopenharmony_ci */ 7162306a36Sopenharmony_ci#define MLXBF_BOOTCTL_GET_TBB_FUSE_STATUS 0x82000006 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci/* Reset eMMC by programming the RST_N register. */ 7462306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SET_EMMC_RST_N 0x82000007 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci#define MLXBF_BOOTCTL_GET_DIMM_INFO 0x82000008 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci/* 7962306a36Sopenharmony_ci * Initiate Firmware Reset via TYU. This might be invoked during the reset 8062306a36Sopenharmony_ci * flow in isolation mode. 8162306a36Sopenharmony_ci */ 8262306a36Sopenharmony_ci#define MLXBF_BOOTCTL_FW_RESET 0x8200000D 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci/* 8562306a36Sopenharmony_ci * SMC function IDs to set, get and lock the manufacturing information 8662306a36Sopenharmony_ci * stored within the eeprom. 8762306a36Sopenharmony_ci */ 8862306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SET_MFG_INFO 0x8200000E 8962306a36Sopenharmony_ci#define MLXBF_BOOTCTL_GET_MFG_INFO 0x8200000F 9062306a36Sopenharmony_ci#define MLXBF_BOOTCTL_LOCK_MFG_INFO 0x82000011 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci/* 9362306a36Sopenharmony_ci * SMC function IDs to set and get the large ICM carveout size 9462306a36Sopenharmony_ci * stored in the eeprom. 9562306a36Sopenharmony_ci */ 9662306a36Sopenharmony_ci#define MLNX_HANDLE_SET_ICM_INFO 0x82000012 9762306a36Sopenharmony_ci#define MLNX_HANDLE_GET_ICM_INFO 0x82000013 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci#define MAX_ICM_BUFFER_SIZE 10 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci/* 10262306a36Sopenharmony_ci * SMC function ID to set the ARM boot state to up 10362306a36Sopenharmony_ci */ 10462306a36Sopenharmony_ci#define MLNX_HANDLE_OS_UP 0x82000014 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci/* SMC function IDs for SiP Service queries */ 10762306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SIP_SVC_CALL_COUNT 0x8200ff00 10862306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SIP_SVC_UID 0x8200ff01 10962306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SIP_SVC_VERSION 0x8200ff03 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci/* ARM Standard Service Calls version numbers */ 11262306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SVC_VERSION_MAJOR 0x0 11362306a36Sopenharmony_ci#define MLXBF_BOOTCTL_SVC_VERSION_MINOR 0x2 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci/* Number of svc calls defined. */ 11662306a36Sopenharmony_ci#define MLXBF_BOOTCTL_NUM_SVC_CALLS 12 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci/* Valid reset actions for MLXBF_BOOTCTL_SET_RESET_ACTION. */ 11962306a36Sopenharmony_ci#define MLXBF_BOOTCTL_EXTERNAL 0 /* Not boot from eMMC */ 12062306a36Sopenharmony_ci#define MLXBF_BOOTCTL_EMMC 1 /* From primary eMMC boot partition */ 12162306a36Sopenharmony_ci#define MLNX_BOOTCTL_SWAP_EMMC 2 /* Swap eMMC boot partitions and reboot */ 12262306a36Sopenharmony_ci#define MLXBF_BOOTCTL_EMMC_LEGACY 3 /* From primary eMMC in legacy mode */ 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci/* Valid arguments for requesting the fuse status. */ 12562306a36Sopenharmony_ci#define MLXBF_BOOTCTL_FUSE_STATUS_LIFECYCLE 0 /* Return lifecycle status. */ 12662306a36Sopenharmony_ci#define MLXBF_BOOTCTL_FUSE_STATUS_KEYS 1 /* Return secure boot key status */ 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci/* Additional value to disable the MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION. */ 12962306a36Sopenharmony_ci#define MLXBF_BOOTCTL_NONE 0x7fffffff /* Don't change next boot action */ 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci#define MLXBF_LARGE_ICMC_MAX_STRING_SIZE 16 13262306a36Sopenharmony_ci#define MLXBF_LARGE_ICMC_SIZE_MIN 0x80 13362306a36Sopenharmony_ci#define MLXBF_LARGE_ICMC_SIZE_MAX 0x100000 13462306a36Sopenharmony_ci#define MLXBF_LARGE_ICMC_GRANULARITY MLXBF_LARGE_ICMC_SIZE_MIN 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci#endif /* __MLXBF_BOOTCTL_H__ */ 137