Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | /* * AGPGART module version 0.99 * Copyright (C) 1999 Jeff Hartmann * Copyright (C) 1999 Precision Insight, Inc. * Copyright (C) 1999 Xi Graphics, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef _AGP_BACKEND_H #define _AGP_BACKEND_H 1 #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #define AGPGART_VERSION_MAJOR 0 #define AGPGART_VERSION_MINOR 99 enum chipset_type { NOT_SUPPORTED, INTEL_GENERIC, INTEL_LX, INTEL_BX, INTEL_GX, INTEL_I810, INTEL_I815, INTEL_I840, VIA_GENERIC, VIA_VP3, VIA_MVP3, VIA_MVP4, VIA_APOLLO_PRO, VIA_APOLLO_KT133, VIA_APOLLO_KX133, SIS_GENERIC, AMD_GENERIC, AMD_IRONGATE, ALI_M1541, ALI_M1621, ALI_M1631, ALI_M1632, ALI_M1641, ALI_M1647, ALI_M1651, ALI_GENERIC, SVWRKS_HE, SVWRKS_LE, SVWRKS_GENERIC }; typedef struct _agp_version { u16 major; u16 minor; } agp_version; typedef struct _agp_kern_info { agp_version version; struct pci_dev *device; enum chipset_type chipset; unsigned long mode; off_t aper_base; size_t aper_size; int max_memory; /* In pages */ int current_memory; } agp_kern_info; /* * The agp_memory structure has information * about the block of agp memory allocated. * A caller may manipulate the next and prev * pointers to link each allocated item into * a list. These pointers are ignored by the * backend. Everything else should never be * written to, but the caller may read any of * the items to detrimine the status of this * block of agp memory. * */ typedef struct _agp_memory { int key; struct _agp_memory *next; struct _agp_memory *prev; size_t page_count; int num_scratch_pages; unsigned long *memory; off_t pg_start; u32 type; u32 physical; u8 is_bound; u8 is_flushed; } agp_memory; #define AGP_NORMAL_MEMORY 0 extern void agp_free_memory(agp_memory *); /* * agp_free_memory : * * This function frees memory associated with * an agp_memory pointer. It is the only function * that can be called when the backend is not owned * by the caller. (So it can free memory on client * death.) * * It takes an agp_memory pointer as an argument. * */ extern agp_memory *agp_allocate_memory(size_t, u32); /* * agp_allocate_memory : * * This function allocates a group of pages of * a certain type. * * It takes a size_t argument of the number of pages, and * an u32 argument of the type of memory to be allocated. * Every agp bridge device will allow you to allocate * AGP_NORMAL_MEMORY which maps to physical ram. Any other * type is device dependant. * * It returns NULL whenever memory is unavailable. * */ extern void agp_copy_info(agp_kern_info *); /* * agp_copy_info : * * This function copies information about the * agp bridge device and the state of the agp * backend into an agp_kern_info pointer. * * It takes an agp_kern_info pointer as an * argument. The caller should insure that * this pointer is valid. * */ extern int agp_bind_memory(agp_memory *, off_t); /* * agp_bind_memory : * * This function binds an agp_memory structure * into the graphics aperture translation table. * * It takes an agp_memory pointer and an offset into * the graphics aperture translation table as arguments * * It returns -EINVAL if the pointer == NULL. * It returns -EBUSY if the area of the table * requested is already in use. * */ extern int agp_unbind_memory(agp_memory *); /* * agp_unbind_memory : * * This function removes an agp_memory structure * from the graphics aperture translation table. * * It takes an agp_memory pointer as an argument. * * It returns -EINVAL if this piece of agp_memory * is not currently bound to the graphics aperture * translation table or if the agp_memory * pointer == NULL * */ extern void agp_enable(u32); /* * agp_enable : * * This function initializes the agp point-to-point * connection. * * It takes an agp mode register as an argument * */ extern int agp_backend_acquire(void); /* * agp_backend_acquire : * * This Function attempts to acquire the agp * backend. * * returns -EBUSY if agp is in use, * returns 0 if the caller owns the agp backend */ extern void agp_backend_release(void); /* * agp_backend_release : * * This Function releases the lock on the agp * backend. * * The caller must insure that the graphics * aperture translation table is read for use * by another entity. (Ensure that all memory * it bound is unbound.) * */ /* Don't call this directly!! used in initialization */ extern int agp_init(void); #endif /* _AGP_BACKEND_H */ |