RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / services / server / include / physmem_osmem.h
1 /**************************************************************************/ /*!
2 @File
3 @Title          PMR implementation of OS derived physical memory
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Part of the memory management.  This module is
6                 responsible for the an implementation of the "PMR"
7                 abstraction.  This interface is for the
8                 PhysmemNewOSRamBackedPMR() "PMR Factory" which is
9                 responsible for claiming chunks of memory (in
10                 particular physically contiguous quanta) from the
11                 Operating System.
12
13                 As such, this interface will be implemented on a
14                 Per-OS basis, in the "env" directory for that system.
15                 A dummy implementation is available in
16                 physmem_osmem_dummy.c for operating systems that
17                 cannot, or do not wish to, offer this functionality.
18 @License        Dual MIT/GPLv2
19
20 The contents of this file are subject to the MIT license as set out below.
21
22 Permission is hereby granted, free of charge, to any person obtaining a copy
23 of this software and associated documentation files (the "Software"), to deal
24 in the Software without restriction, including without limitation the rights
25 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26 copies of the Software, and to permit persons to whom the Software is
27 furnished to do so, subject to the following conditions:
28
29 The above copyright notice and this permission notice shall be included in
30 all copies or substantial portions of the Software.
31
32 Alternatively, the contents of this file may be used under the terms of
33 the GNU General Public License Version 2 ("GPL") in which case the provisions
34 of GPL are applicable instead of those above.
35
36 If you wish to allow use of your version of this file only under the terms of
37 GPL, and not to allow others to use your version of this file under the terms
38 of the MIT license, indicate your decision by deleting the provisions above
39 and replace them with the notice and other provisions required by GPL as set
40 out in the file called "GPL-COPYING" included in this distribution. If you do
41 not delete the provisions above, a recipient may use your version of this file
42 under the terms of either the MIT license or GPL.
43
44 This License is also included in this distribution in the file called
45 "MIT-COPYING".
46
47 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
48 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
49 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
50 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
51 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
52 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
53 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54 */ /***************************************************************************/
55 #ifndef _SRVSRV_PHYSMEM_OSMEM_H_
56 #define _SRVSRV_PHYSMEM_OSMEM_H_
57
58 /* include/ */
59 #include "img_types.h"
60 #include "pvrsrv_error.h"
61 #include "pvrsrv_memallocflags.h"
62
63 /* services/server/include/ */
64 #include "pmr.h"
65 #include "pmr_impl.h"
66
67 /*
68  * PhysmemNewOSRamBackedPMR
69  *
70  * To be overridden on a per-OS basis.
71  *
72  * This function will create a PMR using the default "OS supplied" physical pages
73  * method, assuming such is available on a particular operating system.  (If not,
74  * PVRSRV_ERROR_NOT_SUPPORTED should be returned)
75  */
76 extern PVRSRV_ERROR
77 PhysmemNewOSRamBackedPMR(PVRSRV_DEVICE_NODE *psDevNode,
78                          IMG_DEVMEM_SIZE_T uiSize,
79                                                  IMG_DEVMEM_SIZE_T uiChunkSize,
80                                                  IMG_UINT32 ui32NumPhysChunks,
81                                                  IMG_UINT32 ui32NumVirtChunks,
82                                                  IMG_BOOL *pabMappingTable,
83                          IMG_UINT32 uiLog2PageSize,
84                          PVRSRV_MEMALLOCFLAGS_T uiFlags,
85                          PMR **ppsPMROut);
86
87 /*
88  * PhysmemNewTDMetaCodePMR
89  *
90  * This function is used as part of the facility to provide secure META firmware
91  * memory. A default implementation is provided which must be replaced by the SoC
92  * implementor.
93  *
94  * Calling this function will return a PMR for a memory allocation made in "secure
95  * META code memory". It will only be writable by a hypervisor, and when the feature
96  * is enabled on the SoC, the META will only be able to perform instruction reads from
97  * memory that is secured that way.
98  */
99 PVRSRV_ERROR
100 PhysmemNewTDMetaCodePMR(PVRSRV_DEVICE_NODE *psDevNode,
101                         IMG_DEVMEM_SIZE_T uiSize,
102                         IMG_UINT32 uiLog2PageSize,
103                         PVRSRV_MEMALLOCFLAGS_T uiFlags,
104                         PMR **ppsPMRPtr);
105
106 PVRSRV_ERROR
107 PhysmemNewTDSecureBufPMR(PVRSRV_DEVICE_NODE *psDevNode,
108                          IMG_DEVMEM_SIZE_T uiSize,
109                          IMG_UINT32 uiLog2PageSize,
110                          PVRSRV_MEMALLOCFLAGS_T uiFlags,
111                          PMR **ppsPMRPtr);
112
113
114 #endif /* #ifndef _SRVSRV_PHYSMEM_OSMEM_H_ */