| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
| 2 | /* |
| 3 | * Copyright (C) 2023-2026 Intel Corporation |
| 4 | * Intel Silicon Security Engine Interface (ISSEI) Linux driver: |
| 5 | * ISSEI Interface Header |
| 6 | */ |
| 7 | #ifndef _LINUX_ISSEI_H |
| 8 | #define _LINUX_ISSEI_H |
| 9 | |
| 10 | #include <linux/ioctl.h> |
| 11 | #include <linux/types.h> |
| 12 | |
| 13 | /* |
| 14 | * This ioctl is used to associate the current file descriptor with a |
| 15 | * FW Client (given by UUID). This opens a communication channel |
| 16 | * between a host client and a FW client. From this point every read and write |
| 17 | * will communicate with the associated FW client. |
| 18 | * The communication between the clients can be terminated by |
| 19 | * IOCTL_ISSEI_DISCONNECT_CLIENT IOCTL or by |
| 20 | * closing the file descriptor (file_operation release()). |
| 21 | * |
| 22 | * The ioctl argument is a struct with a union that contains |
| 23 | * the input parameter and the output parameter for this ioctl. |
| 24 | * |
| 25 | * The input parameter is UUID of the FW Client. |
| 26 | * The output parameter is the properties of the FW client |
| 27 | * (FW protocol version, max message size and client flags). |
| 28 | */ |
| 29 | #define IOCTL_ISSEI_CONNECT_CLIENT \ |
| 30 | 	_IOWR('H', 0x01, struct issei_connect_client_data) |
| 31 | |
| 32 | /** |
| 33 | * struct issei_client - ISSEI client information structure |
| 34 | * @max_msg_length: maximum message length supported by the firmware client (in bytes) |
| 35 | * @protocol_version: protocol version reported by the firmware client |
| 36 | * @reserved1: reserved |
| 37 | * @flags: flag bitmask reported by the firmware client |
| 38 | * @reserved2: reserved |
| 39 | */ |
| 40 | struct issei_client { |
| 41 | 	__u32 max_msg_length; |
| 42 | 	__u8 protocol_version; |
| 43 | 	__u8 reserved1[3]; |
| 44 | 	__u32 flags; |
| 45 | 	__u32 reserved2; |
| 46 | }; |
| 47 | |
| 48 | #define ISSEI_IOCTL_UUID_LEN 16 |
| 49 | |
| 50 | /** |
| 51 | * struct issei_connect_client_data - ioctl Connect Client Data structure |
| 52 | * @in_client_uuid: unique id of the firmware client to connect to (from user space to kernel) |
| 53 | * @out_client_properties: connected firmware client properties (from kernel to user space) |
| 54 | */ |
| 55 | struct issei_connect_client_data { |
| 56 | 	union { |
| 57 | 		__u8 in_client_uuid[ISSEI_IOCTL_UUID_LEN]; |
| 58 | 		struct issei_client out_client_properties; |
| 59 | 	}; |
| 60 | }; |
| 61 | |
| 62 | /* |
| 63 | * This ioctl is used to terminate association between |
| 64 | * the host client and the FW client. |
| 65 | */ |
| 66 | #define IOCTL_ISSEI_DISCONNECT_CLIENT \ |
| 67 | 	_IO('H', 0x02) |
| 68 | |
| 69 | #endif /* _LINUX_ISSEI_H */ |