- Kai Germaschewski: ISDN update (including Makefiles)
[davej-history.git] / include / linux / agp_backend.h
blob99df46b37a29e4e2f25a9c2671b98ccf485dac2d
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 INTEL_I815,
49 INTEL_I840,
50 VIA_GENERIC,
51 VIA_VP3,
52 VIA_MVP3,
53 VIA_MVP4,
54 VIA_APOLLO_PRO,
55 VIA_APOLLO_KX133,
56 VIA_APOLLO_KT133,
57 SIS_GENERIC,
58 AMD_GENERIC,
59 AMD_IRONGATE,
60 ALI_M1541,
61 ALI_GENERIC
64 typedef struct _agp_version {
65 u16 major;
66 u16 minor;
67 } agp_version;
69 typedef struct _agp_kern_info {
70 agp_version version;
71 struct pci_dev *device;
72 enum chipset_type chipset;
73 unsigned long mode;
74 off_t aper_base;
75 size_t aper_size;
76 int max_memory; /* In pages */
77 int current_memory;
78 } agp_kern_info;
80 /*
81 * The agp_memory structure has information
82 * about the block of agp memory allocated.
83 * A caller may manipulate the next and prev
84 * pointers to link each allocated item into
85 * a list. These pointers are ignored by the
86 * backend. Everything else should never be
87 * written to, but the caller may read any of
88 * the items to detrimine the status of this
89 * block of agp memory.
93 typedef struct _agp_memory {
94 int key;
95 struct _agp_memory *next;
96 struct _agp_memory *prev;
97 size_t page_count;
98 int num_scratch_pages;
99 unsigned long *memory;
100 off_t pg_start;
101 u32 type;
102 u32 physical;
103 u8 is_bound;
104 u8 is_flushed;
105 } agp_memory;
107 #define AGP_NORMAL_MEMORY 0
109 extern void agp_free_memory(agp_memory *);
112 * agp_free_memory :
114 * This function frees memory associated with
115 * an agp_memory pointer. It is the only function
116 * that can be called when the backend is not owned
117 * by the caller. (So it can free memory on client
118 * death.)
120 * It takes an agp_memory pointer as an argument.
124 extern agp_memory *agp_allocate_memory(size_t, u32);
127 * agp_allocate_memory :
129 * This function allocates a group of pages of
130 * a certain type.
132 * It takes a size_t argument of the number of pages, and
133 * an u32 argument of the type of memory to be allocated.
134 * Every agp bridge device will allow you to allocate
135 * AGP_NORMAL_MEMORY which maps to physical ram. Any other
136 * type is device dependant.
138 * It returns NULL whenever memory is unavailable.
142 extern void agp_copy_info(agp_kern_info *);
145 * agp_copy_info :
147 * This function copies information about the
148 * agp bridge device and the state of the agp
149 * backend into an agp_kern_info pointer.
151 * It takes an agp_kern_info pointer as an
152 * argument. The caller should insure that
153 * this pointer is valid.
157 extern int agp_bind_memory(agp_memory *, off_t);
160 * agp_bind_memory :
162 * This function binds an agp_memory structure
163 * into the graphics aperture translation table.
165 * It takes an agp_memory pointer and an offset into
166 * the graphics aperture translation table as arguments
168 * It returns -EINVAL if the pointer == NULL.
169 * It returns -EBUSY if the area of the table
170 * requested is already in use.
174 extern int agp_unbind_memory(agp_memory *);
177 * agp_unbind_memory :
179 * This function removes an agp_memory structure
180 * from the graphics aperture translation table.
182 * It takes an agp_memory pointer as an argument.
184 * It returns -EINVAL if this piece of agp_memory
185 * is not currently bound to the graphics aperture
186 * translation table or if the agp_memory
187 * pointer == NULL
191 extern void agp_enable(u32);
194 * agp_enable :
196 * This function initializes the agp point-to-point
197 * connection.
199 * It takes an agp mode register as an argument
203 extern int agp_backend_acquire(void);
206 * agp_backend_acquire :
208 * This Function attempts to acquire the agp
209 * backend.
211 * returns -EBUSY if agp is in use,
212 * returns 0 if the caller owns the agp backend
215 extern void agp_backend_release(void);
218 * agp_backend_release :
220 * This Function releases the lock on the agp
221 * backend.
223 * The caller must insure that the graphics
224 * aperture translation table is read for use
225 * by another entity. (Ensure that all memory
226 * it bound is unbound.)
230 typedef struct {
231 void (*free_memory)(agp_memory *);
232 agp_memory *(*allocate_memory)(size_t, u32);
233 int (*bind_memory)(agp_memory *, off_t);
234 int (*unbind_memory)(agp_memory *);
235 void (*enable)(u32);
236 int (*acquire)(void);
237 void (*release)(void);
238 void (*copy_info)(agp_kern_info *);
239 } drm_agp_t;
241 extern const drm_agp_t *drm_agp_p;
244 * Interface between drm and agp code. When agp initializes, it makes
245 * the above structure available via inter_module_register(), drm might
246 * use it. Keith Owens <kaos@ocs.com.au> 28 Oct 2000.
249 #endif /* _AGP_BACKEND_H */