drm_drv.c (189130) | drm_drv.c (189563) |
---|---|
1/*- 2 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. 3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation --- 15 unchanged lines hidden (view full) --- 24 * 25 * Authors: 26 * Rickard E. (Rik) Faith <faith@valinux.com> 27 * Gareth Hughes <gareth@valinux.com> 28 * 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. 3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation --- 15 unchanged lines hidden (view full) --- 24 * 25 * Authors: 26 * Rickard E. (Rik) Faith <faith@valinux.com> 27 * Gareth Hughes <gareth@valinux.com> 28 * 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/drm/drm_drv.c 189130 2009-02-28 02:37:55Z rnoland $"); | 32__FBSDID("$FreeBSD: head/sys/dev/drm/drm_drv.c 189563 2009-03-09 07:55:18Z rnoland $"); |
33 34/** @file drm_drv.c 35 * The catch-all file for DRM device support, including module setup/teardown, 36 * open/close, and ioctl dispatch. 37 */ 38 39 40#include <sys/limits.h> --- 112 unchanged lines hidden (view full) --- 153 (drm_msi_blacklist[i].device == device)) { 154 return 1; 155 } 156 } 157 158 return 0; 159} 160 | 33 34/** @file drm_drv.c 35 * The catch-all file for DRM device support, including module setup/teardown, 36 * open/close, and ioctl dispatch. 37 */ 38 39 40#include <sys/limits.h> --- 112 unchanged lines hidden (view full) --- 153 (drm_msi_blacklist[i].device == device)) { 154 return 1; 155 } 156 } 157 158 return 0; 159} 160 |
161int drm_probe(device_t dev, drm_pci_id_list_t *idlist) | 161int drm_probe(device_t kdev, drm_pci_id_list_t *idlist) |
162{ 163 drm_pci_id_list_t *id_entry; 164 int vendor, device; 165#if __FreeBSD_version < 700010 166 device_t realdev; 167 | 162{ 163 drm_pci_id_list_t *id_entry; 164 int vendor, device; 165#if __FreeBSD_version < 700010 166 device_t realdev; 167 |
168 if (!strcmp(device_get_name(dev), "drmsub")) 169 realdev = device_get_parent(dev); | 168 if (!strcmp(device_get_name(kdev), "drmsub")) 169 realdev = device_get_parent(kdev); |
170 else | 170 else |
171 realdev = dev; | 171 realdev = kdev; |
172 vendor = pci_get_vendor(realdev); 173 device = pci_get_device(realdev); 174#else | 172 vendor = pci_get_vendor(realdev); 173 device = pci_get_device(realdev); 174#else |
175 vendor = pci_get_vendor(dev); 176 device = pci_get_device(dev); | 175 vendor = pci_get_vendor(kdev); 176 device = pci_get_device(kdev); |
177#endif 178 | 177#endif 178 |
179 if (pci_get_class(dev) != PCIC_DISPLAY 180 || pci_get_subclass(dev) != PCIS_DISPLAY_VGA) | 179 if (pci_get_class(kdev) != PCIC_DISPLAY 180 || pci_get_subclass(kdev) != PCIS_DISPLAY_VGA) |
181 return ENXIO; 182 183 id_entry = drm_find_description(vendor, device, idlist); 184 if (id_entry != NULL) { | 181 return ENXIO; 182 183 id_entry = drm_find_description(vendor, device, idlist); 184 if (id_entry != NULL) { |
185 device_set_desc(dev, id_entry->name); | 185 device_set_desc(kdev, id_entry->name); |
186 return 0; 187 } 188 189 return ENXIO; 190} 191 | 186 return 0; 187 } 188 189 return ENXIO; 190} 191 |
192int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist) | 192int drm_attach(device_t kdev, drm_pci_id_list_t *idlist) |
193{ 194 struct drm_device *dev; 195 drm_pci_id_list_t *id_entry; 196 int unit, msicount; 197 | 193{ 194 struct drm_device *dev; 195 drm_pci_id_list_t *id_entry; 196 int unit, msicount; 197 |
198 unit = device_get_unit(nbdev); 199 dev = device_get_softc(nbdev); | 198 unit = device_get_unit(kdev); 199 dev = device_get_softc(kdev); |
200 201#if __FreeBSD_version < 700010 | 200 201#if __FreeBSD_version < 700010 |
202 if (!strcmp(device_get_name(nbdev), "drmsub")) 203 dev->device = device_get_parent(nbdev); | 202 if (!strcmp(device_get_name(kdev), "drmsub")) 203 dev->device = device_get_parent(kdev); |
204 else | 204 else |
205 dev->device = nbdev; | 205 dev->device = kdev; |
206#else | 206#else |
207 dev->device = nbdev; | 207 dev->device = kdev; |
208#endif 209 dev->devnode = make_dev(&drm_cdevsw, 210 unit, 211 DRM_DEV_UID, 212 DRM_DEV_GID, 213 DRM_DEV_MODE, 214 "dri/card%d", unit); 215 --- 38 unchanged lines hidden (view full) --- 254 255 id_entry = drm_find_description(dev->pci_vendor, 256 dev->pci_device, idlist); 257 dev->id_entry = id_entry; 258 259 return drm_load(dev); 260} 261 | 208#endif 209 dev->devnode = make_dev(&drm_cdevsw, 210 unit, 211 DRM_DEV_UID, 212 DRM_DEV_GID, 213 DRM_DEV_MODE, 214 "dri/card%d", unit); 215 --- 38 unchanged lines hidden (view full) --- 254 255 id_entry = drm_find_description(dev->pci_vendor, 256 dev->pci_device, idlist); 257 dev->id_entry = id_entry; 258 259 return drm_load(dev); 260} 261 |
262int drm_detach(device_t nbdev) | 262int drm_detach(device_t kdev) |
263{ 264 struct drm_device *dev; 265 | 263{ 264 struct drm_device *dev; 265 |
266 dev = device_get_softc(nbdev); | 266 dev = device_get_softc(kdev); |
267 268 drm_unload(dev); 269 270 bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr); 271 272 if (dev->msi_enabled) { 273 pci_release_msi(dev->device); 274 DRM_INFO("MSI released\n"); --- 564 unchanged lines hidden --- | 267 268 drm_unload(dev); 269 270 bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr); 271 272 if (dev->msi_enabled) { 273 pci_release_msi(dev->device); 274 DRM_INFO("MSI released\n"); --- 564 unchanged lines hidden --- |