Import 2.3.99pre9-1
[davej-history.git] / include / linux / agp_backend.h
blob3c8c7e01ff71452fb11e21fd0b98985b9c7ad518
1 /*
2 * AGPGART module version 0.99
3 * Copyright (C) 1999 Jeff Hartmann
4 * Copyright (C) 1999 Precision Insight, Inc.
5 * Copyright (C) 1999 Xi Graphics, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
23 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef _AGP_BACKEND_H
28 #define _AGP_BACKEND_H 1
30 #ifndef TRUE
31 #define TRUE 1
32 #endif
34 #ifndef FALSE
35 #define FALSE 0
36 #endif
38 #define AGPGART_VERSION_MAJOR 0
39 #define AGPGART_VERSION_MINOR 99
41 enum chipset_type {
42 NOT_SUPPORTED,
43 INTEL_GENERIC,
44 INTEL_LX,
45 INTEL_BX,
46 INTEL_GX,
47 INTEL_I810,
48 VIA_GENERIC,
49 VIA_VP3,
50 VIA_MVP3,
51 VIA_MVP4,
52 VIA_APOLLO_PRO,
53 SIS_GENERIC,
54 AMD_GENERIC,
55 AMD_IRONGATE,
56 ALI_M1541,
57 ALI_GENERIC
60 typedef struct _agp_version {
61 u16 major;
62 u16 minor;
63 } agp_version;
65 typedef struct _agp_kern_info {
66 agp_version version;
67 struct pci_dev *device;
68 enum chipset_type chipset;
69 unsigned long mode;
70 off_t aper_base;
71 size_t aper_size;
72 int max_memory; /* In pages */
73 int current_memory;
74 } agp_kern_info;
76 /*
77 * The agp_memory structure has information
78 * about the block of agp memory allocated.
79 * A caller may manipulate the next and prev
80 * pointers to link each allocated item into
81 * a list. These pointers are ignored by the
82 * backend. Everything else should never be
83 * written to, but the caller may read any of
84 * the items to detrimine the status of this
85 * block of agp memory.
89 typedef struct _agp_memory {
90 int key;
91 struct _agp_memory *next;
92 struct _agp_memory *prev;
93 size_t page_count;
94 int num_scratch_pages;
95 unsigned long *memory;
96 off_t pg_start;
97 u32 type;
98 u32 physical;
99 u8 is_bound;
100 u8 is_flushed;
101 } agp_memory;
103 #define AGP_NORMAL_MEMORY 0
105 extern void agp_free_memory(agp_memory *);
108 * agp_free_memory :
110 * This function frees memory associated with
111 * an agp_memory pointer. It is the only function
112 * that can be called when the backend is not owned
113 * by the caller. (So it can free memory on client
114 * death.)
116 * It takes an agp_memory pointer as an argument.
120 extern agp_memory *agp_allocate_memory(size_t, u32);
123 * agp_allocate_memory :
125 * This function allocates a group of pages of
126 * a certain type.
128 * It takes a size_t argument of the number of pages, and
129 * an u32 argument of the type of memory to be allocated.
130 * Every agp bridge device will allow you to allocate
131 * AGP_NORMAL_MEMORY which maps to physical ram. Any other
132 * type is device dependant.
134 * It returns NULL whenever memory is unavailable.
138 extern void agp_copy_info(agp_kern_info *);
141 * agp_copy_info :
143 * This function copies information about the
144 * agp bridge device and the state of the agp
145 * backend into an agp_kern_info pointer.
147 * It takes an agp_kern_info pointer as an
148 * argument. The caller should insure that
149 * this pointer is valid.
153 extern int agp_bind_memory(agp_memory *, off_t);
156 * agp_bind_memory :
158 * This function binds an agp_memory structure
159 * into the graphics aperture translation table.
161 * It takes an agp_memory pointer and an offset into
162 * the graphics aperture translation table as arguments
164 * It returns -EINVAL if the pointer == NULL.
165 * It returns -EBUSY if the area of the table
166 * requested is already in use.
170 extern int agp_unbind_memory(agp_memory *);
173 * agp_unbind_memory :
175 * This function removes an agp_memory structure
176 * from the graphics aperture translation table.
178 * It takes an agp_memory pointer as an argument.
180 * It returns -EINVAL if this piece of agp_memory
181 * is not currently bound to the graphics aperture
182 * translation table or if the agp_memory
183 * pointer == NULL
187 extern void agp_enable(u32);
190 * agp_enable :
192 * This function initializes the agp point-to-point
193 * connection.
195 * It takes an agp mode register as an argument
199 extern int agp_backend_acquire(void);
202 * agp_backend_acquire :
204 * This Function attempts to acquire the agp
205 * backend.
207 * returns -EBUSY if agp is in use,
208 * returns 0 if the caller owns the agp backend
211 extern void agp_backend_release(void);
214 * agp_backend_release :
216 * This Function releases the lock on the agp
217 * backend.
219 * The caller must insure that the graphics
220 * aperture translation table is read for use
221 * by another entity. (Ensure that all memory
222 * it bound is unbound.)
226 #endif /* _AGP_BACKEND_H */