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