]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/linux/agp_backend.h
Merge commit '900cfa46191a7d87cf1891924cb90499287fd235'; branches 'timers/nohz',...
[mirror_ubuntu-artful-kernel.git] / include / linux / agp_backend.h
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
33 enum chipset_type {
34 NOT_SUPPORTED,
35 SUPPORTED,
36 };
37
38 struct agp_version {
39 u16 major;
40 u16 minor;
41 };
42
43 struct agp_kern_info {
44 struct agp_version version;
45 struct pci_dev *device;
46 enum chipset_type chipset;
47 unsigned long mode;
48 unsigned long aper_base;
49 size_t aper_size;
50 int max_memory; /* In pages */
51 int current_memory;
52 bool cant_use_aperture;
53 unsigned long page_mask;
54 struct vm_operations_struct *vm_ops;
55 };
56
57 /*
58 * The agp_memory structure has information about the block of agp memory
59 * allocated. A caller may manipulate the next and prev pointers to link
60 * each allocated item into a list. These pointers are ignored by the backend.
61 * Everything else should never be written to, but the caller may read any of
62 * the items to determine the status of this block of agp memory.
63 */
64
65 struct agp_bridge_data;
66
67 struct agp_memory {
68 struct agp_memory *next;
69 struct agp_memory *prev;
70 struct agp_bridge_data *bridge;
71 unsigned long *memory;
72 size_t page_count;
73 int key;
74 int num_scratch_pages;
75 off_t pg_start;
76 u32 type;
77 u32 physical;
78 bool is_bound;
79 bool is_flushed;
80 bool vmalloc_flag;
81 };
82
83 #define AGP_NORMAL_MEMORY 0
84
85 #define AGP_USER_TYPES (1 << 16)
86 #define AGP_USER_MEMORY (AGP_USER_TYPES)
87 #define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
88
89 extern struct agp_bridge_data *agp_bridge;
90 extern struct list_head agp_bridges;
91
92 extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *);
93
94 extern void agp_free_memory(struct agp_memory *);
95 extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);
96 extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
97 extern int agp_bind_memory(struct agp_memory *, off_t);
98 extern int agp_unbind_memory(struct agp_memory *);
99 extern void agp_enable(struct agp_bridge_data *, u32);
100 extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
101 extern void agp_backend_release(struct agp_bridge_data *);
102 extern void agp_flush_chipset(struct agp_bridge_data *);
103
104 #endif /* _AGP_BACKEND_H */