hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/rockchip/rockchip_sip.h
....@@ -52,6 +52,12 @@
5252 #define SIP_SDEI_FIQ_DBG_SWITCH_CPU 0x82000020
5353 #define SIP_SDEI_FIQ_DBG_GET_EVENT_ID 0x82000021
5454 #define RK_SIP_AMP_CFG 0x82000022
55
+#define RK_SIP_FIQ_CTRL 0x82000024
56
+#define SIP_HDCP_CONFIG 0x82000025
57
+#define SIP_WDT_CFG 0x82000026
58
+#define SIP_HDMIRX_CFG 0x82000027
59
+
60
+#define TRUSTED_OS_HDCPKEY_INIT 0xB7000003
5561
5662 /* Rockchip Sip version */
5763 #define SIP_IMPLEMENT_V1 (1)
....@@ -100,6 +106,8 @@
100106 #define VIRTUAL_POWEROFF 0x07
101107 #define SUSPEND_WFI_TIME_MS 0x08
102108 #define LINUX_PM_STATE 0x09
109
+#define SUSPEND_IO_RET_CONFIG 0x0a
110
+#define SLEEP_PIN_CONFIG 0x0b
103111
104112 /* SIP_REMOTECTL_CFG call types */
105113 #define REMOTECTL_SET_IRQ 0xf0
....@@ -109,6 +117,16 @@
109117 #define REMOTECTL_ENABLE 0xf4
110118 /* wakeup state */
111119 #define REMOTECTL_PWRKEY_WAKEUP 0xdeadbeaf
120
+
121
+struct dram_addrmap_info {
122
+ u64 ch_mask[2];
123
+ u64 bk_mask[4];
124
+ u64 bg_mask[2];
125
+ u64 cs_mask[2];
126
+ u32 reserved[20];
127
+ u32 bank_bit_first;
128
+ u32 bank_bit_mask;
129
+};
112130
113131 /* AMP Ctrl */
114132 enum {
....@@ -120,16 +138,6 @@
120138 RK_AMP_SUB_FUNC_RSV, /* for RTOS */
121139 RK_AMP_SUB_FUNC_CPU_ON,
122140 RK_AMP_SUB_FUNC_END,
123
-};
124
-
125
-struct dram_addrmap_info {
126
- u64 ch_mask[2];
127
- u64 bk_mask[4];
128
- u64 bg_mask[2];
129
- u64 cs_mask[2];
130
- u32 reserved[20];
131
- u32 bank_bit_first;
132
- u32 bank_bit_mask;
133141 };
134142
135143 enum {
....@@ -150,8 +158,49 @@
150158 SHARE_PAGE_TYPE_DDRFSP,
151159 SHARE_PAGE_TYPE_DDR_ADDRMAP,
152160 SHARE_PAGE_TYPE_LAST_LOG,
161
+ SHARE_PAGE_TYPE_HDCP,
153162 SHARE_PAGE_TYPE_MAX,
154163 } share_page_type_t;
164
+
165
+/* fiq control sub func */
166
+enum {
167
+ RK_SIP_FIQ_CTRL_FIQ_EN = 1,
168
+ RK_SIP_FIQ_CTRL_FIQ_DIS,
169
+ RK_SIP_FIQ_CTRL_SET_AFF
170
+};
171
+
172
+/* hdcp function types */
173
+enum {
174
+ HDCP_FUNC_STORAGE_INCRYPT = 1,
175
+ HDCP_FUNC_KEY_LOAD,
176
+ HDCP_FUNC_ENCRYPT_MODE
177
+};
178
+
179
+/* support hdcp device list */
180
+enum {
181
+ DP_TX0,
182
+ DP_TX1,
183
+ EDP_TX0,
184
+ EDP_TX1,
185
+ HDMI_TX0,
186
+ HDMI_TX1,
187
+ HDMI_RX,
188
+ MAX_DEVICE,
189
+};
190
+
191
+/* SIP_WDT_CONFIG call types */
192
+enum {
193
+ WDT_START = 0,
194
+ WDT_STOP = 1,
195
+ WDT_PING = 2,
196
+};
197
+
198
+/* SIP_HDMIRX_CONFIG child configs */
199
+enum {
200
+ HDMIRX_AUTO_TOUCH_EN = 0,
201
+ HDMIRX_REG_PRE_FETCH = 1,
202
+ HDMIRX_INFO_NOTIFY = 2,
203
+};
155204
156205 struct pt_regs;
157206 typedef void (*sip_fiq_debugger_uart_irq_tf_cb_t)(struct pt_regs *_pt_regs, unsigned long cpu);
....@@ -162,7 +211,7 @@
162211 * a0: error code(0: success, !0: error);
163212 * a1~a3: data
164213 */
165
-#if IS_ENABLED(CONFIG_ROCKCHIP_SIP)
214
+#if IS_REACHABLE(CONFIG_ROCKCHIP_SIP)
166215 struct arm_smccc_res sip_smc_get_atf_version(void);
167216 struct arm_smccc_res sip_smc_get_sip_version(void);
168217 struct arm_smccc_res sip_smc_dram(u32 arg0, u32 arg1, u32 arg2);
....@@ -180,10 +229,13 @@
180229 int sip_smc_secure_reg_write(u32 addr_phy, u32 val);
181230 u32 sip_smc_secure_reg_read(u32 addr_phy);
182231 struct arm_smccc_res sip_smc_bus_config(u32 arg0, u32 arg1, u32 arg2);
232
+struct dram_addrmap_info *sip_smc_get_dram_map(void);
183233 int sip_smc_amp_config(u32 sub_func_id, u32 arg1, u32 arg2, u32 arg3);
184234 struct arm_smccc_res sip_smc_get_amp_info(u32 sub_func_id, u32 arg1);
185
-struct dram_addrmap_info *sip_smc_get_dram_map(void);
186235
236
+void __iomem *sip_hdcp_request_share_memory(int id);
237
+struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2);
238
+ulong sip_cpu_logical_map_mpidr(u32 cpu);
187239 /***************************fiq debugger **************************************/
188240 void sip_fiq_debugger_enable_fiq(bool enable, uint32_t tgt_cpu);
189241 void sip_fiq_debugger_enable_debug(bool enable);
....@@ -195,49 +247,59 @@
195247 int sip_fiq_debugger_sdei_switch_cpu(u32 cur_cpu, u32 target_cpu, u32 flag);
196248 int sip_fiq_debugger_is_enabled(void);
197249 int sip_fiq_debugger_sdei_get_event_id(u32 *fiq, u32 *sw_cpu, u32 *flag);
250
+int sip_fiq_control(u32 sub_func, u32 irq, unsigned long data);
251
+int sip_wdt_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3);
252
+int sip_hdmirx_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3);
253
+int sip_hdcpkey_init(u32 hdcp_id);
198254 #else
199255 static inline struct arm_smccc_res sip_smc_get_atf_version(void)
200256 {
201
- struct arm_smccc_res tmp = {0};
257
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
202258 return tmp;
203259 }
204260
205261 static inline struct arm_smccc_res sip_smc_get_sip_version(void)
206262 {
207
- struct arm_smccc_res tmp = {0};
263
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
208264 return tmp;
209265 }
210266
211267 static inline struct arm_smccc_res sip_smc_dram(u32 arg0, u32 arg1, u32 arg2)
212268 {
213
- struct arm_smccc_res tmp = {0};
269
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
214270 return tmp;
215271 }
216272
217273 static inline struct arm_smccc_res sip_smc_request_share_mem
218274 (u32 page_num, share_page_type_t page_type)
219275 {
220
- struct arm_smccc_res tmp = {0};
276
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
221277 return tmp;
222278 }
223279
224280 static inline struct arm_smccc_res sip_smc_mcu_el3fiq
225281 (u32 arg0, u32 arg1, u32 arg2)
226282 {
227
- struct arm_smccc_res tmp = {0};
283
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
228284 return tmp;
229285 }
230286
231287 static inline struct arm_smccc_res
232288 sip_smc_vpu_reset(u32 arg0, u32 arg1, u32 arg2)
233289 {
234
- struct arm_smccc_res tmp = {0};
290
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
291
+ return tmp;
292
+}
293
+
294
+static inline struct arm_smccc_res sip_smc_get_suspend_info(u32 info)
295
+{
296
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
235297 return tmp;
236298 }
237299
238300 static inline struct arm_smccc_res sip_smc_lastlog_request(void)
239301 {
240
- struct arm_smccc_res tmp = {0};
302
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
241303 return tmp;
242304 }
243305
....@@ -246,19 +308,17 @@
246308 return 0;
247309 }
248310
249
-static inline int sip_smc_get_suspend_info(u32 info)
250
-{
251
- return 0;
252
-}
253
-
254311 static inline int sip_smc_virtual_poweroff(void) { return 0; }
255312 static inline int sip_smc_remotectl_config(u32 func, u32 data) { return 0; }
256
-static inline u32 sip_smc_secure_reg_read(u32 addr_phy) { return 0; }
257313 static inline int sip_smc_secure_reg_write(u32 addr_phy, u32 val) { return 0; }
258
-static inline int sip_smc_soc_bus_div(u32 arg0, u32 arg1, u32 arg2)
314
+static inline u32 sip_smc_secure_reg_read(u32 addr_phy) { return 0; }
315
+
316
+static inline struct arm_smccc_res sip_smc_bus_config(u32 arg0, u32 arg1, u32 arg2)
259317 {
260
- return 0;
318
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
319
+ return tmp;
261320 }
321
+
262322 static inline struct dram_addrmap_info *sip_smc_get_dram_map(void)
263323 {
264324 return NULL;
....@@ -279,6 +339,20 @@
279339
280340 return tmp;
281341 }
342
+
343
+static inline void __iomem *sip_hdcp_request_share_memory(int id)
344
+{
345
+ return NULL;
346
+}
347
+
348
+static inline struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2)
349
+{
350
+ struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED };
351
+
352
+ return tmp;
353
+}
354
+
355
+static inline ulong sip_cpu_logical_map_mpidr(u32 cpu) { return 0; }
282356
283357 /***************************fiq debugger **************************************/
284358 static inline void sip_fiq_debugger_enable_fiq
....@@ -303,6 +377,36 @@
303377 static inline int sip_fiq_debugger_sdei_switch_cpu(u32 cur_cpu, u32 target_cpu,
304378 u32 flag) { return 0; }
305379 static inline int sip_fiq_debugger_is_enabled(void) { return 0; }
380
+static inline int sip_fiq_debugger_sdei_get_event_id(u32 *fiq, u32 *sw_cpu, u32 *flag)
381
+{
382
+ return SIP_RET_NOT_SUPPORTED;
383
+}
384
+
385
+static inline int sip_fiq_control(u32 sub_func, u32 irq, unsigned long data)
386
+{
387
+ return 0;
388
+}
389
+
390
+static inline int sip_wdt_config(u32 sub_func,
391
+ u32 arg1,
392
+ u32 arg2,
393
+ u32 arg3)
394
+{
395
+ return 0;
396
+}
397
+
398
+static inline int sip_hdmirx_config(u32 sub_func,
399
+ u32 arg1,
400
+ u32 arg2,
401
+ u32 arg3)
402
+{
403
+ return SIP_RET_NOT_SUPPORTED;
404
+}
405
+
406
+static inline int sip_hdcpkey_init(u32 hdcp_id)
407
+{
408
+ return 0;
409
+}
306410 #endif
307411
308412 /* 32-bit OP-TEE context, never change order of members! */