Back to home page

OSCL-LXR

 
 

    


0001 /* savage_drv.c -- Savage driver for Linux
0002  *
0003  * Copyright 2004  Felix Kuehling
0004  * All Rights Reserved.
0005  *
0006  * Permission is hereby granted, free of charge, to any person obtaining a
0007  * copy of this software and associated documentation files (the "Software"),
0008  * to deal in the Software without restriction, including without limitation
0009  * the rights to use, copy, modify, merge, publish, distribute, sub license,
0010  * and/or sell copies of the Software, and to permit persons to whom the
0011  * Software is furnished to do so, subject to the following conditions:
0012  *
0013  * The above copyright notice and this permission notice (including the
0014  * next paragraph) shall be included in all copies or substantial portions
0015  * of the Software.
0016  *
0017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0018  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0020  * NON-INFRINGEMENT. IN NO EVENT SHALL FELIX KUEHLING BE LIABLE FOR
0021  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
0022  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
0023  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0024  */
0025 
0026 #include <linux/module.h>
0027 #include <linux/pci.h>
0028 
0029 #include <drm/drm_drv.h>
0030 #include <drm/drm_file.h>
0031 #include <drm/drm_pciids.h>
0032 
0033 #include "savage_drv.h"
0034 
0035 static struct pci_device_id pciidlist[] = {
0036     savage_PCI_IDS
0037 };
0038 
0039 static const struct file_operations savage_driver_fops = {
0040     .owner = THIS_MODULE,
0041     .open = drm_open,
0042     .release = drm_release,
0043     .unlocked_ioctl = drm_ioctl,
0044     .mmap = drm_legacy_mmap,
0045     .poll = drm_poll,
0046     .compat_ioctl = drm_compat_ioctl,
0047     .llseek = noop_llseek,
0048 };
0049 
0050 static struct drm_driver driver = {
0051     .driver_features =
0052         DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_PCI_DMA | DRIVER_LEGACY,
0053     .dev_priv_size = sizeof(drm_savage_buf_priv_t),
0054     .load = savage_driver_load,
0055     .firstopen = savage_driver_firstopen,
0056     .preclose = savage_reclaim_buffers,
0057     .lastclose = savage_driver_lastclose,
0058     .unload = savage_driver_unload,
0059     .ioctls = savage_ioctls,
0060     .dma_ioctl = savage_bci_buffers,
0061     .fops = &savage_driver_fops,
0062     .name = DRIVER_NAME,
0063     .desc = DRIVER_DESC,
0064     .date = DRIVER_DATE,
0065     .major = DRIVER_MAJOR,
0066     .minor = DRIVER_MINOR,
0067     .patchlevel = DRIVER_PATCHLEVEL,
0068 };
0069 
0070 static struct pci_driver savage_pci_driver = {
0071     .name = DRIVER_NAME,
0072     .id_table = pciidlist,
0073 };
0074 
0075 static int __init savage_init(void)
0076 {
0077     driver.num_ioctls = savage_max_ioctl;
0078     return drm_legacy_pci_init(&driver, &savage_pci_driver);
0079 }
0080 
0081 static void __exit savage_exit(void)
0082 {
0083     drm_legacy_pci_exit(&driver, &savage_pci_driver);
0084 }
0085 
0086 module_init(savage_init);
0087 module_exit(savage_exit);
0088 
0089 MODULE_AUTHOR(DRIVER_AUTHOR);
0090 MODULE_DESCRIPTION(DRIVER_DESC);
0091 MODULE_LICENSE("GPL and additional rights");