More Makefile cleanups, otherwise mainly noticeable are the netfilter fix
[davej-history.git] / include / linux / agp_backend.h
bloba9d0af58a6d9ca0c873881feb9c42e96e91961e9
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 INTEL_I850,
51 VIA_GENERIC,
52 VIA_VP3,
53 VIA_MVP3,
54 VIA_MVP4,
55 VIA_APOLLO_PRO,
56 VIA_APOLLO_KX133,
57 VIA_APOLLO_KT133,
58 SIS_GENERIC,
59 AMD_GENERIC,
60 AMD_IRONGATE,
61 ALI_M1541,
62 ALI_GENERIC
65 typedef struct _agp_version {
66 u16 major;
67 u16 minor;
68 } agp_version;
70 typedef struct _agp_kern_info {
71 agp_version version;
72 struct pci_dev *device;
73 enum chipset_type chipset;
74 unsigned long mode;
75 off_t aper_base;
76 size_t aper_size;
77 int max_memory; /* In pages */
78 int current_memory;
79 } agp_kern_info;
81 /*
82 * The agp_memory structure has information
83 * about the block of agp memory allocated.
84 * A caller may manipulate the next and prev
85 * pointers to link each allocated item into
86 * a list. These pointers are ignored by the
87 * backend. Everything else should never be
88 * written to, but the caller may read any of
89 * the items to detrimine the status of this
90 * block of agp memory.
94 typedef struct _agp_memory {
95 int key;
96 struct _agp_memory *next;
97 struct _agp_memory *prev;
98 size_t page_count;
99 int num_scratch_pages;
100 unsigned long *memory;
101 off_t pg_start;
102 u32 type;
103 u32 physical;
104 u8 is_bound;
105 u8 is_flushed;
106 } agp_memory;
108 #define AGP_NORMAL_MEMORY 0
110 extern void agp_free_memory(agp_memory *);
113 * agp_free_memory :
115 * This function frees memory associated with
116 * an agp_memory pointer. It is the only function
117 * that can be called when the backend is not owned
118 * by the caller. (So it can free memory on client
119 * death.)
121 * It takes an agp_memory pointer as an argument.
125 extern agp_memory *agp_allocate_memory(size_t, u32);
128 * agp_allocate_memory :
130 * This function allocates a group of pages of
131 * a certain type.
133 * It takes a size_t argument of the number of pages, and
134 * an u32 argument of the type of memory to be allocated.
135 * Every agp bridge device will allow you to allocate
136 * AGP_NORMAL_MEMORY which maps to physical ram. Any other
137 * type is device dependant.
139 * It returns NULL whenever memory is unavailable.
143 extern void agp_copy_info(agp_kern_info *);
146 * agp_copy_info :
148 * This function copies information about the
149 * agp bridge device and the state of the agp
150 * backend into an agp_kern_info pointer.
152 * It takes an agp_kern_info pointer as an
153 * argument. The caller should insure that
154 * this pointer is valid.
158 extern int agp_bind_memory(agp_memory *, off_t);
161 * agp_bind_memory :
163 * This function binds an agp_memory structure
164 * into the graphics aperture translation table.
166 * It takes an agp_memory pointer and an offset into
167 * the graphics aperture translation table as arguments
169 * It returns -EINVAL if the pointer == NULL.
170 * It returns -EBUSY if the area of the table
171 * requested is already in use.
175 extern int agp_unbind_memory(agp_memory *);
178 * agp_unbind_memory :
180 * This function removes an agp_memory structure
181 * from the graphics aperture translation table.
183 * It takes an agp_memory pointer as an argument.
185 * It returns -EINVAL if this piece of agp_memory
186 * is not currently bound to the graphics aperture
187 * translation table or if the agp_memory
188 * pointer == NULL
192 extern void agp_enable(u32);
195 * agp_enable :
197 * This function initializes the agp point-to-point
198 * connection.
200 * It takes an agp mode register as an argument
204 extern int agp_backend_acquire(void);
207 * agp_backend_acquire :
209 * This Function attempts to acquire the agp
210 * backend.
212 * returns -EBUSY if agp is in use,
213 * returns 0 if the caller owns the agp backend
216 extern void agp_backend_release(void);
219 * agp_backend_release :
221 * This Function releases the lock on the agp
222 * backend.
224 * The caller must insure that the graphics
225 * aperture translation table is read for use
226 * by another entity. (Ensure that all memory
227 * it bound is unbound.)
231 typedef struct {
232 void (*free_memory)(agp_memory *);
233 agp_memory *(*allocate_memory)(size_t, u32);
234 int (*bind_memory)(agp_memory *, off_t);
235 int (*unbind_memory)(agp_memory *);
236 void (*enable)(u32);
237 int (*acquire)(void);
238 void (*release)(void);
239 void (*copy_info)(agp_kern_info *);
240 } drm_agp_t;
242 extern const drm_agp_t *drm_agp_p;
245 * Interface between drm and agp code. When agp initializes, it makes
246 * the above structure available via inter_module_register(), drm might
247 * use it. Keith Owens <kaos@ocs.com.au> 28 Oct 2000.
250 #endif /* _AGP_BACKEND_H */