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>
35 #include "dev/drm/drmP.h"
36 #include "dev/drm/drm.h"
37 #include "dev/drm/r128_drm.h"
38 #include "dev/drm/r128_drv.h"
39 #include "dev/drm/drm_pciids.h"
41 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
42 static drm_pci_id_list_t r128_pciidlist[] = {
46 extern drm_ioctl_desc_t r128_ioctls[];
47 extern int r128_max_ioctl;
49 static void r128_configure(drm_device_t *dev)
51 dev->dev_priv_size = sizeof(drm_r128_buf_priv_t);
52 dev->prerelease = r128_driver_prerelease;
53 dev->pretakedown = r128_driver_pretakedown;
54 dev->vblank_wait = r128_driver_vblank_wait;
55 dev->irq_preinstall = r128_driver_irq_preinstall;
56 dev->irq_postinstall = r128_driver_irq_postinstall;
57 dev->irq_uninstall = r128_driver_irq_uninstall;
58 dev->irq_handler = r128_driver_irq_handler;
59 dev->dma_ioctl = r128_cce_buffers;
61 dev->driver_ioctls = r128_ioctls;
62 dev->max_driver_ioctl = r128_max_ioctl;
64 dev->driver_name = DRIVER_NAME;
65 dev->driver_desc = DRIVER_DESC;
66 dev->driver_date = DRIVER_DATE;
67 dev->driver_major = DRIVER_MAJOR;
68 dev->driver_minor = DRIVER_MINOR;
69 dev->driver_patchlevel = DRIVER_PATCHLEVEL;
82 r128_probe(device_t dev)
84 return drm_probe(dev, r128_pciidlist);
88 r128_attach(device_t nbdev)
90 drm_device_t *dev = device_get_softc(nbdev);
92 bzero(dev, sizeof(drm_device_t));
94 return drm_attach(nbdev, r128_pciidlist);
97 static device_method_t r128_methods[] = {
98 /* Device interface */
99 DEVMETHOD(device_probe, r128_probe),
100 DEVMETHOD(device_attach, r128_attach),
101 DEVMETHOD(device_detach, drm_detach),
106 static driver_t r128_driver = {
112 extern devclass_t drm_devclass;
113 DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
114 MODULE_DEPEND(r128, drm, 1, 1, 1);
116 #elif defined(__NetBSD__) || defined(__OpenBSD__)
117 CFDRIVER_DECL(r128, DV_TTY, NULL);