4c7462f73e3acc6bc9be1f6fbcc15bb51be8167e
[dragonfly.git] / sys / dev / drm / include / drm / drm_agpsupport.h
1 #ifndef _DRM_AGPSUPPORT_H_
2 #define _DRM_AGPSUPPORT_H_
3
4 #include <linux/kernel.h>
5 #include <linux/list.h>
6 #include <linux/mm.h>
7 #include <linux/mutex.h>
8 #include <linux/types.h>
9 #include <sys/agpio.h>
10 #include <dev/agp/agpvar.h>
11 #include <uapi_drm/drm.h>
12
13 struct drm_device;
14 struct drm_file;
15
16 #define __OS_HAS_AGP    1
17
18 struct drm_agp_head {
19         device_t        agpdev;
20         struct agp_info agp_info;
21         struct drm_agp_mem *memory;
22         unsigned long mode;
23         int enabled;
24         int acquired;
25         unsigned long base;
26         int agp_mtrr;
27         int cant_use_aperture;
28         unsigned long page_mask;
29 };
30
31 #if __OS_HAS_AGP
32
33 #ifdef __linux__
34 void drm_free_agp(struct agp_memory * handle, int pages);
35 int drm_bind_agp(struct agp_memory * handle, unsigned int start);
36 int drm_unbind_agp(struct agp_memory * handle);
37 struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
38                                 struct page **pages,
39                                 unsigned long num_pages,
40                                 uint32_t gtt_offset,
41                                 uint32_t type);
42 #endif
43
44 struct drm_agp_head *drm_agp_init(struct drm_device *dev);
45 void drm_agp_clear(struct drm_device *dev);
46 int drm_agp_acquire(struct drm_device *dev);
47 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
48                           struct drm_file *file_priv);
49 int drm_agp_release(struct drm_device *dev);
50 int drm_agp_release_ioctl(struct drm_device *dev, void *data,
51                           struct drm_file *file_priv);
52 int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
53 int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
54                          struct drm_file *file_priv);
55 int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
56 int drm_agp_info_ioctl(struct drm_device *dev, void *data,
57                        struct drm_file *file_priv);
58 int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
59 int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
60                         struct drm_file *file_priv);
61 int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
62 int drm_agp_free_ioctl(struct drm_device *dev, void *data,
63                        struct drm_file *file_priv);
64 int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
65 int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
66                          struct drm_file *file_priv);
67 int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
68 int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
69                        struct drm_file *file_priv);
70
71 #else /* __OS_HAS_AGP */
72
73 #ifdef __linux__
74 static inline void drm_free_agp(struct agp_memory * handle, int pages)
75 {
76 }
77
78 static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
79 {
80         return -ENODEV;
81 }
82
83 static inline int drm_unbind_agp(struct agp_memory * handle)
84 {
85         return -ENODEV;
86 }
87
88 static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
89                                               struct page **pages,
90                                               unsigned long num_pages,
91                                               uint32_t gtt_offset,
92                                               uint32_t type)
93 {
94         return NULL;
95 }
96 #endif
97
98 static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
99 {
100         return NULL;
101 }
102
103 static inline void drm_agp_clear(struct drm_device *dev)
104 {
105 }
106
107 static inline int drm_agp_acquire(struct drm_device *dev)
108 {
109         return -ENODEV;
110 }
111
112 static inline int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
113                                         struct drm_file *file_priv)
114 {
115         return -ENODEV;
116 }
117
118 static inline int drm_agp_release(struct drm_device *dev)
119 {
120         return -ENODEV;
121 }
122
123 static inline int drm_agp_release_ioctl(struct drm_device *dev, void *data,
124                                         struct drm_file *file_priv)
125 {
126         return -ENODEV;
127 }
128
129 static inline int drm_agp_enable(struct drm_device *dev,
130                                  struct drm_agp_mode mode)
131 {
132         return -ENODEV;
133 }
134
135 static inline int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
136                                        struct drm_file *file_priv)
137 {
138         return -ENODEV;
139 }
140
141 static inline int drm_agp_info(struct drm_device *dev,
142                                struct drm_agp_info *info)
143 {
144         return -ENODEV;
145 }
146
147 static inline int drm_agp_info_ioctl(struct drm_device *dev, void *data,
148                                      struct drm_file *file_priv)
149 {
150         return -ENODEV;
151 }
152
153 static inline int drm_agp_alloc(struct drm_device *dev,
154                                 struct drm_agp_buffer *request)
155 {
156         return -ENODEV;
157 }
158
159 static inline int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
160                                       struct drm_file *file_priv)
161 {
162         return -ENODEV;
163 }
164
165 static inline int drm_agp_free(struct drm_device *dev,
166                                struct drm_agp_buffer *request)
167 {
168         return -ENODEV;
169 }
170
171 static inline int drm_agp_free_ioctl(struct drm_device *dev, void *data,
172                                      struct drm_file *file_priv)
173 {
174         return -ENODEV;
175 }
176
177 static inline int drm_agp_unbind(struct drm_device *dev,
178                                  struct drm_agp_binding *request)
179 {
180         return -ENODEV;
181 }
182
183 static inline int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
184                                        struct drm_file *file_priv)
185 {
186         return -ENODEV;
187 }
188
189 static inline int drm_agp_bind(struct drm_device *dev,
190                                struct drm_agp_binding *request)
191 {
192         return -ENODEV;
193 }
194
195 static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
196                                      struct drm_file *file_priv)
197 {
198         return -ENODEV;
199 }
200
201 #endif /* __OS_HAS_AGP */
202
203 #endif /* _DRM_AGPSUPPORT_H_ */