developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 5 | */ |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 6 | #ifndef MTK_SIP_SVC_H |
| 7 | #define MTK_SIP_SVC_H |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 8 | |
| 9 | #include <stdint.h> |
| 10 | |
| 11 | /* SMC function IDs for SiP Service queries */ |
| 12 | #define SIP_SVC_CALL_COUNT 0x8200ff00 |
| 13 | #define SIP_SVC_UID 0x8200ff01 |
| 14 | /* 0x8200ff02 is reserved */ |
| 15 | #define SIP_SVC_VERSION 0x8200ff03 |
| 16 | |
| 17 | /* Mediatek SiP Service Calls version numbers */ |
| 18 | #define MTK_SIP_SVC_VERSION_MAJOR 0x0 |
| 19 | #define MTK_SIP_SVC_VERSION_MINOR 0x1 |
| 20 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 21 | #define SMC_AARCH64_BIT 0x40000000 |
| 22 | |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 23 | /* Number of Mediatek SiP Calls implemented */ |
developer | 73b982f | 2016-05-11 18:04:09 +0800 | [diff] [blame] | 24 | #define MTK_COMMON_SIP_NUM_CALLS 4 |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 25 | |
| 26 | /* Mediatek SiP Service Calls function IDs */ |
| 27 | #define MTK_SIP_SET_AUTHORIZED_SECURE_REG 0x82000001 |
| 28 | |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 29 | /* For MTK SMC from Secure OS */ |
| 30 | /* 0x82000000 - 0x820000FF & 0xC2000000 - 0xC20000FF */ |
| 31 | #define MTK_SIP_KERNEL_BOOT_AARCH32 0x82000200 |
| 32 | #define MTK_SIP_KERNEL_BOOT_AARCH64 0xC2000200 |
| 33 | |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 34 | /* Mediatek SiP Calls error code */ |
| 35 | enum { |
| 36 | MTK_SIP_E_SUCCESS = 0, |
developer | 14f3fe3 | 2016-04-28 14:07:42 +0800 | [diff] [blame] | 37 | MTK_SIP_E_INVALID_PARAM = -1, |
| 38 | MTK_SIP_E_NOT_SUPPORTED = -2, |
| 39 | MTK_SIP_E_INVALID_RANGE = -3, |
| 40 | MTK_SIP_E_PERMISSION_DENY = -4, |
| 41 | MTK_SIP_E_LOCK_FAIL = -5 |
developer | 65014b8 | 2015-04-13 14:47:57 +0800 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | /* |
| 45 | * This function should be implemented in Mediatek SOC directory. It fullfills |
| 46 | * MTK_SIP_SET_AUTHORIZED_SECURE_REG SiP call by checking the sreg with the |
| 47 | * predefined secure register list, if a match was found, set val to sreg. |
| 48 | * |
| 49 | * Return MTK_SIP_E_SUCCESS on success, and MTK_SIP_E_INVALID_PARAM on failure. |
| 50 | */ |
| 51 | uint64_t mt_sip_set_authorized_sreg(uint32_t sreg, uint32_t val); |
developer | 73b982f | 2016-05-11 18:04:09 +0800 | [diff] [blame] | 52 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 53 | #endif /* MTK_SIP_SVC_H */ |