1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * Driver for Qualcomm Secure Execution Environment (SEE) interface (QSEECOM). 4 * Responsible for setting up and managing QSEECOM client devices. 5 * 6 * Copyright (C) 2023 Maximilian Luz <luzmaximilian@gmail.com> 7 */ 8 9 #ifndef __QCOM_QSEECOM_H 10 #define __QCOM_QSEECOM_H 11 12 #include <linux/auxiliary_bus.h> 13 #include <linux/types.h> 14 15 #include <linux/firmware/qcom/qcom_scm.h> 16 17 /** 18 * struct qseecom_client - QSEECOM client device. 19 * @aux_dev: Underlying auxiliary device. 20 * @app_id: ID of the loaded application. 21 */ 22 struct qseecom_client { 23 struct auxiliary_device aux_dev; 24 u32 app_id; 25 }; 26 27 /** 28 * qcom_qseecom_app_send() - Send to and receive data from a given QSEE app. 29 * @client: The QSEECOM client associated with the target app. 30 * @req: Request buffer sent to the app (must be DMA-mappable). 31 * @req_size: Size of the request buffer. 32 * @rsp: Response buffer, written to by the app (must be DMA-mappable). 33 * @rsp_size: Size of the response buffer. 34 * 35 * Sends a request to the QSEE app associated with the given client and read 36 * back its response. The caller must provide two DMA memory regions, one for 37 * the request and one for the response, and fill out the @req region with the 38 * respective (app-specific) request data. The QSEE app reads this and returns 39 * its response in the @rsp region. 40 * 41 * Note: This is a convenience wrapper around qcom_scm_qseecom_app_send(). 42 * Clients should prefer to use this wrapper. 43 * 44 * Return: Zero on success, nonzero on failure. 45 */ 46 static inline int qcom_qseecom_app_send(struct qseecom_client *client, void *req, size_t req_size, 47 void *rsp, size_t rsp_size) 48 { 49 return qcom_scm_qseecom_app_send(client->app_id, req, req_size, rsp, rsp_size); 50 } 51 52 #endif /* __QCOM_QSEECOM_H */ 53