agpgart.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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
  28. #define AGPIOC_BASE 'A'
  29. #define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)
  30. #define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)
  31. #define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)
  32. #define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*)
  33. #define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)
  34. #define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)
  35. #define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
  36. #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
  37. #define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
  38. #define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
  39. #define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)
  40. #define AGP_DEVICE "/dev/agpgart"
  41. #ifndef TRUE
  42. #define TRUE 1
  43. #endif
  44. #ifndef FALSE
  45. #define FALSE 0
  46. #endif
  47. #include <linux/types.h>
  48. struct agp_version {
  49. __u16 major;
  50. __u16 minor;
  51. };
  52. typedef struct _agp_info {
  53. struct agp_version version; /* version of the driver */
  54. __u32 bridge_id; /* bridge vendor/device */
  55. __u32 agp_mode; /* mode info of bridge */
  56. unsigned long aper_base;/* base of aperture */
  57. size_t aper_size; /* size of aperture */
  58. size_t pg_total; /* max pages (swap + system) */
  59. size_t pg_system; /* max pages (system) */
  60. size_t pg_used; /* current pages used */
  61. } agp_info;
  62. typedef struct _agp_setup {
  63. __u32 agp_mode; /* mode info of bridge */
  64. } agp_setup;
  65. /*
  66. * The "prot" down below needs still a "sleep" flag somehow ...
  67. */
  68. typedef struct _agp_segment {
  69. __kernel_off_t pg_start; /* starting page to populate */
  70. __kernel_size_t pg_count; /* number of pages */
  71. int prot; /* prot flags for mmap */
  72. } agp_segment;
  73. typedef struct _agp_region {
  74. __kernel_pid_t pid; /* pid of process */
  75. __kernel_size_t seg_count; /* number of segments */
  76. struct _agp_segment *seg_list;
  77. } agp_region;
  78. typedef struct _agp_allocate {
  79. int key; /* tag of allocation */
  80. __kernel_size_t pg_count;/* number of pages */
  81. __u32 type; /* 0 == normal, other devspec */
  82. __u32 physical; /* device specific (some devices
  83. * need a phys address of the
  84. * actual page behind the gatt
  85. * table) */
  86. } agp_allocate;
  87. typedef struct _agp_bind {
  88. int key; /* tag of allocation */
  89. __kernel_off_t pg_start;/* starting page to populate */
  90. } agp_bind;
  91. typedef struct _agp_unbind {
  92. int key; /* tag of allocation */
  93. __u32 priority; /* priority for paging out */
  94. } agp_unbind;
  95. #endif /* _AGP_H */