blob: 45ce281eb2adcb72fc1b17c7db1d3b3cbfdd77fe [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
developerafa342e2020-12-14 17:41:08 +080034/* VCORE */
35#define MTK_SIP_VCORE_CONTROL_ARCH32 0x82000506
36#define MTK_SIP_VCORE_CONTROL_ARCH64 0xC2000506
37
developer65014b82015-04-13 14:47:57 +080038/* Mediatek SiP Calls error code */
39enum {
40 MTK_SIP_E_SUCCESS = 0,
developer14f3fe32016-04-28 14:07:42 +080041 MTK_SIP_E_INVALID_PARAM = -1,
42 MTK_SIP_E_NOT_SUPPORTED = -2,
43 MTK_SIP_E_INVALID_RANGE = -3,
44 MTK_SIP_E_PERMISSION_DENY = -4,
45 MTK_SIP_E_LOCK_FAIL = -5
developer65014b82015-04-13 14:47:57 +080046};
47
48/*
49 * This function should be implemented in Mediatek SOC directory. It fullfills
50 * MTK_SIP_SET_AUTHORIZED_SECURE_REG SiP call by checking the sreg with the
51 * predefined secure register list, if a match was found, set val to sreg.
52 *
53 * Return MTK_SIP_E_SUCCESS on success, and MTK_SIP_E_INVALID_PARAM on failure.
54 */
55uint64_t mt_sip_set_authorized_sreg(uint32_t sreg, uint32_t val);
developer73b982f2016-05-11 18:04:09 +080056
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000057#endif /* MTK_SIP_SVC_H */