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