i915_drv.c (189054) | i915_drv.c (189563) |
---|---|
1/* i915_drv.c -- Intel i915 driver -*- linux-c -*- 2 * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com 3 */ 4/*- 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 6 * All Rights Reserved. 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a --- 16 unchanged lines hidden (view full) --- 25 * OTHER DEALINGS IN THE SOFTWARE. 26 * 27 * Authors: 28 * Gareth Hughes <gareth@valinux.com> 29 * 30 */ 31 32#include <sys/cdefs.h> | 1/* i915_drv.c -- Intel i915 driver -*- linux-c -*- 2 * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com 3 */ 4/*- 5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 6 * All Rights Reserved. 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a --- 16 unchanged lines hidden (view full) --- 25 * 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 189054 2009-02-25 20:24:13Z rnoland $"); | 33__FBSDID("$FreeBSD: head/sys/dev/drm/i915_drv.c 189563 2009-03-09 07:55:18Z rnoland $"); |
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 | 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 int i915_suspend(device_t nbdev) | 46static int i915_suspend(device_t kdev) |
47{ | 47{ |
48 struct drm_device *dev = device_get_softc(nbdev); | 48 struct drm_device *dev = device_get_softc(kdev); |
49 struct drm_i915_private *dev_priv = dev->dev_private; 50 51 if (!dev || !dev_priv) { 52 DRM_ERROR("dev: 0x%lx, dev_priv: 0x%lx\n", 53 (unsigned long) dev, (unsigned long) dev_priv); 54 DRM_ERROR("DRM not initialized, aborting suspend.\n"); 55 return -ENODEV; 56 } 57 58 i915_save_state(dev); 59 | 49 struct drm_i915_private *dev_priv = dev->dev_private; 50 51 if (!dev || !dev_priv) { 52 DRM_ERROR("dev: 0x%lx, dev_priv: 0x%lx\n", 53 (unsigned long) dev, (unsigned long) dev_priv); 54 DRM_ERROR("DRM not initialized, aborting suspend.\n"); 55 return -ENODEV; 56 } 57 58 i915_save_state(dev); 59 |
60 return (bus_generic_suspend(nbdev)); | 60 return (bus_generic_suspend(kdev)); |
61} 62 | 61} 62 |
63static int i915_resume(device_t nbdev) | 63static int i915_resume(device_t kdev) |
64{ | 64{ |
65 struct drm_device *dev = device_get_softc(nbdev); | 65 struct drm_device *dev = device_get_softc(kdev); |
66 67 i915_restore_state(dev); 68 | 66 67 i915_restore_state(dev); 68 |
69 return (bus_generic_resume(nbdev)); | 69 return (bus_generic_resume(kdev)); |
70} 71 72static void i915_configure(struct drm_device *dev) 73{ 74 dev->driver->driver_features = 75 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | 76 DRIVER_HAVE_IRQ; 77 --- 17 unchanged lines hidden (view full) --- 95 dev->driver->desc = DRIVER_DESC; 96 dev->driver->date = DRIVER_DATE; 97 dev->driver->major = DRIVER_MAJOR; 98 dev->driver->minor = DRIVER_MINOR; 99 dev->driver->patchlevel = DRIVER_PATCHLEVEL; 100} 101 102static int | 70} 71 72static void i915_configure(struct drm_device *dev) 73{ 74 dev->driver->driver_features = 75 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | 76 DRIVER_HAVE_IRQ; 77 --- 17 unchanged lines hidden (view full) --- 95 dev->driver->desc = DRIVER_DESC; 96 dev->driver->date = DRIVER_DATE; 97 dev->driver->major = DRIVER_MAJOR; 98 dev->driver->minor = DRIVER_MINOR; 99 dev->driver->patchlevel = DRIVER_PATCHLEVEL; 100} 101 102static int |
103i915_probe(device_t dev) | 103i915_probe(device_t kdev) |
104{ | 104{ |
105 return drm_probe(dev, i915_pciidlist); | 105 return drm_probe(kdev, i915_pciidlist); |
106} 107 108static int | 106} 107 108static int |
109i915_attach(device_t nbdev) | 109i915_attach(device_t kdev) |
110{ | 110{ |
111 struct drm_device *dev = device_get_softc(nbdev); | 111 struct drm_device *dev = device_get_softc(kdev); |
112 113 dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, 114 M_WAITOK | M_ZERO); 115 116 i915_configure(dev); 117 | 112 113 dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, 114 M_WAITOK | M_ZERO); 115 116 i915_configure(dev); 117 |
118 return drm_attach(nbdev, i915_pciidlist); | 118 return drm_attach(kdev, i915_pciidlist); |
119} 120 121static int | 119} 120 121static int |
122i915_detach(device_t nbdev) | 122i915_detach(device_t kdev) |
123{ | 123{ |
124 struct drm_device *dev = device_get_softc(nbdev); | 124 struct drm_device *dev = device_get_softc(kdev); |
125 int ret; 126 | 125 int ret; 126 |
127 ret = drm_detach(nbdev); | 127 ret = drm_detach(kdev); |
128 129 free(dev->driver, DRM_MEM_DRIVER); 130 131 return ret; 132} 133 134static device_method_t i915_methods[] = { 135 /* Device interface */ --- 26 unchanged lines hidden --- | 128 129 free(dev->driver, DRM_MEM_DRIVER); 130 131 return ret; 132} 133 134static device_method_t i915_methods[] = { 135 /* Device interface */ --- 26 unchanged lines hidden --- |