agp_backend.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * AGPGART backend specific includes. Not for userspace consumption.
  3. *
  4. * Copyright (C) 2004 Silicon Graphics, Inc.
  5. * Copyright (C) 2002-2003 Dave Jones
  6. * Copyright (C) 1999 Jeff Hartmann
  7. * Copyright (C) 1999 Precision Insight, Inc.
  8. * Copyright (C) 1999 Xi Graphics, Inc.
  9. *
  10. * Permission is hereby granted, free of charge, to any person obtaining a
  11. * copy of this software and associated documentation files (the "Software"),
  12. * to deal in the Software without restriction, including without limitation
  13. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  14. * and/or sell copies of the Software, and to permit persons to whom the
  15. * Software is furnished to do so, subject to the following conditions:
  16. *
  17. * The above copyright notice and this permission notice shall be included
  18. * in all copies or substantial portions of the Software.
  19. *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  23. * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
  24. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  26. * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. *
  28. */
  29. #ifndef _AGP_BACKEND_H
  30. #define _AGP_BACKEND_H 1
  31. #include <linux/list.h>
  32. enum chipset_type {
  33. NOT_SUPPORTED,
  34. SUPPORTED,
  35. };
  36. struct agp_version {
  37. u16 major;
  38. u16 minor;
  39. };
  40. struct agp_kern_info {
  41. struct agp_version version;
  42. struct pci_dev *device;
  43. enum chipset_type chipset;
  44. unsigned long mode;
  45. unsigned long aper_base;
  46. size_t aper_size;
  47. int max_memory; /* In pages */
  48. int current_memory;
  49. bool cant_use_aperture;
  50. unsigned long page_mask;
  51. const struct vm_operations_struct *vm_ops;
  52. };
  53. /*
  54. * The agp_memory structure has information about the block of agp memory
  55. * allocated. A caller may manipulate the next and prev pointers to link
  56. * each allocated item into a list. These pointers are ignored by the backend.
  57. * Everything else should never be written to, but the caller may read any of
  58. * the items to determine the status of this block of agp memory.
  59. */
  60. struct agp_bridge_data;
  61. struct agp_memory {
  62. struct agp_memory *next;
  63. struct agp_memory *prev;
  64. struct agp_bridge_data *bridge;
  65. struct page **pages;
  66. size_t page_count;
  67. int key;
  68. int num_scratch_pages;
  69. off_t pg_start;
  70. u32 type;
  71. u32 physical;
  72. bool is_bound;
  73. bool is_flushed;
  74. /* list of agp_memory mapped to the aperture */
  75. struct list_head mapped_list;
  76. /* DMA-mapped addresses */
  77. struct scatterlist *sg_list;
  78. int num_sg;
  79. };
  80. #define AGP_NORMAL_MEMORY 0
  81. #define AGP_USER_TYPES (1 << 16)
  82. #define AGP_USER_MEMORY (AGP_USER_TYPES)
  83. #define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
  84. extern struct agp_bridge_data *agp_bridge;
  85. extern struct list_head agp_bridges;
  86. extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *);
  87. extern void agp_free_memory(struct agp_memory *);
  88. extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);
  89. extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
  90. extern int agp_bind_memory(struct agp_memory *, off_t);
  91. extern int agp_unbind_memory(struct agp_memory *);
  92. extern void agp_enable(struct agp_bridge_data *, u32);
  93. extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
  94. extern void agp_backend_release(struct agp_bridge_data *);
  95. #endif /* _AGP_BACKEND_H */