e1000 - Literally import e1000 driver from FreeBSD
[dragonfly.git] / sys / dev / drm / tdfx_drv.c
blob05216e964fe44fc1fcd244ce61205d7fbb13cb93
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>
35 #include "dev/drm/tdfx_drv.h"
36 #include "dev/drm/drmP.h"
37 #include "dev/drm/drm_pciids.h"
39 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
40 static drm_pci_id_list_t tdfx_pciidlist[] = {
41 tdfx_PCI_IDS
44 static void tdfx_configure(struct drm_device *dev)
46 dev->driver->driver_features =
47 DRIVER_USE_MTRR;
49 dev->driver->buf_priv_size = 1; /* No dev_priv */
51 dev->driver->max_ioctl = 0;
53 dev->driver->name = DRIVER_NAME;
54 dev->driver->desc = DRIVER_DESC;
55 dev->driver->date = DRIVER_DATE;
56 dev->driver->major = DRIVER_MAJOR;
57 dev->driver->minor = DRIVER_MINOR;
58 dev->driver->patchlevel = DRIVER_PATCHLEVEL;
61 static int
62 tdfx_probe(device_t kdev)
64 return drm_probe(kdev, tdfx_pciidlist);
67 static int
68 tdfx_attach(device_t kdev)
70 struct drm_device *dev = device_get_softc(kdev);
72 dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER,
73 M_WAITOK | M_ZERO);
75 tdfx_configure(dev);
77 return drm_attach(kdev, tdfx_pciidlist);
80 static int
81 tdfx_detach(device_t kdev)
83 struct drm_device *dev = device_get_softc(kdev);
84 int ret;
86 ret = drm_detach(kdev);
88 free(dev->driver, DRM_MEM_DRIVER);
90 return ret;
93 static device_method_t tdfx_methods[] = {
94 /* Device interface */
95 DEVMETHOD(device_probe, tdfx_probe),
96 DEVMETHOD(device_attach, tdfx_attach),
97 DEVMETHOD(device_detach, tdfx_detach),
99 { 0, 0 }
102 static driver_t tdfx_driver = {
103 "drm",
104 tdfx_methods,
105 sizeof(struct drm_device)
108 extern devclass_t drm_devclass;
109 DRIVER_MODULE(tdfx, vgapci, tdfx_driver, drm_devclass, 0, 0);
110 MODULE_DEPEND(tdfx, drm, 1, 1, 1);