Etienne Carriere | 94ccfb7 | 2022-07-26 16:21:42 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
| 2 | /* |
| 3 | * (C) Copyright 2022 Linaro Limited |
| 4 | */ |
| 5 | |
| 6 | #ifndef _OPTEE_SERVICE_H |
| 7 | #define _OPTEE_SERVICE_H |
| 8 | |
| 9 | /* |
| 10 | * struct optee_service - Discoverable OP-TEE service |
| 11 | * |
| 12 | * @driver_name - Name of the related driver |
| 13 | * @uuid - UUID of the OP-TEE service related to the driver |
| 14 | * |
| 15 | * Use macro OPTEE_SERVICE_DRIVER() to register a driver related to an |
| 16 | * OP-TEE service discovered when driver asks OP-TEE services enumaration. |
| 17 | */ |
| 18 | struct optee_service { |
| 19 | const char *driver_name; |
| 20 | const struct tee_optee_ta_uuid uuid; |
| 21 | }; |
| 22 | |
| 23 | #ifdef CONFIG_OPTEE_SERVICE_DISCOVERY |
| 24 | #define OPTEE_SERVICE_DRIVER(__name, __uuid, __drv_name) \ |
| 25 | ll_entry_declare(struct optee_service, __name, optee_service) = { \ |
| 26 | .uuid = __uuid, \ |
| 27 | .driver_name = __drv_name, \ |
| 28 | } |
| 29 | #else |
| 30 | #define OPTEE_SERVICE_DRIVER(__name, __uuid, __drv_name) \ |
| 31 | static int __name##__COUNTER__ __always_unused |
| 32 | #endif |
| 33 | |
| 34 | #endif /* _OPTEE_SERVICE_H */ |