blob: b05e462276d588dcd8b147711043c3e05bf180e1 [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
Daniel Vetterd2e546b2013-12-11 11:34:40 +010031void drm_free_agp(struct agp_memory * handle, int pages);
32int drm_bind_agp(struct agp_memory * handle, unsigned int start);
33int drm_unbind_agp(struct agp_memory * handle);
34struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
David Herrmann00fd78e2013-08-08 22:19:12 +020035 struct page **pages,
36 unsigned long num_pages,
37 uint32_t gtt_offset,
38 uint32_t type);
39
40struct drm_agp_head *drm_agp_init(struct drm_device *dev);
Daniel Vetter366884b2016-04-26 19:29:34 +020041void drm_legacy_agp_clear(struct drm_device *dev);
David Herrmann00fd78e2013-08-08 22:19:12 +020042int drm_agp_acquire(struct drm_device *dev);
43int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
44 struct drm_file *file_priv);
45int drm_agp_release(struct drm_device *dev);
46int drm_agp_release_ioctl(struct drm_device *dev, void *data,
47 struct drm_file *file_priv);
48int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
49int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
50 struct drm_file *file_priv);
51int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
52int drm_agp_info_ioctl(struct drm_device *dev, void *data,
53 struct drm_file *file_priv);
54int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
55int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
56 struct drm_file *file_priv);
57int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
58int drm_agp_free_ioctl(struct drm_device *dev, void *data,
59 struct drm_file *file_priv);
60int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
61int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
62 struct drm_file *file_priv);
63int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
64int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
65 struct drm_file *file_priv);
David Herrmannd7d2c482014-08-29 12:12:40 +020066
Daniel Vettera7fb8a22015-09-09 16:45:52 +020067#else /* CONFIG_AGP */
David Herrmann00fd78e2013-08-08 22:19:12 +020068
Daniel Vetterd2e546b2013-12-11 11:34:40 +010069static inline void drm_free_agp(struct agp_memory * handle, int pages)
David Herrmann00fd78e2013-08-08 22:19:12 +020070{
71}
72
Daniel Vetterd2e546b2013-12-11 11:34:40 +010073static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
David Herrmann00fd78e2013-08-08 22:19:12 +020074{
75 return -ENODEV;
76}
77
Daniel Vetterd2e546b2013-12-11 11:34:40 +010078static inline int drm_unbind_agp(struct agp_memory * handle)
David Herrmann00fd78e2013-08-08 22:19:12 +020079{
80 return -ENODEV;
81}
82
Daniel Vetterd2e546b2013-12-11 11:34:40 +010083static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
David Herrmann00fd78e2013-08-08 22:19:12 +020084 struct page **pages,
85 unsigned long num_pages,
86 uint32_t gtt_offset,
87 uint32_t type)
88{
89 return NULL;
90}
91
92static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
93{
94 return NULL;
95}
96
Daniel Vetter366884b2016-04-26 19:29:34 +020097static inline void drm_legacy_agp_clear(struct drm_device *dev)
David Herrmann00fd78e2013-08-08 22:19:12 +020098{
99}
100
101static inline int drm_agp_acquire(struct drm_device *dev)
102{
103 return -ENODEV;
104}
105
David Herrmann00fd78e2013-08-08 22:19:12 +0200106static inline int drm_agp_release(struct drm_device *dev)
107{
108 return -ENODEV;
109}
110
David Herrmann00fd78e2013-08-08 22:19:12 +0200111static inline int drm_agp_enable(struct drm_device *dev,
112 struct drm_agp_mode mode)
113{
114 return -ENODEV;
115}
116
David Herrmann00fd78e2013-08-08 22:19:12 +0200117static inline int drm_agp_info(struct drm_device *dev,
118 struct drm_agp_info *info)
119{
120 return -ENODEV;
121}
122
David Herrmann00fd78e2013-08-08 22:19:12 +0200123static inline int drm_agp_alloc(struct drm_device *dev,
124 struct drm_agp_buffer *request)
125{
126 return -ENODEV;
127}
128
David Herrmann00fd78e2013-08-08 22:19:12 +0200129static inline int drm_agp_free(struct drm_device *dev,
130 struct drm_agp_buffer *request)
131{
132 return -ENODEV;
133}
134
David Herrmann00fd78e2013-08-08 22:19:12 +0200135static inline int drm_agp_unbind(struct drm_device *dev,
136 struct drm_agp_binding *request)
137{
138 return -ENODEV;
139}
140
David Herrmann00fd78e2013-08-08 22:19:12 +0200141static inline int drm_agp_bind(struct drm_device *dev,
142 struct drm_agp_binding *request)
143{
144 return -ENODEV;
145}
146
Daniel Vettera7fb8a22015-09-09 16:45:52 +0200147#endif /* CONFIG_AGP */
David Herrmann00fd78e2013-08-08 22:19:12 +0200148
149#endif /* _DRM_AGPSUPPORT_H_ */