xref: /OK3568_Linux_fs/kernel/drivers/char/agp/compat_ioctl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 1999 Jeff Hartmann
3*4882a593Smuzhiyun  * Copyright (C) 1999 Precision Insight, Inc.
4*4882a593Smuzhiyun  * Copyright (C) 1999 Xi Graphics, Inc.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
7*4882a593Smuzhiyun  * copy of this software and associated documentation files (the "Software"),
8*4882a593Smuzhiyun  * to deal in the Software without restriction, including without limitation
9*4882a593Smuzhiyun  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10*4882a593Smuzhiyun  * and/or sell copies of the Software, and to permit persons to whom the
11*4882a593Smuzhiyun  * Software is furnished to do so, subject to the following conditions:
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  * The above copyright notice and this permission notice shall be included
14*4882a593Smuzhiyun  * in all copies or substantial portions of the Software.
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17*4882a593Smuzhiyun  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*4882a593Smuzhiyun  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19*4882a593Smuzhiyun  * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
20*4882a593Smuzhiyun  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21*4882a593Smuzhiyun  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22*4882a593Smuzhiyun  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  */
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #ifndef _AGP_COMPAT_IOCTL_H
27*4882a593Smuzhiyun #define _AGP_COMPAT_IOCTL_H
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #include <linux/compat.h>
30*4882a593Smuzhiyun #include <linux/agpgart.h>
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #define AGPIOC_INFO32       _IOR (AGPIOC_BASE, 0, compat_uptr_t)
33*4882a593Smuzhiyun #define AGPIOC_ACQUIRE32    _IO  (AGPIOC_BASE, 1)
34*4882a593Smuzhiyun #define AGPIOC_RELEASE32    _IO  (AGPIOC_BASE, 2)
35*4882a593Smuzhiyun #define AGPIOC_SETUP32      _IOW (AGPIOC_BASE, 3, compat_uptr_t)
36*4882a593Smuzhiyun #define AGPIOC_RESERVE32    _IOW (AGPIOC_BASE, 4, compat_uptr_t)
37*4882a593Smuzhiyun #define AGPIOC_PROTECT32    _IOW (AGPIOC_BASE, 5, compat_uptr_t)
38*4882a593Smuzhiyun #define AGPIOC_ALLOCATE32   _IOWR(AGPIOC_BASE, 6, compat_uptr_t)
39*4882a593Smuzhiyun #define AGPIOC_DEALLOCATE32 _IOW (AGPIOC_BASE, 7, compat_int_t)
40*4882a593Smuzhiyun #define AGPIOC_BIND32       _IOW (AGPIOC_BASE, 8, compat_uptr_t)
41*4882a593Smuzhiyun #define AGPIOC_UNBIND32     _IOW (AGPIOC_BASE, 9, compat_uptr_t)
42*4882a593Smuzhiyun #define AGPIOC_CHIPSET_FLUSH32 _IO (AGPIOC_BASE, 10)
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun struct agp_info32 {
45*4882a593Smuzhiyun 	struct agp_version version;	/* version of the driver        */
46*4882a593Smuzhiyun 	u32 bridge_id;		/* bridge vendor/device         */
47*4882a593Smuzhiyun 	u32 agp_mode;		/* mode info of bridge          */
48*4882a593Smuzhiyun 	compat_long_t aper_base;	/* base of aperture             */
49*4882a593Smuzhiyun 	compat_size_t aper_size;	/* size of aperture             */
50*4882a593Smuzhiyun 	compat_size_t pg_total;	/* max pages (swap + system)    */
51*4882a593Smuzhiyun 	compat_size_t pg_system;	/* max pages (system)           */
52*4882a593Smuzhiyun 	compat_size_t pg_used;		/* current pages used           */
53*4882a593Smuzhiyun };
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun /*
56*4882a593Smuzhiyun  * The "prot" down below needs still a "sleep" flag somehow ...
57*4882a593Smuzhiyun  */
58*4882a593Smuzhiyun struct agp_segment32 {
59*4882a593Smuzhiyun 	compat_off_t pg_start;		/* starting page to populate    */
60*4882a593Smuzhiyun 	compat_size_t pg_count;	/* number of pages              */
61*4882a593Smuzhiyun 	compat_int_t prot;		/* prot flags for mmap          */
62*4882a593Smuzhiyun };
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun struct agp_region32 {
65*4882a593Smuzhiyun 	compat_pid_t pid;		/* pid of process               */
66*4882a593Smuzhiyun 	compat_size_t seg_count;	/* number of segments           */
67*4882a593Smuzhiyun 	struct agp_segment32 *seg_list;
68*4882a593Smuzhiyun };
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun struct agp_allocate32 {
71*4882a593Smuzhiyun 	compat_int_t key;		/* tag of allocation            */
72*4882a593Smuzhiyun 	compat_size_t pg_count;	/* number of pages              */
73*4882a593Smuzhiyun 	u32 type;		/* 0 == normal, other devspec   */
74*4882a593Smuzhiyun 	u32 physical;           /* device specific (some devices
75*4882a593Smuzhiyun 				 * need a phys address of the
76*4882a593Smuzhiyun 				 * actual page behind the gatt
77*4882a593Smuzhiyun 				 * table)                        */
78*4882a593Smuzhiyun };
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun struct agp_bind32 {
81*4882a593Smuzhiyun 	compat_int_t key;		/* tag of allocation            */
82*4882a593Smuzhiyun 	compat_off_t pg_start;		/* starting page to populate    */
83*4882a593Smuzhiyun };
84*4882a593Smuzhiyun 
85*4882a593Smuzhiyun struct agp_unbind32 {
86*4882a593Smuzhiyun 	compat_int_t key;		/* tag of allocation            */
87*4882a593Smuzhiyun 	u32 priority;		/* priority for paging out      */
88*4882a593Smuzhiyun };
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun extern struct agp_front_data agp_fe;
91*4882a593Smuzhiyun 
92*4882a593Smuzhiyun int agpioc_acquire_wrap(struct agp_file_private *priv);
93*4882a593Smuzhiyun int agpioc_release_wrap(struct agp_file_private *priv);
94*4882a593Smuzhiyun int agpioc_protect_wrap(struct agp_file_private *priv);
95*4882a593Smuzhiyun int agpioc_setup_wrap(struct agp_file_private *priv, void __user *arg);
96*4882a593Smuzhiyun int agpioc_deallocate_wrap(struct agp_file_private *priv, int arg);
97*4882a593Smuzhiyun struct agp_file_private *agp_find_private(pid_t pid);
98*4882a593Smuzhiyun struct agp_client *agp_create_client(pid_t id);
99*4882a593Smuzhiyun int agp_remove_client(pid_t id);
100*4882a593Smuzhiyun int agp_create_segment(struct agp_client *client, struct agp_region *region);
101*4882a593Smuzhiyun void agp_free_memory_wrap(struct agp_memory *memory);
102*4882a593Smuzhiyun struct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type);
103*4882a593Smuzhiyun struct agp_memory *agp_find_mem_by_key(int key);
104*4882a593Smuzhiyun struct agp_client *agp_find_client_by_pid(pid_t id);
105*4882a593Smuzhiyun 
106*4882a593Smuzhiyun #endif /* _AGP_COMPAT_H */
107