blob: f3136750c490270029d1d1e0cd63d76b4af8a24b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
David Herrmann00fd78e2013-08-08 22:19:12 +02002#ifndef _DRM_AGPSUPPORT_H_
3#define _DRM_AGPSUPPORT_H_
4
David Herrmannd7d2c482014-08-29 12:12:40 +02005#include <linux/agp_backend.h>
David Herrmann00fd78e2013-08-08 22:19:12 +02006#include <linux/kernel.h>
David Herrmannd7d2c482014-08-29 12:12:40 +02007#include <linux/list.h>
David Herrmann00fd78e2013-08-08 22:19:12 +02008#include <linux/mm.h>
9#include <linux/mutex.h>
10#include <linux/types.h>
David Herrmannd7d2c482014-08-29 12:12:40 +020011#include <uapi/drm/drm.h>
12
13struct drm_device;
14struct drm_file;
David Herrmann00fd78e2013-08-08 22:19:12 +020015
David Herrmanncc5ea592014-08-29 12:12:32 +020016struct 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 Vettera7fb8a22015-09-09 16:45:52 +020029#if IS_ENABLED(CONFIG_AGP)
David Herrmann00fd78e2013-08-08 22:19:12 +020030
David Herrmann00fd78e2013-08-08 22:19:12 +020031struct drm_agp_head *drm_agp_init(struct drm_device *dev);
Daniel Vetter366884b2016-04-26 19:29:34 +020032void drm_legacy_agp_clear(struct drm_device *dev);
David Herrmann00fd78e2013-08-08 22:19:12 +020033int drm_agp_acquire(struct drm_device *dev);
34int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
35 struct drm_file *file_priv);
36int drm_agp_release(struct drm_device *dev);
37int drm_agp_release_ioctl(struct drm_device *dev, void *data,
38 struct drm_file *file_priv);
39int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
40int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
41 struct drm_file *file_priv);
42int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
43int drm_agp_info_ioctl(struct drm_device *dev, void *data,
44 struct drm_file *file_priv);
45int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
46int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
47 struct drm_file *file_priv);
48int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
49int drm_agp_free_ioctl(struct drm_device *dev, void *data,
50 struct drm_file *file_priv);
51int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
52int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
53 struct drm_file *file_priv);
54int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
55int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
56 struct drm_file *file_priv);
David Herrmannd7d2c482014-08-29 12:12:40 +020057
Daniel Vettera7fb8a22015-09-09 16:45:52 +020058#else /* CONFIG_AGP */
David Herrmann00fd78e2013-08-08 22:19:12 +020059
David Herrmann00fd78e2013-08-08 22:19:12 +020060static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
61{
62 return NULL;
63}
64
Daniel Vetter366884b2016-04-26 19:29:34 +020065static inline void drm_legacy_agp_clear(struct drm_device *dev)
David Herrmann00fd78e2013-08-08 22:19:12 +020066{
67}
68
69static inline int drm_agp_acquire(struct drm_device *dev)
70{
71 return -ENODEV;
72}
73
David Herrmann00fd78e2013-08-08 22:19:12 +020074static inline int drm_agp_release(struct drm_device *dev)
75{
76 return -ENODEV;
77}
78
David Herrmann00fd78e2013-08-08 22:19:12 +020079static inline int drm_agp_enable(struct drm_device *dev,
80 struct drm_agp_mode mode)
81{
82 return -ENODEV;
83}
84
David Herrmann00fd78e2013-08-08 22:19:12 +020085static inline int drm_agp_info(struct drm_device *dev,
86 struct drm_agp_info *info)
87{
88 return -ENODEV;
89}
90
David Herrmann00fd78e2013-08-08 22:19:12 +020091static inline int drm_agp_alloc(struct drm_device *dev,
92 struct drm_agp_buffer *request)
93{
94 return -ENODEV;
95}
96
David Herrmann00fd78e2013-08-08 22:19:12 +020097static inline int drm_agp_free(struct drm_device *dev,
98 struct drm_agp_buffer *request)
99{
100 return -ENODEV;
101}
102
David Herrmann00fd78e2013-08-08 22:19:12 +0200103static inline int drm_agp_unbind(struct drm_device *dev,
104 struct drm_agp_binding *request)
105{
106 return -ENODEV;
107}
108
David Herrmann00fd78e2013-08-08 22:19:12 +0200109static inline int drm_agp_bind(struct drm_device *dev,
110 struct drm_agp_binding *request)
111{
112 return -ENODEV;
113}
114
Daniel Vettera7fb8a22015-09-09 16:45:52 +0200115#endif /* CONFIG_AGP */
David Herrmann00fd78e2013-08-08 22:19:12 +0200116
117#endif /* _DRM_AGPSUPPORT_H_ */