GNU Linux-libre 4.14.254-gnu1
[releases.git] / drivers / staging / ccree / ssi_request_mgr.h
1 /*
2  * Copyright (C) 2012-2017 ARM Limited or its affiliates.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, see <http://www.gnu.org/licenses/>.
15  */
16
17 /* \file request_mgr.h
18  * Request Manager
19  */
20
21 #ifndef __REQUEST_MGR_H__
22 #define __REQUEST_MGR_H__
23
24 #include "cc_hw_queue_defs.h"
25
26 int request_mgr_init(struct ssi_drvdata *drvdata);
27
28 /*!
29  * Enqueue caller request to crypto hardware.
30  *
31  * \param drvdata
32  * \param ssi_req The request to enqueue
33  * \param desc The crypto sequence
34  * \param len The crypto sequence length
35  * \param is_dout If "true": completion is handled by the caller
36  *        If "false": this function adds a dummy descriptor completion
37  *        and waits upon completion signal.
38  *
39  * \return int Returns -EINPROGRESS if "is_dout=ture"; "0" if "is_dout=false"
40  */
41 int send_request(
42         struct ssi_drvdata *drvdata, struct ssi_crypto_req *ssi_req,
43         struct cc_hw_desc *desc, unsigned int len, bool is_dout);
44
45 int send_request_init(
46         struct ssi_drvdata *drvdata, struct cc_hw_desc *desc, unsigned int len);
47
48 void complete_request(struct ssi_drvdata *drvdata);
49
50 void request_mgr_fini(struct ssi_drvdata *drvdata);
51
52 #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
53 int ssi_request_mgr_runtime_resume_queue(struct ssi_drvdata *drvdata);
54
55 int ssi_request_mgr_runtime_suspend_queue(struct ssi_drvdata *drvdata);
56
57 bool ssi_request_mgr_is_queue_runtime_suspend(struct ssi_drvdata *drvdata);
58 #endif
59
60 #endif /*__REQUEST_MGR_H__*/