Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 2 | #ifndef _DRM_AGPSUPPORT_H_ |
| 3 | #define _DRM_AGPSUPPORT_H_ |
| 4 | |
David Herrmann | d7d2c48 | 2014-08-29 12:12:40 +0200 | [diff] [blame] | 5 | #include <linux/agp_backend.h> |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 6 | #include <linux/kernel.h> |
David Herrmann | d7d2c48 | 2014-08-29 12:12:40 +0200 | [diff] [blame] | 7 | #include <linux/list.h> |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 8 | #include <linux/mm.h> |
| 9 | #include <linux/mutex.h> |
| 10 | #include <linux/types.h> |
David Herrmann | d7d2c48 | 2014-08-29 12:12:40 +0200 | [diff] [blame] | 11 | #include <uapi/drm/drm.h> |
| 12 | |
| 13 | struct drm_device; |
| 14 | struct drm_file; |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 15 | |
David Herrmann | cc5ea59 | 2014-08-29 12:12:32 +0200 | [diff] [blame] | 16 | struct drm_agp_head { |
| 17 | struct agp_kern_info agp_info; |
| 18 | struct list_head memory; |
| 19 | unsigned long mode; |
| 20 | struct agp_bridge_data *bridge; |
| 21 | int enabled; |
| 22 | int acquired; |
| 23 | unsigned long base; |
| 24 | int agp_mtrr; |
| 25 | int cant_use_aperture; |
| 26 | unsigned long page_mask; |
| 27 | }; |
| 28 | |
Daniel Vetter | a7fb8a2 | 2015-09-09 16:45:52 +0200 | [diff] [blame] | 29 | #if IS_ENABLED(CONFIG_AGP) |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 30 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 31 | struct drm_agp_head *drm_agp_init(struct drm_device *dev); |
Daniel Vetter | 366884b | 2016-04-26 19:29:34 +0200 | [diff] [blame] | 32 | void drm_legacy_agp_clear(struct drm_device *dev); |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 33 | int drm_agp_acquire(struct drm_device *dev); |
| 34 | int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, |
| 35 | struct drm_file *file_priv); |
| 36 | int drm_agp_release(struct drm_device *dev); |
| 37 | int drm_agp_release_ioctl(struct drm_device *dev, void *data, |
| 38 | struct drm_file *file_priv); |
| 39 | int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode); |
| 40 | int drm_agp_enable_ioctl(struct drm_device *dev, void *data, |
| 41 | struct drm_file *file_priv); |
| 42 | int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info); |
| 43 | int drm_agp_info_ioctl(struct drm_device *dev, void *data, |
| 44 | struct drm_file *file_priv); |
| 45 | int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request); |
| 46 | int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, |
| 47 | struct drm_file *file_priv); |
| 48 | int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request); |
| 49 | int drm_agp_free_ioctl(struct drm_device *dev, void *data, |
| 50 | struct drm_file *file_priv); |
| 51 | int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request); |
| 52 | int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, |
| 53 | struct drm_file *file_priv); |
| 54 | int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); |
| 55 | int drm_agp_bind_ioctl(struct drm_device *dev, void *data, |
| 56 | struct drm_file *file_priv); |
David Herrmann | d7d2c48 | 2014-08-29 12:12:40 +0200 | [diff] [blame] | 57 | |
Daniel Vetter | a7fb8a2 | 2015-09-09 16:45:52 +0200 | [diff] [blame] | 58 | #else /* CONFIG_AGP */ |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 59 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 60 | static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev) |
| 61 | { |
| 62 | return NULL; |
| 63 | } |
| 64 | |
Daniel Vetter | 366884b | 2016-04-26 19:29:34 +0200 | [diff] [blame] | 65 | static inline void drm_legacy_agp_clear(struct drm_device *dev) |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 66 | { |
| 67 | } |
| 68 | |
| 69 | static inline int drm_agp_acquire(struct drm_device *dev) |
| 70 | { |
| 71 | return -ENODEV; |
| 72 | } |
| 73 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 74 | static inline int drm_agp_release(struct drm_device *dev) |
| 75 | { |
| 76 | return -ENODEV; |
| 77 | } |
| 78 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 79 | static inline int drm_agp_enable(struct drm_device *dev, |
| 80 | struct drm_agp_mode mode) |
| 81 | { |
| 82 | return -ENODEV; |
| 83 | } |
| 84 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 85 | static inline int drm_agp_info(struct drm_device *dev, |
| 86 | struct drm_agp_info *info) |
| 87 | { |
| 88 | return -ENODEV; |
| 89 | } |
| 90 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 91 | static inline int drm_agp_alloc(struct drm_device *dev, |
| 92 | struct drm_agp_buffer *request) |
| 93 | { |
| 94 | return -ENODEV; |
| 95 | } |
| 96 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 97 | static inline int drm_agp_free(struct drm_device *dev, |
| 98 | struct drm_agp_buffer *request) |
| 99 | { |
| 100 | return -ENODEV; |
| 101 | } |
| 102 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 103 | static inline int drm_agp_unbind(struct drm_device *dev, |
| 104 | struct drm_agp_binding *request) |
| 105 | { |
| 106 | return -ENODEV; |
| 107 | } |
| 108 | |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 109 | static inline int drm_agp_bind(struct drm_device *dev, |
| 110 | struct drm_agp_binding *request) |
| 111 | { |
| 112 | return -ENODEV; |
| 113 | } |
| 114 | |
Daniel Vetter | a7fb8a2 | 2015-09-09 16:45:52 +0200 | [diff] [blame] | 115 | #endif /* CONFIG_AGP */ |
David Herrmann | 00fd78e | 2013-08-08 22:19:12 +0200 | [diff] [blame] | 116 | |
| 117 | #endif /* _DRM_AGPSUPPORT_H_ */ |