/*1* AGPGART module version 0.992* Copyright (C) 1999 Jeff Hartmann3* 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 a7* copy of this software and associated documentation files (the "Software"),8* to deal in the Software without restriction, including without limitation9* the rights to use, copy, modify, merge, publish, distribute, sublicense,10* and/or sell copies of the Software, and to permit persons to whom the11* Software is furnished to do so, subject to the following conditions:12*13* The above copyright notice and this permission notice shall be included14* in all copies or substantial portions of the Software.15*16* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS17* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,18* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL19* JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,20* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR21* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE22* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.23*24*/2526#ifndef _AGP_H27#define _AGP_H 12829#define AGPIOC_BASE 'A'30#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)31#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)32#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)33#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*)34#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)35#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)36#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)37#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)38#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)39#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)40#define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)4142#define AGP_DEVICE "/dev/agpgart"4344#ifndef TRUE45#define TRUE 146#endif4748#ifndef FALSE49#define FALSE 050#endif5152#ifndef __KERNEL__53#include <linux/types.h>5455struct agp_version {56__u16 major;57__u16 minor;58};5960typedef struct _agp_info {61struct agp_version version; /* version of the driver */62__u32 bridge_id; /* bridge vendor/device */63__u32 agp_mode; /* mode info of bridge */64unsigned long aper_base;/* base of aperture */65size_t aper_size; /* size of aperture */66size_t pg_total; /* max pages (swap + system) */67size_t pg_system; /* max pages (system) */68size_t pg_used; /* current pages used */69} agp_info;7071typedef struct _agp_setup {72__u32 agp_mode; /* mode info of bridge */73} agp_setup;7475/*76* The "prot" down below needs still a "sleep" flag somehow ...77*/78typedef struct _agp_segment {79__kernel_off_t pg_start; /* starting page to populate */80__kernel_size_t pg_count; /* number of pages */81int prot; /* prot flags for mmap */82} agp_segment;8384typedef struct _agp_region {85__kernel_pid_t pid; /* pid of process */86__kernel_size_t seg_count; /* number of segments */87struct _agp_segment *seg_list;88} agp_region;8990typedef struct _agp_allocate {91int key; /* tag of allocation */92__kernel_size_t pg_count;/* number of pages */93__u32 type; /* 0 == normal, other devspec */94__u32 physical; /* device specific (some devices95* need a phys address of the96* actual page behind the gatt97* table) */98} agp_allocate;99100typedef struct _agp_bind {101int key; /* tag of allocation */102__kernel_off_t pg_start;/* starting page to populate */103} agp_bind;104105typedef struct _agp_unbind {106int key; /* tag of allocation */107__u32 priority; /* priority for paging out */108} agp_unbind;109110#else /* __KERNEL__ */111#include <linux/mutex.h>112#include <linux/agp_backend.h>113114#define AGPGART_MINOR 175115116struct agp_info {117struct agp_version version; /* version of the driver */118u32 bridge_id; /* bridge vendor/device */119u32 agp_mode; /* mode info of bridge */120unsigned long aper_base;/* base of aperture */121size_t aper_size; /* size of aperture */122size_t pg_total; /* max pages (swap + system) */123size_t pg_system; /* max pages (system) */124size_t pg_used; /* current pages used */125};126127struct agp_setup {128u32 agp_mode; /* mode info of bridge */129};130131/*132* The "prot" down below needs still a "sleep" flag somehow ...133*/134struct agp_segment {135off_t pg_start; /* starting page to populate */136size_t pg_count; /* number of pages */137int prot; /* prot flags for mmap */138};139140struct agp_segment_priv {141off_t pg_start;142size_t pg_count;143pgprot_t prot;144};145146struct agp_region {147pid_t pid; /* pid of process */148size_t seg_count; /* number of segments */149struct agp_segment *seg_list;150};151152struct agp_allocate {153int key; /* tag of allocation */154size_t pg_count; /* number of pages */155u32 type; /* 0 == normal, other devspec */156u32 physical; /* device specific (some devices157* need a phys address of the158* actual page behind the gatt159* table) */160};161162struct agp_bind {163int key; /* tag of allocation */164off_t pg_start; /* starting page to populate */165};166167struct agp_unbind {168int key; /* tag of allocation */169u32 priority; /* priority for paging out */170};171172struct agp_client {173struct agp_client *next;174struct agp_client *prev;175pid_t pid;176int num_segments;177struct agp_segment_priv **segments;178};179180struct agp_controller {181struct agp_controller *next;182struct agp_controller *prev;183pid_t pid;184int num_clients;185struct agp_memory *pool;186struct agp_client *clients;187};188189#define AGP_FF_ALLOW_CLIENT 0190#define AGP_FF_ALLOW_CONTROLLER 1191#define AGP_FF_IS_CLIENT 2192#define AGP_FF_IS_CONTROLLER 3193#define AGP_FF_IS_VALID 4194195struct agp_file_private {196struct agp_file_private *next;197struct agp_file_private *prev;198pid_t my_pid;199unsigned long access_flags; /* long req'd for set_bit --RR */200};201202struct agp_front_data {203struct mutex agp_mutex;204struct agp_controller *current_controller;205struct agp_controller *controllers;206struct agp_file_private *file_priv_list;207bool used_by_controller;208bool backend_acquired;209};210211#endif /* __KERNEL__ */212213#endif /* _AGP_H */214215216