blob: 8e1e9bbf4375c6739b67627a10ee4b923371a9e7 [file] [log] [blame]
Peng Fan0c830d32018-10-18 14:28:07 +02001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright 2017-2018 NXP
4 *
5 */
6
7#ifndef SC_RPC_H
8#define SC_RPC_H
9
10/* Note: Check SCFW API Released DOC before you want to modify something */
11#define SC_RPC_VERSION 1U
12
13#define SC_RPC_MAX_MSG 8U
14
15#define RPC_VER(MSG) ((MSG)->version)
16#define RPC_SIZE(MSG) ((MSG)->size)
17#define RPC_SVC(MSG) ((MSG)->svc)
18#define RPC_FUNC(MSG) ((MSG)->func)
19#define RPC_R8(MSG) ((MSG)->func)
20#define RPC_I32(MSG, IDX) ((MSG)->DATA.i32[(IDX) / 4U])
21#define RPC_I16(MSG, IDX) ((MSG)->DATA.i16[(IDX) / 2U])
22#define RPC_I8(MSG, IDX) ((MSG)->DATA.i8[(IDX)])
23#define RPC_U32(MSG, IDX) ((MSG)->DATA.u32[(IDX) / 4U])
24#define RPC_U16(MSG, IDX) ((MSG)->DATA.u16[(IDX) / 2U])
25#define RPC_U8(MSG, IDX) ((MSG)->DATA.u8[(IDX)])
26
27#define SC_RPC_SVC_UNKNOWN 0U
28#define SC_RPC_SVC_RETURN 1U
29#define SC_RPC_SVC_PM 2U
30#define SC_RPC_SVC_RM 3U
31#define SC_RPC_SVC_TIMER 5U
32#define SC_RPC_SVC_PAD 6U
33#define SC_RPC_SVC_MISC 7U
34#define SC_RPC_SVC_IRQ 8U
Peng Fan098d3e62019-08-26 08:12:16 +000035#define SC_RPC_SVC_SECO 9U
36#define SC_RPC_SVC_ABORT 10U
37
Peng Fan0c830d32018-10-18 14:28:07 +020038
39/* Types */
40
41struct sc_rpc_msg_s {
42 u8 version;
43 u8 size;
44 u8 svc;
45 u8 func;
46 union {
47 s32 i32[(SC_RPC_MAX_MSG - 1U)];
48 s16 i16[(SC_RPC_MAX_MSG - 1U) * 2U];
49 s8 i8[(SC_RPC_MAX_MSG - 1U) * 4U];
50 u32 u32[(SC_RPC_MAX_MSG - 1U)];
51 u16 u16[(SC_RPC_MAX_MSG - 1U) * 2U];
52 u8 u8[(SC_RPC_MAX_MSG - 1U) * 4U];
53 } DATA;
54};
55
56/* PM RPC */
57#define PM_FUNC_UNKNOWN 0
58#define PM_FUNC_SET_SYS_POWER_MODE 19U
59#define PM_FUNC_SET_PARTITION_POWER_MODE 1U
60#define PM_FUNC_GET_SYS_POWER_MODE 2U
61#define PM_FUNC_SET_RESOURCE_POWER_MODE 3U
62#define PM_FUNC_GET_RESOURCE_POWER_MODE 4U
63#define PM_FUNC_REQ_LOW_POWER_MODE 16U
64#define PM_FUNC_REQ_CPU_LOW_POWER_MODE 20U
65#define PM_FUNC_SET_CPU_RESUME_ADDR 17U
66#define PM_FUNC_SET_CPU_RESUME 21U
67#define PM_FUNC_REQ_SYS_IF_POWER_MODE 18U
68#define PM_FUNC_SET_CLOCK_RATE 5U
69#define PM_FUNC_GET_CLOCK_RATE 6U
70#define PM_FUNC_CLOCK_ENABLE 7U
71#define PM_FUNC_SET_CLOCK_PARENT 14U
72#define PM_FUNC_GET_CLOCK_PARENT 15U
73#define PM_FUNC_RESET 13U
74#define PM_FUNC_RESET_REASON 10U
75#define PM_FUNC_BOOT 8U
76#define PM_FUNC_REBOOT 9U
77#define PM_FUNC_REBOOT_PARTITION 12U
78#define PM_FUNC_CPU_START 11U
Peng Fan098d3e62019-08-26 08:12:16 +000079#define PM_FUNC_IS_PARTITION_STARTED 24U
Peng Fan0c830d32018-10-18 14:28:07 +020080
81/* MISC RPC */
82#define MISC_FUNC_UNKNOWN 0
83#define MISC_FUNC_SET_CONTROL 1U
84#define MISC_FUNC_GET_CONTROL 2U
85#define MISC_FUNC_SET_MAX_DMA_GROUP 4U
86#define MISC_FUNC_SET_DMA_GROUP 5U
87#define MISC_FUNC_SECO_IMAGE_LOAD 8U
88#define MISC_FUNC_SECO_AUTHENTICATE 9U
89#define MISC_FUNC_SECO_FUSE_WRITE 20U
90#define MISC_FUNC_SECO_ENABLE_DEBUG 21U
91#define MISC_FUNC_SECO_FORWARD_LIFECYCLE 22U
92#define MISC_FUNC_SECO_RETURN_LIFECYCLE 23U
93#define MISC_FUNC_SECO_BUILD_INFO 24U
94#define MISC_FUNC_DEBUG_OUT 10U
95#define MISC_FUNC_WAVEFORM_CAPTURE 6U
96#define MISC_FUNC_BUILD_INFO 15U
97#define MISC_FUNC_UNIQUE_ID 19U
98#define MISC_FUNC_SET_ARI 3U
99#define MISC_FUNC_BOOT_STATUS 7U
100#define MISC_FUNC_BOOT_DONE 14U
101#define MISC_FUNC_OTP_FUSE_READ 11U
102#define MISC_FUNC_OTP_FUSE_WRITE 17U
103#define MISC_FUNC_SET_TEMP 12U
104#define MISC_FUNC_GET_TEMP 13U
105#define MISC_FUNC_GET_BOOT_DEV 16U
106#define MISC_FUNC_GET_BUTTON_STATUS 18U
107
108/* PAD RPC */
109#define PAD_FUNC_UNKNOWN 0
110#define PAD_FUNC_SET_MUX 1U
111#define PAD_FUNC_GET_MUX 6U
112#define PAD_FUNC_SET_GP 2U
113#define PAD_FUNC_GET_GP 7U
114#define PAD_FUNC_SET_WAKEUP 4U
115#define PAD_FUNC_GET_WAKEUP 9U
116#define PAD_FUNC_SET_ALL 5U
117#define PAD_FUNC_GET_ALL 10U
118#define PAD_FUNC_SET 15U
119#define PAD_FUNC_GET 16U
120#define PAD_FUNC_SET_GP_28FDSOI 11U
121#define PAD_FUNC_GET_GP_28FDSOI 12U
122#define PAD_FUNC_SET_GP_28FDSOI_HSIC 3U
123#define PAD_FUNC_GET_GP_28FDSOI_HSIC 8U
124#define PAD_FUNC_SET_GP_28FDSOI_COMP 13U
125#define PAD_FUNC_GET_GP_28FDSOI_COMP 14U
126
127/* RM RPC */
128#define RM_FUNC_UNKNOWN 0
129#define RM_FUNC_PARTITION_ALLOC 1U
130#define RM_FUNC_SET_CONFIDENTIAL 31U
131#define RM_FUNC_PARTITION_FREE 2U
132#define RM_FUNC_GET_DID 26U
133#define RM_FUNC_PARTITION_STATIC 3U
134#define RM_FUNC_PARTITION_LOCK 4U
135#define RM_FUNC_GET_PARTITION 5U
136#define RM_FUNC_SET_PARENT 6U
137#define RM_FUNC_MOVE_ALL 7U
138#define RM_FUNC_ASSIGN_RESOURCE 8U
139#define RM_FUNC_SET_RESOURCE_MOVABLE 9U
140#define RM_FUNC_SET_SUBSYS_RSRC_MOVABLE 28U
141#define RM_FUNC_SET_MASTER_ATTRIBUTES 10U
142#define RM_FUNC_SET_MASTER_SID 11U
143#define RM_FUNC_SET_PERIPHERAL_PERMISSIONS 12U
144#define RM_FUNC_IS_RESOURCE_OWNED 13U
Peng Fand4191db2019-09-23 10:12:31 +0000145#define RM_FUNC_GET_RESOURCE_OWNER 33U
Peng Fan0c830d32018-10-18 14:28:07 +0200146#define RM_FUNC_IS_RESOURCE_MASTER 14U
147#define RM_FUNC_IS_RESOURCE_PERIPHERAL 15U
148#define RM_FUNC_GET_RESOURCE_INFO 16U
149#define RM_FUNC_MEMREG_ALLOC 17U
150#define RM_FUNC_MEMREG_SPLIT 29U
151#define RM_FUNC_MEMREG_FREE 18U
152#define RM_FUNC_FIND_MEMREG 30U
153#define RM_FUNC_ASSIGN_MEMREG 19U
154#define RM_FUNC_SET_MEMREG_PERMISSIONS 20U
155#define RM_FUNC_IS_MEMREG_OWNED 21U
156#define RM_FUNC_GET_MEMREG_INFO 22U
157#define RM_FUNC_ASSIGN_PAD 23U
158#define RM_FUNC_SET_PAD_MOVABLE 24U
159#define RM_FUNC_IS_PAD_OWNED 25U
160#define RM_FUNC_DUMP 27U
161
Peng Fand4191db2019-09-23 10:12:31 +0000162/* SECO RPC */
163#define SECO_FUNC_UNKNOWN 0
164#define SECO_FUNC_IMAGE_LOAD 1U
165#define SECO_FUNC_AUTHENTICATE 2U
166#define SECO_FUNC_FORWARD_LIFECYCLE 3U
167#define SECO_FUNC_RETURN_LIFECYCLE 4U
168#define SECO_FUNC_COMMIT 5U
169#define SECO_FUNC_ATTEST_MODE 6U
170#define SECO_FUNC_ATTEST 7U
171#define SECO_FUNC_GET_ATTEST_PKEY 8U
172#define SECO_FUNC_GET_ATTEST_SIGN 9U
173#define SECO_FUNC_ATTEST_VERIFY 10U
174#define SECO_FUNC_GEN_KEY_BLOB 11U
175#define SECO_FUNC_LOAD_KEY 12U
176#define SECO_FUNC_GET_MP_KEY 13U
177#define SECO_FUNC_UPDATE_MPMR 14U
178#define SECO_FUNC_GET_MP_SIGN 15U
179#define SECO_FUNC_BUILD_INFO 16U
180#define SECO_FUNC_CHIP_INFO 17U
181#define SECO_FUNC_ENABLE_DEBUG 18U
182#define SECO_FUNC_GET_EVENT 19U
183#define SECO_FUNC_FUSE_WRITE 20U
184
Peng Fan0c830d32018-10-18 14:28:07 +0200185#endif /* SC_RPC_H */