agpgart.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * AGPGART module version 0.99
  3. * Copyright (C) 1999 Jeff Hartmann
  4. * Copyright (C) 1999 Precision Insight, Inc.
  5. * Copyright (C) 1999 Xi Graphics, Inc.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. * and/or sell copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included
  15. * in all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  18. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  20. * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
  21. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  23. * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. */
  26. #ifndef _AGP_H
  27. #define _AGP_H 1
  28. #include <linux/mutex.h>
  29. #include <linux/agp_backend.h>
  30. #include <uapi/linux/agpgart.h>
  31. struct agp_info {
  32. struct agp_version version; /* version of the driver */
  33. u32 bridge_id; /* bridge vendor/device */
  34. u32 agp_mode; /* mode info of bridge */
  35. unsigned long aper_base;/* base of aperture */
  36. size_t aper_size; /* size of aperture */
  37. size_t pg_total; /* max pages (swap + system) */
  38. size_t pg_system; /* max pages (system) */
  39. size_t pg_used; /* current pages used */
  40. };
  41. struct agp_setup {
  42. u32 agp_mode; /* mode info of bridge */
  43. };
  44. /*
  45. * The "prot" down below needs still a "sleep" flag somehow ...
  46. */
  47. struct agp_segment {
  48. off_t pg_start; /* starting page to populate */
  49. size_t pg_count; /* number of pages */
  50. int prot; /* prot flags for mmap */
  51. };
  52. struct agp_segment_priv {
  53. off_t pg_start;
  54. size_t pg_count;
  55. pgprot_t prot;
  56. };
  57. struct agp_region {
  58. pid_t pid; /* pid of process */
  59. size_t seg_count; /* number of segments */
  60. struct agp_segment *seg_list;
  61. };
  62. struct agp_allocate {
  63. int key; /* tag of allocation */
  64. size_t pg_count; /* number of pages */
  65. u32 type; /* 0 == normal, other devspec */
  66. u32 physical; /* device specific (some devices
  67. * need a phys address of the
  68. * actual page behind the gatt
  69. * table) */
  70. };
  71. struct agp_bind {
  72. int key; /* tag of allocation */
  73. off_t pg_start; /* starting page to populate */
  74. };
  75. struct agp_unbind {
  76. int key; /* tag of allocation */
  77. u32 priority; /* priority for paging out */
  78. };
  79. struct agp_client {
  80. struct agp_client *next;
  81. struct agp_client *prev;
  82. pid_t pid;
  83. int num_segments;
  84. struct agp_segment_priv **segments;
  85. };
  86. struct agp_controller {
  87. struct agp_controller *next;
  88. struct agp_controller *prev;
  89. pid_t pid;
  90. int num_clients;
  91. struct agp_memory *pool;
  92. struct agp_client *clients;
  93. };
  94. #define AGP_FF_ALLOW_CLIENT 0
  95. #define AGP_FF_ALLOW_CONTROLLER 1
  96. #define AGP_FF_IS_CLIENT 2
  97. #define AGP_FF_IS_CONTROLLER 3
  98. #define AGP_FF_IS_VALID 4
  99. struct agp_file_private {
  100. struct agp_file_private *next;
  101. struct agp_file_private *prev;
  102. pid_t my_pid;
  103. unsigned long access_flags; /* long req'd for set_bit --RR */
  104. };
  105. struct agp_front_data {
  106. struct mutex agp_mutex;
  107. struct agp_controller *current_controller;
  108. struct agp_controller *controllers;
  109. struct agp_file_private *file_priv_list;
  110. bool used_by_controller;
  111. bool backend_acquired;
  112. };
  113. #endif /* _AGP_H */