1 /**************************************************************************
2 * Copyright (c) 2007-2008, Intel Corporation.
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.
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
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.
18 **************************************************************************/
25 /*#include "img_types.h"*/
28 struct drm_device *dev;
31 uint32_t mmu_gatt_start;
35 uint32_t gtt_phys_start;
42 unsigned long stolen_size;
43 unsigned long vram_stolen_size;
44 unsigned long ci_stolen_size;
45 unsigned long rar_stolen_size;
47 struct rw_semaphore sem;
52 struct drm_open_hash hash;
57 struct psb_gtt_hash_entry {
58 struct drm_open_hash ht;
60 struct drm_hash_item item;
63 struct psb_gtt_mem_mapping {
64 struct drm_mm_node *node;
65 struct drm_hash_item item;
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,
76 unsigned desired_tile_stride,
77 unsigned hw_tile_stride,
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,
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);
94 extern int psb_gtt_map_pvr_memory(struct drm_device *dev,
96 unsigned int ui32TaskId,
98 unsigned int ui32PagesNum,
99 unsigned int *ui32Offset);
101 extern int psb_gtt_unmap_pvr_memory(struct drm_device *dev,
102 unsigned int hHandle,
103 unsigned int ui32TaskId);