2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2018 Andrew Turner
6 * This software was developed by SRI International and the University of
7 * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
8 * ("CTSRD"), as part of the DARPA CRASH research programme.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #ifndef _PSCI_SMCCC_H_
35 #define _PSCI_SMCCC_H_
37 #define SMCCC_VERSION_MAJOR(ver) (((ver) >> 16) & 0x7fff)
38 #define SMCCC_VERSION_MINOR(ver) ((ver) & 0xffff)
40 #define SMCCC_FUNC_ID(type, call_conv, range, func) \
42 ((call_conv) << 30) | \
43 (((range) & 0x3f) << 24) | \
46 #define SMCCC_YIELDING_CALL 0
47 #define SMCCC_FAST_CALL 1
49 #define SMCCC_32BIT_CALL 0
50 #define SMCCC_64BIT_CALL 1
53 * Arm Architecture Calls.
54 * These are documented in the document ARM DEN 0070A.
56 #define SMCCC_VERSION \
57 SMCCC_FUNC_ID(SMCCC_FAST_CALL, SMCCC_32BIT_CALL, 0, 0)
58 #define SMCCC_ARCH_FEATURES \
59 SMCCC_FUNC_ID(SMCCC_FAST_CALL, SMCCC_32BIT_CALL, 0, 1)
60 #define SMCCC_ARCH_WORKAROUND_1 \
61 SMCCC_FUNC_ID(SMCCC_FAST_CALL, SMCCC_32BIT_CALL, 0, 0x8000)
63 /* The return values from ARM DEN 0070A. */
64 #define SMCCC_RET_SUCCESS 0
65 #define SMCCC_RET_NOT_SUPPORTED -1
66 #define SMCCC_RET_NOT_REQUIRED -2
68 int32_t smccc_arch_features(uint32_t);
69 int smccc_arch_workaround_1(void);
72 #endif /* _PSCI_SMCCC_H_ */