agpgart.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 _UAPI_AGP_H
  27. #define _UAPI_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. #ifndef __KERNEL__
  48. #include <linux/types.h>
  49. #include <stdlib.h>
  50. struct agp_version {
  51. __u16 major;
  52. __u16 minor;
  53. };
  54. typedef struct _agp_info {
  55. struct agp_version version; /* version of the driver */
  56. __u32 bridge_id; /* bridge vendor/device */
  57. __u32 agp_mode; /* mode info of bridge */
  58. unsigned long aper_base;/* base of aperture */
  59. size_t aper_size; /* size of aperture */
  60. size_t pg_total; /* max pages (swap + system) */
  61. size_t pg_system; /* max pages (system) */
  62. size_t pg_used; /* current pages used */
  63. } agp_info;
  64. typedef struct _agp_setup {
  65. __u32 agp_mode; /* mode info of bridge */
  66. } agp_setup;
  67. /*
  68. * The "prot" down below needs still a "sleep" flag somehow ...
  69. */
  70. typedef struct _agp_segment {
  71. __kernel_off_t pg_start; /* starting page to populate */
  72. __kernel_size_t pg_count; /* number of pages */
  73. int prot; /* prot flags for mmap */
  74. } agp_segment;
  75. typedef struct _agp_region {
  76. __kernel_pid_t pid; /* pid of process */
  77. __kernel_size_t seg_count; /* number of segments */
  78. struct _agp_segment *seg_list;
  79. } agp_region;
  80. typedef struct _agp_allocate {
  81. int key; /* tag of allocation */
  82. __kernel_size_t pg_count;/* number of pages */
  83. __u32 type; /* 0 == normal, other devspec */
  84. __u32 physical; /* device specific (some devices
  85. * need a phys address of the
  86. * actual page behind the gatt
  87. * table) */
  88. } agp_allocate;
  89. typedef struct _agp_bind {
  90. int key; /* tag of allocation */
  91. __kernel_off_t pg_start;/* starting page to populate */
  92. } agp_bind;
  93. typedef struct _agp_unbind {
  94. int key; /* tag of allocation */
  95. __u32 priority; /* priority for paging out */
  96. } agp_unbind;
  97. #endif /* __KERNEL__ */
  98. #endif /* _UAPI_AGP_H */