xref: /OK3568_Linux_fs/kernel/include/uapi/linux/agpgart.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * AGPGART module version 0.99
3*4882a593Smuzhiyun  * Copyright (C) 1999 Jeff Hartmann
4*4882a593Smuzhiyun  * Copyright (C) 1999 Precision Insight, Inc.
5*4882a593Smuzhiyun  * Copyright (C) 1999 Xi Graphics, Inc.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
8*4882a593Smuzhiyun  * copy of this software and associated documentation files (the "Software"),
9*4882a593Smuzhiyun  * to deal in the Software without restriction, including without limitation
10*4882a593Smuzhiyun  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11*4882a593Smuzhiyun  * and/or sell copies of the Software, and to permit persons to whom the
12*4882a593Smuzhiyun  * Software is furnished to do so, subject to the following conditions:
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * The above copyright notice and this permission notice shall be included
15*4882a593Smuzhiyun  * in all copies or substantial portions of the Software.
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18*4882a593Smuzhiyun  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19*4882a593Smuzhiyun  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20*4882a593Smuzhiyun  * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
21*4882a593Smuzhiyun  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22*4882a593Smuzhiyun  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
23*4882a593Smuzhiyun  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun #ifndef _UAPI_AGP_H
28*4882a593Smuzhiyun #define _UAPI_AGP_H
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #define AGPIOC_BASE       'A'
31*4882a593Smuzhiyun #define AGPIOC_INFO       _IOR (AGPIOC_BASE, 0, struct agp_info*)
32*4882a593Smuzhiyun #define AGPIOC_ACQUIRE    _IO  (AGPIOC_BASE, 1)
33*4882a593Smuzhiyun #define AGPIOC_RELEASE    _IO  (AGPIOC_BASE, 2)
34*4882a593Smuzhiyun #define AGPIOC_SETUP      _IOW (AGPIOC_BASE, 3, struct agp_setup*)
35*4882a593Smuzhiyun #define AGPIOC_RESERVE    _IOW (AGPIOC_BASE, 4, struct agp_region*)
36*4882a593Smuzhiyun #define AGPIOC_PROTECT    _IOW (AGPIOC_BASE, 5, struct agp_region*)
37*4882a593Smuzhiyun #define AGPIOC_ALLOCATE   _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
38*4882a593Smuzhiyun #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
39*4882a593Smuzhiyun #define AGPIOC_BIND       _IOW (AGPIOC_BASE, 8, struct agp_bind*)
40*4882a593Smuzhiyun #define AGPIOC_UNBIND     _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
41*4882a593Smuzhiyun #define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun #define AGP_DEVICE      "/dev/agpgart"
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #ifndef TRUE
46*4882a593Smuzhiyun #define TRUE 1
47*4882a593Smuzhiyun #endif
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun #ifndef FALSE
50*4882a593Smuzhiyun #define FALSE 0
51*4882a593Smuzhiyun #endif
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun #ifndef __KERNEL__
54*4882a593Smuzhiyun #include <linux/types.h>
55*4882a593Smuzhiyun #include <stdlib.h>
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun struct agp_version {
58*4882a593Smuzhiyun 	__u16 major;
59*4882a593Smuzhiyun 	__u16 minor;
60*4882a593Smuzhiyun };
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun typedef struct _agp_info {
63*4882a593Smuzhiyun 	struct agp_version version;	/* version of the driver        */
64*4882a593Smuzhiyun 	__u32 bridge_id;	/* bridge vendor/device         */
65*4882a593Smuzhiyun 	__u32 agp_mode;		/* mode info of bridge          */
66*4882a593Smuzhiyun 	unsigned long aper_base;/* base of aperture             */
67*4882a593Smuzhiyun 	size_t aper_size;	/* size of aperture             */
68*4882a593Smuzhiyun 	size_t pg_total;	/* max pages (swap + system)    */
69*4882a593Smuzhiyun 	size_t pg_system;	/* max pages (system)           */
70*4882a593Smuzhiyun 	size_t pg_used;		/* current pages used           */
71*4882a593Smuzhiyun } agp_info;
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun typedef struct _agp_setup {
74*4882a593Smuzhiyun 	__u32 agp_mode;		/* mode info of bridge          */
75*4882a593Smuzhiyun } agp_setup;
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun /*
78*4882a593Smuzhiyun  * The "prot" down below needs still a "sleep" flag somehow ...
79*4882a593Smuzhiyun  */
80*4882a593Smuzhiyun typedef struct _agp_segment {
81*4882a593Smuzhiyun 	__kernel_off_t pg_start;	/* starting page to populate    */
82*4882a593Smuzhiyun 	__kernel_size_t pg_count;	/* number of pages              */
83*4882a593Smuzhiyun 	int prot;			/* prot flags for mmap          */
84*4882a593Smuzhiyun } agp_segment;
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun typedef struct _agp_region {
87*4882a593Smuzhiyun 	__kernel_pid_t pid;		/* pid of process       */
88*4882a593Smuzhiyun 	__kernel_size_t seg_count;	/* number of segments   */
89*4882a593Smuzhiyun 	struct _agp_segment *seg_list;
90*4882a593Smuzhiyun } agp_region;
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun typedef struct _agp_allocate {
93*4882a593Smuzhiyun 	int key;		/* tag of allocation            */
94*4882a593Smuzhiyun 	__kernel_size_t pg_count;/* number of pages             */
95*4882a593Smuzhiyun 	__u32 type;		/* 0 == normal, other devspec   */
96*4882a593Smuzhiyun    	__u32 physical;         /* device specific (some devices
97*4882a593Smuzhiyun 				 * need a phys address of the
98*4882a593Smuzhiyun 				 * actual page behind the gatt
99*4882a593Smuzhiyun 				 * table)                        */
100*4882a593Smuzhiyun } agp_allocate;
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun typedef struct _agp_bind {
103*4882a593Smuzhiyun 	int key;		/* tag of allocation            */
104*4882a593Smuzhiyun 	__kernel_off_t pg_start;/* starting page to populate    */
105*4882a593Smuzhiyun } agp_bind;
106*4882a593Smuzhiyun 
107*4882a593Smuzhiyun typedef struct _agp_unbind {
108*4882a593Smuzhiyun 	int key;		/* tag of allocation            */
109*4882a593Smuzhiyun 	__u32 priority;		/* priority for paging out      */
110*4882a593Smuzhiyun } agp_unbind;
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun #endif				/* __KERNEL__ */
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun #endif /* _UAPI_AGP_H */
115