i810_drv.c revision 1.2
1/* $NetBSD: i810_drv.c,v 1.2 2018/08/27 04:58:23 riastradh Exp $ */ 2 3/* i810_drv.c -- I810 driver -*- linux-c -*- 4 * Created: Mon Dec 13 01:56:22 1999 by jhartmann@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 * VA LINUX SYSTEMS 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 27 * OTHER DEALINGS IN THE SOFTWARE. 28 * 29 * Authors: 30 * Rickard E. (Rik) Faith <faith@valinux.com> 31 * Jeff Hartmann <jhartmann@valinux.com> 32 * Gareth Hughes <gareth@valinux.com> 33 */ 34 35#include <sys/cdefs.h> 36__KERNEL_RCSID(0, "$NetBSD: i810_drv.c,v 1.2 2018/08/27 04:58:23 riastradh Exp $"); 37 38#include <linux/module.h> 39 40#include <drm/drmP.h> 41#include <drm/i810_drm.h> 42#include "i810_drv.h" 43 44#include <drm/drm_pciids.h> 45 46static struct pci_device_id pciidlist[] = { 47 i810_PCI_IDS 48}; 49 50static const struct file_operations i810_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 63static struct drm_driver driver = { 64 .driver_features = 65 DRIVER_USE_AGP | 66 DRIVER_HAVE_DMA, 67 .dev_priv_size = sizeof(drm_i810_buf_priv_t), 68 .load = i810_driver_load, 69 .lastclose = i810_driver_lastclose, 70 .preclose = i810_driver_preclose, 71 .set_busid = drm_pci_set_busid, 72 .device_is_agp = i810_driver_device_is_agp, 73 .dma_quiescent = i810_driver_dma_quiescent, 74 .ioctls = i810_ioctls, 75 .fops = &i810_driver_fops, 76 .name = DRIVER_NAME, 77 .desc = DRIVER_DESC, 78 .date = DRIVER_DATE, 79 .major = DRIVER_MAJOR, 80 .minor = DRIVER_MINOR, 81 .patchlevel = DRIVER_PATCHLEVEL, 82}; 83 84static struct pci_driver i810_pci_driver = { 85 .name = DRIVER_NAME, 86 .id_table = pciidlist, 87}; 88 89static int __init i810_init(void) 90{ 91 if (num_possible_cpus() > 1) { 92 pr_err("drm/i810 does not support SMP\n"); 93 return -EINVAL; 94 } 95 driver.num_ioctls = i810_max_ioctl; 96 return drm_pci_init(&driver, &i810_pci_driver); 97} 98 99static void __exit i810_exit(void) 100{ 101 drm_pci_exit(&driver, &i810_pci_driver); 102} 103 104module_init(i810_init); 105module_exit(i810_exit); 106 107MODULE_AUTHOR(DRIVER_AUTHOR); 108MODULE_DESCRIPTION(DRIVER_DESC); 109MODULE_LICENSE("GPL and additional rights"); 110