Commit | Line | Data |
---|---|---|
0867b421 AC |
1 | /************************************************************************** |
2 | * Copyright (c) 2007-2008, Intel Corporation. | |
3 | * 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 WITHOUT | |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | * more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License along with | |
5352161f | 15 | * this program; if not, write to the Free Software Foundation, Inc., |
0867b421 AC |
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
17 | * | |
18 | **************************************************************************/ | |
19 | ||
20 | #ifndef _PSB_GTT_H_ | |
21 | #define _PSB_GTT_H_ | |
22 | ||
23 | #include <drm/drmP.h> | |
24 | ||
25 | /*#include "img_types.h"*/ | |
26 | ||
27 | struct psb_gtt { | |
28 | struct drm_device *dev; | |
29 | int initialized; | |
30 | uint32_t gatt_start; | |
31 | uint32_t mmu_gatt_start; | |
32 | uint32_t ci_start; | |
33 | uint32_t rar_start; | |
34 | uint32_t gtt_start; | |
35 | uint32_t gtt_phys_start; | |
36 | unsigned gtt_pages; | |
37 | unsigned gatt_pages; | |
38 | uint32_t stolen_base; | |
39 | void *vram_addr; | |
40 | uint32_t pge_ctl; | |
41 | u16 gmch_ctrl; | |
42 | unsigned long stolen_size; | |
43 | unsigned long vram_stolen_size; | |
44 | unsigned long ci_stolen_size; | |
45 | unsigned long rar_stolen_size; | |
46 | uint32_t *gtt_map; | |
47 | struct rw_semaphore sem; | |
48 | }; | |
49 | ||
50 | struct psb_gtt_mm { | |
51 | struct drm_mm base; | |
52 | struct drm_open_hash hash; | |
53 | uint32_t count; | |
54 | spinlock_t lock; | |
55 | }; | |
56 | ||
57 | struct psb_gtt_hash_entry { | |
58 | struct drm_open_hash ht; | |
59 | uint32_t count; | |
60 | struct drm_hash_item item; | |
61 | }; | |
62 | ||
63 | struct psb_gtt_mem_mapping { | |
64 | struct drm_mm_node *node; | |
65 | struct drm_hash_item item; | |
66 | }; | |
67 | ||
68 | /*Exported functions*/ | |
69 | extern int psb_gtt_init(struct psb_gtt *pg, int resume); | |
70 | extern int psb_gtt_insert_pages(struct psb_gtt *pg, struct page **pages, | |
71 | unsigned offset_pages, unsigned num_pages, | |
72 | unsigned desired_tile_stride, | |
73 | unsigned hw_tile_stride, int type); | |
74 | extern int psb_gtt_remove_pages(struct psb_gtt *pg, unsigned offset_pages, | |
75 | unsigned num_pages, | |
76 | unsigned desired_tile_stride, | |
77 | unsigned hw_tile_stride, | |
78 | int rc_prot); | |
79 | ||
80 | extern struct psb_gtt *psb_gtt_alloc(struct drm_device *dev); | |
81 | extern void psb_gtt_takedown(struct psb_gtt *pg, int free); | |
82 | extern int psb_gtt_map_meminfo(struct drm_device *dev, | |
83 | void * hKernelMemInfo, | |
84 | uint32_t *offset); | |
85 | extern int psb_gtt_unmap_meminfo(struct drm_device *dev, | |
86 | void * hKernelMemInfo); | |
87 | extern int psb_gtt_map_meminfo_ioctl(struct drm_device *dev, void *data, | |
88 | struct drm_file *file_priv); | |
89 | extern int psb_gtt_unmap_meminfo_ioctl(struct drm_device *dev, void *data, | |
90 | struct drm_file *file_priv); | |
91 | extern int psb_gtt_mm_init(struct psb_gtt *pg); | |
92 | extern void psb_gtt_mm_takedown(void); | |
93 | ||
94 | extern int psb_gtt_map_pvr_memory(struct drm_device *dev, | |
95 | unsigned int hHandle, | |
96 | unsigned int ui32TaskId, | |
97 | dma_addr_t *pPages, | |
98 | unsigned int ui32PagesNum, | |
99 | unsigned int *ui32Offset); | |
100 | ||
101 | extern int psb_gtt_unmap_pvr_memory(struct drm_device *dev, | |
102 | unsigned int hHandle, | |
103 | unsigned int ui32TaskId); | |
104 | ||
105 | #endif |