blob: cd4096e738849b9feecc82a6e90e09dd43205354 [file] [log] [blame]
developer65014b82015-04-13 14:47:57 +08001/*
2 * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
developer65014b82015-04-13 14:47:57 +08005 */
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00006#ifndef MTK_SIP_SVC_H
7#define MTK_SIP_SVC_H
developer65014b82015-04-13 14:47:57 +08008
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
developer14f3fe32016-04-28 14:07:42 +080021#define SMC_AARCH64_BIT 0x40000000
22
developer65014b82015-04-13 14:47:57 +080023/* Number of Mediatek SiP Calls implemented */
developer73b982f2016-05-11 18:04:09 +080024#define MTK_COMMON_SIP_NUM_CALLS 4
developer65014b82015-04-13 14:47:57 +080025
26/* Mediatek SiP Service Calls function IDs */
27#define MTK_SIP_SET_AUTHORIZED_SECURE_REG 0x82000001
28
developer14f3fe32016-04-28 14:07:42 +080029/* 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
developer65014b82015-04-13 14:47:57 +080034/* Mediatek SiP Calls error code */
35enum {
36 MTK_SIP_E_SUCCESS = 0,
developer14f3fe32016-04-28 14:07:42 +080037 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
developer65014b82015-04-13 14:47:57 +080042};
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 */
51uint64_t mt_sip_set_authorized_sreg(uint32_t sreg, uint32_t val);
developer73b982f2016-05-11 18:04:09 +080052
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000053#endif /* MTK_SIP_SVC_H */