RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / rogue / interrupt_support.h
1 /*************************************************************************/ /*!
2 @File
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License        Dual MIT/GPLv2
5
6 The contents of this file are subject to the MIT license as set out below.
7
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
21
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
29
30 This License is also included in this distribution in the file called
31 "MIT-COPYING".
32
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /**************************************************************************/
41
42 #if !defined(__INTERRUPT_SUPPORT_H__)
43 #define __INTERRUPT_SUPPORT_H__
44
45 #include "img_types.h"
46 #include "pvrsrv_error.h"
47 #include "pvrsrv_device.h"
48
49 #define SYS_IRQ_FLAG_TRIGGER_DEFAULT (0x0 << 0)
50 #define SYS_IRQ_FLAG_TRIGGER_LOW     (0x1 << 0)
51 #define SYS_IRQ_FLAG_TRIGGER_HIGH    (0x2 << 0)
52 #define SYS_IRQ_FLAG_TRIGGER_MASK    (SYS_IRQ_FLAG_TRIGGER_DEFAULT | \
53                                       SYS_IRQ_FLAG_TRIGGER_LOW | \
54                                       SYS_IRQ_FLAG_TRIGGER_HIGH)
55 #define SYS_IRQ_FLAG_SHARED          (0x1 << 8)
56
57 #define SYS_IRQ_FLAG_MASK            (SYS_IRQ_FLAG_TRIGGER_MASK | \
58                                       SYS_IRQ_FLAG_SHARED)
59
60 typedef IMG_BOOL (*PFN_SYS_LISR)(void *pvData);
61
62 typedef struct _SYS_INTERRUPT_DATA_
63 {
64         void                    *psSysData;
65         const IMG_CHAR  *pszName;
66         PFN_SYS_LISR    pfnLISR;
67         void                    *pvData;
68         IMG_UINT32              ui32InterruptFlag;
69 #if defined(SUPPORT_PVRSRV_GPUVIRT)
70         IMG_UINT32              ui32IRQ;
71 #endif
72 } SYS_INTERRUPT_DATA;
73
74 /*************************************************************************/ /*!
75 @Function       OSInstallSystemLISR
76 @Description    Installs a system low-level interrupt handler
77 @Output         phLISR                  On return, contains a handle to the
78                                         installed LISR
79 @Input          ui32IRQ                 The IRQ number for which the
80                                         interrupt handler should be installed
81 @Input          pszDevName              Name of the device for which the handler
82                                         is being installed
83 @Input          pfnLISR                 A pointer to an interrupt handler
84                                         function
85 @Input          pvData                  A pointer to data that should be passed
86                                         to pfnLISR when it is called
87 @Input          ui32Flags               Interrupt flags
88 @Return         PVRSRV_OK on success, a failure code otherwise
89 */ /**************************************************************************/
90 PVRSRV_ERROR OSInstallSystemLISR(IMG_HANDLE *phLISR, 
91                                  IMG_UINT32 ui32IRQ,
92                                  const IMG_CHAR *pszDevName, 
93                                  PFN_SYS_LISR pfnLISR, 
94                                  void *pvData,
95                                  IMG_UINT32 ui32Flags);
96
97 /*************************************************************************/ /*!
98 @Function       OSUninstallSystemLISR
99 @Description    Uninstalls a system low-level interrupt handler
100 @Input          hLISRData              The handle to the LISR to uninstall
101 @Return         PVRSRV_OK on success, a failure code otherwise
102 */ /**************************************************************************/
103 PVRSRV_ERROR OSUninstallSystemLISR(IMG_HANDLE hLISRData);
104 #endif /* !defined(__INTERRUPT_SUPPORT_H__) */