fixes for bc_cat
[sgx.git] / pvr / mmu.h
1 /**********************************************************************
2  *
3  * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful but, except
10  * as otherwise stated in writing, without any warranty; without even the
11  * implied warranty of merchantability or fitness for a particular purpose.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * The full GNU General Public License is included in this distribution in
19  * the file called "COPYING".
20  *
21  * Contact Information:
22  * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23  * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24  *
25  ******************************************************************************/
26
27 #ifndef _MMU_H_
28 #define _MMU_H_
29
30 #include "sgxinfokm.h"
31
32 enum PVRSRV_ERROR MMU_Initialise(struct PVRSRV_DEVICE_NODE *psDeviceNode,
33                 struct MMU_CONTEXT **ppsMMUContext,
34                 struct IMG_DEV_PHYADDR *psPDDevPAddr);
35
36 void MMU_Finalise(struct MMU_CONTEXT *psMMUContext);
37
38 void MMU_InsertHeap(struct MMU_CONTEXT *psMMUContext,
39                 struct MMU_HEAP *psMMUHeap);
40
41 struct MMU_HEAP *MMU_Create(struct MMU_CONTEXT *psMMUContext,
42                 struct DEV_ARENA_DESCRIPTOR *psDevArena,
43                 struct RA_ARENA **ppsVMArena);
44
45 void MMU_Delete(struct MMU_HEAP *pMMU);
46
47 IMG_BOOL MMU_Alloc(struct MMU_HEAP *pMMU, size_t uSize, u32 uFlags,
48                 u32 uDevVAddrAlignment, struct IMG_DEV_VIRTADDR *pDevVAddr);
49
50 void MMU_Free(struct MMU_HEAP *pMMU, struct IMG_DEV_VIRTADDR DevVAddr,
51               u32 ui32Size);
52
53 void MMU_Enable(struct MMU_HEAP *pMMU);
54
55 void MMU_Disable(struct MMU_HEAP *pMMU);
56
57 void MMU_MapPages(struct MMU_HEAP *pMMU, struct IMG_DEV_VIRTADDR devVAddr,
58                 struct IMG_SYS_PHYADDR SysPAddr, size_t uSize, u32 ui32MemFlags,
59                 void *hUniqueTag);
60
61 void MMU_MapShadow(struct MMU_HEAP *pMMU,
62                 struct IMG_DEV_VIRTADDR MapBaseDevVAddr, size_t uSize,
63                 void *CpuVAddr, void *hOSMemHandle,
64                 struct IMG_DEV_VIRTADDR *pDevVAddr, u32 ui32MemFlags,
65                 void *hUniqueTag);
66
67 void MMU_UnmapPages(struct MMU_HEAP *pMMU, struct IMG_DEV_VIRTADDR dev_vaddr,
68                 u32 ui32PageCount, void *hUniqueTag);
69
70 void MMU_MapScatter(struct MMU_HEAP *pMMU, struct IMG_DEV_VIRTADDR DevVAddr,
71                 struct IMG_SYS_PHYADDR *psSysAddr, size_t uSize,
72                 u32 ui32MemFlags, void *hUniqueTag);
73
74 struct IMG_DEV_PHYADDR MMU_GetPhysPageAddr(struct MMU_HEAP *pMMUHeap,
75                                         struct IMG_DEV_VIRTADDR sDevVPageAddr);
76
77 struct IMG_DEV_PHYADDR MMU_GetPDDevPAddr(struct MMU_CONTEXT *pMMUContext);
78
79 void MMU_InvalidateDirectoryCache(struct PVRSRV_SGXDEV_INFO *psDevInfo);
80
81 enum PVRSRV_ERROR MMU_BIFResetPDAlloc(struct PVRSRV_SGXDEV_INFO *psDevInfo);
82
83 void MMU_BIFResetPDFree(struct PVRSRV_SGXDEV_INFO *psDevInfo);
84
85 u32 mmu_get_page_dir(struct MMU_CONTEXT *pMMUContext);
86
87 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_PVR_DEBUG)
88 int mmu_hwrec_mem_dump(struct PVRSRV_SGXDEV_INFO *psDevInfo);
89 #endif
90
91 #endif /* _MMU_H_ */