Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * AGPGART backend specific includes. Not for userspace consumption. |
| 3 | * |
| 4 | * Copyright (C) 2004 Silicon Graphics, Inc. |
| 5 | * Copyright (C) 2002-2003 Dave Jones |
| 6 | * Copyright (C) 1999 Jeff Hartmann |
| 7 | * Copyright (C) 1999 Precision Insight, Inc. |
| 8 | * Copyright (C) 1999 Xi Graphics, Inc. |
| 9 | * |
| 10 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 11 | * copy of this software and associated documentation files (the "Software"), |
| 12 | * to deal in the Software without restriction, including without limitation |
| 13 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 14 | * and/or sell copies of the Software, and to permit persons to whom the |
| 15 | * Software is furnished to do so, subject to the following conditions: |
| 16 | * |
| 17 | * The above copyright notice and this permission notice shall be included |
| 18 | * in all copies or substantial portions of the Software. |
| 19 | * |
| 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 23 | * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, |
| 24 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 25 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE |
| 26 | * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | #ifndef _AGP_BACKEND_H |
| 31 | #define _AGP_BACKEND_H 1 |
| 32 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | #ifndef TRUE |
| 34 | #define TRUE 1 |
| 35 | #endif |
| 36 | |
| 37 | #ifndef FALSE |
| 38 | #define FALSE 0 |
| 39 | #endif |
| 40 | |
| 41 | enum chipset_type { |
| 42 | NOT_SUPPORTED, |
| 43 | SUPPORTED, |
| 44 | }; |
| 45 | |
| 46 | struct agp_version { |
| 47 | u16 major; |
| 48 | u16 minor; |
| 49 | }; |
| 50 | |
| 51 | struct agp_kern_info { |
| 52 | struct agp_version version; |
| 53 | struct pci_dev *device; |
| 54 | enum chipset_type chipset; |
| 55 | unsigned long mode; |
| 56 | unsigned long aper_base; |
| 57 | size_t aper_size; |
| 58 | int max_memory; /* In pages */ |
| 59 | int current_memory; |
| 60 | int cant_use_aperture; |
| 61 | unsigned long page_mask; |
| 62 | struct vm_operations_struct *vm_ops; |
| 63 | }; |
| 64 | |
| 65 | /* |
| 66 | * The agp_memory structure has information about the block of agp memory |
| 67 | * allocated. A caller may manipulate the next and prev pointers to link |
| 68 | * each allocated item into a list. These pointers are ignored by the backend. |
| 69 | * Everything else should never be written to, but the caller may read any of |
| 70 | * the items to determine the status of this block of agp memory. |
| 71 | */ |
| 72 | |
| 73 | struct agp_bridge_data; |
| 74 | |
| 75 | struct agp_memory { |
| 76 | struct agp_memory *next; |
| 77 | struct agp_memory *prev; |
| 78 | struct agp_bridge_data *bridge; |
| 79 | unsigned long *memory; |
| 80 | size_t page_count; |
| 81 | int key; |
| 82 | int num_scratch_pages; |
| 83 | off_t pg_start; |
| 84 | u32 type; |
| 85 | u32 physical; |
| 86 | u8 is_bound; |
| 87 | u8 is_flushed; |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 88 | u8 vmalloc_flag; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | #define AGP_NORMAL_MEMORY 0 |
| 92 | |
Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 93 | #define AGP_USER_TYPES (1 << 16) |
| 94 | #define AGP_USER_MEMORY (AGP_USER_TYPES) |
| 95 | #define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1) |
| 96 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | extern struct agp_bridge_data *agp_bridge; |
| 98 | extern struct list_head agp_bridges; |
| 99 | |
| 100 | extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *); |
| 101 | |
| 102 | extern void agp_free_memory(struct agp_memory *); |
| 103 | extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32); |
| 104 | extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); |
| 105 | extern int agp_bind_memory(struct agp_memory *, off_t); |
| 106 | extern int agp_unbind_memory(struct agp_memory *); |
| 107 | extern void agp_enable(struct agp_bridge_data *, u32); |
| 108 | extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); |
| 109 | extern void agp_backend_release(struct agp_bridge_data *); |
Dave Airlie | a13af4b | 2007-10-29 15:14:03 +1000 | [diff] [blame] | 110 | extern void agp_flush_chipset(struct agp_bridge_data *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | #endif /* _AGP_BACKEND_H */ |