diff options
Diffstat (limited to 'include/linux/tee_drv.h')
| -rw-r--r-- | include/linux/tee_drv.h | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index 6cfe05893a76..4a49f80e7f71 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h | |||
| @@ -15,11 +15,14 @@ | |||
| 15 | #ifndef __TEE_DRV_H | 15 | #ifndef __TEE_DRV_H |
| 16 | #define __TEE_DRV_H | 16 | #define __TEE_DRV_H |
| 17 | 17 | ||
| 18 | #include <linux/types.h> | 18 | #include <linux/device.h> |
| 19 | #include <linux/idr.h> | 19 | #include <linux/idr.h> |
| 20 | #include <linux/kref.h> | 20 | #include <linux/kref.h> |
| 21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
| 22 | #include <linux/mod_devicetable.h> | ||
| 22 | #include <linux/tee.h> | 23 | #include <linux/tee.h> |
| 24 | #include <linux/types.h> | ||
| 25 | #include <linux/uuid.h> | ||
| 23 | 26 | ||
| 24 | /* | 27 | /* |
| 25 | * The file describes the API provided by the generic TEE driver to the | 28 | * The file describes the API provided by the generic TEE driver to the |
| @@ -47,6 +50,11 @@ struct tee_shm_pool; | |||
| 47 | * @releasing: flag that indicates if context is being released right now. | 50 | * @releasing: flag that indicates if context is being released right now. |
| 48 | * It is needed to break circular dependency on context during | 51 | * It is needed to break circular dependency on context during |
| 49 | * shared memory release. | 52 | * shared memory release. |
| 53 | * @supp_nowait: flag that indicates that requests in this context should not | ||
| 54 | * wait for tee-supplicant daemon to be started if not present | ||
| 55 | * and just return with an error code. It is needed for requests | ||
| 56 | * that arises from TEE based kernel drivers that should be | ||
| 57 | * non-blocking in nature. | ||
| 50 | */ | 58 | */ |
| 51 | struct tee_context { | 59 | struct tee_context { |
| 52 | struct tee_device *teedev; | 60 | struct tee_device *teedev; |
| @@ -54,6 +62,7 @@ struct tee_context { | |||
| 54 | void *data; | 62 | void *data; |
| 55 | struct kref refcount; | 63 | struct kref refcount; |
| 56 | bool releasing; | 64 | bool releasing; |
| 65 | bool supp_nowait; | ||
| 57 | }; | 66 | }; |
| 58 | 67 | ||
| 59 | struct tee_param_memref { | 68 | struct tee_param_memref { |
| @@ -526,6 +535,18 @@ int tee_client_invoke_func(struct tee_context *ctx, | |||
| 526 | struct tee_ioctl_invoke_arg *arg, | 535 | struct tee_ioctl_invoke_arg *arg, |
| 527 | struct tee_param *param); | 536 | struct tee_param *param); |
| 528 | 537 | ||
| 538 | /** | ||
| 539 | * tee_client_cancel_req() - Request cancellation of the previous open-session | ||
| 540 | * or invoke-command operations in a Trusted Application | ||
| 541 | * @ctx: TEE Context | ||
| 542 | * @arg: Cancellation arguments, see description of | ||
| 543 | * struct tee_ioctl_cancel_arg | ||
| 544 | * | ||
| 545 | * Returns < 0 on error else 0 if the cancellation was successfully requested. | ||
| 546 | */ | ||
| 547 | int tee_client_cancel_req(struct tee_context *ctx, | ||
| 548 | struct tee_ioctl_cancel_arg *arg); | ||
| 549 | |||
| 529 | static inline bool tee_param_is_memref(struct tee_param *param) | 550 | static inline bool tee_param_is_memref(struct tee_param *param) |
| 530 | { | 551 | { |
| 531 | switch (param->attr & TEE_IOCTL_PARAM_ATTR_TYPE_MASK) { | 552 | switch (param->attr & TEE_IOCTL_PARAM_ATTR_TYPE_MASK) { |
| @@ -538,4 +559,31 @@ static inline bool tee_param_is_memref(struct tee_param *param) | |||
| 538 | } | 559 | } |
| 539 | } | 560 | } |
| 540 | 561 | ||
| 562 | extern struct bus_type tee_bus_type; | ||
| 563 | |||
| 564 | /** | ||
| 565 | * struct tee_client_device - tee based device | ||
| 566 | * @id: device identifier | ||
| 567 | * @dev: device structure | ||
| 568 | */ | ||
| 569 | struct tee_client_device { | ||
| 570 | struct tee_client_device_id id; | ||
| 571 | struct device dev; | ||
| 572 | }; | ||
| 573 | |||
| 574 | #define to_tee_client_device(d) container_of(d, struct tee_client_device, dev) | ||
| 575 | |||
| 576 | /** | ||
| 577 | * struct tee_client_driver - tee client driver | ||
| 578 | * @id_table: device id table supported by this driver | ||
| 579 | * @driver: driver structure | ||
| 580 | */ | ||
| 581 | struct tee_client_driver { | ||
| 582 | const struct tee_client_device_id *id_table; | ||
| 583 | struct device_driver driver; | ||
| 584 | }; | ||
| 585 | |||
| 586 | #define to_tee_client_driver(d) \ | ||
| 587 | container_of(d, struct tee_client_driver, driver) | ||
| 588 | |||
| 541 | #endif /*__TEE_DRV_H*/ | 589 | #endif /*__TEE_DRV_H*/ |
