blob: 2d454ed7e06d50529475d9111b0725b86880dde9 [file] [log] [blame]
Amit Blayfe23ee22015-01-09 19:09:51 +02001/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
Shashank Mittal162244e2011-08-08 19:01:25 -07002
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
Siddhartha Agrawaleb094c52013-01-28 12:11:43 -080012 * * Neither the name of The Linux Foundation nor the names of its
Shashank Mittal162244e2011-08-08 19:01:25 -070013 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __SCM_H__
30#define __SCM_H__
31
Channagoud Kadabidd85e7f2014-08-05 19:58:37 -070032/* ARM SCM format support related flags */
33#define SIP_SVC_CALLS 0x02000000
34#define MAKE_SIP_SCM_CMD(svc_id, cmd_id) ((((svc_id << 8) | (cmd_id)) & 0xFFFF) | SIP_SVC_CALLS)
35#define MAKE_SCM_VAR_ARGS(num_args, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, ...) (\
36 (((t0) & 0xff) << 4) | \
37 (((t1) & 0xff) << 6) | \
38 (((t2) & 0xff) << 8) | \
39 (((t3) & 0xff) << 10) | \
40 (((t4) & 0xff) << 12) | \
41 (((t5) & 0xff) << 14) | \
42 (((t6) & 0xff) << 16) | \
43 (((t7) & 0xff) << 18) | \
44 (((t8) & 0xff) << 20) | \
45 (((t9) & 0xff) << 22) | \
46 (num_args & 0xffff))
47#define MAKE_SCM_ARGS(...) MAKE_SCM_VAR_ARGS(__VA_ARGS__, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
48#define SCM_ATOMIC_BIT BIT(31)
49#define SCM_MAX_ARG_LEN 5
50#define SCM_INDIR_MAX_LEN 10
51
52enum
53{
54 SMC_PARAM_TYPE_VALUE = 0,
55 SMC_PARAM_TYPE_BUFFER_READ,
56 SMC_PARAM_TYPE_BUFFER_READWRITE,
57 SMC_PARAM_TYPE_BUFFER_VALIDATION,
58} scm_arg_type;
59
Shashank Mittal162244e2011-08-08 19:01:25 -070060/* 8 Byte SSD magic number (LE) */
Neeti Desai127b9e02012-03-20 16:11:23 -070061#define DECRYPT_MAGIC_0 0x73737A74
62#define DECRYPT_MAGIC_1 0x676D6964
63#define ENCRYPT_MAGIC_0 0x6B647373
64#define ENCRYPT_MAGIC_1 0x676D6973
Shashank Mittal162244e2011-08-08 19:01:25 -070065#define SSD_HEADER_MAGIC_SIZE 8
66#define SSD_HEADER_XML_SIZE 2048
sundarajan srinivasan6173b872013-03-13 17:36:48 -070067#define SSD_HEADER_MIN_SIZE 128
68#define MULTIPLICATION_FACTOR 2
Shashank Mittal162244e2011-08-08 19:01:25 -070069
70typedef unsigned int uint32;
71
Ajay Dudanib01e5062011-12-03 23:23:42 -080072typedef struct {
73 uint32 len;
74 uint32 buf_offset;
75 uint32 resp_hdr_offset;
76 uint32 id;
Shashank Mittal162244e2011-08-08 19:01:25 -070077} scm_command;
78
Ajay Dudanib01e5062011-12-03 23:23:42 -080079typedef struct {
80 uint32 len;
81 uint32 buf_offset;
82 uint32 is_complete;
Shashank Mittal162244e2011-08-08 19:01:25 -070083} scm_response;
84
Ajay Dudanib01e5062011-12-03 23:23:42 -080085typedef struct {
Ajay Dudanib01e5062011-12-03 23:23:42 -080086 uint32 *img_ptr;
87 uint32 *img_len_ptr;
Neeti Desai127b9e02012-03-20 16:11:23 -070088} img_req;
Shashank Mittal162244e2011-08-08 19:01:25 -070089
Siddhartha Agrawaleb094c52013-01-28 12:11:43 -080090typedef struct {
91 uint32 id;
92 uint32 spare;
93} tz_secure_cfg;
94
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -080095typedef struct {
96 uint32 md_len;
97 uint32* md;
98} ssd_parse_md_req;
99
100typedef struct {
101 uint32 status;
102 uint32 md_ctx_id;
103 uint32* md_end_ptr;
104} ssd_parse_md_rsp;
105
106typedef struct {
107 uint32 md_ctx_id;
108 uint32 last_frag;
109 uint32 frag_len;
110 uint32 *frag;
111} ssd_decrypt_img_frag_req;
112
113typedef struct {
114 uint32 status;
115} ssd_decrypt_img_frag_rsp;
116
117typedef struct{
118 uint32 feature_id;
119} feature_version_req;
120
121typedef struct{
122 uint32 version;
123} feature_version_rsp;
124
125typedef struct{
Amit Blaybdfabc62015-01-29 22:04:13 +0200126 uint32 *status_ptr;
127 uint32 status_len;
128} get_secure_state_req;
129
130typedef struct{
131 uint32 status_low;
132 uint32 status_high;
133} get_secure_state_rsp;
134
135typedef struct{
136 uint32 row_address;
137 uint32 addr_type;
138 uint32 *row_data;
139 uint32 *qfprom_api_status;
140} qfprom_read_row_req;
141
142typedef struct{
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800143 uint32 *keystore_ptr;
144 uint32 keystore_len;
145} ssd_protect_keystore_req;
146
147typedef struct{
148 uint32 status;
149} ssd_protect_keystore_rsp;
150
Abhimanyu Kapurb3207fb2014-01-27 21:33:23 -0800151typedef struct {
Aparna Mallavarapu6875ade2014-06-16 22:15:28 +0530152 uint32_t config;
153 uint32_t spare;
154} tz_xpu_prot_cmd;
155
156typedef struct {
Abhimanyu Kapurb3207fb2014-01-27 21:33:23 -0800157 uint64_t el1_x0;
158 uint64_t el1_x1;
159 uint64_t el1_x2;
160 uint64_t el1_x3;
161 uint64_t el1_x4;
162 uint64_t el1_x5;
163 uint64_t el1_x6;
164 uint64_t el1_x7;
165 uint64_t el1_x8;
166 uint64_t el1_elr;
167} el1_system_param;
168
Maria Yubeeeeaf2014-06-30 13:05:43 +0800169struct tz_prng_data {
170 uint8_t *out_buf;
171 uint32_t out_buf_size;
Maria Yud3aec502014-12-23 16:58:47 +0800172}__PACKED;
Maria Yubeeeeaf2014-06-30 13:05:43 +0800173
Amit Blayfe23ee22015-01-09 19:09:51 +0200174typedef struct {
175 uint8_t *in_buf;
176 uint32_t in_buf_size;
177 uint8_t *out_buf;
178 uint32_t out_buf_size;
179 uint32_t direction;
180} mdtp_cipher_dip_req;
181
Channagoud Kadabidd85e7f2014-08-05 19:58:37 -0700182/* SCM support as per ARM spec */
183/*
184 * Structure to define the argument for scm call
185 * x0: is the command ID
186 * x1: Number of argument & type of arguments
187 * : Type can be any of
188 * : SMC_PARAM_TYPE_VALUE 0
189 * : SMC_PARAM_TYPE_BUFFER_READ 1
190 * : SMC_PARAM_TYPE_BUFFER_READWRITE 2
191 * : SMC_PARAM_TYPE_BUFFER_VALIDATION 3
192 * @Note: Number of argument count starts from X2.
193 * x2-x4: Arguments
194 * X5[10]: if the number of argument is more, an indirect
195 * : list can be passed here.
196 */
197typedef struct {
198 uint32_t x0;/* command ID details as per ARMv8 spec :
199 0:7 command, 8:15 service id
200 0x02000000: SIP calls
201 30: SMC32 or SMC64
202 31: Standard or fast calls*/
203 uint32_t x1; /* # of args and attributes for buffers
204 * 0-3: arg #
205 * 4-5: type of arg1
206 * 6-7: type of arg2
207 * :
208 * :
209 * 20-21: type of arg8
210 * 22-23: type of arg9
211 */
212 uint32_t x2; /* Param1 */
213 uint32_t x3; /* Param2 */
214 uint32_t x4; /* Param3 */
215 uint32_t x5[10]; /* Indirect parameter list */
216 uint32_t atomic; /* To indicate if its standard or fast call */
217} scmcall_arg;
218
219/* Return value for the SCM call:
220 * SCM call returns values in register if its less than
221 * 12 bytes, anything greater need to be input buffer + input len
222 * arguments
223 */
224typedef struct
225{
226 uint32_t x1;
227 uint32_t x2;
228 uint32_t x3;
229} scmcall_ret;
230
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800231/* Service IDs */
Aparna Mallavarapu68e233f2014-03-21 19:18:34 +0530232#define SCM_SVC_BOOT 0x01
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800233#define TZBSP_SVC_INFO 0x06
234#define SCM_SVC_SSD 0x07
235#define SVC_MEMORY_PROTECTION 0x0C
Maria Yubeeeeaf2014-06-30 13:05:43 +0800236#define TZ_SVC_CRYPTO 0x0A
Channagoud Kadabidd85e7f2014-08-05 19:58:37 -0700237#define SCM_SVC_INFO 0x06
Channagoud Kadabi6479ce32015-06-17 17:30:40 -0700238#define TZ_SVC_DLOAD_MODE 0x3
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800239
240/*Service specific command IDs */
Aparna Mallavarapu6875ade2014-06-16 22:15:28 +0530241#define ERR_FATAL_ENABLE 0x0
Neeti Desai127b9e02012-03-20 16:11:23 -0700242#define SSD_DECRYPT_ID 0x01
243#define SSD_ENCRYPT_ID 0x02
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800244#define SSD_PROTECT_KEYSTORE_ID 0x05
245#define SSD_PARSE_MD_ID 0x06
246#define SSD_DECRYPT_IMG_FRAG_ID 0x07
Aparna Mallavarapu68e233f2014-03-21 19:18:34 +0530247#define WDOG_DEBUG_DISABLE 0x09
248#define SCM_DLOAD_CMD 0x10
Aparna Mallavarapu6875ade2014-06-16 22:15:28 +0530249#define XPU_ERR_FATAL 0xe
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800250
251#define SECURE_DEVICE_MDSS 0x01
252
Siddhartha Agrawaleb094c52013-01-28 12:11:43 -0800253#define IOMMU_SECURE_CFG 0x02
254
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800255#define TZ_INFO_GET_FEATURE_ID 0x03
Amit Blaybdfabc62015-01-29 22:04:13 +0200256#define TZ_INFO_GET_SECURE_STATE 0x04
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800257
Maria Yubeeeeaf2014-06-30 13:05:43 +0800258#define PRNG_CMD_ID 0x01
Channagoud Kadabidd85e7f2014-08-05 19:58:37 -0700259#define IS_CALL_AVAIL_CMD 0x01
Aparna Mallavarapu246c30b2014-12-11 12:07:51 +0530260#define IS_SECURE_BOOT_ENABLED 0x04
Maria Yubeeeeaf2014-06-30 13:05:43 +0800261
Aparna Mallavarapu68e233f2014-03-21 19:18:34 +0530262/* Download Mode specific arguments to be passed to TZ */
Lijuan Gaof1286fb2015-01-29 19:47:28 +0800263#define SCM_EDLOAD_MODE 0x01
Aparna Mallavarapu68e233f2014-03-21 19:18:34 +0530264#define SCM_DLOAD_MODE 0x10
265
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800266/* SSD parsing status messages from TZ */
267#define SSD_PMD_ENCRYPTED 0
268#define SSD_PMD_NOT_ENCRYPTED 1
269#define SSD_PMD_NO_MD_FOUND 3
270#define SSD_PMD_BUSY 4
271#define SSD_PMD_BAD_MD_PTR_OR_LEN 5
272#define SSD_PMD_PARSING_INCOMPLETE 6
273#define SSD_PMD_PARSING_FAILED 7
274#define SSD_PMD_SETUP_CIPHER_FAILED 8
275
276/* Keystore status messages */
277#define TZBSP_SSD_PKS_SUCCESS 0 /**< Successful return. */
278#define TZBSP_SSD_PKS_INVALID_PTR 1 /**< Keystore pointer invalid. */
279#define TZBSP_SSD_PKS_INVALID_LEN 2 /**< Keystore length incorrect. */
280#define TZBSP_SSD_PKS_UNALIGNED_PTR 3 /**< Keystore pointer not word
281 aligned. */
282#define TZBSP_SSD_PKS_PROTECT_MEM_FAILED 4 /**< Failure when protecting
283 the keystore memory.*/
284#define TZBSP_SSD_PKS_INVALID_NUM_KEYS 5 /**< Unsupported number of
285 keys passed. If a valid
286 pointer to non-secure
287 memory is passed that
288 isn't a keystore, this is
289 a likely return code. */
290#define TZBSP_SSD_PKS_DECRYPT_FAILED 6 /**< The keystore could not be
291 decrypted. */
292
293/* Features in TZ */
294#define TZBSP_FVER_SSD 5
295
296#define TZBSP_GET_FEATURE_VERSION(major) ((major >> 22)& 0x3FF)
Siddhartha Agrawaleb094c52013-01-28 12:11:43 -0800297
Shashank Mittal162244e2011-08-08 19:01:25 -0700298static uint32 smc(uint32 cmd_addr);
Neeti Desai127b9e02012-03-20 16:11:23 -0700299int decrypt_scm(uint32_t ** img_ptr, uint32_t * img_len_ptr);
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800300int decrypt_scm_v2(uint32_t ** img_ptr, uint32_t * img_len_ptr);
Neeti Desai127b9e02012-03-20 16:11:23 -0700301int encrypt_scm(uint32_t ** img_ptr, uint32_t * img_len_ptr);
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800302int scm_svc_version(uint32 * major, uint32 * minor);
Amit Blaybdfabc62015-01-29 22:04:13 +0200303
304/**
305 * Check security status on the device. Returns the security check result.
306 * Bit value 0 means the check passing, and bit value 1 means the check failing.
307 *
308 * @state_low[out] : lower 32 bits of the state:
309 * Bit 0: secboot enabling check failed
310 * Bit 1: Sec HW key is not programmed
311 * Bit 2: debug disable check failed
312 * Bit 3: Anti-rollback check failed
313 * Bit 4: fuse config check failed
314 * Bit 5: rpmb fuse check failed
315 * @state_high[out] : highr 32 bits of the state.
316 *
317 * Returns 0 on success, negative on failure.
318 */
319int scm_svc_get_secure_state(uint32_t *state_low, uint32_t *state_high);
320
sundarajan srinivasan4dfd4f72013-02-27 14:13:09 -0800321int scm_protect_keystore(uint32_t * img_ptr, uint32_t img_len);
Dinesh K Garg6bbbb702015-01-30 11:13:31 -0800322int
323scm_call(uint32_t svc_id, uint32_t cmd_id, const void *cmd_buf,
324 size_t cmd_len, void *resp_buf, size_t resp_len);
325
Shashank Mittal162244e2011-08-08 19:01:25 -0700326
Deepa Dinamani193874e2012-02-07 14:00:04 -0800327#define SCM_SVC_FUSE 0x08
328#define SCM_BLOW_SW_FUSE_ID 0x01
329#define SCM_IS_SW_FUSE_BLOWN_ID 0x02
Amit Blaybdfabc62015-01-29 22:04:13 +0200330#define SCM_QFPROM_READ_ROW_ID 0x05
Shashank Mittal162244e2011-08-08 19:01:25 -0700331
Deepa Dinamani193874e2012-02-07 14:00:04 -0800332#define HLOS_IMG_TAMPER_FUSE 0
333
334
335#define SCM_SVC_CE_CHN_SWITCH_ID 0x04
336#define SCM_CE_CHN_SWITCH_ID 0x02
337
Amir Samuelov4620ad22013-03-13 11:30:05 +0200338#define SCM_SVC_ES 0x10
339#define SCM_SAVE_PARTITION_HASH_ID 0x01
340
Amit Blayfe23ee22015-01-09 19:09:51 +0200341#define SCM_SVC_MDTP 0x12
342#define SCM_MDTP_CIPHER_DIP 0x01
343
Channagoud Kadabi179df0b2013-12-12 14:53:31 -0800344#define SCM_SVC_PWR 0x9
345#define SCM_IO_DISABLE_PMIC_ARBITER 0x1
Aparna Mallavarapu664ea772015-02-24 18:44:33 +0530346#define SCM_IO_DISABLE_PMIC_ARBITER1 0x2
Channagoud Kadabi179df0b2013-12-12 14:53:31 -0800347
Abhimanyu Kapurb3207fb2014-01-27 21:33:23 -0800348#define SCM_SVC_MILESTONE_32_64_ID 0x1
349#define SCM_SVC_MILESTONE_CMD_ID 0xf
Dinesh K Garg6bbbb702015-01-30 11:13:31 -0800350#define SCM_SVC_TZSCHEDULER 0xFC
Abhimanyu Kapurb3207fb2014-01-27 21:33:23 -0800351
Deepa Dinamani193874e2012-02-07 14:00:04 -0800352enum ap_ce_channel_type {
353AP_CE_REGISTER_USE = 0,
354AP_CE_ADM_USE = 1
355};
356
357/* Apps CE resource. */
358#define TZ_RESOURCE_CE_AP 2
359
Aparna Mallavarapu246c30b2014-12-11 12:07:51 +0530360/* Secure IO Service IDs */
361#define SCM_IO_READ 0x1
362#define SCM_IO_WRITE 0x2
363#define SCM_SVC_IO 0x5
364
Deepa Dinamani193874e2012-02-07 14:00:04 -0800365uint8_t switch_ce_chn_cmd(enum ap_ce_channel_type channel);
366
Amit Blayfe23ee22015-01-09 19:09:51 +0200367/**
368 * Encrypt or Decrypt a Data Integrity Partition (DIP) structure using a
369 * HW derived key. The DIP is used for storing integrity information for
370 * Mobile Device Theft Protection (MDTP) service.
371 *
372 * @in_buf[in] : Pointer to plain text buffer.
373 * @in_buf_size[in] : Plain text buffer size.
374 * @out_buf[in] : Pointer to encrypted buffer.
375 * @out_buf_size[in] : Encrypted buffer size.
376 * @direction[in] : 0 for ENCRYPTION, 1 for DECRYPTION.
377 *
378 * Returns 0 on success, negative on failure.
379 */
380int mdtp_cipher_dip_cmd(uint8_t *in_buf, uint32_t in_buf_size, uint8_t *out_buf,
381 uint32_t out_buf_size, uint32_t direction);
Deepa Dinamani193874e2012-02-07 14:00:04 -0800382
Shashank Mittal162244e2011-08-08 19:01:25 -0700383void set_tamper_fuse_cmd();
384
Amit Blaybdfabc62015-01-29 22:04:13 +0200385/**
386 * Reads the row data of the specified QFPROM row address.
387 *
388 * @row_address[in] : Row address in the QFPROM region to read.
389 * @addr_type[in] : Raw or corrected address.
390 * @row_data[in] : Pointer to the data to be read.
391 * @qfprom_api_status[out] : Status of the read operation.
392 *
393 * Returns Any errors while reading data from the specified
394 * Returns 0 on success, negative on failure.
395 */
396int qfprom_read_row_cmd(uint32_t row_address, uint32_t addr_type, uint32_t *row_data, uint32_t *qfprom_api_status);
397
Channagoud Kadabi179df0b2013-12-12 14:53:31 -0800398int scm_halt_pmic_arbiter();
Aparna Mallavarapu68e233f2014-03-21 19:18:34 +0530399int scm_call_atomic2(uint32_t svc, uint32_t cmd, uint32_t arg1, uint32_t arg2);
vijay kumar4f4405f2014-08-08 11:49:53 +0530400int restore_secure_cfg(uint32_t id);
Channagoud Kadabi179df0b2013-12-12 14:53:31 -0800401
Abhimanyu Kapurb3207fb2014-01-27 21:33:23 -0800402void scm_elexec_call(paddr_t kernel_entry, paddr_t dtb_offset);
Channagoud Kadabiefdeb8a2015-09-23 11:52:20 -0700403uintptr_t get_canary();
Aparna Mallavarapu6875ade2014-06-16 22:15:28 +0530404/* API to configure XPU violations as fatal */
405int scm_xpu_err_fatal_init();
Abhimanyu Kapurb3207fb2014-01-27 21:33:23 -0800406
Channagoud Kadabidd85e7f2014-08-05 19:58:37 -0700407/* APIs to support ARM scm standard
408 * Takes arguments : x0-x5 and returns result
409 * in x0-x3*/
410uint32_t scm_call2(scmcall_arg *arg, scmcall_ret *ret);
411
Shashank Mittal162244e2011-08-08 19:01:25 -0700412/**
413 * struct scm_command - one SCM command buffer
414 * @len: total available memory for command and response
415 * @buf_offset: start of command buffer
416 * @resp_hdr_offset: start of response buffer
417 * @id: command to be executed
418 * @buf: buffer returned from scm_get_command_buffer()
419 *
420 * An SCM command is layed out in memory as follows:
421 *
422 * ------------------- <--- struct scm_command
423 * | command header |
424 * ------------------- <--- scm_get_command_buffer()
425 * | command buffer |
426 * ------------------- <--- struct scm_response and
427 * | response header | scm_command_to_response()
428 * ------------------- <--- scm_get_response_buffer()
429 * | response buffer |
430 * -------------------
431 *
432 * There can be arbitrary padding between the headers and buffers so
433 * you should always use the appropriate scm_get_*_buffer() routines
434 * to access the buffers in a safe manner.
435 */
436struct scm_command {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800437 uint32_t len;
438 uint32_t buf_offset;
439 uint32_t resp_hdr_offset;
440 uint32_t id;
441 uint32_t buf[0];
Shashank Mittal162244e2011-08-08 19:01:25 -0700442};
443
444/**
445 * struct scm_response - one SCM response buffer
446 * @len: total available memory for response
447 * @buf_offset: start of response data relative to start of scm_response
448 * @is_complete: indicates if the command has finished processing
449 */
450struct scm_response {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800451 uint32_t len;
452 uint32_t buf_offset;
453 uint32_t is_complete;
Shashank Mittal162244e2011-08-08 19:01:25 -0700454};
Channagoud Kadabidd85e7f2014-08-05 19:58:37 -0700455/* Perform any scm init needed before making scm calls
456 * Used for checking if armv8 SCM support present
457 */
458void scm_init();
Aparna Mallavarapu246c30b2014-12-11 12:07:51 +0530459bool is_secure_boot_enable();
Dinesh K Garg6bbbb702015-01-30 11:13:31 -0800460
461/* Is armv8 supported */
462bool is_scm_armv8_support();
Channagoud Kadabib2e080f2015-03-27 18:29:10 -0700463
464int scm_dload_mode(int mode);
Channagoud Kadabi6479ce32015-06-17 17:30:40 -0700465int scm_device_enter_dload();
Aparna Mallavarapuda91ea92015-07-10 12:03:46 +0530466int scm_call2_atomic(uint32_t svc, uint32_t cmd, uint32_t arg1, uint32_t arg2);
467uint32_t scm_io_write(uint32_t address, uint32_t val);
Channagoud Kadabi77f46a32015-08-05 16:13:13 -0700468int is_scm_call_available(uint32_t svc_id, uint32_t cmd_id);
Shashank Mittal162244e2011-08-08 19:01:25 -0700469#endif