Linux 2.6.20.7
[linux/fpc-iii.git] / drivers / char / drm / radeon_drv.c
blob2eb652ec674578c97f24cf1ca6c40b0d58a4454e
1 /**
2 * \file radeon_drv.c
3 * ATI Radeon driver
5 * \author Gareth Hughes <gareth@valinux.com>
6 */
8 /*
9 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
10 * All Rights Reserved.
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:
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.
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.
32 #include "drmP.h"
33 #include "drm.h"
34 #include "radeon_drm.h"
35 #include "radeon_drv.h"
37 #include "drm_pciids.h"
39 int radeon_no_wb;
41 MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers\n");
42 module_param_named(no_wb, radeon_no_wb, int, 0444);
44 static int dri_library_name(struct drm_device *dev, char *buf)
46 drm_radeon_private_t *dev_priv = dev->dev_private;
47 int family = dev_priv->flags & RADEON_FAMILY_MASK;
49 return snprintf(buf, PAGE_SIZE, "%s\n",
50 (family < CHIP_R200) ? "radeon" :
51 ((family < CHIP_R300) ? "r200" :
52 "r300"));
55 static struct pci_device_id pciidlist[] = {
56 radeon_PCI_IDS
59 static struct drm_driver driver = {
60 .driver_features =
61 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
62 DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED |
63 DRIVER_IRQ_VBL,
64 .dev_priv_size = sizeof(drm_radeon_buf_priv_t),
65 .load = radeon_driver_load,
66 .firstopen = radeon_driver_firstopen,
67 .open = radeon_driver_open,
68 .preclose = radeon_driver_preclose,
69 .postclose = radeon_driver_postclose,
70 .lastclose = radeon_driver_lastclose,
71 .unload = radeon_driver_unload,
72 .vblank_wait = radeon_driver_vblank_wait,
73 .dri_library_name = dri_library_name,
74 .irq_preinstall = radeon_driver_irq_preinstall,
75 .irq_postinstall = radeon_driver_irq_postinstall,
76 .irq_uninstall = radeon_driver_irq_uninstall,
77 .irq_handler = radeon_driver_irq_handler,
78 .reclaim_buffers = drm_core_reclaim_buffers,
79 .get_map_ofs = drm_core_get_map_ofs,
80 .get_reg_ofs = drm_core_get_reg_ofs,
81 .ioctls = radeon_ioctls,
82 .dma_ioctl = radeon_cp_buffers,
83 .fops = {
84 .owner = THIS_MODULE,
85 .open = drm_open,
86 .release = drm_release,
87 .ioctl = drm_ioctl,
88 .mmap = drm_mmap,
89 .poll = drm_poll,
90 .fasync = drm_fasync,
91 #ifdef CONFIG_COMPAT
92 .compat_ioctl = radeon_compat_ioctl,
93 #endif
96 .pci_driver = {
97 .name = DRIVER_NAME,
98 .id_table = pciidlist,
101 .name = DRIVER_NAME,
102 .desc = DRIVER_DESC,
103 .date = DRIVER_DATE,
104 .major = DRIVER_MAJOR,
105 .minor = DRIVER_MINOR,
106 .patchlevel = DRIVER_PATCHLEVEL,
109 static int __init radeon_init(void)
111 driver.num_ioctls = radeon_max_ioctl;
112 return drm_init(&driver);
115 static void __exit radeon_exit(void)
117 drm_exit(&driver);
120 module_init(radeon_init);
121 module_exit(radeon_exit);
123 MODULE_AUTHOR(DRIVER_AUTHOR);
124 MODULE_DESCRIPTION(DRIVER_DESC);
125 MODULE_LICENSE("GPL and additional rights");