18c2ecf20Sopenharmony_ci/* i810_drv.c -- I810 driver -*- linux-c -*- 28c2ecf20Sopenharmony_ci * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 58c2ecf20Sopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 68c2ecf20Sopenharmony_ci * All Rights Reserved. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 98c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 108c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 118c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 128c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 138c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next 168c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 178c2ecf20Sopenharmony_ci * Software. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 208c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 218c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 228c2ecf20Sopenharmony_ci * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 238c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 248c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 258c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * Authors: 288c2ecf20Sopenharmony_ci * Rickard E. (Rik) Faith <faith@valinux.com> 298c2ecf20Sopenharmony_ci * Jeff Hartmann <jhartmann@valinux.com> 308c2ecf20Sopenharmony_ci * Gareth Hughes <gareth@valinux.com> 318c2ecf20Sopenharmony_ci */ 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#include "i810_drv.h" 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#include <linux/module.h> 368c2ecf20Sopenharmony_ci#include <linux/pci.h> 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#include <drm/drm_drv.h> 398c2ecf20Sopenharmony_ci#include <drm/drm_file.h> 408c2ecf20Sopenharmony_ci#include <drm/drm_pciids.h> 418c2ecf20Sopenharmony_ci#include <drm/i810_drm.h> 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic struct pci_device_id pciidlist[] = { 458c2ecf20Sopenharmony_ci i810_PCI_IDS 468c2ecf20Sopenharmony_ci}; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_cistatic const struct file_operations i810_driver_fops = { 498c2ecf20Sopenharmony_ci .owner = THIS_MODULE, 508c2ecf20Sopenharmony_ci .open = drm_open, 518c2ecf20Sopenharmony_ci .release = drm_release, 528c2ecf20Sopenharmony_ci .unlocked_ioctl = drm_ioctl, 538c2ecf20Sopenharmony_ci .mmap = drm_legacy_mmap, 548c2ecf20Sopenharmony_ci .poll = drm_poll, 558c2ecf20Sopenharmony_ci .compat_ioctl = drm_compat_ioctl, 568c2ecf20Sopenharmony_ci .llseek = noop_llseek, 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistatic struct drm_driver driver = { 608c2ecf20Sopenharmony_ci .driver_features = DRIVER_USE_AGP | DRIVER_HAVE_DMA | DRIVER_LEGACY, 618c2ecf20Sopenharmony_ci .dev_priv_size = sizeof(drm_i810_buf_priv_t), 628c2ecf20Sopenharmony_ci .load = i810_driver_load, 638c2ecf20Sopenharmony_ci .lastclose = i810_driver_lastclose, 648c2ecf20Sopenharmony_ci .preclose = i810_driver_preclose, 658c2ecf20Sopenharmony_ci .dma_quiescent = i810_driver_dma_quiescent, 668c2ecf20Sopenharmony_ci .ioctls = i810_ioctls, 678c2ecf20Sopenharmony_ci .fops = &i810_driver_fops, 688c2ecf20Sopenharmony_ci .name = DRIVER_NAME, 698c2ecf20Sopenharmony_ci .desc = DRIVER_DESC, 708c2ecf20Sopenharmony_ci .date = DRIVER_DATE, 718c2ecf20Sopenharmony_ci .major = DRIVER_MAJOR, 728c2ecf20Sopenharmony_ci .minor = DRIVER_MINOR, 738c2ecf20Sopenharmony_ci .patchlevel = DRIVER_PATCHLEVEL, 748c2ecf20Sopenharmony_ci}; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_cistatic struct pci_driver i810_pci_driver = { 778c2ecf20Sopenharmony_ci .name = DRIVER_NAME, 788c2ecf20Sopenharmony_ci .id_table = pciidlist, 798c2ecf20Sopenharmony_ci}; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cistatic int __init i810_init(void) 828c2ecf20Sopenharmony_ci{ 838c2ecf20Sopenharmony_ci if (num_possible_cpus() > 1) { 848c2ecf20Sopenharmony_ci pr_err("drm/i810 does not support SMP\n"); 858c2ecf20Sopenharmony_ci return -EINVAL; 868c2ecf20Sopenharmony_ci } 878c2ecf20Sopenharmony_ci driver.num_ioctls = i810_max_ioctl; 888c2ecf20Sopenharmony_ci return drm_legacy_pci_init(&driver, &i810_pci_driver); 898c2ecf20Sopenharmony_ci} 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cistatic void __exit i810_exit(void) 928c2ecf20Sopenharmony_ci{ 938c2ecf20Sopenharmony_ci drm_legacy_pci_exit(&driver, &i810_pci_driver); 948c2ecf20Sopenharmony_ci} 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_cimodule_init(i810_init); 978c2ecf20Sopenharmony_cimodule_exit(i810_exit); 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ciMODULE_AUTHOR(DRIVER_AUTHOR); 1008c2ecf20Sopenharmony_ciMODULE_DESCRIPTION(DRIVER_DESC); 1018c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL and additional rights"); 102