| 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 |  | 
| Keith Packard | a8c84df | 2008-07-31 15:48:07 +1000 | [diff] [blame] | 33 | #include <linux/list.h> | 
 | 34 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | enum chipset_type { | 
 | 36 | 	NOT_SUPPORTED, | 
 | 37 | 	SUPPORTED, | 
 | 38 | }; | 
 | 39 |  | 
 | 40 | struct agp_version { | 
 | 41 | 	u16 major; | 
 | 42 | 	u16 minor; | 
 | 43 | }; | 
 | 44 |  | 
 | 45 | struct agp_kern_info { | 
 | 46 | 	struct agp_version version; | 
 | 47 | 	struct pci_dev *device; | 
 | 48 | 	enum chipset_type chipset; | 
 | 49 | 	unsigned long mode; | 
 | 50 | 	unsigned long aper_base; | 
 | 51 | 	size_t aper_size; | 
 | 52 | 	int max_memory;		/* In pages */ | 
 | 53 | 	int current_memory; | 
| Joe Perches | c725801 | 2008-03-26 14:10:02 -0700 | [diff] [blame] | 54 | 	bool cant_use_aperture; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | 	unsigned long page_mask; | 
| Alexey Dobriyan | f0f37e2 | 2009-09-27 22:29:37 +0400 | [diff] [blame] | 56 | 	const struct vm_operations_struct *vm_ops; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | }; | 
 | 58 |  | 
 | 59 | /* | 
 | 60 |  * The agp_memory structure has information about the block of agp memory | 
 | 61 |  * allocated.  A caller may manipulate the next and prev pointers to link | 
 | 62 |  * each allocated item into a list.  These pointers are ignored by the backend. | 
 | 63 |  * Everything else should never be written to, but the caller may read any of | 
 | 64 |  * the items to determine the status of this block of agp memory. | 
 | 65 |  */ | 
 | 66 |  | 
 | 67 | struct agp_bridge_data; | 
 | 68 |  | 
 | 69 | struct agp_memory { | 
 | 70 | 	struct agp_memory *next; | 
 | 71 | 	struct agp_memory *prev; | 
 | 72 | 	struct agp_bridge_data *bridge; | 
| Dave Airlie | 07613ba | 2009-06-12 14:11:41 +1000 | [diff] [blame] | 73 | 	struct page **pages; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | 	size_t page_count; | 
 | 75 | 	int key; | 
 | 76 | 	int num_scratch_pages; | 
 | 77 | 	off_t pg_start; | 
 | 78 | 	u32 type; | 
 | 79 | 	u32 physical; | 
| Joe Perches | c725801 | 2008-03-26 14:10:02 -0700 | [diff] [blame] | 80 | 	bool is_bound; | 
 | 81 | 	bool is_flushed; | 
| Keith Packard | a8c84df | 2008-07-31 15:48:07 +1000 | [diff] [blame] | 82 | 	/* list of agp_memory mapped to the aperture */ | 
 | 83 | 	struct list_head mapped_list; | 
| Zhenyu Wang | ff663cf | 2009-07-23 17:25:49 +0100 | [diff] [blame] | 84 | 	/* DMA-mapped addresses */ | 
 | 85 | 	struct scatterlist *sg_list; | 
 | 86 | 	int num_sg; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; | 
 | 88 |  | 
 | 89 | #define AGP_NORMAL_MEMORY 0 | 
 | 90 |  | 
| Thomas Hellstrom | a030ce4 | 2007-01-23 10:33:43 +0100 | [diff] [blame] | 91 | #define AGP_USER_TYPES (1 << 16) | 
 | 92 | #define AGP_USER_MEMORY (AGP_USER_TYPES) | 
 | 93 | #define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1) | 
 | 94 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | extern struct agp_bridge_data *agp_bridge; | 
 | 96 | extern struct list_head agp_bridges; | 
 | 97 |  | 
 | 98 | extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *); | 
 | 99 |  | 
 | 100 | extern void agp_free_memory(struct agp_memory *); | 
 | 101 | extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32); | 
 | 102 | extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); | 
 | 103 | extern int agp_bind_memory(struct agp_memory *, off_t); | 
 | 104 | extern int agp_unbind_memory(struct agp_memory *); | 
 | 105 | extern void agp_enable(struct agp_bridge_data *, u32); | 
 | 106 | extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); | 
 | 107 | extern void agp_backend_release(struct agp_bridge_data *); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | #endif				/* _AGP_BACKEND_H */ |