tdfx_drv.c revision 145132
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. 8 * 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: 15 * 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. 19 * 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. 27 * 28 * Authors: 29 * Rickard E. (Rik) Faith <faith@valinux.com> 30 * Daryll Strauss <daryll@valinux.com> 31 * Gareth Hughes <gareth@valinux.com> 32 * 33 * $FreeBSD: head/sys/dev/drm/tdfx_drv.c 145132 2005-04-16 03:44:47Z anholt $ 34 */ 35 36#include "dev/drm/tdfx_drv.h" 37#include "dev/drm/drmP.h" 38#include "dev/drm/drm_pciids.h" 39 40/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */ 41static drm_pci_id_list_t tdfx_pciidlist[] = { 42 tdfx_PCI_IDS 43}; 44 45extern drm_ioctl_desc_t tdfx_ioctls[]; 46extern int tdfx_max_ioctl; 47 48static void tdfx_configure(drm_device_t *dev) 49{ 50 dev->dev_priv_size = 1; /* No dev_priv */ 51 52 dev->max_driver_ioctl = 0; 53 54 dev->driver_name = DRIVER_NAME; 55 dev->driver_desc = DRIVER_DESC; 56 dev->driver_date = DRIVER_DATE; 57 dev->driver_major = DRIVER_MAJOR; 58 dev->driver_minor = DRIVER_MINOR; 59 dev->driver_patchlevel = DRIVER_PATCHLEVEL; 60 61 dev->use_mtrr = 1; 62} 63 64#ifdef __FreeBSD__ 65static int 66tdfx_probe(device_t dev) 67{ 68 return drm_probe(dev, tdfx_pciidlist); 69} 70 71static int 72tdfx_attach(device_t nbdev) 73{ 74 drm_device_t *dev = device_get_softc(nbdev); 75 76 bzero(dev, sizeof(drm_device_t)); 77 tdfx_configure(dev); 78 return drm_attach(nbdev, tdfx_pciidlist); 79} 80 81static device_method_t tdfx_methods[] = { 82 /* Device interface */ 83 DEVMETHOD(device_probe, tdfx_probe), 84 DEVMETHOD(device_attach, tdfx_attach), 85 DEVMETHOD(device_detach, drm_detach), 86 87 { 0, 0 } 88}; 89 90static driver_t tdfx_driver = { 91 "drm", 92 tdfx_methods, 93 sizeof(drm_device_t) 94}; 95 96extern devclass_t drm_devclass; 97DRIVER_MODULE(tdfx, pci, tdfx_driver, drm_devclass, 0, 0); 98MODULE_DEPEND(tdfx, drm, 1, 1, 1); 99 100#elif defined(__NetBSD__) || defined(__OpenBSD__) 101CFDRIVER_DECL(tdfx, DV_TTY, NULL); 102#endif 103