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#ifndef _AGP_H
28#define _AGP_H 1
29
30#define AGPIOC_BASE 'A'
31#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct 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, struct agp_setup*)
35#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)
36#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)
37#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
38#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
39#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
40#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
41#define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)
42
43#define AGP_DEVICE "/dev/agpgart"
44
45#ifndef TRUE
46#define TRUE 1
47#endif
48
49#ifndef FALSE
50#define FALSE 0
51#endif
52
53#ifndef __KERNEL__
54#include <linux/types.h>
55#include <asm/types.h>
56
57struct agp_version {
58 __u16 major;
59 __u16 minor;
60};
61
62typedef struct _agp_info {
63 struct agp_version version;
64 __u32 bridge_id;
65 __u32 agp_mode;
66 unsigned long aper_base;
67 size_t aper_size;
68 size_t pg_total;
69 size_t pg_system;
70 size_t pg_used;
71} agp_info;
72
73typedef struct _agp_setup {
74 __u32 agp_mode;
75} agp_setup;
76
77
78
79
80typedef struct _agp_segment {
81 off_t pg_start;
82 size_t pg_count;
83 int prot;
84} agp_segment;
85
86typedef struct _agp_region {
87 pid_t pid;
88 size_t seg_count;
89 struct _agp_segment *seg_list;
90} agp_region;
91
92typedef struct _agp_allocate {
93 int key;
94 size_t pg_count;
95 __u32 type;
96 __u32 physical;
97
98
99
100} agp_allocate;
101
102typedef struct _agp_bind {
103 int key;
104 off_t pg_start;
105} agp_bind;
106
107typedef struct _agp_unbind {
108 int key;
109 __u32 priority;
110} agp_unbind;
111
112#else
113#include <linux/mutex.h>
114#include <linux/agp_backend.h>
115
116#define AGPGART_MINOR 175
117
118struct agp_info {
119 struct agp_version version;
120 u32 bridge_id;
121 u32 agp_mode;
122 unsigned long aper_base;
123 size_t aper_size;
124 size_t pg_total;
125 size_t pg_system;
126 size_t pg_used;
127};
128
129struct agp_setup {
130 u32 agp_mode;
131};
132
133
134
135
136struct agp_segment {
137 off_t pg_start;
138 size_t pg_count;
139 int prot;
140};
141
142struct agp_segment_priv {
143 off_t pg_start;
144 size_t pg_count;
145 pgprot_t prot;
146};
147
148struct agp_region {
149 pid_t pid;
150 size_t seg_count;
151 struct agp_segment *seg_list;
152};
153
154struct agp_allocate {
155 int key;
156 size_t pg_count;
157 u32 type;
158 u32 physical;
159
160
161
162};
163
164struct agp_bind {
165 int key;
166 off_t pg_start;
167};
168
169struct agp_unbind {
170 int key;
171 u32 priority;
172};
173
174struct agp_client {
175 struct agp_client *next;
176 struct agp_client *prev;
177 pid_t pid;
178 int num_segments;
179 struct agp_segment_priv **segments;
180};
181
182struct agp_controller {
183 struct agp_controller *next;
184 struct agp_controller *prev;
185 pid_t pid;
186 int num_clients;
187 struct agp_memory *pool;
188 struct agp_client *clients;
189};
190
191#define AGP_FF_ALLOW_CLIENT 0
192#define AGP_FF_ALLOW_CONTROLLER 1
193#define AGP_FF_IS_CLIENT 2
194#define AGP_FF_IS_CONTROLLER 3
195#define AGP_FF_IS_VALID 4
196
197struct agp_file_private {
198 struct agp_file_private *next;
199 struct agp_file_private *prev;
200 pid_t my_pid;
201 unsigned long access_flags;
202};
203
204struct agp_front_data {
205 struct mutex agp_mutex;
206 struct agp_controller *current_controller;
207 struct agp_controller *controllers;
208 struct agp_file_private *file_priv_list;
209 bool used_by_controller;
210 bool backend_acquired;
211};
212
213#endif
214
215#endif
216