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