mach64_drv.c (182080) | mach64_drv.c (183573) |
---|---|
1/* mach64_drv.c -- ATI Rage 128 driver -*- linux-c -*- 2 * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com 3 */ 4/*- 5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 7 * All Rights Reserved. 8 * --- 17 unchanged lines hidden (view full) --- 26 * OTHER DEALINGS IN THE SOFTWARE. 27 * 28 * Authors: 29 * Rickard E. (Rik) Faith <faith@valinux.com> 30 * Gareth Hughes <gareth@valinux.com> 31 */ 32 33#include <sys/cdefs.h> | 1/* mach64_drv.c -- ATI Rage 128 driver -*- linux-c -*- 2 * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com 3 */ 4/*- 5 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 6 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 7 * All Rights Reserved. 8 * --- 17 unchanged lines hidden (view full) --- 26 * OTHER DEALINGS IN THE SOFTWARE. 27 * 28 * Authors: 29 * Rickard E. (Rik) Faith <faith@valinux.com> 30 * Gareth Hughes <gareth@valinux.com> 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/drm/mach64_drv.c 182080 2008-08-23 20:59:12Z rnoland $"); | 34__FBSDID("$FreeBSD: head/sys/dev/drm/mach64_drv.c 183573 2008-10-03 16:59:11Z rnoland $"); |
35 36 37#include <sys/types.h> 38 39#include "dev/drm/drmP.h" 40#include "dev/drm/drm.h" 41#include "dev/drm/mach64_drm.h" 42#include "dev/drm/mach64_drv.h" 43#include "dev/drm/drm_pciids.h" 44 45/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */ 46static drm_pci_id_list_t mach64_pciidlist[] = { 47 mach64_PCI_IDS 48}; 49 50static void mach64_configure(struct drm_device *dev) 51{ | 35 36 37#include <sys/types.h> 38 39#include "dev/drm/drmP.h" 40#include "dev/drm/drm.h" 41#include "dev/drm/mach64_drm.h" 42#include "dev/drm/mach64_drv.h" 43#include "dev/drm/drm_pciids.h" 44 45/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */ 46static drm_pci_id_list_t mach64_pciidlist[] = { 47 mach64_PCI_IDS 48}; 49 50static void mach64_configure(struct drm_device *dev) 51{ |
52 dev->driver.buf_priv_size = 1; /* No dev_priv */ 53 dev->driver.lastclose = mach64_driver_lastclose; 54 dev->driver.get_vblank_counter = mach64_get_vblank_counter; 55 dev->driver.enable_vblank = mach64_enable_vblank; 56 dev->driver.disable_vblank = mach64_disable_vblank; 57 dev->driver.irq_preinstall = mach64_driver_irq_preinstall; 58 dev->driver.irq_postinstall = mach64_driver_irq_postinstall; 59 dev->driver.irq_uninstall = mach64_driver_irq_uninstall; 60 dev->driver.irq_handler = mach64_driver_irq_handler; 61 dev->driver.dma_ioctl = mach64_dma_buffers; | 52 dev->driver->driver_features = 53 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | 54 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ; |
62 | 55 |
63 dev->driver.ioctls = mach64_ioctls; 64 dev->driver.max_ioctl = mach64_max_ioctl; | 56 dev->driver->buf_priv_size = 1; /* No dev_priv */ 57 dev->driver->lastclose = mach64_driver_lastclose; 58 dev->driver->get_vblank_counter = mach64_get_vblank_counter; 59 dev->driver->enable_vblank = mach64_enable_vblank; 60 dev->driver->disable_vblank = mach64_disable_vblank; 61 dev->driver->irq_preinstall = mach64_driver_irq_preinstall; 62 dev->driver->irq_postinstall = mach64_driver_irq_postinstall; 63 dev->driver->irq_uninstall = mach64_driver_irq_uninstall; 64 dev->driver->irq_handler = mach64_driver_irq_handler; 65 dev->driver->dma_ioctl = mach64_dma_buffers; |
65 | 66 |
66 dev->driver.name = DRIVER_NAME; 67 dev->driver.desc = DRIVER_DESC; 68 dev->driver.date = DRIVER_DATE; 69 dev->driver.major = DRIVER_MAJOR; 70 dev->driver.minor = DRIVER_MINOR; 71 dev->driver.patchlevel = DRIVER_PATCHLEVEL; | 67 dev->driver->ioctls = mach64_ioctls; 68 dev->driver->max_ioctl = mach64_max_ioctl; |
72 | 69 |
73 dev->driver.use_agp = 1; 74 dev->driver.use_mtrr = 1; 75 dev->driver.use_pci_dma = 1; 76 dev->driver.use_dma = 1; 77 dev->driver.use_irq = 1; 78 dev->driver.use_vbl_irq = 1; | 70 dev->driver->name = DRIVER_NAME; 71 dev->driver->desc = DRIVER_DESC; 72 dev->driver->date = DRIVER_DATE; 73 dev->driver->major = DRIVER_MAJOR; 74 dev->driver->minor = DRIVER_MINOR; 75 dev->driver->patchlevel = DRIVER_PATCHLEVEL; |
79} 80 | 76} 77 |
81#ifdef __FreeBSD__ | |
82static int 83mach64_probe(device_t dev) 84{ 85 return drm_probe(dev, mach64_pciidlist); 86} 87 88static int 89mach64_attach(device_t nbdev) 90{ 91 struct drm_device *dev = device_get_softc(nbdev); 92 93 bzero(dev, sizeof(struct drm_device)); | 78static int 79mach64_probe(device_t dev) 80{ 81 return drm_probe(dev, mach64_pciidlist); 82} 83 84static int 85mach64_attach(device_t nbdev) 86{ 87 struct drm_device *dev = device_get_softc(nbdev); 88 89 bzero(dev, sizeof(struct drm_device)); |
90 91 dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); |
|
94 mach64_configure(dev); | 92 mach64_configure(dev); |
93 |
|
95 return drm_attach(nbdev, mach64_pciidlist); 96} 97 | 94 return drm_attach(nbdev, mach64_pciidlist); 95} 96 |
97static int 98mach64_detach(device_t nbdev) 99{ 100 struct drm_device *dev = device_get_softc(nbdev); 101 int ret; 102 103 ret = drm_detach(nbdev); 104 105 free(dev->driver, M_DRM); 106 107 return ret; 108} 109 |
|
98static device_method_t mach64_methods[] = { 99 /* Device interface */ 100 DEVMETHOD(device_probe, mach64_probe), 101 DEVMETHOD(device_attach, mach64_attach), | 110static device_method_t mach64_methods[] = { 111 /* Device interface */ 112 DEVMETHOD(device_probe, mach64_probe), 113 DEVMETHOD(device_attach, mach64_attach), |
102 DEVMETHOD(device_detach, drm_detach), | 114 DEVMETHOD(device_detach, mach64_detach), |
103 104 { 0, 0 } 105}; 106 107static driver_t mach64_driver = { 108 "drm", 109 mach64_methods, 110 sizeof(struct drm_device) 111}; 112 113extern devclass_t drm_devclass; 114#if __FreeBSD_version >= 700010 115DRIVER_MODULE(mach64, vgapci, mach64_driver, drm_devclass, 0, 0); 116#else 117DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0); 118#endif 119MODULE_DEPEND(mach64, drm, 1, 1, 1); | 115 116 { 0, 0 } 117}; 118 119static driver_t mach64_driver = { 120 "drm", 121 mach64_methods, 122 sizeof(struct drm_device) 123}; 124 125extern devclass_t drm_devclass; 126#if __FreeBSD_version >= 700010 127DRIVER_MODULE(mach64, vgapci, mach64_driver, drm_devclass, 0, 0); 128#else 129DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0); 130#endif 131MODULE_DEPEND(mach64, drm, 1, 1, 1); |
120 121#elif defined(__NetBSD__) || defined(__OpenBSD__) 122CFDRIVER_DECL(mach64, DV_TTY, NULL); 123#endif | |