2 * AGPGART backend specific includes. Not for userspace consumption.
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.
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:
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
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.
30 #ifndef _AGP_BACKEND_H
31 #define _AGP_BACKEND_H 1
33 #include <linux/list.h>
45 struct agp_kern_info {
46 struct agp_version version;
47 struct pci_dev *device;
48 enum chipset_type chipset;
50 unsigned long aper_base;
52 int max_memory; /* In pages */
54 bool cant_use_aperture;
55 unsigned long page_mask;
56 const struct vm_operations_struct *vm_ops;
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.
67 struct agp_bridge_data;
70 struct agp_memory *next;
71 struct agp_memory *prev;
72 struct agp_bridge_data *bridge;
76 int num_scratch_pages;
83 /* list of agp_memory mapped to the aperture */
84 struct list_head mapped_list;
85 /* DMA-mapped addresses */
86 struct scatterlist *sg_list;
90 #define AGP_NORMAL_MEMORY 0
92 #define AGP_USER_TYPES (1 << 16)
93 #define AGP_USER_MEMORY (AGP_USER_TYPES)
94 #define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
96 extern struct agp_bridge_data *agp_bridge;
97 extern struct list_head agp_bridges;
99 extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *);
101 extern void agp_free_memory(struct agp_memory *);
102 extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);
103 extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
104 extern int agp_bind_memory(struct agp_memory *, off_t);
105 extern int agp_unbind_memory(struct agp_memory *);
106 extern int agp_rebind_memory(void);
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 *);
110 extern void agp_flush_chipset(struct agp_bridge_data *);
112 #endif /* _AGP_BACKEND_H */