summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-12-20 21:06:43 +0000
committerjhb <jhb@FreeBSD.org>2005-12-20 21:06:43 +0000
commit6e683e52b7ce974a4e839da2a42c3ce22eeba98b (patch)
tree0c41a839202b330b4b120a7b29390a8b8114d82b /sys/pci
parent97736242bbaefa0b0eddabeb62a1e157358e7bdd (diff)
downloadFreeBSD-src-6e683e52b7ce974a4e839da2a42c3ce22eeba98b.zip
FreeBSD-src-6e683e52b7ce974a4e839da2a42c3ce22eeba98b.tar.gz
Change the agp_find_device() to return the first agp device that has been
attached to a driver rather than always returning agp0.
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/agp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/pci/agp.c b/sys/pci/agp.c
index ac9014f..3986589 100644
--- a/sys/pci/agp.c
+++ b/sys/pci/agp.c
@@ -830,9 +830,18 @@ agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot)
device_t
agp_find_device()
{
+ device_t *children;
+ int i, count;
+
if (!agp_devclass)
- return 0;
- return devclass_get_device(agp_devclass, 0);
+ return NULL;
+ if (devclass_get_devices(agp_devclass, &children, &count) != 0)
+ return NULL;
+ for (i = 0; i < count; i++) {
+ if (device_is_attached(children[i]))
+ return (children[i]);
+ }
+ return NULL;
}
enum agp_acquire_state
OpenPOWER on IntegriCloud