Back to home page

OSCL-LXR

 
 

    


0001 /* i810_drv.c -- I810 driver -*- linux-c -*-
0002  * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com
0003  *
0004  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
0005  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
0006  * All Rights Reserved.
0007  *
0008  * Permission is hereby granted, free of charge, to any person obtaining a
0009  * copy of this software and associated documentation files (the "Software"),
0010  * to deal in the Software without restriction, including without limitation
0011  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0012  * and/or sell copies of the Software, and to permit persons to whom the
0013  * Software is furnished to do so, subject to the following conditions:
0014  *
0015  * The above copyright notice and this permission notice (including the next
0016  * paragraph) shall be included in all copies or substantial portions of the
0017  * Software.
0018  *
0019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0020  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0021  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0022  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
0023  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0024  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0025  * OTHER DEALINGS IN THE SOFTWARE.
0026  *
0027  * Authors:
0028  *    Rickard E. (Rik) Faith <faith@valinux.com>
0029  *    Jeff Hartmann <jhartmann@valinux.com>
0030  *    Gareth Hughes <gareth@valinux.com>
0031  */
0032 
0033 #include "i810_drv.h"
0034 
0035 #include <linux/module.h>
0036 #include <linux/pci.h>
0037 
0038 #include <drm/drm_drv.h>
0039 #include <drm/drm_file.h>
0040 #include <drm/drm_pciids.h>
0041 #include <drm/i810_drm.h>
0042 
0043 
0044 static struct pci_device_id pciidlist[] = {
0045     i810_PCI_IDS
0046 };
0047 
0048 static const struct file_operations i810_driver_fops = {
0049     .owner = THIS_MODULE,
0050     .open = drm_open,
0051     .release = drm_release,
0052     .unlocked_ioctl = drm_ioctl,
0053     .mmap = drm_legacy_mmap,
0054     .poll = drm_poll,
0055     .compat_ioctl = drm_compat_ioctl,
0056     .llseek = noop_llseek,
0057 };
0058 
0059 static struct drm_driver driver = {
0060     .driver_features = DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_LEGACY,
0061     .dev_priv_size = sizeof(drm_i810_buf_priv_t),
0062     .load = i810_driver_load,
0063     .lastclose = i810_driver_lastclose,
0064     .preclose = i810_driver_preclose,
0065     .dma_quiescent = i810_driver_dma_quiescent,
0066     .ioctls = i810_ioctls,
0067     .fops = &i810_driver_fops,
0068     .name = DRIVER_NAME,
0069     .desc = DRIVER_DESC,
0070     .date = DRIVER_DATE,
0071     .major = DRIVER_MAJOR,
0072     .minor = DRIVER_MINOR,
0073     .patchlevel = DRIVER_PATCHLEVEL,
0074 };
0075 
0076 static struct pci_driver i810_pci_driver = {
0077     .name = DRIVER_NAME,
0078     .id_table = pciidlist,
0079 };
0080 
0081 static int __init i810_init(void)
0082 {
0083     if (num_possible_cpus() > 1) {
0084         pr_err("drm/i810 does not support SMP\n");
0085         return -EINVAL;
0086     }
0087     driver.num_ioctls = i810_max_ioctl;
0088     return drm_legacy_pci_init(&driver, &i810_pci_driver);
0089 }
0090 
0091 static void __exit i810_exit(void)
0092 {
0093     drm_legacy_pci_exit(&driver, &i810_pci_driver);
0094 }
0095 
0096 module_init(i810_init);
0097 module_exit(i810_exit);
0098 
0099 MODULE_AUTHOR(DRIVER_AUTHOR);
0100 MODULE_DESCRIPTION(DRIVER_DESC);
0101 MODULE_LICENSE("GPL and additional rights");