drm_agpsupport.h 3.4 KB

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