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