2  * Copyright (C) 1999 Jeff Hartmann
 
   3  * Copyright (C) 1999 Precision Insight, Inc.
 
   4  * Copyright (C) 1999 Xi Graphics, Inc.
 
   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:
 
  13  * The above copyright notice and this permission notice shall be included
 
  14  * in all copies or substantial portions of the Software.
 
  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.
 
  26 #ifndef _AGP_COMPAT_IOCTL_H
 
  27 #define _AGP_COMPAT_IOCTL_H
 
  29 #include <linux/compat.h>
 
  30 #include <linux/agpgart.h>
 
  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)
 
  44         struct agp_version version;     /* version of the driver        */
 
  45         u32 bridge_id;          /* bridge vendor/device         */
 
  46         u32 agp_mode;           /* mode info of bridge          */
 
  47         compat_long_t aper_base;        /* base of aperture             */
 
  48         compat_size_t aper_size;        /* size of aperture             */
 
  49         compat_size_t pg_total; /* max pages (swap + system)    */
 
  50         compat_size_t pg_system;        /* max pages (system)           */
 
  51         compat_size_t pg_used;          /* current pages used           */
 
  55  * The "prot" down below needs still a "sleep" flag somehow ...
 
  57 struct agp_segment32 {
 
  58         compat_off_t pg_start;          /* starting page to populate    */
 
  59         compat_size_t pg_count; /* number of pages              */
 
  60         compat_int_t prot;              /* prot flags for mmap          */
 
  64         compat_pid_t pid;               /* pid of process               */
 
  65         compat_size_t seg_count;        /* number of segments           */
 
  66         struct agp_segment32 *seg_list;
 
  69 struct agp_allocate32 {
 
  70         compat_int_t key;               /* tag of allocation            */
 
  71         compat_size_t pg_count; /* number of pages              */
 
  72         u32 type;               /* 0 == normal, other devspec   */
 
  73         u32 physical;           /* device specific (some devices
 
  74                                  * need a phys address of the
 
  75                                  * actual page behind the gatt
 
  80         compat_int_t key;               /* tag of allocation            */
 
  81         compat_off_t pg_start;          /* starting page to populate    */
 
  85         compat_int_t key;               /* tag of allocation            */
 
  86         u32 priority;           /* priority for paging out      */
 
  89 extern struct agp_front_data agp_fe;
 
  91 int agpioc_acquire_wrap(struct agp_file_private *priv);
 
  92 int agpioc_release_wrap(struct agp_file_private *priv);
 
  93 int agpioc_protect_wrap(struct agp_file_private *priv);
 
  94 int agpioc_setup_wrap(struct agp_file_private *priv, void __user *arg);
 
  95 int agpioc_deallocate_wrap(struct agp_file_private *priv, int arg);
 
  96 struct agp_file_private *agp_find_private(pid_t pid);
 
  97 struct agp_client *agp_create_client(pid_t id);
 
  98 int agp_remove_client(pid_t id);
 
  99 int agp_create_segment(struct agp_client *client, struct agp_region *region);
 
 100 void agp_free_memory_wrap(struct agp_memory *memory);
 
 101 struct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type);
 
 102 struct agp_memory *agp_find_mem_by_key(int key);
 
 103 struct agp_client *agp_find_client_by_pid(pid_t id);
 
 105 #endif /* _AGP_COMPAT_H */