Sync with HEAD.
[dragonfly.git] / sys / dev / drm / tdfx_drv.c
blob8794a4259a382ab0dec44606ec014efb13eaa4b6
1 /* tdfx_drv.c -- tdfx driver -*- linux-c -*-
2 * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com
3 */
4 /*-
5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
7 * All Rights Reserved.
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
18 * Software.
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 * PRECISION INSIGHT 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 OTHER
26 * DEALINGS IN THE SOFTWARE.
28 * Authors:
29 * Rickard E. (Rik) Faith <faith@valinux.com>
30 * Daryll Strauss <daryll@valinux.com>
31 * Gareth Hughes <gareth@valinux.com>
33 * $DragonFly: src/sys/dev/drm/tdfx_drv.c,v 1.1 2008/04/05 18:12:29 hasso Exp $
36 #include "tdfx_drv.h"
37 #include "drmP.h"
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 tdfx_pciidlist[] = {
42 tdfx_PCI_IDS
45 static void tdfx_configure(drm_device_t *dev)
47 dev->driver.buf_priv_size = 1; /* No dev_priv */
49 dev->driver.max_ioctl = 0;
51 dev->driver.name = DRIVER_NAME;
52 dev->driver.desc = DRIVER_DESC;
53 dev->driver.date = DRIVER_DATE;
54 dev->driver.major = DRIVER_MAJOR;
55 dev->driver.minor = DRIVER_MINOR;
56 dev->driver.patchlevel = DRIVER_PATCHLEVEL;
58 dev->driver.use_mtrr = 1;
61 #if defined(__FreeBSD__) || defined(__DragonFly__)
62 static int
63 tdfx_probe(device_t dev)
65 return drm_probe(dev, tdfx_pciidlist);
68 static int
69 tdfx_attach(device_t nbdev)
71 drm_device_t *dev = device_get_softc(nbdev);
73 bzero(dev, sizeof(drm_device_t));
74 tdfx_configure(dev);
75 return drm_attach(nbdev, tdfx_pciidlist);
78 static device_method_t tdfx_methods[] = {
79 /* Device interface */
80 DEVMETHOD(device_probe, tdfx_probe),
81 DEVMETHOD(device_attach, tdfx_attach),
82 DEVMETHOD(device_detach, drm_detach),
84 { 0, 0 }
87 static driver_t tdfx_driver = {
88 "drm",
89 tdfx_methods,
90 sizeof(drm_device_t)
93 extern devclass_t drm_devclass;
94 #if __FreeBSD_version >= 700010
95 DRIVER_MODULE(tdfx, vgapci, tdfx_driver, drm_devclass, 0, 0);
96 #else
97 DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0);
98 #endif
99 MODULE_DEPEND(tdfx, drm, 1, 1, 1);
101 #elif defined(__NetBSD__) || defined(__OpenBSD__)
102 #ifdef _LKM
103 CFDRIVER_DECL(tdfx, DV_TTY, NULL);
104 #else
105 CFATTACH_DECL(tdfx, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
106 drm_activate);
107 #endif
108 #endif