Merge branch '2023-07-24-introduce-FF-A-suppport'
[platform/kernel/u-boot.git] / arch / sandbox / include / asm / sandbox_arm_ffa.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
4  *
5  * Authors:
6  *   Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
7  */
8
9 #ifndef __SANDBOX_ARM_FFA_H
10 #define __SANDBOX_ARM_FFA_H
11
12 #include <arm_ffa.h>
13
14 /*
15  * This header provides public sandbox FF-A emulator declarations
16  * and declarations needed by FF-A sandbox clients
17  */
18
19 /* UUIDs strings of the emulated services */
20 #define SANDBOX_SERVICE1_UUID   "ed32d533-4209-99e6-2d72-cdd998a79cc0"
21 #define SANDBOX_SERVICE2_UUID   "ed32d544-4209-99e6-2d72-cdd998a79cc0"
22
23 /* IDs of the emulated secure partitions (SPs) */
24 #define SANDBOX_SP1_ID 0x1245
25 #define SANDBOX_SP2_ID 0x9836
26 #define SANDBOX_SP3_ID 0x6452
27 #define SANDBOX_SP4_ID 0x7814
28
29 /* Invalid service UUID (no matching SP) */
30 #define SANDBOX_SERVICE3_UUID   "55d532ed-0942-e699-722d-c09ca798d9cd"
31
32 /* Invalid service UUID (invalid UUID string format) */
33 #define SANDBOX_SERVICE4_UUID   "32ed-0942-e699-722d-c09ca798d9cd"
34
35 /* Number of valid services */
36 #define SANDBOX_SP_COUNT_PER_VALID_SERVICE      2
37
38 /**
39  * struct ffa_sandbox_data - query ABI state data structure
40  * @data0_size: size of the first argument
41  * @data0:      pointer to the first argument
42  * @data1_size>:        size of the second argument
43  * @data1:      pointer to the second argument
44  *
45  * Used to pass various types of data with different sizes between
46  * the test cases and the sandbox emulator.
47  * The data is for querying FF-A ABIs state.
48  */
49 struct ffa_sandbox_data {
50         u32 data0_size; /* size of the first argument */
51         void *data0; /* pointer to the first argument */
52         u32 data1_size; /* size of the second argument */
53         void *data1; /* pointer to the second argument */
54 };
55
56 /* The sandbox FF-A  emulator public functions */
57
58 /**
59  * sandbox_query_ffa_emul_state() - Inspect the FF-A ABIs
60  * @queried_func_id:    The FF-A function to be queried
61  * @func_data:  Pointer to the FF-A function arguments container structure
62  *
63  * Query the status of FF-A ABI specified in the input argument.
64  *
65  * Return:
66  *
67  * 0 on success. Otherwise, failure
68  */
69 int sandbox_query_ffa_emul_state(u32 queried_func_id,
70                                  struct ffa_sandbox_data *func_data);
71
72 #endif