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

source code of linux/drivers/char/agp/compat_ioctl.h