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