drm_agpsupport.h revision 1.1.1.2 1 /* $NetBSD: drm_agpsupport.h,v 1.1.1.2 2018/08/27 01:35:00 riastradh Exp $ */
2
3 #ifndef _DRM_AGPSUPPORT_H_
4 #define _DRM_AGPSUPPORT_H_
5
6 #include <linux/agp_backend.h>
7 #include <linux/kernel.h>
8 #include <linux/list.h>
9 #include <linux/mm.h>
10 #include <linux/mutex.h>
11 #include <linux/types.h>
12 #include <uapi/drm/drm.h>
13
14 struct drm_device;
15 struct drm_file;
16
17 struct drm_agp_head {
18 struct agp_kern_info agp_info;
19 struct list_head memory;
20 unsigned long mode;
21 struct agp_bridge_data *bridge;
22 int enabled;
23 int acquired;
24 unsigned long base;
25 int agp_mtrr;
26 int cant_use_aperture;
27 unsigned long page_mask;
28 };
29
30 #if IS_ENABLED(CONFIG_AGP)
31
32 void drm_free_agp(struct agp_memory * handle, int pages);
33 int drm_bind_agp(struct agp_memory * handle, unsigned int start);
34 int drm_unbind_agp(struct agp_memory * handle);
35 struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
36 struct page **pages,
37 unsigned long num_pages,
38 uint32_t gtt_offset,
39 uint32_t type);
40
41 struct drm_agp_head *drm_agp_init(struct drm_device *dev);
42 void drm_agp_clear(struct drm_device *dev);
43 int drm_agp_acquire(struct drm_device *dev);
44 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
45 struct drm_file *file_priv);
46 int drm_agp_release(struct drm_device *dev);
47 int drm_agp_release_ioctl(struct drm_device *dev, void *data,
48 struct drm_file *file_priv);
49 int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
50 int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
51 struct drm_file *file_priv);
52 int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
53 int drm_agp_info_ioctl(struct drm_device *dev, void *data,
54 struct drm_file *file_priv);
55 int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
56 int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
57 struct drm_file *file_priv);
58 int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
59 int drm_agp_free_ioctl(struct drm_device *dev, void *data,
60 struct drm_file *file_priv);
61 int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
62 int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
63 struct drm_file *file_priv);
64 int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
65 int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
66 struct drm_file *file_priv);
67
68 #else /* CONFIG_AGP */
69
70 static inline void drm_free_agp(struct agp_memory * handle, int pages)
71 {
72 }
73
74 static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
75 {
76 return -ENODEV;
77 }
78
79 static inline int drm_unbind_agp(struct agp_memory * handle)
80 {
81 return -ENODEV;
82 }
83
84 static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
85 struct page **pages,
86 unsigned long num_pages,
87 uint32_t gtt_offset,
88 uint32_t type)
89 {
90 return NULL;
91 }
92
93 static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
94 {
95 return NULL;
96 }
97
98 static inline void drm_agp_clear(struct drm_device *dev)
99 {
100 }
101
102 static inline int drm_agp_acquire(struct drm_device *dev)
103 {
104 return -ENODEV;
105 }
106
107 static inline int drm_agp_release(struct drm_device *dev)
108 {
109 return -ENODEV;
110 }
111
112 static inline int drm_agp_enable(struct drm_device *dev,
113 struct drm_agp_mode mode)
114 {
115 return -ENODEV;
116 }
117
118 static inline int drm_agp_info(struct drm_device *dev,
119 struct drm_agp_info *info)
120 {
121 return -ENODEV;
122 }
123
124 static inline int drm_agp_alloc(struct drm_device *dev,
125 struct drm_agp_buffer *request)
126 {
127 return -ENODEV;
128 }
129
130 static inline int drm_agp_free(struct drm_device *dev,
131 struct drm_agp_buffer *request)
132 {
133 return -ENODEV;
134 }
135
136 static inline int drm_agp_unbind(struct drm_device *dev,
137 struct drm_agp_binding *request)
138 {
139 return -ENODEV;
140 }
141
142 static inline int drm_agp_bind(struct drm_device *dev,
143 struct drm_agp_binding *request)
144 {
145 return -ENODEV;
146 }
147
148 #endif /* CONFIG_AGP */
149
150 #endif /* _DRM_AGPSUPPORT_H_ */
151