RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / rogue / physmem_tdsecbuf.h
1 /**************************************************************************/ /*!
2 @File
3 @Title          Header for secure buffer PMR factory
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Part of the memory management. This module is responsible for
6                 implementing the function callbacks importing secure buffer
7                 allocations.
8 @License        Dual MIT/GPLv2
9
10 The contents of this file are subject to the MIT license as set out below.
11
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18
19 The above copyright notice and this permission notice shall be included in
20 all copies or substantial portions of the Software.
21
22 Alternatively, the contents of this file may be used under the terms of
23 the GNU General Public License Version 2 ("GPL") in which case the provisions
24 of GPL are applicable instead of those above.
25
26 If you wish to allow use of your version of this file only under the terms of
27 GPL, and not to allow others to use your version of this file under the terms
28 of the MIT license, indicate your decision by deleting the provisions above
29 and replace them with the notice and other provisions required by GPL as set
30 out in the file called "GPL-COPYING" included in this distribution. If you do
31 not delete the provisions above, a recipient may use your version of this file
32 under the terms of either the MIT license or GPL.
33
34 This License is also included in this distribution in the file called
35 "MIT-COPYING".
36
37 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
38 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
39 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
40 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
41 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
42 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
43 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44 */ /***************************************************************************/
45
46 #ifndef _PHYSMEM_TDSECBUF_H_
47 #define _PHYSMEM_TDSECBUF_H_
48
49 #include "img_types.h"
50 #include "pvrsrv_error.h"
51 #include "pvrsrv_memallocflags.h"
52 #include "pmr.h"
53
54 /*
55  * PhysmemNewTDSecureBufPMR
56  *
57  * This function is used as part of the facility to provide secure buffer
58  * memory. A default implementation is provided but it can be replaced by
59  * the SoC implementor if necessary.
60  *
61  * Calling this function will create a PMR for a memory allocation made
62  * in "secure buffer memory". It will only be writable by a trusted
63  * entity and when the feature is enabled on the SoC the GPU will only
64  * be able to perform operations permitted by security rules.
65  */
66
67 PVRSRV_ERROR PhysmemNewTDSecureBufPMR(CONNECTION_DATA *psConnection,
68                                       PVRSRV_DEVICE_NODE *psDevNode,
69                                       IMG_DEVMEM_SIZE_T uiSize,
70                                       PMR_LOG2ALIGN_T uiLog2Align,
71                                       PVRSRV_MEMALLOCFLAGS_T uiFlags,
72                                       PMR **ppsPMRPtr,
73                                       IMG_UINT64 *pui64SecBufHandle);
74
75 PVRSRV_ERROR PhysmemImportSecBuf(CONNECTION_DATA *psConnection,
76                                  PVRSRV_DEVICE_NODE *psDevNode,
77                                  IMG_DEVMEM_SIZE_T uiSize,
78                                  IMG_UINT32 ui32Log2Align,
79                                  PVRSRV_MEMALLOCFLAGS_T uiFlags,
80                                  PMR **ppsPMRPtr,
81                                  IMG_UINT64 *pui64SecBufHandle);
82
83 #endif /* _PHYSMEM_TDSECBUF_H_ */
84