1 /* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*-
2 * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com
5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
29 * Rickard E. (Rik) Faith <faith@valinux.com>
30 * Gareth Hughes <gareth@valinux.com>
38 #include "drm_pciids.h"
40 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
41 static drm_pci_id_list_t r128_pciidlist[] = {
45 static void r128_configure(struct drm_device *dev)
47 dev->driver->driver_features =
48 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA |
49 DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ;
51 dev->driver->buf_priv_size = sizeof(drm_r128_buf_priv_t);
52 dev->driver->preclose = r128_driver_preclose;
53 dev->driver->lastclose = r128_driver_lastclose;
54 dev->driver->get_vblank_counter = r128_get_vblank_counter;
55 dev->driver->enable_vblank = r128_enable_vblank;
56 dev->driver->disable_vblank = r128_disable_vblank;
57 dev->driver->irq_preinstall = r128_driver_irq_preinstall;
58 dev->driver->irq_postinstall = r128_driver_irq_postinstall;
59 dev->driver->irq_uninstall = r128_driver_irq_uninstall;
60 dev->driver->irq_handler = r128_driver_irq_handler;
61 dev->driver->dma_ioctl = r128_cce_buffers;
63 dev->driver->ioctls = r128_ioctls;
64 dev->driver->max_ioctl = r128_max_ioctl;
66 dev->driver->name = DRIVER_NAME;
67 dev->driver->desc = DRIVER_DESC;
68 dev->driver->date = DRIVER_DATE;
69 dev->driver->major = DRIVER_MAJOR;
70 dev->driver->minor = DRIVER_MINOR;
71 dev->driver->patchlevel = DRIVER_PATCHLEVEL;
76 r128_probe(device_t dev)
78 return drm_probe(dev, r128_pciidlist);
82 r128_attach(device_t nbdev)
84 struct drm_device *dev = device_get_softc(nbdev);
86 bzero(dev, sizeof(struct drm_device));
88 dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_ZERO);
91 return drm_attach(nbdev, r128_pciidlist);
95 r128_detach(device_t nbdev)
97 struct drm_device *dev = device_get_softc(nbdev);
99 free(dev->driver, M_DRM);
101 return drm_detach(nbdev);
104 static device_method_t r128_methods[] = {
105 /* Device interface */
106 DEVMETHOD(device_probe, r128_probe),
107 DEVMETHOD(device_attach, r128_attach),
108 DEVMETHOD(device_detach, r128_detach),
113 static driver_t r128_driver = {
116 sizeof(struct drm_device)
119 extern devclass_t drm_devclass;
120 #if __FreeBSD_version >= 700010
121 DRIVER_MODULE(r128, vgapci, r128_driver, drm_devclass, 0, 0);
123 DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
125 MODULE_DEPEND(r128, drm, 1, 1, 1);
127 #elif defined(__NetBSD__) || defined(__OpenBSD__)
129 CFDRIVER_DECL(r128, DV_TTY, NULL);
131 CFATTACH_DECL(r128, sizeof(struct drm_device), drm_probe, drm_attach,
132 drm_detach, drm_activate);