xref: /linux/include/uapi/linux/agpgart.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1607ca46eSDavid Howells /*
2607ca46eSDavid Howells  * AGPGART module version 0.99
3607ca46eSDavid Howells  * Copyright (C) 1999 Jeff Hartmann
4607ca46eSDavid Howells  * Copyright (C) 1999 Precision Insight, Inc.
5607ca46eSDavid Howells  * Copyright (C) 1999 Xi Graphics, Inc.
6607ca46eSDavid Howells  *
7607ca46eSDavid Howells  * Permission is hereby granted, free of charge, to any person obtaining a
8607ca46eSDavid Howells  * copy of this software and associated documentation files (the "Software"),
9607ca46eSDavid Howells  * to deal in the Software without restriction, including without limitation
10607ca46eSDavid Howells  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11607ca46eSDavid Howells  * and/or sell copies of the Software, and to permit persons to whom the
12607ca46eSDavid Howells  * Software is furnished to do so, subject to the following conditions:
13607ca46eSDavid Howells  *
14607ca46eSDavid Howells  * The above copyright notice and this permission notice shall be included
15607ca46eSDavid Howells  * in all copies or substantial portions of the Software.
16607ca46eSDavid Howells  *
17607ca46eSDavid Howells  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18607ca46eSDavid Howells  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19607ca46eSDavid Howells  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20607ca46eSDavid Howells  * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
21607ca46eSDavid Howells  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22607ca46eSDavid Howells  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
23607ca46eSDavid Howells  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24607ca46eSDavid Howells  *
25607ca46eSDavid Howells  */
26607ca46eSDavid Howells 
27607ca46eSDavid Howells #ifndef _UAPI_AGP_H
28607ca46eSDavid Howells #define _UAPI_AGP_H
29607ca46eSDavid Howells 
30607ca46eSDavid Howells #define AGPIOC_BASE       'A'
31607ca46eSDavid Howells #define AGPIOC_INFO       _IOR (AGPIOC_BASE, 0, struct agp_info*)
32607ca46eSDavid Howells #define AGPIOC_ACQUIRE    _IO  (AGPIOC_BASE, 1)
33607ca46eSDavid Howells #define AGPIOC_RELEASE    _IO  (AGPIOC_BASE, 2)
34607ca46eSDavid Howells #define AGPIOC_SETUP      _IOW (AGPIOC_BASE, 3, struct agp_setup*)
35607ca46eSDavid Howells #define AGPIOC_RESERVE    _IOW (AGPIOC_BASE, 4, struct agp_region*)
36607ca46eSDavid Howells #define AGPIOC_PROTECT    _IOW (AGPIOC_BASE, 5, struct agp_region*)
37607ca46eSDavid Howells #define AGPIOC_ALLOCATE   _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
38607ca46eSDavid Howells #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
39607ca46eSDavid Howells #define AGPIOC_BIND       _IOW (AGPIOC_BASE, 8, struct agp_bind*)
40607ca46eSDavid Howells #define AGPIOC_UNBIND     _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
41607ca46eSDavid Howells #define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)
42607ca46eSDavid Howells 
43607ca46eSDavid Howells #define AGP_DEVICE      "/dev/agpgart"
44607ca46eSDavid Howells 
45607ca46eSDavid Howells #ifndef TRUE
46607ca46eSDavid Howells #define TRUE 1
47607ca46eSDavid Howells #endif
48607ca46eSDavid Howells 
49607ca46eSDavid Howells #ifndef FALSE
50607ca46eSDavid Howells #define FALSE 0
51607ca46eSDavid Howells #endif
52607ca46eSDavid Howells 
53607ca46eSDavid Howells #ifndef __KERNEL__
54607ca46eSDavid Howells #include <linux/types.h>
55607ca46eSDavid Howells 
56607ca46eSDavid Howells struct agp_version {
57607ca46eSDavid Howells 	__u16 major;
58607ca46eSDavid Howells 	__u16 minor;
59607ca46eSDavid Howells };
60607ca46eSDavid Howells 
61607ca46eSDavid Howells typedef struct _agp_info {
62607ca46eSDavid Howells 	struct agp_version version;	/* version of the driver        */
63607ca46eSDavid Howells 	__u32 bridge_id;	/* bridge vendor/device         */
64607ca46eSDavid Howells 	__u32 agp_mode;		/* mode info of bridge          */
65607ca46eSDavid Howells 	unsigned long aper_base;/* base of aperture             */
66*783eb354SMasahiro Yamada 	__kernel_size_t aper_size;	/* size of aperture             */
67*783eb354SMasahiro Yamada 	__kernel_size_t pg_total;	/* max pages (swap + system)    */
68*783eb354SMasahiro Yamada 	__kernel_size_t pg_system;	/* max pages (system)           */
69*783eb354SMasahiro Yamada 	__kernel_size_t pg_used;	/* current pages used           */
70607ca46eSDavid Howells } agp_info;
71607ca46eSDavid Howells 
72607ca46eSDavid Howells typedef struct _agp_setup {
73607ca46eSDavid Howells 	__u32 agp_mode;		/* mode info of bridge          */
74607ca46eSDavid Howells } agp_setup;
75607ca46eSDavid Howells 
76607ca46eSDavid Howells /*
77607ca46eSDavid Howells  * The "prot" down below needs still a "sleep" flag somehow ...
78607ca46eSDavid Howells  */
79607ca46eSDavid Howells typedef struct _agp_segment {
80607ca46eSDavid Howells 	__kernel_off_t pg_start;	/* starting page to populate    */
81607ca46eSDavid Howells 	__kernel_size_t pg_count;	/* number of pages              */
82607ca46eSDavid Howells 	int prot;			/* prot flags for mmap          */
83607ca46eSDavid Howells } agp_segment;
84607ca46eSDavid Howells 
85607ca46eSDavid Howells typedef struct _agp_region {
86607ca46eSDavid Howells 	__kernel_pid_t pid;		/* pid of process       */
87607ca46eSDavid Howells 	__kernel_size_t seg_count;	/* number of segments   */
88607ca46eSDavid Howells 	struct _agp_segment *seg_list;
89607ca46eSDavid Howells } agp_region;
90607ca46eSDavid Howells 
91607ca46eSDavid Howells typedef struct _agp_allocate {
92607ca46eSDavid Howells 	int key;		/* tag of allocation            */
93607ca46eSDavid Howells 	__kernel_size_t pg_count;/* number of pages             */
94607ca46eSDavid Howells 	__u32 type;		/* 0 == normal, other devspec   */
95607ca46eSDavid Howells    	__u32 physical;         /* device specific (some devices
96607ca46eSDavid Howells 				 * need a phys address of the
97607ca46eSDavid Howells 				 * actual page behind the gatt
98607ca46eSDavid Howells 				 * table)                        */
99607ca46eSDavid Howells } agp_allocate;
100607ca46eSDavid Howells 
101607ca46eSDavid Howells typedef struct _agp_bind {
102607ca46eSDavid Howells 	int key;		/* tag of allocation            */
103607ca46eSDavid Howells 	__kernel_off_t pg_start;/* starting page to populate    */
104607ca46eSDavid Howells } agp_bind;
105607ca46eSDavid Howells 
106607ca46eSDavid Howells typedef struct _agp_unbind {
107607ca46eSDavid Howells 	int key;		/* tag of allocation            */
108607ca46eSDavid Howells 	__u32 priority;		/* priority for paging out      */
109607ca46eSDavid Howells } agp_unbind;
110607ca46eSDavid Howells 
111607ca46eSDavid Howells #endif				/* __KERNEL__ */
112607ca46eSDavid Howells 
113607ca46eSDavid Howells #endif /* _UAPI_AGP_H */
114