blob: d9e61e96dc19c7d7a9e4ff669cb862f13493a0d0 [file] [log] [blame]
Pankaj Gupta5aa0ffa2020-12-09 14:02:40 +05301/*
2 * Copyright 2018-2020 NXP
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef SIPSVC_H
9#define SIPSVC_H
10
11#include <stdint.h>
12
13#define SMC_FUNC_MASK 0x0000ffff
14#define SMC32_PARAM_MASK 0xffffffff
15
16/* SMC function IDs for SiP Service queries */
17#define SIP_SVC_CALL_COUNT 0xff00
18#define SIP_SVC_UID 0xff01
19#define SIP_SVC_VERSION 0xff03
20#define SIP_SVC_PRNG 0xff10
21#define SIP_SVC_RNG 0xff11
22#define SIP_SVC_MEM_BANK 0xff12
23#define SIP_SVC_PREFETCH_DIS 0xff13
24#define SIP_SVC_HUK 0xff14
25#define SIP_SVC_ALLOW_L1L2_ERR 0xff15
26#define SIP_SVC_ALLOW_L2_CLR 0xff16
27#define SIP_SVC_2_AARCH32 0xff17
28#define SIP_SVC_PORSR1 0xff18
29
30/* Layerscape SiP Service Calls version numbers */
31#define LS_SIP_SVC_VERSION_MAJOR 0x0
32#define LS_SIP_SVC_VERSION_MINOR 0x1
33
34/* Number of Layerscape SiP Calls implemented */
35#define LS_COMMON_SIP_NUM_CALLS 10
36
37/* Parameter Type Constants */
38#define SIP_PARAM_TYPE_NONE 0x0
39#define SIP_PARAM_TYPE_VALUE_INPUT 0x1
40#define SIP_PARAM_TYPE_VALUE_OUTPUT 0x2
41#define SIP_PARAM_TYPE_VALUE_INOUT 0x3
42#define SIP_PARAM_TYPE_MEMREF_INPUT 0x5
43#define SIP_PARAM_TYPE_MEMREF_OUTPUT 0x6
44#define SIP_PARAM_TYPE_MEMREF_INOUT 0x7
45
46#define SIP_PARAM_TYPE_MASK 0xF
47
48/*
49 * The macro SIP_PARAM_TYPES can be used to construct a value that you can
50 * compare against an incoming paramTypes to check the type of all the
51 * parameters in one comparison.
52 */
53#define SIP_PARAM_TYPES(t0, t1, t2, t3) \
54 ((t0) | ((t1) << 4) | ((t2) << 8) | ((t3) << 12))
55
56/*
57 * The macro SIP_PARAM_TYPE_GET can be used to extract the type of a given
58 * parameter from paramTypes if you need more fine-grained type checking.
59 */
60#define SIP_PARAM_TYPE_GET(t, i) ((((uint32_t)(t)) >> ((i) * 4)) & 0xF)
61
62/*
63 * The macro SIP_PARAM_TYPE_SET can be used to load the type of a given
64 * parameter from paramTypes without specifying all types (SIP_PARAM_TYPES)
65 */
66#define SIP_PARAM_TYPE_SET(t, i) (((uint32_t)(t) & 0xF) << ((i) * 4))
67
68#define SIP_SVC_RNG_PARAMS (SIP_PARAM_TYPE_VALUE_INPUT, \
69 SIP_PARAM_TYPE_MEMREF_OUTPUT, \
70 SIP_PARAM_TYPE_NONE, \
71 SIP_PARAM_TYPE_NONE)
72
73/* Layerscape SiP Calls error code */
74enum {
75 LS_SIP_SUCCESS = 0,
76 LS_SIP_INVALID_PARAM = -1,
77 LS_SIP_NOT_SUPPORTED = -2,
78};
79
80#endif /* SIPSVC_H */