1 /* 1 /* 2 * AGPGART module version 0.99 2 * AGPGART module version 0.99 3 * Copyright (C) 1999 Jeff Hartmann 3 * Copyright (C) 1999 Jeff Hartmann 4 * Copyright (C) 1999 Precision Insight, Inc. 4 * Copyright (C) 1999 Precision Insight, Inc. 5 * Copyright (C) 1999 Xi Graphics, Inc. 5 * Copyright (C) 1999 Xi Graphics, Inc. 6 * 6 * 7 * Permission is hereby granted, free of charg 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated docume 8 * copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction 9 * to deal in the Software without restriction, including without limitation 10 * the rights to use, copy, modify, merge, pub 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * and/or sell copies of the Software, and to 11 * and/or sell copies of the Software, and to permit persons to whom the 12 * Software is furnished to do so, subject to 12 * Software is furnished to do so, subject to the following conditions: 13 * 13 * 14 * The above copyright notice and this permiss 14 * The above copyright notice and this permission notice shall be included 15 * in all copies or substantial portions of th 15 * in all copies or substantial portions of the Software. 16 * 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT W 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO TH 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINF 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE 20 * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN A 21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNE 22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 23 * OR THE USE OR OTHER DEALINGS IN THE SOFTWAR 23 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 * 24 * 25 */ 25 */ 26 #ifndef _AGP_H 26 #ifndef _AGP_H 27 #define _AGP_H 1 27 #define _AGP_H 1 28 28 29 #include <linux/mutex.h> 29 #include <linux/mutex.h> 30 #include <linux/agp_backend.h> 30 #include <linux/agp_backend.h> 31 #include <uapi/linux/agpgart.h> 31 #include <uapi/linux/agpgart.h> 32 32 >> 33 #define AGPGART_MINOR 175 >> 34 33 struct agp_info { 35 struct agp_info { 34 struct agp_version version; /* ver 36 struct agp_version version; /* version of the driver */ 35 u32 bridge_id; /* bridge vend 37 u32 bridge_id; /* bridge vendor/device */ 36 u32 agp_mode; /* mode info o 38 u32 agp_mode; /* mode info of bridge */ 37 unsigned long aper_base;/* base of ape 39 unsigned long aper_base;/* base of aperture */ 38 size_t aper_size; /* size of ape 40 size_t aper_size; /* size of aperture */ 39 size_t pg_total; /* max pages ( 41 size_t pg_total; /* max pages (swap + system) */ 40 size_t pg_system; /* max pages ( 42 size_t pg_system; /* max pages (system) */ 41 size_t pg_used; /* current pag 43 size_t pg_used; /* current pages used */ 42 }; 44 }; 43 45 44 struct agp_setup { 46 struct agp_setup { 45 u32 agp_mode; /* mode info o 47 u32 agp_mode; /* mode info of bridge */ 46 }; 48 }; 47 49 48 /* 50 /* 49 * The "prot" down below needs still a "sleep" 51 * The "prot" down below needs still a "sleep" flag somehow ... 50 */ 52 */ 51 struct agp_segment { 53 struct agp_segment { 52 off_t pg_start; /* starting pa 54 off_t pg_start; /* starting page to populate */ 53 size_t pg_count; /* number of p 55 size_t pg_count; /* number of pages */ 54 int prot; /* prot flags 56 int prot; /* prot flags for mmap */ 55 }; 57 }; 56 58 57 struct agp_segment_priv { 59 struct agp_segment_priv { 58 off_t pg_start; 60 off_t pg_start; 59 size_t pg_count; 61 size_t pg_count; 60 pgprot_t prot; 62 pgprot_t prot; 61 }; 63 }; 62 64 63 struct agp_region { 65 struct agp_region { 64 pid_t pid; /* pid of proc 66 pid_t pid; /* pid of process */ 65 size_t seg_count; /* number of s 67 size_t seg_count; /* number of segments */ 66 struct agp_segment *seg_list; 68 struct agp_segment *seg_list; 67 }; 69 }; 68 70 69 struct agp_allocate { 71 struct agp_allocate { 70 int key; /* tag of allo 72 int key; /* tag of allocation */ 71 size_t pg_count; /* number of p 73 size_t pg_count; /* number of pages */ 72 u32 type; /* 0 == normal 74 u32 type; /* 0 == normal, other devspec */ 73 u32 physical; /* device spec 75 u32 physical; /* device specific (some devices 74 * need a phys 76 * need a phys address of the 75 * actual page 77 * actual page behind the gatt 76 * table) 78 * table) */ 77 }; 79 }; 78 80 79 struct agp_bind { 81 struct agp_bind { 80 int key; /* tag of allo 82 int key; /* tag of allocation */ 81 off_t pg_start; /* starting pa 83 off_t pg_start; /* starting page to populate */ 82 }; 84 }; 83 85 84 struct agp_unbind { 86 struct agp_unbind { 85 int key; /* tag of allo 87 int key; /* tag of allocation */ 86 u32 priority; /* priority fo 88 u32 priority; /* priority for paging out */ 87 }; 89 }; 88 90 89 struct agp_client { 91 struct agp_client { 90 struct agp_client *next; 92 struct agp_client *next; 91 struct agp_client *prev; 93 struct agp_client *prev; 92 pid_t pid; 94 pid_t pid; 93 int num_segments; 95 int num_segments; 94 struct agp_segment_priv **segments; 96 struct agp_segment_priv **segments; 95 }; 97 }; 96 98 97 struct agp_controller { 99 struct agp_controller { 98 struct agp_controller *next; 100 struct agp_controller *next; 99 struct agp_controller *prev; 101 struct agp_controller *prev; 100 pid_t pid; 102 pid_t pid; 101 int num_clients; 103 int num_clients; 102 struct agp_memory *pool; 104 struct agp_memory *pool; 103 struct agp_client *clients; 105 struct agp_client *clients; 104 }; 106 }; 105 107 106 #define AGP_FF_ALLOW_CLIENT 0 108 #define AGP_FF_ALLOW_CLIENT 0 107 #define AGP_FF_ALLOW_CONTROLLER 1 109 #define AGP_FF_ALLOW_CONTROLLER 1 108 #define AGP_FF_IS_CLIENT 2 110 #define AGP_FF_IS_CLIENT 2 109 #define AGP_FF_IS_CONTROLLER 3 111 #define AGP_FF_IS_CONTROLLER 3 110 #define AGP_FF_IS_VALID 4 112 #define AGP_FF_IS_VALID 4 111 113 112 struct agp_file_private { 114 struct agp_file_private { 113 struct agp_file_private *next; 115 struct agp_file_private *next; 114 struct agp_file_private *prev; 116 struct agp_file_private *prev; 115 pid_t my_pid; 117 pid_t my_pid; 116 unsigned long access_flags; /* lon 118 unsigned long access_flags; /* long req'd for set_bit --RR */ 117 }; 119 }; 118 120 119 struct agp_front_data { 121 struct agp_front_data { 120 struct mutex agp_mutex; 122 struct mutex agp_mutex; 121 struct agp_controller *current_control 123 struct agp_controller *current_controller; 122 struct agp_controller *controllers; 124 struct agp_controller *controllers; 123 struct agp_file_private *file_priv_lis 125 struct agp_file_private *file_priv_list; 124 bool used_by_controller; 126 bool used_by_controller; 125 bool backend_acquired; 127 bool backend_acquired; 126 }; 128 }; 127 129 128 #endif /* _AGP_H */ 130 #endif /* _AGP_H */ 129 131
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.