162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (C) 1999 Jeff Hartmann
362306a36Sopenharmony_ci * Copyright (C) 1999 Precision Insight, Inc.
462306a36Sopenharmony_ci * Copyright (C) 1999 Xi Graphics, Inc.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
762306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
862306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
962306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1062306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
1162306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included
1462306a36Sopenharmony_ci * in all copies or substantial portions of the Software.
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1762306a36Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1862306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1962306a36Sopenharmony_ci * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
2062306a36Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2162306a36Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
2262306a36Sopenharmony_ci * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci */
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#ifndef _AGP_COMPAT_IOCTL_H
2762306a36Sopenharmony_ci#define _AGP_COMPAT_IOCTL_H
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#include <linux/compat.h>
3062306a36Sopenharmony_ci#include <linux/agpgart.h>
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define AGPIOC_INFO32       _IOR (AGPIOC_BASE, 0, compat_uptr_t)
3362306a36Sopenharmony_ci#define AGPIOC_ACQUIRE32    _IO  (AGPIOC_BASE, 1)
3462306a36Sopenharmony_ci#define AGPIOC_RELEASE32    _IO  (AGPIOC_BASE, 2)
3562306a36Sopenharmony_ci#define AGPIOC_SETUP32      _IOW (AGPIOC_BASE, 3, compat_uptr_t)
3662306a36Sopenharmony_ci#define AGPIOC_RESERVE32    _IOW (AGPIOC_BASE, 4, compat_uptr_t)
3762306a36Sopenharmony_ci#define AGPIOC_PROTECT32    _IOW (AGPIOC_BASE, 5, compat_uptr_t)
3862306a36Sopenharmony_ci#define AGPIOC_ALLOCATE32   _IOWR(AGPIOC_BASE, 6, compat_uptr_t)
3962306a36Sopenharmony_ci#define AGPIOC_DEALLOCATE32 _IOW (AGPIOC_BASE, 7, compat_int_t)
4062306a36Sopenharmony_ci#define AGPIOC_BIND32       _IOW (AGPIOC_BASE, 8, compat_uptr_t)
4162306a36Sopenharmony_ci#define AGPIOC_UNBIND32     _IOW (AGPIOC_BASE, 9, compat_uptr_t)
4262306a36Sopenharmony_ci#define AGPIOC_CHIPSET_FLUSH32 _IO (AGPIOC_BASE, 10)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_cistruct agp_info32 {
4562306a36Sopenharmony_ci	struct agp_version version;	/* version of the driver        */
4662306a36Sopenharmony_ci	u32 bridge_id;		/* bridge vendor/device         */
4762306a36Sopenharmony_ci	u32 agp_mode;		/* mode info of bridge          */
4862306a36Sopenharmony_ci	compat_long_t aper_base;	/* base of aperture             */
4962306a36Sopenharmony_ci	compat_size_t aper_size;	/* size of aperture             */
5062306a36Sopenharmony_ci	compat_size_t pg_total;	/* max pages (swap + system)    */
5162306a36Sopenharmony_ci	compat_size_t pg_system;	/* max pages (system)           */
5262306a36Sopenharmony_ci	compat_size_t pg_used;		/* current pages used           */
5362306a36Sopenharmony_ci};
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci/*
5662306a36Sopenharmony_ci * The "prot" down below needs still a "sleep" flag somehow ...
5762306a36Sopenharmony_ci */
5862306a36Sopenharmony_cistruct agp_segment32 {
5962306a36Sopenharmony_ci	compat_off_t pg_start;		/* starting page to populate    */
6062306a36Sopenharmony_ci	compat_size_t pg_count;	/* number of pages              */
6162306a36Sopenharmony_ci	compat_int_t prot;		/* prot flags for mmap          */
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_cistruct agp_region32 {
6562306a36Sopenharmony_ci	compat_pid_t pid;		/* pid of process               */
6662306a36Sopenharmony_ci	compat_size_t seg_count;	/* number of segments           */
6762306a36Sopenharmony_ci	struct agp_segment32 *seg_list;
6862306a36Sopenharmony_ci};
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_cistruct agp_allocate32 {
7162306a36Sopenharmony_ci	compat_int_t key;		/* tag of allocation            */
7262306a36Sopenharmony_ci	compat_size_t pg_count;	/* number of pages              */
7362306a36Sopenharmony_ci	u32 type;		/* 0 == normal, other devspec   */
7462306a36Sopenharmony_ci	u32 physical;           /* device specific (some devices
7562306a36Sopenharmony_ci				 * need a phys address of the
7662306a36Sopenharmony_ci				 * actual page behind the gatt
7762306a36Sopenharmony_ci				 * table)                        */
7862306a36Sopenharmony_ci};
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_cistruct agp_bind32 {
8162306a36Sopenharmony_ci	compat_int_t key;		/* tag of allocation            */
8262306a36Sopenharmony_ci	compat_off_t pg_start;		/* starting page to populate    */
8362306a36Sopenharmony_ci};
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_cistruct agp_unbind32 {
8662306a36Sopenharmony_ci	compat_int_t key;		/* tag of allocation            */
8762306a36Sopenharmony_ci	u32 priority;		/* priority for paging out      */
8862306a36Sopenharmony_ci};
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ciextern struct agp_front_data agp_fe;
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ciint agpioc_acquire_wrap(struct agp_file_private *priv);
9362306a36Sopenharmony_ciint agpioc_release_wrap(struct agp_file_private *priv);
9462306a36Sopenharmony_ciint agpioc_protect_wrap(struct agp_file_private *priv);
9562306a36Sopenharmony_ciint agpioc_setup_wrap(struct agp_file_private *priv, void __user *arg);
9662306a36Sopenharmony_ciint agpioc_deallocate_wrap(struct agp_file_private *priv, int arg);
9762306a36Sopenharmony_cistruct agp_file_private *agp_find_private(pid_t pid);
9862306a36Sopenharmony_cistruct agp_client *agp_create_client(pid_t id);
9962306a36Sopenharmony_ciint agp_remove_client(pid_t id);
10062306a36Sopenharmony_ciint agp_create_segment(struct agp_client *client, struct agp_region *region);
10162306a36Sopenharmony_civoid agp_free_memory_wrap(struct agp_memory *memory);
10262306a36Sopenharmony_cistruct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type);
10362306a36Sopenharmony_cistruct agp_memory *agp_find_mem_by_key(int key);
10462306a36Sopenharmony_cistruct agp_client *agp_find_client_by_pid(pid_t id);
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#endif /* _AGP_COMPAT_H */
107