sis_drv.c revision 189563
133965Sjdp/* sis.c -- sis driver -*- linux-c -*- 278828Sobrien */ 3218822Sdim/*- 438889Sjdp * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 533965Sjdp * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 633965Sjdp * All Rights Reserved. 7130561Sobrien * 833965Sjdp * Permission is hereby granted, free of charge, to any person obtaining a 9130561Sobrien * copy of this software and associated documentation files (the "Software"), 10130561Sobrien * to deal in the Software without restriction, including without limitation 11130561Sobrien * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12130561Sobrien * and/or sell copies of the Software, and to permit persons to whom the 1333965Sjdp * Software is furnished to do so, subject to the following conditions: 14130561Sobrien * 15130561Sobrien * The above copyright notice and this permission notice (including the next 16130561Sobrien * paragraph) shall be included in all copies or substantial portions of the 17130561Sobrien * Software. 1833965Sjdp * 19130561Sobrien * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20130561Sobrien * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21218822Sdim * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2233965Sjdp * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23218822Sdim * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24218822Sdim * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 2533965Sjdp * DEALINGS IN THE SOFTWARE. 2633965Sjdp * 2733965Sjdp */ 2833965Sjdp 2933965Sjdp#include <sys/cdefs.h> 3033965Sjdp__FBSDID("$FreeBSD: head/sys/dev/drm/sis_drv.c 189563 2009-03-09 07:55:18Z rnoland $"); 3133965Sjdp 3233965Sjdp#include "dev/drm/drmP.h" 3333965Sjdp#include "dev/drm/sis_drm.h" 3433965Sjdp#include "dev/drm/sis_drv.h" 3533965Sjdp#include "dev/drm/drm_pciids.h" 3633965Sjdp 3733965Sjdp/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */ 3833965Sjdpstatic drm_pci_id_list_t sis_pciidlist[] = { 3933965Sjdp sis_PCI_IDS 4033965Sjdp}; 4133965Sjdp 4233965Sjdpstatic void sis_configure(struct drm_device *dev) 4333965Sjdp{ 4433965Sjdp dev->driver->driver_features = 4533965Sjdp DRIVER_USE_AGP | DRIVER_USE_MTRR; 4633965Sjdp 4733965Sjdp dev->driver->buf_priv_size = 1; /* No dev_priv */ 4833965Sjdp dev->driver->context_ctor = sis_init_context; 4933965Sjdp dev->driver->context_dtor = sis_final_context; 5033965Sjdp 5133965Sjdp dev->driver->ioctls = sis_ioctls; 5233965Sjdp dev->driver->max_ioctl = sis_max_ioctl; 5333965Sjdp 5433965Sjdp dev->driver->name = DRIVER_NAME; 5533965Sjdp dev->driver->desc = DRIVER_DESC; 5633965Sjdp dev->driver->date = DRIVER_DATE; 5733965Sjdp dev->driver->major = DRIVER_MAJOR; 5833965Sjdp dev->driver->minor = DRIVER_MINOR; 5933965Sjdp dev->driver->patchlevel = DRIVER_PATCHLEVEL; 6033965Sjdp} 6133965Sjdp 6233965Sjdpstatic int 6333965Sjdpsis_probe(device_t kdev) 6433965Sjdp{ 6533965Sjdp return drm_probe(kdev, sis_pciidlist); 6633965Sjdp} 6733965Sjdp 6833965Sjdpstatic int 6933965Sjdpsis_attach(device_t kdev) 7033965Sjdp{ 7133965Sjdp struct drm_device *dev = device_get_softc(kdev); 7233965Sjdp 7333965Sjdp dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, 7433965Sjdp M_WAITOK | M_ZERO); 7533965Sjdp 7633965Sjdp sis_configure(dev); 7733965Sjdp 7833965Sjdp return drm_attach(kdev, sis_pciidlist); 7933965Sjdp} 8033965Sjdp 8133965Sjdpstatic int 8233965Sjdpsis_detach(device_t kdev) 8333965Sjdp{ 8433965Sjdp struct drm_device *dev = device_get_softc(kdev); 8533965Sjdp int ret; 8633965Sjdp 8733965Sjdp ret = drm_detach(kdev); 8833965Sjdp 8933965Sjdp free(dev->driver, DRM_MEM_DRIVER); 9033965Sjdp 9133965Sjdp return ret; 9233965Sjdp} 9333965Sjdp 9433965Sjdpstatic device_method_t sis_methods[] = { 9533965Sjdp /* Device interface */ 9633965Sjdp DEVMETHOD(device_probe, sis_probe), 9733965Sjdp DEVMETHOD(device_attach, sis_attach), 9833965Sjdp DEVMETHOD(device_detach, sis_detach), 9933965Sjdp 10033965Sjdp { 0, 0 } 10133965Sjdp}; 10233965Sjdp 10333965Sjdpstatic driver_t sis_driver = { 10433965Sjdp "drm", 10533965Sjdp sis_methods, 10633965Sjdp sizeof(struct drm_device) 10733965Sjdp}; 10833965Sjdp 10933965Sjdpextern devclass_t drm_devclass; 11033965Sjdp#if __FreeBSD_version >= 700010 11133965SjdpDRIVER_MODULE(sisdrm, vgapci, sis_driver, drm_devclass, 0, 0); 11233965Sjdp#else 11333965SjdpDRIVER_MODULE(sisdrm, pci, sis_driver, drm_devclass, 0, 0); 11433965Sjdp#endif 11533965SjdpMODULE_DEPEND(sisdrm, drm, 1, 1, 1); 11633965Sjdp