1 #ifndef _DRM_AGPSUPPORT_H_ 2 #define _DRM_AGPSUPPORT_H_ 3 4 #include <linux/kernel.h> 5 #include <linux/mm.h> 6 #include <linux/mutex.h> 7 #include <linux/types.h> 8 #include <dev/agp/agpvar.h> 9 #include <drm/drmP.h> 10 11 typedef struct drm_agp_mem { 12 void *handle; 13 unsigned long bound; /* address */ 14 int pages; 15 struct drm_agp_mem *prev; 16 struct drm_agp_mem *next; 17 } drm_agp_mem_t; 18 19 struct drm_agp_head { 20 device_t agpdev; 21 struct agp_info agp_info; 22 const char *chipset; 23 drm_agp_mem_t *memory; 24 unsigned long mode; 25 int enabled; 26 int acquired; 27 unsigned long base; 28 int agp_mtrr; 29 int cant_use_aperture; 30 unsigned long page_mask; 31 }; 32 33 #if __OS_HAS_AGP 34 35 #if 0 36 void drm_free_agp(struct agp_memory * handle, int pages); 37 int drm_bind_agp(struct agp_memory * handle, unsigned int start); 38 int drm_unbind_agp(struct agp_memory * handle); 39 struct agp_memory *drm_agp_bind_pages(struct drm_device *dev, 40 struct page **pages, 41 unsigned long num_pages, 42 uint32_t gtt_offset, 43 uint32_t type); 44 #endif 45 46 int drm_device_is_agp(struct drm_device *dev); 47 int drm_device_is_pcie(struct drm_device *dev); 48 struct drm_agp_head *drm_agp_init(void); 49 void drm_agp_clear(struct drm_device *dev); 50 int drm_agp_acquire(struct drm_device *dev); 51 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, 52 struct drm_file *file_priv); 53 int drm_agp_release(struct drm_device *dev); 54 int drm_agp_release_ioctl(struct drm_device *dev, void *data, 55 struct drm_file *file_priv); 56 int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode); 57 int drm_agp_enable_ioctl(struct drm_device *dev, void *data, 58 struct drm_file *file_priv); 59 void *drm_agp_allocate_memory(size_t pages, u32 type); 60 int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info); 61 int drm_agp_info_ioctl(struct drm_device *dev, void *data, 62 struct drm_file *file_priv); 63 int drm_agp_free_memory(void *handle); 64 int drm_agp_bind_memory(void *handle, off_t start); 65 int drm_agp_unbind_memory(void *handle); 66 int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request); 67 int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, 68 struct drm_file *file_priv); 69 int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request); 70 int drm_agp_free_ioctl(struct drm_device *dev, void *data, 71 struct drm_file *file_priv); 72 int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request); 73 int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, 74 struct drm_file *file_priv); 75 int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); 76 int drm_agp_bind_ioctl(struct drm_device *dev, void *data, 77 struct drm_file *file_priv); 78 #else /* __OS_HAS_AGP */ 79 80 static inline void drm_free_agp(struct agp_memory * handle, int pages) 81 { 82 } 83 84 static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start) 85 { 86 return -ENODEV; 87 } 88 89 static inline int drm_unbind_agp(struct agp_memory * handle) 90 { 91 return -ENODEV; 92 } 93 94 static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev, 95 struct page **pages, 96 unsigned long num_pages, 97 uint32_t gtt_offset, 98 uint32_t type) 99 { 100 return NULL; 101 } 102 103 static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev) 104 { 105 return NULL; 106 } 107 108 static inline void drm_agp_clear(struct drm_device *dev) 109 { 110 } 111 112 static inline int drm_agp_acquire(struct drm_device *dev) 113 { 114 return -ENODEV; 115 } 116 117 static inline int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, 118 struct drm_file *file_priv) 119 { 120 return -ENODEV; 121 } 122 123 static inline int drm_agp_release(struct drm_device *dev) 124 { 125 return -ENODEV; 126 } 127 128 static inline int drm_agp_release_ioctl(struct drm_device *dev, void *data, 129 struct drm_file *file_priv) 130 { 131 return -ENODEV; 132 } 133 134 static inline int drm_agp_enable(struct drm_device *dev, 135 struct drm_agp_mode mode) 136 { 137 return -ENODEV; 138 } 139 140 static inline int drm_agp_enable_ioctl(struct drm_device *dev, void *data, 141 struct drm_file *file_priv) 142 { 143 return -ENODEV; 144 } 145 146 static inline int drm_agp_info(struct drm_device *dev, 147 struct drm_agp_info *info) 148 { 149 return -ENODEV; 150 } 151 152 static inline int drm_agp_info_ioctl(struct drm_device *dev, void *data, 153 struct drm_file *file_priv) 154 { 155 return -ENODEV; 156 } 157 158 static inline int drm_agp_alloc(struct drm_device *dev, 159 struct drm_agp_buffer *request) 160 { 161 return -ENODEV; 162 } 163 164 static inline int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, 165 struct drm_file *file_priv) 166 { 167 return -ENODEV; 168 } 169 170 static inline int drm_agp_free(struct drm_device *dev, 171 struct drm_agp_buffer *request) 172 { 173 return -ENODEV; 174 } 175 176 static inline int drm_agp_free_ioctl(struct drm_device *dev, void *data, 177 struct drm_file *file_priv) 178 { 179 return -ENODEV; 180 } 181 182 static inline int drm_agp_unbind(struct drm_device *dev, 183 struct drm_agp_binding *request) 184 { 185 return -ENODEV; 186 } 187 188 static inline int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, 189 struct drm_file *file_priv) 190 { 191 return -ENODEV; 192 } 193 194 static inline int drm_agp_bind(struct drm_device *dev, 195 struct drm_agp_binding *request) 196 { 197 return -ENODEV; 198 } 199 200 static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data, 201 struct drm_file *file_priv) 202 { 203 return -ENODEV; 204 } 205 #endif /* __OS_HAS_AGP */ 206 207 #endif /* _DRM_AGPSUPPORT_H_ */ 208