6db4831e98
Android 14
204 lines
5.1 KiB
C
204 lines
5.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2019 MediaTek Inc.
|
|
*/
|
|
|
|
#ifndef __MTK_SIP_SVC_H
|
|
#define __MTK_SIP_SVC_H
|
|
|
|
/* Error Code */
|
|
#define SIP_SVC_E_SUCCESS 0
|
|
#define SIP_SVC_E_NOT_SUPPORTED -1
|
|
#define SIP_SVC_E_INVALID_PARAMS -2
|
|
#define SIP_SVC_E_INVALID_RANGE -3
|
|
#define SIP_SVC_E_PERMISSION_DENIED -4
|
|
|
|
#ifdef CONFIG_ARM64
|
|
#define MTK_SIP_SMC_CONVENTION ARM_SMCCC_SMC_64
|
|
#else
|
|
#define MTK_SIP_SMC_CONVENTION ARM_SMCCC_SMC_32
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARM64
|
|
#define MTK_SIP_SMC_AARCH_BIT 0x40000000
|
|
#else
|
|
#define MTK_SIP_SMC_AARCH_BIT 0x00000000
|
|
#endif
|
|
|
|
#define MTK_SIP_SMC_CMD(fn_id) \
|
|
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, MTK_SIP_SMC_CONVENTION, \
|
|
ARM_SMCCC_OWNER_SIP, fn_id)
|
|
|
|
/* 0x82000200 - 0x820003FF & 0xC2000300 - 0xC20003FF */
|
|
/* Debug feature and ATF related */
|
|
#define MTK_SIP_KERNEL_WDT \
|
|
MTK_SIP_SMC_CMD(0x200)
|
|
#define MTK_SIP_KERNEL_GIC_DUMP \
|
|
MTK_SIP_SMC_CMD(0x201)
|
|
#define MTK_SIP_KERNEL_TIME_SYNC \
|
|
MTK_SIP_SMC_CMD(0x202)
|
|
#define MTK_SIP_KERNEL_ATF_DEBUG \
|
|
MTK_SIP_SMC_CMD(0x204)
|
|
#define MTK_SIP_KERNEL_DFD \
|
|
MTK_SIP_SMC_CMD(0x205)
|
|
|
|
/* CCCI debug feature */
|
|
#define MTK_SIP_KERNEL_CCCI_GET_INFO \
|
|
MTK_SIP_SMC_CMD(0x206)
|
|
|
|
/* SPM related SMC call */
|
|
#define MTK_SIP_KERNEL_SPM_SUSPEND_ARGS \
|
|
MTK_SIP_SMC_CMD(0x220)
|
|
#define MTK_SIP_KERNEL_SPM_FIRMWARE_STATUS \
|
|
MTK_SIP_SMC_CMD(0x221)
|
|
#define MTK_SIP_KERNEL_SPM_IRQ0_HANDLER \
|
|
MTK_SIP_SMC_CMD(0x222)
|
|
#define MTK_SIP_KERNEL_SPM_AP_MDSRC_REQ \
|
|
MTK_SIP_SMC_CMD(0x223)
|
|
#define MTK_SIP_KERNEL_SPM_PWR_CTRL_ARGS \
|
|
MTK_SIP_SMC_CMD(0x224)
|
|
#define MTK_SIP_KERNEL_SPM_LEGACY_SLEEP \
|
|
MTK_SIP_SMC_CMD(0x225)
|
|
#define MTK_SIP_KERNEL_SPM_VCOREFS_ARGS \
|
|
MTK_SIP_SMC_CMD(0x226)
|
|
|
|
/* SPM deepidle related SMC call */
|
|
#define MTK_SIP_KERNEL_SPM_DPIDLE_ARGS \
|
|
MTK_SIP_SMC_CMD(0x227)
|
|
|
|
/* SPM SODI related SMC call */
|
|
#define MTK_SIP_KERNEL_SPM_SODI_ARGS \
|
|
MTK_SIP_SMC_CMD(0x228)
|
|
|
|
/* SPM sleep deepidle related SMC call */
|
|
#define MTK_SIP_KERNEL_SPM_SLEEP_DPIDLE_ARGS \
|
|
MTK_SIP_SMC_CMD(0x229)
|
|
/* SPM ARGS */
|
|
#define MTK_SIP_KERNEL_SPM_ARGS \
|
|
MTK_SIP_SMC_CMD(0x22A)
|
|
|
|
/* SPM get pwr_ctrl args */
|
|
#define MTK_SIP_KERNEL_SPM_GET_PWR_CTRL_ARGS \
|
|
MTK_SIP_SMC_CMD(0x22B)
|
|
|
|
/* SPM Check security CG (for deepidle/SODI) */
|
|
#define MTK_SIP_KERNEL_CHECK_SECURE_CG \
|
|
MTK_SIP_SMC_CMD(0x22D)
|
|
|
|
/* SCP DVFS */
|
|
#define MTK_SIP_KERNEL_SCP_DVFS_CTRL \
|
|
MTK_SIP_SMC_CMD(0x232)
|
|
|
|
/* AMMS related SMC call */
|
|
#define MTK_SIP_KERNEL_AMMS_GET_FREE_ADDR \
|
|
MTK_SIP_SMC_CMD(0x250)
|
|
#define MTK_SIP_KERNEL_AMMS_GET_FREE_LENGTH \
|
|
MTK_SIP_SMC_CMD(0x251)
|
|
#define MTK_SIP_KERNEL_AMMS_GET_PENDING \
|
|
MTK_SIP_SMC_CMD(0x252)
|
|
#define MTK_SIP_KERNEL_AMMS_ACK_PENDING \
|
|
MTK_SIP_SMC_CMD(0x253)
|
|
#define MTK_SIP_KERNEL_AMMS_MD_POS_ADDR \
|
|
MTK_SIP_SMC_CMD(0x254)
|
|
#define MTK_SIP_KERNEL_AMMS_MD_POS_LENGTH \
|
|
MTK_SIP_SMC_CMD(0x255)
|
|
#define MTK_SIP_KERNEL_AMMS_GET_MD_POS_ADDR \
|
|
MTK_SIP_SMC_CMD(0x256)
|
|
#define MTK_SIP_KERNEL_AMMS_GET_MD_POS_LENGTH \
|
|
MTK_SIP_SMC_CMD(0x257)
|
|
#define MTK_SIP_KERNEL_AMMS_GET_SEQ_ID \
|
|
MTK_SIP_SMC_CMD(0x258)
|
|
|
|
/* Security related SMC call */
|
|
/* DEVMPU */
|
|
#define MTK_SIP_KERNEL_DEVMPU_VIO_GET \
|
|
MTK_SIP_SMC_CMD(0x264)
|
|
#define MTK_SIP_KERNEL_DEVMPU_PERM_GET \
|
|
MTK_SIP_SMC_CMD(0x265)
|
|
#define MTK_SIP_KERNEL_DEVMPU_VIO_CLR \
|
|
MTK_SIP_SMC_CMD(0x268)
|
|
/* TRNG */
|
|
#define MTK_SIP_KERNEL_GET_RND \
|
|
MTK_SIP_SMC_CMD(0x26A)
|
|
/* DEVAPC */
|
|
#define MTK_SIP_KERNEL_DAPC_PERM_GET \
|
|
MTK_SIP_SMC_CMD(0x26B)
|
|
#define MTK_SIP_KERNEL_CLR_SRAMROM_VIO \
|
|
MTK_SIP_SMC_CMD(0x26C)
|
|
#define MTK_SIP_KERNEL_DAPC_DUMP \
|
|
MTK_SIP_SMC_CMD(0x26D)
|
|
|
|
/* eMMC related SMC call */
|
|
#define MTK_SIP_KERNEL_HW_FDE_KEY \
|
|
MTK_SIP_SMC_CMD(0x272)
|
|
#define MTK_SIP_KERNEL_HW_FDE_MSDC_CTL \
|
|
MTK_SIP_SMC_CMD(0x273)
|
|
|
|
/* UFS related SMC call */
|
|
#define MTK_SIP_UFS_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x276)
|
|
|
|
/* I2C related SMC call */
|
|
#define MTK_SIP_I2C_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x2A0)
|
|
|
|
/* M4U related SMC call */
|
|
#define MTK_M4U_DEBUG_DUMP \
|
|
MTK_SIP_SMC_CMD(0x2B0)
|
|
|
|
/* Debug related SMC call */
|
|
#define MTK_SIP_KERNEL_CCCI_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x505)
|
|
/* VCOREFS */
|
|
#define MTK_SIP_VCOREFS_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x506)
|
|
/* MTK LPM */
|
|
#define MTK_SIP_MTK_LPM_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x507)
|
|
/* EMIMPU */
|
|
#define MTK_SIP_EMIMPU_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x50B)
|
|
#define MTK_SIP_KERNEL_EMIMPU_WRITE \
|
|
MTK_SIP_SMC_CMD(0x260)
|
|
#define MTK_SIP_KERNEL_EMIMPU_READ \
|
|
MTK_SIP_SMC_CMD(0x261)
|
|
#define MTK_SIP_KERNEL_EMIMPU_SET \
|
|
MTK_SIP_SMC_CMD(0x262)
|
|
#define MTK_SIP_KERNEL_EMIMPU_CLEAR \
|
|
MTK_SIP_SMC_CMD(0x263)
|
|
|
|
/* TEEs related SMC call */
|
|
#define MTK_SIP_KERNEL_TEE_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x516)
|
|
|
|
/* AUDIO related SMC call */
|
|
#define MTK_SIP_AUDIO_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x517)
|
|
|
|
/* VPU */
|
|
#define MTK_SIP_APUSYS_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x51E)
|
|
|
|
/* TMEM */
|
|
#define MTK_SIP_KERNEL_TMEM_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x524)
|
|
|
|
/* APU VCORE CG control related SMC call */
|
|
#define MTK_SIP_KERNEL_APU_VCORE_CG_CTL \
|
|
MTK_SIP_SMC_CMD(0x2B1)
|
|
|
|
/* USB related SMC call */
|
|
#define MTK_SIP_KERNEL_USB_CONTROL \
|
|
MTK_SIP_SMC_CMD(0x527)
|
|
|
|
/* SDA */
|
|
#define MTK_SIP_SDA_CONTROL \
|
|
(0x82000525 | MTK_SIP_SMC_AARCH_BIT)
|
|
|
|
/* Clock Buffer */
|
|
#define MTK_SIP_CLKBUF_CONTROL \
|
|
(0x82000520 | MTK_SIP_SMC_AARCH_BIT)
|
|
|
|
|
|
#endif
|