drm_agpsupport.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 agp_memory *drm_agp_bind_pages(struct drm_device *dev,
  30. struct page **pages,
  31. unsigned long num_pages,
  32. uint32_t gtt_offset,
  33. uint32_t type);
  34. struct drm_agp_head *drm_agp_init(struct drm_device *dev);
  35. void drm_legacy_agp_clear(struct drm_device *dev);
  36. int drm_agp_acquire(struct drm_device *dev);
  37. int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
  38. struct drm_file *file_priv);
  39. int drm_agp_release(struct drm_device *dev);
  40. int drm_agp_release_ioctl(struct drm_device *dev, void *data,
  41. struct drm_file *file_priv);
  42. int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode);
  43. int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
  44. struct drm_file *file_priv);
  45. int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info);
  46. int drm_agp_info_ioctl(struct drm_device *dev, void *data,
  47. struct drm_file *file_priv);
  48. int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request);
  49. int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
  50. struct drm_file *file_priv);
  51. int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request);
  52. int drm_agp_free_ioctl(struct drm_device *dev, void *data,
  53. struct drm_file *file_priv);
  54. int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request);
  55. int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
  56. struct drm_file *file_priv);
  57. int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request);
  58. int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
  59. struct drm_file *file_priv);
  60. #else /* CONFIG_AGP */
  61. static inline void drm_free_agp(struct agp_memory * handle, int pages)
  62. {
  63. }
  64. static inline int drm_bind_agp(struct agp_memory * handle, unsigned int start)
  65. {
  66. return -ENODEV;
  67. }
  68. static inline int drm_unbind_agp(struct agp_memory * handle)
  69. {
  70. return -ENODEV;
  71. }
  72. static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
  73. struct page **pages,
  74. unsigned long num_pages,
  75. uint32_t gtt_offset,
  76. uint32_t type)
  77. {
  78. return NULL;
  79. }
  80. static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
  81. {
  82. return NULL;
  83. }
  84. static inline void drm_legacy_agp_clear(struct drm_device *dev)
  85. {
  86. }
  87. static inline int drm_agp_acquire(struct drm_device *dev)
  88. {
  89. return -ENODEV;
  90. }
  91. static inline int drm_agp_release(struct drm_device *dev)
  92. {
  93. return -ENODEV;
  94. }
  95. static inline int drm_agp_enable(struct drm_device *dev,
  96. struct drm_agp_mode mode)
  97. {
  98. return -ENODEV;
  99. }
  100. static inline int drm_agp_info(struct drm_device *dev,
  101. struct drm_agp_info *info)
  102. {
  103. return -ENODEV;
  104. }
  105. static inline int drm_agp_alloc(struct drm_device *dev,
  106. struct drm_agp_buffer *request)
  107. {
  108. return -ENODEV;
  109. }
  110. static inline int drm_agp_free(struct drm_device *dev,
  111. struct drm_agp_buffer *request)
  112. {
  113. return -ENODEV;
  114. }
  115. static inline int drm_agp_unbind(struct drm_device *dev,
  116. struct drm_agp_binding *request)
  117. {
  118. return -ENODEV;
  119. }
  120. static inline int drm_agp_bind(struct drm_device *dev,
  121. struct drm_agp_binding *request)
  122. {
  123. return -ENODEV;
  124. }
  125. #endif /* CONFIG_AGP */
  126. #endif /* _DRM_AGPSUPPORT_H_ */