blob: 6de2abb85fdd6593403cccddaaa6e5519064f878 [file] [log] [blame]
Mikael Olsson7da66192021-02-12 17:30:22 +01001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef ETHOSN_H
8#define ETHOSN_H
9
10#include <lib/smccc.h>
11
12/* Function numbers */
13#define ETHOSN_FNUM_VERSION U(0x50)
14#define ETHOSN_FNUM_IS_SEC U(0x51)
15#define ETHOSN_FNUM_HARD_RESET U(0x52)
16#define ETHOSN_FNUM_SOFT_RESET U(0x53)
17/* 0x54-0x5F reserved for future use */
18
19/* SMC64 function IDs */
20#define ETHOSN_FID_64(func_num) U(0xC2000000 | func_num)
21#define ETHOSN_FID_VERSION_64 ETHOSN_FID_64(ETHOSN_FNUM_VERSION)
22#define ETHOSN_FID_IS_SEC_64 ETHOSN_FID_64(ETHOSN_FNUM_IS_SEC)
23#define ETHOSN_FID_HARD_RESET_64 ETHOSN_FID_64(ETHOSN_FNUM_HARD_RESET)
24#define ETHOSN_FID_SOFT_RESET_64 ETHOSN_FID_64(ETHOSN_FNUM_SOFT_RESET)
25
26/* SMC32 function IDs */
27#define ETHOSN_FID_32(func_num) U(0x82000000 | func_num)
28#define ETHOSN_FID_VERSION_32 ETHOSN_FID_32(ETHOSN_FNUM_VERSION)
29#define ETHOSN_FID_IS_SEC_32 ETHOSN_FID_32(ETHOSN_FNUM_IS_SEC)
30#define ETHOSN_FID_HARD_RESET_32 ETHOSN_FID_32(ETHOSN_FNUM_HARD_RESET)
31#define ETHOSN_FID_SOFT_RESET_32 ETHOSN_FID_32(ETHOSN_FNUM_SOFT_RESET)
32
33#define ETHOSN_NUM_SMC_CALLS 8
34
35/* Macro to identify function calls */
36#define ETHOSN_FID_MASK U(0xFFF0)
37#define ETHOSN_FID_VALUE U(0x50)
38#define is_ethosn_fid(_fid) (((_fid) & ETHOSN_FID_MASK) == ETHOSN_FID_VALUE)
39
40/* Service version */
41#define ETHOSN_VERSION_MAJOR U(0)
42#define ETHOSN_VERSION_MINOR U(1)
43
44/* Return codes for function calls */
45#define ETHOSN_SUCCESS 0
46#define ETHOSN_NOT_SUPPORTED -1
47/* -2 Reserved for NOT_REQUIRED */
48/* -3 Reserved for INVALID_PARAMETER */
49#define ETHOSN_FAILURE -4
50#define ETHOSN_CORE_IDX_OUT_OF_RANGE -5
51
52uintptr_t ethosn_smc_handler(uint32_t smc_fid,
53 u_register_t core_idx,
54 u_register_t x2,
55 u_register_t x3,
56 u_register_t x4,
57 void *cookie,
58 void *handle,
59 u_register_t flags);
60
61#endif /* ETHOSN_H */