i915_drv.c revision 153579
164562Sgshapiro/* i915_drv.c -- ATI Radeon driver -*- linux-c -*- 264562Sgshapiro * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com 3261363Sgshapiro */ 464562Sgshapiro/*- 564562Sgshapiro * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 664562Sgshapiro * All Rights Reserved. 764562Sgshapiro * 864562Sgshapiro * Permission is hereby granted, free of charge, to any person obtaining a 964562Sgshapiro * copy of this software and associated documentation files (the "Software"), 1064562Sgshapiro * to deal in the Software without restriction, including without limitation 1164562Sgshapiro * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1264562Sgshapiro * and/or sell copies of the Software, and to permit persons to whom the 13266692Sgshapiro * Software is furnished to do so, subject to the following conditions: 1464562Sgshapiro * 1564562Sgshapiro * The above copyright notice and this permission notice (including the next 1664562Sgshapiro * paragraph) shall be included in all copies or substantial portions of the 1764562Sgshapiro * Software. 1864562Sgshapiro * 1964562Sgshapiro * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2064562Sgshapiro * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2164562Sgshapiro * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2264562Sgshapiro * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 2390792Sgshapiro * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 2490792Sgshapiro * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2590792Sgshapiro * OTHER DEALINGS IN THE SOFTWARE. 26 * 27 * Authors: 28 * Gareth Hughes <gareth@valinux.com> 29 * 30 */ 31 32#include <sys/cdefs.h> 33__FBSDID("$FreeBSD: head/sys/dev/drm/i915_drv.c 153579 2005-12-20 22:44:36Z jhb $"); 34 35#include "dev/drm/drmP.h" 36#include "dev/drm/drm.h" 37#include "dev/drm/i915_drm.h" 38#include "dev/drm/i915_drv.h" 39#include "dev/drm/drm_pciids.h" 40 41/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */ 42static drm_pci_id_list_t i915_pciidlist[] = { 43 i915_PCI_IDS 44}; 45 46static void i915_configure(drm_device_t *dev) 47{ 48 dev->driver.buf_priv_size = 1; /* No dev_priv */ 49 dev->driver.load = i915_driver_load; 50 dev->driver.preclose = i915_driver_preclose; 51 dev->driver.lastclose = i915_driver_lastclose; 52 dev->driver.device_is_agp = i915_driver_device_is_agp, 53 dev->driver.irq_preinstall = i915_driver_irq_preinstall; 54 dev->driver.irq_postinstall = i915_driver_irq_postinstall; 55 dev->driver.irq_uninstall = i915_driver_irq_uninstall; 56 dev->driver.irq_handler = i915_driver_irq_handler; 57 58 dev->driver.ioctls = i915_ioctls; 59 dev->driver.max_ioctl = i915_max_ioctl; 60 61 dev->driver.name = DRIVER_NAME; 62 dev->driver.desc = DRIVER_DESC; 63 dev->driver.date = DRIVER_DATE; 64 dev->driver.major = DRIVER_MAJOR; 65 dev->driver.minor = DRIVER_MINOR; 66 dev->driver.patchlevel = DRIVER_PATCHLEVEL; 67 68 dev->driver.use_agp = 1; 69 dev->driver.require_agp = 1; 70 dev->driver.use_mtrr = 1; 71 dev->driver.use_irq = 1; 72} 73 74#ifdef __FreeBSD__ 75static int 76i915_probe(device_t dev) 77{ 78 return drm_probe(dev, i915_pciidlist); 79} 80 81static int 82i915_attach(device_t nbdev) 83{ 84 drm_device_t *dev = device_get_softc(nbdev); 85 86 bzero(dev, sizeof(drm_device_t)); 87 i915_configure(dev); 88 return drm_attach(nbdev, i915_pciidlist); 89} 90 91static device_method_t i915_methods[] = { 92 /* Device interface */ 93 DEVMETHOD(device_probe, i915_probe), 94 DEVMETHOD(device_attach, i915_attach), 95 DEVMETHOD(device_detach, drm_detach), 96 97 { 0, 0 } 98}; 99 100static driver_t i915_driver = { 101#if __FreeBSD_version >= 700010 102 "drm", 103#else 104 "drmsub", 105#endif 106 i915_methods, 107 sizeof(drm_device_t) 108}; 109 110extern devclass_t drm_devclass; 111#if __FreeBSD_version >= 700010 112DRIVER_MODULE(i915, vgapci, i915_driver, drm_devclass, 0, 0); 113#else 114DRIVER_MODULE(i915, agp, i915_driver, drm_devclass, 0, 0); 115#endif 116MODULE_DEPEND(i915, drm, 1, 1, 1); 117 118#elif defined(__NetBSD__) || defined(__OpenBSD__) 119CFDRIVER_DECL(i915, DV_TTY, NULL); 120#endif 121