sprt_svc.h 2.19 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Copyright (c) 2018, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef SPRT_SVC_H
#define SPRT_SVC_H

#include <smccc.h>
#include <utils_def.h>

/* SPRT_VERSION helpers */

#define SPRT_VERSION_MAJOR		U(0)
#define SPRT_VERSION_MAJOR_SHIFT	16
#define SPRT_VERSION_MAJOR_MASK		U(0x7FFF)
#define SPRT_VERSION_MINOR		U(1)
#define SPRT_VERSION_MINOR_SHIFT	0
#define SPRT_VERSION_MINOR_MASK		U(0xFFFF)
#define SPRT_VERSION_FORM(major, minor)	((((major) & SPRT_VERSION_MAJOR_MASK)  \
						<< SPRT_VERSION_MAJOR_SHIFT) | \
					((minor) & SPRT_VERSION_MINOR_MASK))
#define SPRT_VERSION_COMPILED		SPRT_VERSION_FORM(SPRT_VERSION_MAJOR, \
							  SPRT_VERSION_MINOR)

/* SPRT function IDs */

#define SPRT_FID_VERSION		U(0x0)
#define SPRT_FID_PUT_RESPONSE		U(0x1)
#define SPRT_FID_YIELD			U(0x5)
#define SPRT_FID_PANIC			U(0x7)
#define SPRT_FID_MEMORY_PERM_ATTR_GET	U(0xB)
#define SPRT_FID_MEMORY_PERM_ATTR_SET	U(0xC)

#define SPRT_FID_MASK			U(0xFF)

/* Definitions to build the complete SMC ID */

#define SPRT_SMC_64(sprt_fid)	((FUNCID_NAMESPACE_SPRT << FUNCID_NAMESPACE_SHIFT) | \
				 (U(1) << 31) | ((sprt_fid) & SPRT_FID_MASK) | \
				 (SMC_64 << FUNCID_CC_SHIFT))
#define SPRT_SMC_32(sprt_fid)	((FUNCID_NAMESPACE_SPRT << FUNCID_NAMESPACE_SHIFT) | \
				 (U(1) << 31) | ((sprt_fid) & SPRT_FID_MASK) | \
				 (SMC_32 << FUNCID_CC_SHIFT))

/* Complete SMC IDs */

#define SPRT_VERSION				SPRT_SMC_32(SPRT_FID_VERSION)
#define SPRT_PUT_RESPONSE_AARCH64		SPRT_SMC_64(SPRT_FID_PUT_RESPONSE)
#define SPRT_YIELD_AARCH64			SPRT_SMC_64(SPRT_FID_YIELD)
#define SPRT_PANIC_AARCH64			SPRT_SMC_64(SPRT_FID_PANIC)
#define SPRT_MEMORY_PERM_ATTR_GET_AARCH64	SPRT_SMC_64(SPRT_FID_MEMORY_PERM_ATTR_GET)
#define SPRT_MEMORY_PERM_ATTR_SET_AARCH64	SPRT_SMC_64(SPRT_FID_MEMORY_PERM_ATTR_SET)

56
57
58
59
60
61
62
63
64
/* Defines used by SPRT_MEMORY_PERM_ATTR_{GET,SET}_AARCH64 */

#define SPRT_MEMORY_PERM_ATTR_RO	U(0)
#define SPRT_MEMORY_PERM_ATTR_RW	U(1)
#define SPRT_MEMORY_PERM_ATTR_RO_EXEC	U(2)
/* U(3) is reserved */
#define SPRT_MEMORY_PERM_ATTR_MASK	U(3)
#define SPRT_MEMORY_PERM_ATTR_SHIFT	3

65
66
67
68
69
70
71
/* SPRT error codes. */

#define SPRT_SUCCESS		 0
#define SPRT_NOT_SUPPORTED	-1
#define SPRT_INVALID_PARAMETER	-2

#endif /* SPRT_SVC_H */