1 /* 1 /* 2 * AGPGART backend specific includes. Not for !! 2 * AGPGART module version 0.99 3 * << 4 * Copyright (C) 2004 Silicon Graphics, Inc. << 5 * Copyright (C) 2002-2003 Dave Jones << 6 * Copyright (C) 1999 Jeff Hartmann 3 * Copyright (C) 1999 Jeff Hartmann 7 * Copyright (C) 1999 Precision Insight, Inc. 4 * Copyright (C) 1999 Precision Insight, Inc. 8 * Copyright (C) 1999 Xi Graphics, Inc. 5 * Copyright (C) 1999 Xi Graphics, Inc. 9 * 6 * 10 * Permission is hereby granted, free of charg 7 * Permission is hereby granted, free of charge, to any person obtaining a 11 * copy of this software and associated docume 8 * copy of this software and associated documentation files (the "Software"), 12 * to deal in the Software without restriction 9 * to deal in the Software without restriction, including without limitation 13 * the rights to use, copy, modify, merge, pub 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 * and/or sell copies of the Software, and to 11 * and/or sell copies of the Software, and to permit persons to whom the 15 * Software is furnished to do so, subject to 12 * Software is furnished to do so, subject to the following conditions: 16 * 13 * 17 * The above copyright notice and this permiss 14 * The above copyright notice and this permission notice shall be included 18 * in all copies or substantial portions of th 15 * in all copies or substantial portions of the Software. 19 * 16 * 20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT W 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO TH 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINF 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 23 * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE 20 * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 24 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN A 21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 25 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNE 22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 26 * OR THE USE OR OTHER DEALINGS IN THE SOFTWAR 23 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 * 24 * 28 */ 25 */ 29 26 30 #ifndef _AGP_BACKEND_H 27 #ifndef _AGP_BACKEND_H 31 #define _AGP_BACKEND_H 1 28 #define _AGP_BACKEND_H 1 32 29 33 #include <linux/list.h> !! 30 #ifndef TRUE >> 31 #define TRUE 1 >> 32 #endif >> 33 >> 34 #ifndef FALSE >> 35 #define FALSE 0 >> 36 #endif >> 37 >> 38 #define AGPGART_VERSION_MAJOR 0 >> 39 #define AGPGART_VERSION_MINOR 99 34 40 35 enum chipset_type { 41 enum chipset_type { 36 NOT_SUPPORTED, 42 NOT_SUPPORTED, 37 SUPPORTED, !! 43 INTEL_GENERIC, >> 44 INTEL_LX, >> 45 INTEL_BX, >> 46 INTEL_GX, >> 47 INTEL_I810, >> 48 INTEL_I815, >> 49 INTEL_I820, >> 50 INTEL_I830_M, >> 51 INTEL_I845_G, >> 52 INTEL_I840, >> 53 INTEL_I845, >> 54 INTEL_I850, >> 55 INTEL_I855_PM, >> 56 INTEL_I860, >> 57 INTEL_I865_G, >> 58 INTEL_I915_G, >> 59 INTEL_I915_GM, >> 60 INTEL_I7205, >> 61 INTEL_I7505, >> 62 INTEL_460GX, >> 63 VIA_GENERIC, >> 64 VIA_VP3, >> 65 VIA_MVP3, >> 66 VIA_MVP4, >> 67 VIA_APOLLO_PLE133, >> 68 VIA_APOLLO_PRO, >> 69 VIA_APOLLO_KX133, >> 70 VIA_APOLLO_KT133, >> 71 VIA_APOLLO_KM266, >> 72 VIA_APOLLO_KT400, >> 73 VIA_CLE266, >> 74 VIA_APOLLO_P4M266, >> 75 VIA_APOLLO_P4X400, >> 76 SIS_GENERIC, >> 77 AMD_GENERIC, >> 78 AMD_IRONGATE, >> 79 AMD_761, >> 80 AMD_762, >> 81 AMD_8151, >> 82 ALI_M1541, >> 83 ALI_M1621, >> 84 ALI_M1631, >> 85 ALI_M1632, >> 86 ALI_M1641, >> 87 ALI_M1644, >> 88 ALI_M1647, >> 89 ALI_M1651, >> 90 ALI_M1671, >> 91 ALI_GENERIC, >> 92 SVWRKS_HE, >> 93 SVWRKS_LE, >> 94 SVWRKS_GENERIC, >> 95 NVIDIA_NFORCE, >> 96 NVIDIA_NFORCE2, >> 97 NVIDIA_NFORCE3, >> 98 NVIDIA_GENERIC, >> 99 HP_ZX1, >> 100 ATI_RS100, >> 101 ATI_RS200, >> 102 ATI_RS250, >> 103 ATI_RS300_100, >> 104 ATI_RS300_133, >> 105 ATI_RS300_166, >> 106 ATI_RS300_200 38 }; 107 }; 39 108 40 struct agp_version { !! 109 typedef struct _agp_version { 41 u16 major; 110 u16 major; 42 u16 minor; 111 u16 minor; 43 }; !! 112 } agp_version; 44 113 45 struct agp_kern_info { !! 114 typedef struct _agp_kern_info { 46 struct agp_version version; !! 115 agp_version version; 47 struct pci_dev *device; 116 struct pci_dev *device; 48 enum chipset_type chipset; 117 enum chipset_type chipset; 49 unsigned long mode; 118 unsigned long mode; 50 unsigned long aper_base; !! 119 off_t aper_base; 51 size_t aper_size; 120 size_t aper_size; 52 int max_memory; /* In pages */ 121 int max_memory; /* In pages */ 53 int current_memory; 122 int current_memory; 54 bool cant_use_aperture; !! 123 int cant_use_aperture; 55 unsigned long page_mask; 124 unsigned long page_mask; 56 const struct vm_operations_struct *vm_ !! 125 } agp_kern_info; 57 }; << 58 126 59 /* !! 127 /* 60 * The agp_memory structure has information ab !! 128 * The agp_memory structure has information 61 * allocated. A caller may manipulate the nex !! 129 * about the block of agp memory allocated. 62 * each allocated item into a list. These poi !! 130 * A caller may manipulate the next and prev 63 * Everything else should never be written to, !! 131 * pointers to link each allocated item into 64 * the items to determine the status of this b !! 132 * a list. These pointers are ignored by the >> 133 * backend. Everything else should never be >> 134 * written to, but the caller may read any of >> 135 * the items to detrimine the status of this >> 136 * block of agp memory. >> 137 * 65 */ 138 */ 66 139 67 struct agp_bridge_data; !! 140 typedef struct _agp_memory { 68 << 69 struct agp_memory { << 70 struct agp_memory *next; << 71 struct agp_memory *prev; << 72 struct agp_bridge_data *bridge; << 73 struct page **pages; << 74 size_t page_count; << 75 int key; 141 int key; >> 142 struct _agp_memory *next; >> 143 struct _agp_memory *prev; >> 144 size_t page_count; 76 int num_scratch_pages; 145 int num_scratch_pages; >> 146 unsigned long *memory; 77 off_t pg_start; 147 off_t pg_start; 78 u32 type; 148 u32 type; 79 u32 physical; 149 u32 physical; 80 bool is_bound; !! 150 u8 is_bound; 81 bool is_flushed; !! 151 u8 is_flushed; 82 /* list of agp_memory mapped to the ap !! 152 } agp_memory; 83 struct list_head mapped_list; << 84 /* DMA-mapped addresses */ << 85 struct scatterlist *sg_list; << 86 int num_sg; << 87 }; << 88 153 89 #define AGP_NORMAL_MEMORY 0 154 #define AGP_NORMAL_MEMORY 0 90 155 91 #define AGP_USER_TYPES (1 << 16) !! 156 extern void agp_free_memory(agp_memory *); 92 #define AGP_USER_MEMORY (AGP_USER_TYPES) !! 157 93 #define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES !! 158 /* 94 !! 159 * agp_free_memory : 95 extern struct agp_bridge_data *agp_bridge; !! 160 * 96 extern struct list_head agp_bridges; !! 161 * This function frees memory associated with 97 !! 162 * an agp_memory pointer. It is the only function 98 extern struct agp_bridge_data *(*agp_find_brid !! 163 * that can be called when the backend is not owned 99 !! 164 * by the caller. (So it can free memory on client 100 extern void agp_free_memory(struct agp_memory !! 165 * death.) 101 extern struct agp_memory *agp_allocate_memory( !! 166 * 102 extern int agp_copy_info(struct agp_bridge_dat !! 167 * It takes an agp_memory pointer as an argument. 103 extern int agp_bind_memory(struct agp_memory * !! 168 * 104 extern int agp_unbind_memory(struct agp_memory !! 169 */ 105 extern void agp_enable(struct agp_bridge_data !! 170 106 extern struct agp_bridge_data *agp_backend_acq !! 171 extern agp_memory *agp_allocate_memory(size_t, u32); 107 extern void agp_backend_release(struct agp_bri !! 172 >> 173 /* >> 174 * agp_allocate_memory : >> 175 * >> 176 * This function allocates a group of pages of >> 177 * a certain type. >> 178 * >> 179 * It takes a size_t argument of the number of pages, and >> 180 * an u32 argument of the type of memory to be allocated. >> 181 * Every agp bridge device will allow you to allocate >> 182 * AGP_NORMAL_MEMORY which maps to physical ram. Any other >> 183 * type is device dependant. >> 184 * >> 185 * It returns NULL whenever memory is unavailable. >> 186 * >> 187 */ >> 188 >> 189 extern int agp_copy_info(agp_kern_info *); >> 190 >> 191 /* >> 192 * agp_copy_info : >> 193 * >> 194 * This function copies information about the >> 195 * agp bridge device and the state of the agp >> 196 * backend into an agp_kern_info pointer. >> 197 * >> 198 * It takes an agp_kern_info pointer as an >> 199 * argument. The caller should insure that >> 200 * this pointer is valid. >> 201 * >> 202 */ >> 203 >> 204 extern int agp_bind_memory(agp_memory *, off_t); >> 205 >> 206 /* >> 207 * agp_bind_memory : >> 208 * >> 209 * This function binds an agp_memory structure >> 210 * into the graphics aperture translation table. >> 211 * >> 212 * It takes an agp_memory pointer and an offset into >> 213 * the graphics aperture translation table as arguments >> 214 * >> 215 * It returns -EINVAL if the pointer == NULL. >> 216 * It returns -EBUSY if the area of the table >> 217 * requested is already in use. >> 218 * >> 219 */ >> 220 >> 221 extern int agp_unbind_memory(agp_memory *); >> 222 >> 223 /* >> 224 * agp_unbind_memory : >> 225 * >> 226 * This function removes an agp_memory structure >> 227 * from the graphics aperture translation table. >> 228 * >> 229 * It takes an agp_memory pointer as an argument. >> 230 * >> 231 * It returns -EINVAL if this piece of agp_memory >> 232 * is not currently bound to the graphics aperture >> 233 * translation table or if the agp_memory >> 234 * pointer == NULL >> 235 * >> 236 */ >> 237 >> 238 extern void agp_enable(u32); >> 239 >> 240 /* >> 241 * agp_enable : >> 242 * >> 243 * This function initializes the agp point-to-point >> 244 * connection. >> 245 * >> 246 * It takes an agp mode register as an argument >> 247 * >> 248 */ >> 249 >> 250 extern int agp_backend_acquire(void); >> 251 >> 252 /* >> 253 * agp_backend_acquire : >> 254 * >> 255 * This Function attempts to acquire the agp >> 256 * backend. >> 257 * >> 258 * returns -EBUSY if agp is in use, >> 259 * returns 0 if the caller owns the agp backend >> 260 */ >> 261 >> 262 extern void agp_backend_release(void); >> 263 >> 264 /* >> 265 * agp_backend_release : >> 266 * >> 267 * This Function releases the lock on the agp >> 268 * backend. >> 269 * >> 270 * The caller must insure that the graphics >> 271 * aperture translation table is read for use >> 272 * by another entity. (Ensure that all memory >> 273 * it bound is unbound.) >> 274 * >> 275 */ >> 276 >> 277 typedef struct { >> 278 void (*free_memory)(agp_memory *); >> 279 agp_memory *(*allocate_memory)(size_t, u32); >> 280 int (*bind_memory)(agp_memory *, off_t); >> 281 int (*unbind_memory)(agp_memory *); >> 282 void (*enable)(u32); >> 283 int (*acquire)(void); >> 284 void (*release)(void); >> 285 int (*copy_info)(agp_kern_info *); >> 286 } drm_agp_t; >> 287 >> 288 extern const drm_agp_t *drm_agp_p; >> 289 >> 290 /* >> 291 * Interface between drm and agp code. When agp initializes, it makes >> 292 * the above structure available via inter_module_register(), drm might >> 293 * use it. Keith Owens <kaos@ocs.com.au> 28 Oct 2000. >> 294 */ 108 295 109 #endif /* _AGP_BACKEN 296 #endif /* _AGP_BACKEND_H */ 110 297
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.