- Kai Germaschewski: ISDN update (including Makefiles)
[davej-history.git] / include / linux / agpgart.h
blobd18b71dc73578f4cbf97941e5bcb4c50a27a6b48
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_H
28 #define _AGP_H 1
30 #define AGPIOC_BASE 'A'
31 #define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, agp_info*)
32 #define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)
33 #define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)
34 #define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, agp_setup*)
35 #define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, agp_region*)
36 #define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, agp_region*)
37 #define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, agp_allocate*)
38 #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
39 #define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, agp_bind*)
40 #define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, agp_unbind*)
42 #define AGP_DEVICE "/dev/agpgart"
44 #ifndef TRUE
45 #define TRUE 1
46 #endif
48 #ifndef FALSE
49 #define FALSE 0
50 #endif
52 #ifndef __KERNEL__
53 #include <linux/types.h>
54 #include <asm/types.h>
56 typedef struct _agp_version {
57 __u16 major;
58 __u16 minor;
59 } agp_version;
61 typedef struct _agp_info {
62 agp_version version; /* version of the driver */
63 __u32 bridge_id; /* bridge vendor/device */
64 __u32 agp_mode; /* mode info of bridge */
65 off_t aper_base; /* base of aperture */
66 size_t aper_size; /* size of aperture */
67 size_t pg_total; /* max pages (swap + system) */
68 size_t pg_system; /* max pages (system) */
69 size_t pg_used; /* current pages used */
70 } agp_info;
72 typedef struct _agp_setup {
73 __u32 agp_mode; /* mode info of bridge */
74 } agp_setup;
77 * The "prot" down below needs still a "sleep" flag somehow ...
79 typedef struct _agp_segment {
80 off_t pg_start; /* starting page to populate */
81 size_t pg_count; /* number of pages */
82 int prot; /* prot flags for mmap */
83 } agp_segment;
85 typedef struct _agp_region {
86 pid_t pid; /* pid of process */
87 size_t seg_count; /* number of segments */
88 struct _agp_segment *seg_list;
89 } agp_region;
91 typedef struct _agp_allocate {
92 int key; /* tag of allocation */
93 size_t pg_count; /* number of pages */
94 __u32 type; /* 0 == normal, other devspec */
95 __u32 physical; /* device specific (some devices
96 * need a phys address of the
97 * actual page behind the gatt
98 * table) */
99 } agp_allocate;
101 typedef struct _agp_bind {
102 int key; /* tag of allocation */
103 off_t pg_start; /* starting page to populate */
104 } agp_bind;
106 typedef struct _agp_unbind {
107 int key; /* tag of allocation */
108 __u32 priority; /* priority for paging out */
109 } agp_unbind;
111 #else /* __KERNEL__ */
113 #define AGPGART_MINOR 175
115 #define AGP_UNLOCK() up(&(agp_fe.agp_mutex));
116 #define AGP_LOCK() down(&(agp_fe.agp_mutex));
117 #define AGP_LOCK_INIT() sema_init(&(agp_fe.agp_mutex), 1)
119 #ifndef _AGP_BACKEND_H
120 typedef struct _agp_version {
121 u16 major;
122 u16 minor;
123 } agp_version;
125 #endif
127 typedef struct _agp_info {
128 agp_version version; /* version of the driver */
129 u32 bridge_id; /* bridge vendor/device */
130 u32 agp_mode; /* mode info of bridge */
131 off_t aper_base; /* base of aperture */
132 size_t aper_size; /* size of aperture */
133 size_t pg_total; /* max pages (swap + system) */
134 size_t pg_system; /* max pages (system) */
135 size_t pg_used; /* current pages used */
136 } agp_info;
138 typedef struct _agp_setup {
139 u32 agp_mode; /* mode info of bridge */
140 } agp_setup;
143 * The "prot" down below needs still a "sleep" flag somehow ...
145 typedef struct _agp_segment {
146 off_t pg_start; /* starting page to populate */
147 size_t pg_count; /* number of pages */
148 int prot; /* prot flags for mmap */
149 } agp_segment;
151 typedef struct _agp_segment_priv {
152 off_t pg_start;
153 size_t pg_count;
154 pgprot_t prot;
155 } agp_segment_priv;
157 typedef struct _agp_region {
158 pid_t pid; /* pid of process */
159 size_t seg_count; /* number of segments */
160 struct _agp_segment *seg_list;
161 } agp_region;
163 typedef struct _agp_allocate {
164 int key; /* tag of allocation */
165 size_t pg_count; /* number of pages */
166 u32 type; /* 0 == normal, other devspec */
167 u32 physical; /* device specific (some devices
168 * need a phys address of the
169 * actual page behind the gatt
170 * table) */
171 } agp_allocate;
173 typedef struct _agp_bind {
174 int key; /* tag of allocation */
175 off_t pg_start; /* starting page to populate */
176 } agp_bind;
178 typedef struct _agp_unbind {
179 int key; /* tag of allocation */
180 u32 priority; /* priority for paging out */
181 } agp_unbind;
183 typedef struct _agp_client {
184 struct _agp_client *next;
185 struct _agp_client *prev;
186 pid_t pid;
187 int num_segments;
188 agp_segment_priv **segments;
189 } agp_client;
191 typedef struct _agp_controller {
192 struct _agp_controller *next;
193 struct _agp_controller *prev;
194 pid_t pid;
195 int num_clients;
196 agp_memory *pool;
197 agp_client *clients;
198 } agp_controller;
200 #define AGP_FF_ALLOW_CLIENT 0
201 #define AGP_FF_ALLOW_CONTROLLER 1
202 #define AGP_FF_IS_CLIENT 2
203 #define AGP_FF_IS_CONTROLLER 3
204 #define AGP_FF_IS_VALID 4
206 typedef struct _agp_file_private {
207 struct _agp_file_private *next;
208 struct _agp_file_private *prev;
209 pid_t my_pid;
210 long access_flags; /* long req'd for set_bit --RR */
211 } agp_file_private;
213 struct agp_front_data {
214 struct semaphore agp_mutex;
215 agp_controller *current_controller;
216 agp_controller *controllers;
217 agp_file_private *file_priv_list;
218 u8 used_by_controller;
219 u8 backend_acquired;
222 #endif /* __KERNEL__ */
224 #endif /* _AGP_H */