179e29cb8SLiming Sun /* SPDX-License-Identifier: GPL-2.0 */ 279e29cb8SLiming Sun /* 379e29cb8SLiming Sun * Copyright (c) 2019, Mellanox Technologies. All rights reserved. 479e29cb8SLiming Sun */ 579e29cb8SLiming Sun 679e29cb8SLiming Sun #ifndef __MLXBF_BOOTCTL_H__ 779e29cb8SLiming Sun #define __MLXBF_BOOTCTL_H__ 879e29cb8SLiming Sun 979e29cb8SLiming Sun /* 1079e29cb8SLiming Sun * Request that the on-chip watchdog be enabled, or disabled, after 1179e29cb8SLiming Sun * the next chip soft reset. This call does not affect the current 1279e29cb8SLiming Sun * status of the on-chip watchdog. If non-zero, the argument 1379e29cb8SLiming Sun * specifies the watchdog interval in seconds. If zero, the watchdog 1479e29cb8SLiming Sun * will not be enabled after the next soft reset. Non-zero errors are 1579e29cb8SLiming Sun * returned as documented below. 1679e29cb8SLiming Sun */ 1779e29cb8SLiming Sun #define MLXBF_BOOTCTL_SET_POST_RESET_WDOG 0x82000000 1879e29cb8SLiming Sun 1979e29cb8SLiming Sun /* 2079e29cb8SLiming Sun * Query the status which has been requested for the on-chip watchdog 2179e29cb8SLiming Sun * after the next chip soft reset. Returns the interval as set by 2279e29cb8SLiming Sun * MLXBF_BOOTCTL_SET_POST_RESET_WDOG. 2379e29cb8SLiming Sun */ 2479e29cb8SLiming Sun #define MLXBF_BOOTCTL_GET_POST_RESET_WDOG 0x82000001 2579e29cb8SLiming Sun 2679e29cb8SLiming Sun /* 2779e29cb8SLiming Sun * Request that a specific boot action be taken at the next soft 2879e29cb8SLiming Sun * reset. By default, the boot action is set by external chip pins, 2979e29cb8SLiming Sun * which are sampled on hard reset. Note that the boot action 3079e29cb8SLiming Sun * requested by this call will persist on subsequent resets unless 3179e29cb8SLiming Sun * this service, or the MLNX_SET_SECOND_RESET_ACTION service, is 3279e29cb8SLiming Sun * invoked. See below for the available MLNX_BOOT_xxx parameter 3379e29cb8SLiming Sun * values. Non-zero errors are returned as documented below. 3479e29cb8SLiming Sun */ 3579e29cb8SLiming Sun #define MLXBF_BOOTCTL_SET_RESET_ACTION 0x82000002 3679e29cb8SLiming Sun 3779e29cb8SLiming Sun /* 3879e29cb8SLiming Sun * Return the specific boot action which will be taken at the next 3979e29cb8SLiming Sun * soft reset. Returns the reset action (see below for the parameter 4079e29cb8SLiming Sun * values for MLXBF_BOOTCTL_SET_RESET_ACTION). 4179e29cb8SLiming Sun */ 4279e29cb8SLiming Sun #define MLXBF_BOOTCTL_GET_RESET_ACTION 0x82000003 4379e29cb8SLiming Sun 4479e29cb8SLiming Sun /* 4579e29cb8SLiming Sun * Request that a specific boot action be taken at the soft reset 4679e29cb8SLiming Sun * after the next soft reset. For a specified valid boot mode, the 4779e29cb8SLiming Sun * effect of this call is identical to that of invoking 4879e29cb8SLiming Sun * MLXBF_BOOTCTL_SET_RESET_ACTION after the next chip soft reset; in 4979e29cb8SLiming Sun * particular, after that reset, the action for the now next reset can 5079e29cb8SLiming Sun * be queried with MLXBF_BOOTCTL_GET_RESET_ACTION and modified with 5179e29cb8SLiming Sun * MLXBF_BOOTCTL_SET_RESET_ACTION. You may also specify the parameter as 5279e29cb8SLiming Sun * MLNX_BOOT_NONE, which is equivalent to specifying that no call to 5379e29cb8SLiming Sun * MLXBF_BOOTCTL_SET_RESET_ACTION be taken after the next chip soft reset. 5479e29cb8SLiming Sun * This call does not affect the action to be taken at the next soft 5579e29cb8SLiming Sun * reset. Non-zero errors are returned as documented below. 5679e29cb8SLiming Sun */ 5779e29cb8SLiming Sun #define MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION 0x82000004 5879e29cb8SLiming Sun 5979e29cb8SLiming Sun /* 6079e29cb8SLiming Sun * Return the specific boot action which will be taken at the soft 6179e29cb8SLiming Sun * reset after the next soft reset; this will be one of the valid 6279e29cb8SLiming Sun * actions for MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION. 6379e29cb8SLiming Sun */ 6479e29cb8SLiming Sun #define MLXBF_BOOTCTL_GET_SECOND_RESET_ACTION 0x82000005 6579e29cb8SLiming Sun 6679e29cb8SLiming Sun /* 6779e29cb8SLiming Sun * Return the fuse status of the current chip. The caller should specify 6879e29cb8SLiming Sun * with the second argument if the state of the lifecycle fuses or the 6979e29cb8SLiming Sun * version of secure boot fuse keys left should be returned. 7079e29cb8SLiming Sun */ 7179e29cb8SLiming Sun #define MLXBF_BOOTCTL_GET_TBB_FUSE_STATUS 0x82000006 7279e29cb8SLiming Sun 7379e29cb8SLiming Sun /* Reset eMMC by programming the RST_N register. */ 7479e29cb8SLiming Sun #define MLXBF_BOOTCTL_SET_EMMC_RST_N 0x82000007 7579e29cb8SLiming Sun 7679e29cb8SLiming Sun #define MLXBF_BOOTCTL_GET_DIMM_INFO 0x82000008 7779e29cb8SLiming Sun 787bef7eeaSKhalil Blaiech /* 797bef7eeaSKhalil Blaiech * Initiate Firmware Reset via TYU. This might be invoked during the reset 807bef7eeaSKhalil Blaiech * flow in isolation mode. 817bef7eeaSKhalil Blaiech */ 827bef7eeaSKhalil Blaiech #define MLXBF_BOOTCTL_FW_RESET 0x8200000D 837bef7eeaSKhalil Blaiech 84b18a97edSAsmaa Mnebhi /* 85*7e38a742SDavid Thompson * SMC function IDs to set, get and lock the manufacturing information 86*7e38a742SDavid Thompson * stored within the eeprom. 87*7e38a742SDavid Thompson */ 88*7e38a742SDavid Thompson #define MLXBF_BOOTCTL_SET_MFG_INFO 0x8200000E 89*7e38a742SDavid Thompson #define MLXBF_BOOTCTL_GET_MFG_INFO 0x8200000F 90*7e38a742SDavid Thompson #define MLXBF_BOOTCTL_LOCK_MFG_INFO 0x82000011 91*7e38a742SDavid Thompson 92*7e38a742SDavid Thompson /* 93b18a97edSAsmaa Mnebhi * SMC function IDs to set and get the large ICM carveout size 94b18a97edSAsmaa Mnebhi * stored in the eeprom. 95b18a97edSAsmaa Mnebhi */ 96b18a97edSAsmaa Mnebhi #define MLNX_HANDLE_SET_ICM_INFO 0x82000012 97b18a97edSAsmaa Mnebhi #define MLNX_HANDLE_GET_ICM_INFO 0x82000013 98b18a97edSAsmaa Mnebhi 99b18a97edSAsmaa Mnebhi #define MAX_ICM_BUFFER_SIZE 10 100b18a97edSAsmaa Mnebhi 101e3205d41SAsmaa Mnebhi /* 102e3205d41SAsmaa Mnebhi * SMC function ID to set the ARM boot state to up 103e3205d41SAsmaa Mnebhi */ 104e3205d41SAsmaa Mnebhi #define MLNX_HANDLE_OS_UP 0x82000014 105e3205d41SAsmaa Mnebhi 10679e29cb8SLiming Sun /* SMC function IDs for SiP Service queries */ 10779e29cb8SLiming Sun #define MLXBF_BOOTCTL_SIP_SVC_CALL_COUNT 0x8200ff00 10879e29cb8SLiming Sun #define MLXBF_BOOTCTL_SIP_SVC_UID 0x8200ff01 10979e29cb8SLiming Sun #define MLXBF_BOOTCTL_SIP_SVC_VERSION 0x8200ff03 11079e29cb8SLiming Sun 11179e29cb8SLiming Sun /* ARM Standard Service Calls version numbers */ 11279e29cb8SLiming Sun #define MLXBF_BOOTCTL_SVC_VERSION_MAJOR 0x0 11379e29cb8SLiming Sun #define MLXBF_BOOTCTL_SVC_VERSION_MINOR 0x2 11479e29cb8SLiming Sun 11579e29cb8SLiming Sun /* Number of svc calls defined. */ 11679e29cb8SLiming Sun #define MLXBF_BOOTCTL_NUM_SVC_CALLS 12 11779e29cb8SLiming Sun 11879e29cb8SLiming Sun /* Valid reset actions for MLXBF_BOOTCTL_SET_RESET_ACTION. */ 11979e29cb8SLiming Sun #define MLXBF_BOOTCTL_EXTERNAL 0 /* Not boot from eMMC */ 12079e29cb8SLiming Sun #define MLXBF_BOOTCTL_EMMC 1 /* From primary eMMC boot partition */ 12179e29cb8SLiming Sun #define MLNX_BOOTCTL_SWAP_EMMC 2 /* Swap eMMC boot partitions and reboot */ 12279e29cb8SLiming Sun #define MLXBF_BOOTCTL_EMMC_LEGACY 3 /* From primary eMMC in legacy mode */ 12379e29cb8SLiming Sun 12479e29cb8SLiming Sun /* Valid arguments for requesting the fuse status. */ 12579e29cb8SLiming Sun #define MLXBF_BOOTCTL_FUSE_STATUS_LIFECYCLE 0 /* Return lifecycle status. */ 12679e29cb8SLiming Sun #define MLXBF_BOOTCTL_FUSE_STATUS_KEYS 1 /* Return secure boot key status */ 12779e29cb8SLiming Sun 12879e29cb8SLiming Sun /* Additional value to disable the MLXBF_BOOTCTL_SET_SECOND_RESET_ACTION. */ 12979e29cb8SLiming Sun #define MLXBF_BOOTCTL_NONE 0x7fffffff /* Don't change next boot action */ 13079e29cb8SLiming Sun 131b18a97edSAsmaa Mnebhi #define MLXBF_LARGE_ICMC_MAX_STRING_SIZE 16 132b18a97edSAsmaa Mnebhi #define MLXBF_LARGE_ICMC_SIZE_MIN 0x80 133b18a97edSAsmaa Mnebhi #define MLXBF_LARGE_ICMC_SIZE_MAX 0x100000 134b18a97edSAsmaa Mnebhi #define MLXBF_LARGE_ICMC_GRANULARITY MLXBF_LARGE_ICMC_SIZE_MIN 135b18a97edSAsmaa Mnebhi 13679e29cb8SLiming Sun #endif /* __MLXBF_BOOTCTL_H__ */ 137