1 /* $NetBSD: tdfx_drv.c,v 1.3 2018/08/28 03:41:39 riastradh Exp $ */ 2 3 /* tdfx_drv.c -- tdfx driver -*- linux-c -*- 4 * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com 5 * 6 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 7 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 8 * All Rights Reserved. 9 * 10 * Permission is hereby granted, free of charge, to any person obtaining a 11 * copy of this software and associated documentation files (the "Software"), 12 * to deal in the Software without restriction, including without limitation 13 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 * and/or sell copies of the Software, and to permit persons to whom the 15 * Software is furnished to do so, subject to the following conditions: 16 * 17 * The above copyright notice and this permission notice (including the next 18 * paragraph) shall be included in all copies or substantial portions of the 19 * Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 25 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 26 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 * DEALINGS IN THE SOFTWARE. 28 * 29 * Authors: 30 * Rickard E. (Rik) Faith <faith@valinux.com> 31 * Daryll Strauss <daryll@valinux.com> 32 * Gareth Hughes <gareth@valinux.com> 33 */ 34 35 #include <sys/cdefs.h> 36 __KERNEL_RCSID(0, "$NetBSD: tdfx_drv.c,v 1.3 2018/08/28 03:41:39 riastradh Exp $"); 37 38 #include <linux/module.h> 39 40 #include <drm/drmP.h> 41 #include "tdfx_drv.h" 42 43 #include <drm/drm_pciids.h> 44 #include <drm/drm_legacy.h> 45 46 static struct pci_device_id pciidlist[] = { 47 tdfx_PCI_IDS 48 }; 49 50 static const struct file_operations tdfx_driver_fops = { 51 .owner = THIS_MODULE, 52 .open = drm_open, 53 .release = drm_release, 54 .unlocked_ioctl = drm_ioctl, 55 .mmap = drm_legacy_mmap, 56 .poll = drm_poll, 57 #ifdef CONFIG_COMPAT 58 .compat_ioctl = drm_compat_ioctl, 59 #endif 60 .llseek = noop_llseek, 61 }; 62 63 static struct drm_driver driver = { 64 .set_busid = drm_pci_set_busid, 65 .set_unique = drm_pci_set_unique, 66 .fops = &tdfx_driver_fops, 67 .name = DRIVER_NAME, 68 .desc = DRIVER_DESC, 69 .date = DRIVER_DATE, 70 .major = DRIVER_MAJOR, 71 .minor = DRIVER_MINOR, 72 .patchlevel = DRIVER_PATCHLEVEL, 73 }; 74 75 static struct pci_driver tdfx_pci_driver = { 76 .name = DRIVER_NAME, 77 .id_table = pciidlist, 78 }; 79 80 static int __init tdfx_init(void) 81 { 82 return drm_pci_init(&driver, &tdfx_pci_driver); 83 } 84 85 static void __exit tdfx_exit(void) 86 { 87 drm_pci_exit(&driver, &tdfx_pci_driver); 88 } 89 90 module_init(tdfx_init); 91 module_exit(tdfx_exit); 92 93 MODULE_AUTHOR(DRIVER_AUTHOR); 94 MODULE_DESCRIPTION(DRIVER_DESC); 95 MODULE_LICENSE("GPL and additional rights"); 96