radeon_drv.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /**
  2. * \file radeon_drv.c
  3. * ATI Radeon driver
  4. *
  5. * \author Gareth Hughes <gareth@valinux.com>
  6. */
  7. /*
  8. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
  9. * All Rights Reserved.
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a
  12. * copy of this software and associated documentation files (the "Software"),
  13. * to deal in the Software without restriction, including without limitation
  14. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  15. * and/or sell copies of the Software, and to permit persons to whom the
  16. * Software is furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice (including the next
  19. * paragraph) shall be included in all copies or substantial portions of the
  20. * Software.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  25. * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  26. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  27. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  28. * OTHER DEALINGS IN THE SOFTWARE.
  29. */
  30. #include <linux/config.h>
  31. #include "drmP.h"
  32. #include "drm.h"
  33. #include "radeon_drm.h"
  34. #include "radeon_drv.h"
  35. #include "drm_pciids.h"
  36. int radeon_no_wb;
  37. MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers\n");
  38. module_param_named(no_wb, radeon_no_wb, int, 0444);
  39. static int postinit(struct drm_device *dev, unsigned long flags)
  40. {
  41. DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
  42. DRIVER_NAME,
  43. DRIVER_MAJOR,
  44. DRIVER_MINOR,
  45. DRIVER_PATCHLEVEL,
  46. DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
  47. );
  48. return 0;
  49. }
  50. static int version(drm_version_t * version)
  51. {
  52. int len;
  53. version->version_major = DRIVER_MAJOR;
  54. version->version_minor = DRIVER_MINOR;
  55. version->version_patchlevel = DRIVER_PATCHLEVEL;
  56. DRM_COPY(version->name, DRIVER_NAME);
  57. DRM_COPY(version->date, DRIVER_DATE);
  58. DRM_COPY(version->desc, DRIVER_DESC);
  59. return 0;
  60. }
  61. static struct pci_device_id pciidlist[] = {
  62. radeon_PCI_IDS
  63. };
  64. static struct drm_driver driver = {
  65. .driver_features =
  66. DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
  67. DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED |
  68. DRIVER_IRQ_VBL,
  69. .dev_priv_size = sizeof(drm_radeon_buf_priv_t),
  70. .preinit = radeon_driver_preinit,
  71. .presetup = radeon_presetup,
  72. .postcleanup = radeon_driver_postcleanup,
  73. .prerelease = radeon_driver_prerelease,
  74. .pretakedown = radeon_driver_pretakedown,
  75. .open_helper = radeon_driver_open_helper,
  76. .vblank_wait = radeon_driver_vblank_wait,
  77. .irq_preinstall = radeon_driver_irq_preinstall,
  78. .irq_postinstall = radeon_driver_irq_postinstall,
  79. .irq_uninstall = radeon_driver_irq_uninstall,
  80. .irq_handler = radeon_driver_irq_handler,
  81. .free_filp_priv = radeon_driver_free_filp_priv,
  82. .reclaim_buffers = drm_core_reclaim_buffers,
  83. .get_map_ofs = drm_core_get_map_ofs,
  84. .get_reg_ofs = drm_core_get_reg_ofs,
  85. .postinit = postinit,
  86. .version = version,
  87. .ioctls = radeon_ioctls,
  88. .dma_ioctl = radeon_cp_buffers,
  89. .fops = {
  90. .owner = THIS_MODULE,
  91. .open = drm_open,
  92. .release = drm_release,
  93. .ioctl = drm_ioctl,
  94. .mmap = drm_mmap,
  95. .poll = drm_poll,
  96. .fasync = drm_fasync,
  97. #ifdef CONFIG_COMPAT
  98. .compat_ioctl = radeon_compat_ioctl,
  99. #endif
  100. }
  101. ,
  102. .pci_driver = {
  103. .name = DRIVER_NAME,
  104. .id_table = pciidlist,
  105. }
  106. };
  107. static int __init radeon_init(void)
  108. {
  109. driver.num_ioctls = radeon_max_ioctl;
  110. return drm_init(&driver);
  111. }
  112. static void __exit radeon_exit(void)
  113. {
  114. drm_exit(&driver);
  115. }
  116. module_init(radeon_init);
  117. module_exit(radeon_exit);
  118. MODULE_AUTHOR(DRIVER_AUTHOR);
  119. MODULE_DESCRIPTION(DRIVER_DESC);
  120. MODULE_LICENSE("GPL and additional rights");