10316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo/*
20316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * Copyright (C) 1999 Jeff Hartmann
30316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * Copyright (C) 1999 Precision Insight, Inc.
40316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * Copyright (C) 1999 Xi Graphics, Inc.
50316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo *
60316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * Permission is hereby granted, free of charge, to any person obtaining a
70316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * copy of this software and associated documentation files (the "Software"),
80316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * to deal in the Software without restriction, including without limitation
90316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * the rights to use, copy, modify, merge, publish, distribute, sublicense,
100316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * and/or sell copies of the Software, and to permit persons to whom the
110316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * Software is furnished to do so, subject to the following conditions:
120316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo *
130316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * The above copyright notice and this permission notice shall be included
140316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * in all copies or substantial portions of the Software.
150316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo *
160316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
170316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
180316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
190316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
200316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
210316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
220316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
230316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo *
240316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo */
250316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
260316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#ifndef _AGP_COMPAT_IOCTL_H
270316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define _AGP_COMPAT_IOCTL_H
280316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
290316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#include <linux/compat.h>
300316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#include <linux/agpgart.h>
310316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
320316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_INFO32       _IOR (AGPIOC_BASE, 0, compat_uptr_t)
330316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_ACQUIRE32    _IO  (AGPIOC_BASE, 1)
340316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_RELEASE32    _IO  (AGPIOC_BASE, 2)
350316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_SETUP32      _IOW (AGPIOC_BASE, 3, compat_uptr_t)
360316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_RESERVE32    _IOW (AGPIOC_BASE, 4, compat_uptr_t)
370316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_PROTECT32    _IOW (AGPIOC_BASE, 5, compat_uptr_t)
380316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_ALLOCATE32   _IOWR(AGPIOC_BASE, 6, compat_uptr_t)
390316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_DEALLOCATE32 _IOW (AGPIOC_BASE, 7, compat_int_t)
400316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_BIND32       _IOW (AGPIOC_BASE, 8, compat_uptr_t)
410316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#define AGPIOC_UNBIND32     _IOW (AGPIOC_BASE, 9, compat_uptr_t)
42a13af4b4d842da6d7065b8c73fa8f0ac58fea1b6Dave Airlie#define AGPIOC_CHIPSET_FLUSH32 _IO (AGPIOC_BASE, 10)
430316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
440316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_info32 {
450316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	struct agp_version version;	/* version of the driver        */
460316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	u32 bridge_id;		/* bridge vendor/device         */
470316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	u32 agp_mode;		/* mode info of bridge          */
480316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_long_t aper_base;	/* base of aperture             */
490316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_size_t aper_size;	/* size of aperture             */
500316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_size_t pg_total;	/* max pages (swap + system)    */
510316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_size_t pg_system;	/* max pages (system)           */
520316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_size_t pg_used;		/* current pages used           */
530316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo};
540316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
550316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo/*
560316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo * The "prot" down below needs still a "sleep" flag somehow ...
570316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo */
580316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_segment32 {
590316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_off_t pg_start;		/* starting page to populate    */
600316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_size_t pg_count;	/* number of pages              */
610316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_int_t prot;		/* prot flags for mmap          */
620316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo};
630316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
640316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_region32 {
650316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_pid_t pid;		/* pid of process               */
660316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_size_t seg_count;	/* number of segments           */
670316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	struct agp_segment32 *seg_list;
680316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo};
690316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
700316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_allocate32 {
710316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_int_t key;		/* tag of allocation            */
720316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_size_t pg_count;	/* number of pages              */
730316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	u32 type;		/* 0 == normal, other devspec   */
740316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	u32 physical;           /* device specific (some devices
750316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo				 * need a phys address of the
760316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo				 * actual page behind the gatt
770316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo				 * table)                        */
780316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo};
790316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
800316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_bind32 {
810316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_int_t key;		/* tag of allocation            */
820316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_off_t pg_start;		/* starting page to populate    */
830316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo};
840316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
850316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_unbind32 {
860316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	compat_int_t key;		/* tag of allocation            */
870316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo	u32 priority;		/* priority for paging out      */
880316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo};
890316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
900316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikamboextern struct agp_front_data agp_fe;
910316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
920316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikamboint agpioc_acquire_wrap(struct agp_file_private *priv);
930316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikamboint agpioc_release_wrap(struct agp_file_private *priv);
940316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikamboint agpioc_protect_wrap(struct agp_file_private *priv);
950316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikamboint agpioc_setup_wrap(struct agp_file_private *priv, void __user *arg);
960316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikamboint agpioc_deallocate_wrap(struct agp_file_private *priv, int arg);
970316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_file_private *agp_find_private(pid_t pid);
980316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_client *agp_create_client(pid_t id);
990316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikamboint agp_remove_client(pid_t id);
1000316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikamboint agp_create_segment(struct agp_client *client, struct agp_region *region);
1010316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambovoid agp_free_memory_wrap(struct agp_memory *memory);
1020316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type);
1030316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_memory *agp_find_mem_by_key(int key);
1040316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambostruct agp_client *agp_find_client_by_pid(pid_t id);
1050316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo
1060316fe8319ff62e527d0d91a3bc7df1c59eafae8Zwane Mwaikambo#endif /* _AGP_COMPAT_H */
107