summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2004-05-22 13:06:38 +0000
committermux <mux@FreeBSD.org>2004-05-22 13:06:38 +0000
commitfa099ba5b071e63bd2d1e78cd1427aa99c28c707 (patch)
tree9d08771c4158406ba8d37b340dcb684e716133a3 /sys/pci
parentce5e2c9dde72f7d687d6d56da86bbcdb5c202901 (diff)
downloadFreeBSD-src-fa099ba5b071e63bd2d1e78cd1427aa99c28c707.zip
FreeBSD-src-fa099ba5b071e63bd2d1e78cd1427aa99c28c707.tar.gz
Get rid of a lockmgr consumer by making agp(4) use a standard mutex,
since it's always acquiring the lock exclusively. This was tested with X on an SMP box, with and without WITNESS.
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/agp.c22
-rw-r--r--sys/pci/agp_ali.c1
-rw-r--r--sys/pci/agp_amd.c1
-rw-r--r--sys/pci/agp_i810.c1
-rw-r--r--sys/pci/agp_intel.c1
-rw-r--r--sys/pci/agp_nvidia.c1
-rw-r--r--sys/pci/agp_sis.c1
-rw-r--r--sys/pci/agp_via.c1
-rw-r--r--sys/pci/agppriv.h2
9 files changed, 11 insertions, 20 deletions
diff --git a/sys/pci/agp.c b/sys/pci/agp.c
index 03d5937..e638607 100644
--- a/sys/pci/agp.c
+++ b/sys/pci/agp.c
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
#include <sys/ioccom.h>
#include <sys/agpio.h>
#include <sys/lock.h>
-#include <sys/lockmgr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
@@ -251,7 +250,7 @@ agp_generic_attach(device_t dev)
* The lock is used to prevent re-entry to
* agp_generic_bind_memory() since that function can sleep.
*/
- lockinit(&sc->as_lock, PZERO|PCATCH, "agplk", 0, 0);
+ mtx_init(&sc->as_lock, "agp lock", NULL, MTX_DEF);
/*
* Initialise stuff for the userland device.
@@ -275,8 +274,7 @@ agp_generic_detach(device_t dev)
{
struct agp_softc *sc = device_get_softc(dev);
bus_release_resource(dev, SYS_RES_MEMORY, AGP_APBASE, sc->as_aperture);
- lockmgr(&sc->as_lock, LK_DRAIN, 0, curthread);
- lockdestroy(&sc->as_lock);
+ mtx_destroy(&sc->as_lock);
destroy_dev(sc->as_devnode);
agp_flush_cache();
return 0;
@@ -489,11 +487,11 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem,
vm_page_t m;
int error;
- lockmgr(&sc->as_lock, LK_EXCLUSIVE, 0, curthread);
+ mtx_lock(&sc->as_lock);
if (mem->am_is_bound) {
device_printf(dev, "memory already bound\n");
- lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread);
+ mtx_unlock(&sc->as_lock);
return EINVAL;
}
@@ -502,7 +500,7 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem,
|| offset + mem->am_size > AGP_GET_APERTURE(dev)) {
device_printf(dev, "binding memory at bad offset %#x\n",
(int) offset);
- lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread);
+ mtx_unlock(&sc->as_lock);
return EINVAL;
}
@@ -559,7 +557,7 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem,
vm_page_unlock_queues();
}
VM_OBJECT_UNLOCK(mem->am_obj);
- lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread);
+ mtx_unlock(&sc->as_lock);
return error;
}
}
@@ -582,7 +580,7 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem,
mem->am_offset = offset;
mem->am_is_bound = 1;
- lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread);
+ mtx_unlock(&sc->as_lock);
return 0;
}
@@ -594,11 +592,11 @@ agp_generic_unbind_memory(device_t dev, struct agp_memory *mem)
vm_page_t m;
int i;
- lockmgr(&sc->as_lock, LK_EXCLUSIVE, 0, curthread);
+ mtx_lock(&sc->as_lock);
if (!mem->am_is_bound) {
device_printf(dev, "memory is not bound\n");
- lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread);
+ mtx_unlock(&sc->as_lock);
return EINVAL;
}
@@ -624,7 +622,7 @@ agp_generic_unbind_memory(device_t dev, struct agp_memory *mem)
mem->am_offset = 0;
mem->am_is_bound = 0;
- lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread);
+ mtx_unlock(&sc->as_lock);
return 0;
}
diff --git a/sys/pci/agp_ali.c b/sys/pci/agp_ali.c
index c455ed3..81260dd 100644
--- a/sys/pci/agp_ali.c
+++ b/sys/pci/agp_ali.c
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/lock.h>
-#include <sys/lockmgr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
diff --git a/sys/pci/agp_amd.c b/sys/pci/agp_amd.c
index 2b6072a..a20b59b 100644
--- a/sys/pci/agp_amd.c
+++ b/sys/pci/agp_amd.c
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/lock.h>
-#include <sys/lockmgr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
diff --git a/sys/pci/agp_i810.c b/sys/pci/agp_i810.c
index 30aca50..faa0f48 100644
--- a/sys/pci/agp_i810.c
+++ b/sys/pci/agp_i810.c
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/lock.h>
-#include <sys/lockmgr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
diff --git a/sys/pci/agp_intel.c b/sys/pci/agp_intel.c
index 4c6f651..9258fdf 100644
--- a/sys/pci/agp_intel.c
+++ b/sys/pci/agp_intel.c
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/lock.h>
-#include <sys/lockmgr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
diff --git a/sys/pci/agp_nvidia.c b/sys/pci/agp_nvidia.c
index cc6ac2c..a2d1e95 100644
--- a/sys/pci/agp_nvidia.c
+++ b/sys/pci/agp_nvidia.c
@@ -45,7 +45,6 @@
#endif
#if __FreeBSD_version > 500000
-#include <sys/lockmgr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#endif
diff --git a/sys/pci/agp_sis.c b/sys/pci/agp_sis.c
index a959c3b..c32e722 100644
--- a/sys/pci/agp_sis.c
+++ b/sys/pci/agp_sis.c
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/lock.h>
-#include <sys/lockmgr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
diff --git a/sys/pci/agp_via.c b/sys/pci/agp_via.c
index 8d94200..1f4cd8c 100644
--- a/sys/pci/agp_via.c
+++ b/sys/pci/agp_via.c
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/lock.h>
-#include <sys/lockmgr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
diff --git a/sys/pci/agppriv.h b/sys/pci/agppriv.h
index 1c5f022..6ba4ed6 100644
--- a/sys/pci/agppriv.h
+++ b/sys/pci/agppriv.h
@@ -76,7 +76,7 @@ struct agp_softc {
int as_nextid; /* next memory block id */
int as_isopen; /* user device is open */
dev_t as_devnode; /* from make_dev */
- struct lock as_lock; /* lock for access to GATT */
+ struct mtx as_lock; /* lock for access to GATT */
};
struct agp_gatt {
OpenPOWER on IntegriCloud