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, 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*)
41
42#define AGP_DEVICE "/dev/agpgart"
43
44#ifndef TRUE
45#define TRUE 1
46#endif
47
48#ifndef FALSE
49#define FALSE 0
50#endif
51
52#ifndef __KERNEL__
53#include <linux/types.h>
54#include <asm/types.h>
55
56typedef struct _agp_version {
57 __u16 major;
58 __u16 minor;
59} agp_version;
60
61typedef struct _agp_info {
62 agp_version version;
63 __u32 bridge_id;
64 __u32 agp_mode;
65 off_t aper_base;
66 size_t aper_size;
67 size_t pg_total;
68 size_t pg_system;
69 size_t pg_used;
70} agp_info;
71
72typedef struct _agp_setup {
73 __u32 agp_mode;
74} agp_setup;
75
76
77
78
79typedef struct _agp_segment {
80 off_t pg_start;
81 size_t pg_count;
82 int prot;
83} agp_segment;
84
85typedef struct _agp_region {
86 pid_t pid;
87 size_t seg_count;
88 struct _agp_segment *seg_list;
89} agp_region;
90
91typedef struct _agp_allocate {
92 int key;
93 size_t pg_count;
94 __u32 type;
95 __u32 physical;
96
97
98
99} agp_allocate;
100
101typedef struct _agp_bind {
102 int key;
103 off_t pg_start;
104} agp_bind;
105
106typedef struct _agp_unbind {
107 int key;
108 __u32 priority;
109} agp_unbind;
110
111#else
112
113#define AGPGART_MINOR 175
114
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)
118
119#ifndef _AGP_BACKEND_H
120typedef struct _agp_version {
121 u16 major;
122 u16 minor;
123} agp_version;
124
125#endif
126
127typedef struct _agp_info {
128 agp_version version;
129 u32 bridge_id;
130 u32 agp_mode;
131 off_t aper_base;
132 size_t aper_size;
133 size_t pg_total;
134 size_t pg_system;
135 size_t pg_used;
136} agp_info;
137
138typedef struct _agp_setup {
139 u32 agp_mode;
140} agp_setup;
141
142
143
144
145typedef struct _agp_segment {
146 off_t pg_start;
147 size_t pg_count;
148 int prot;
149} agp_segment;
150
151typedef struct _agp_segment_priv {
152 off_t pg_start;
153 size_t pg_count;
154 pgprot_t prot;
155} agp_segment_priv;
156
157typedef struct _agp_region {
158 pid_t pid;
159 size_t seg_count;
160 struct _agp_segment *seg_list;
161} agp_region;
162
163typedef struct _agp_allocate {
164 int key;
165 size_t pg_count;
166 u32 type;
167 u32 physical;
168
169
170
171} agp_allocate;
172
173typedef struct _agp_bind {
174 int key;
175 off_t pg_start;
176} agp_bind;
177
178typedef struct _agp_unbind {
179 int key;
180 u32 priority;
181} agp_unbind;
182
183typedef 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;
190
191typedef 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;
199
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
205
206typedef 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;
211} agp_file_private;
212
213struct 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;
220};
221
222#endif
223
224#endif
225