blob: abc521cfb08464a7e5a9c3cf11ca60d80f0529af [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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#ifdef __KERNEL__
34
35#ifndef TRUE
36#define TRUE 1
37#endif
38
39#ifndef FALSE
40#define FALSE 0
41#endif
42
43enum chipset_type {
44 NOT_SUPPORTED,
45 SUPPORTED,
46};
47
48struct agp_version {
49 u16 major;
50 u16 minor;
51};
52
53struct agp_kern_info {
54 struct agp_version version;
55 struct pci_dev *device;
56 enum chipset_type chipset;
57 unsigned long mode;
58 unsigned long aper_base;
59 size_t aper_size;
60 int max_memory; /* In pages */
61 int current_memory;
62 int cant_use_aperture;
63 unsigned long page_mask;
64 struct vm_operations_struct *vm_ops;
65};
66
67/*
68 * The agp_memory structure has information about the block of agp memory
69 * allocated. A caller may manipulate the next and prev pointers to link
70 * each allocated item into a list. These pointers are ignored by the backend.
71 * Everything else should never be written to, but the caller may read any of
72 * the items to determine the status of this block of agp memory.
73 */
74
75struct agp_bridge_data;
76
77struct agp_memory {
78 struct agp_memory *next;
79 struct agp_memory *prev;
80 struct agp_bridge_data *bridge;
81 unsigned long *memory;
82 size_t page_count;
83 int key;
84 int num_scratch_pages;
85 off_t pg_start;
86 u32 type;
87 u32 physical;
88 u8 is_bound;
89 u8 is_flushed;
Thomas Hellstroma030ce42007-01-23 10:33:43 +010090 u8 vmalloc_flag;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091};
92
93#define AGP_NORMAL_MEMORY 0
94
Thomas Hellstroma030ce42007-01-23 10:33:43 +010095#define AGP_USER_TYPES (1 << 16)
96#define AGP_USER_MEMORY (AGP_USER_TYPES)
97#define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
98
Linus Torvalds1da177e2005-04-16 15:20:36 -070099extern struct agp_bridge_data *agp_bridge;
100extern struct list_head agp_bridges;
101
102extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *);
103
104extern void agp_free_memory(struct agp_memory *);
105extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);
106extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
107extern int agp_bind_memory(struct agp_memory *, off_t);
108extern int agp_unbind_memory(struct agp_memory *);
109extern void agp_enable(struct agp_bridge_data *, u32);
110extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
111extern void agp_backend_release(struct agp_bridge_data *);
112
113#endif /* __KERNEL__ */
114#endif /* _AGP_BACKEND_H */