1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <zircon/types.h>
8 
9 __BEGIN_CDECLS
10 
11 #define ARM_SMC_SERVICE_CALL_NUM_TRUSTED_OS_BASE 0x32
12 #define ARM_SMC_SERVICE_CALL_NUM_TRUSTED_OS_LENGTH 0xE
13 #define ARM_SMC_SERVICE_CALL_NUM_MAX 0x3F
14 #define ARM_SMC_SERVICE_CALL_NUM_MASK 0x3F
15 #define ARM_SMC_SERVICE_CALL_NUM_SHIFT 24
16 #define ARM_SMC_GET_SERVICE_CALL_NUM_FROM_FUNC_ID(func_id) \
17     (((func_id) >> ARM_SMC_SERVICE_CALL_NUM_SHIFT) & ARM_SMC_SERVICE_CALL_NUM_MASK)
18 
19 typedef struct zx_smc_parameters {
20     uint32_t func_id;
21     uint64_t arg1;
22     uint64_t arg2;
23     uint64_t arg3;
24     uint64_t arg4;
25     uint64_t arg5;
26     uint64_t arg6;
27     uint16_t client_id;
28     uint16_t secure_os_id;
29 } zx_smc_parameters_t;
30 
31 typedef struct zx_smc_result {
32     uint64_t arg0;
33     uint64_t arg1;
34     uint64_t arg2;
35     uint64_t arg3;
36 } zx_smc_result_t;
37 
38 __END_CDECLS
39