OSDN Git Service

Convert more drivers for bsd-core, moving the ioctl definitions to shared
[android-x86/external-libdrm.git] / bsd-core / tdfx_drv.c
1 /* tdfx_drv.c -- tdfx driver -*- linux-c -*-
2  * Created: Thu Oct  7 10:38:32 1999 by faith@precisioninsight.com
3  *
4  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6  * All Rights Reserved.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice (including the next
16  * paragraph) shall be included in all copies or substantial portions of the
17  * Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  * DEALINGS IN THE SOFTWARE.
26  *
27  * Authors:
28  *    Rickard E. (Rik) Faith <faith@valinux.com>
29  *    Daryll Strauss <daryll@valinux.com>
30  *    Gareth Hughes <gareth@valinux.com>
31  *
32  */
33
34 #include "tdfx_drv.h"
35 #include "drmP.h"
36 #include "drm_pciids.h"
37
38 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
39 static drm_pci_id_list_t tdfx_pciidlist[] = {
40         tdfx_PCI_IDS
41 };
42
43 extern drm_ioctl_desc_t tdfx_ioctls[];
44 extern int tdfx_max_ioctl;
45
46 static void tdfx_configure(drm_device_t *dev)
47 {
48         dev->dev_priv_size = 1; /* No dev_priv */
49
50         dev->max_driver_ioctl = 0;
51
52         dev->driver_name = DRIVER_NAME;
53         dev->driver_desc = DRIVER_DESC;
54         dev->driver_date = DRIVER_DATE;
55         dev->driver_major = DRIVER_MAJOR;
56         dev->driver_minor = DRIVER_MINOR;
57         dev->driver_patchlevel = DRIVER_PATCHLEVEL;
58
59         dev->use_mtrr = 1;
60 }
61
62 #ifdef __FreeBSD__
63 static int
64 tdfx_probe(device_t dev)
65 {
66         return drm_probe(dev, tdfx_pciidlist);
67 }
68
69 static int
70 tdfx_attach(device_t nbdev)
71 {
72         drm_device_t *dev = device_get_softc(nbdev);
73
74         bzero(dev, sizeof(drm_device_t));
75         tdfx_configure(dev);
76         return drm_attach(nbdev, tdfx_pciidlist);
77 }
78
79 static device_method_t tdfx_methods[] = {
80         /* Device interface */
81         DEVMETHOD(device_probe,         tdfx_probe),
82         DEVMETHOD(device_attach,        tdfx_attach),
83         DEVMETHOD(device_detach,        drm_detach),
84
85         { 0, 0 }
86 };
87
88 static driver_t tdfx_driver = {
89         "drm",
90         tdfx_methods,
91         sizeof(drm_device_t)
92 };
93
94 extern devclass_t drm_devclass;
95 DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0);
96 MODULE_DEPEND(tdfx, drm, 1, 1, 1);
97
98 #elif defined(__NetBSD__) || defined(__OpenBSD__)
99 CFDRIVER_DECL(tdfx, DV_TTY, NULL);
100 #endif