summaryrefslogtreecommitdiffstats
path: root/sys/i386/bios
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2009-08-02 14:28:40 +0000
committerattilio <attilio@FreeBSD.org>2009-08-02 14:28:40 +0000
commit7f42e47a67ad2835fbc404253f835223020256d4 (patch)
treec00d808d1df8000c2086c86613be9ec8536a5e28 /sys/i386/bios
parentea03af42ccd07d2533707afe4d1ba08f34bdb2e9 (diff)
downloadFreeBSD-src-7f42e47a67ad2835fbc404253f835223020256d4.zip
FreeBSD-src-7f42e47a67ad2835fbc404253f835223020256d4.tar.gz
Make the newbus subsystem Giant free by adding the new newbus sxlock.
The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races. Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped. For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens. Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing. Bump __FreeBSD_version in order to reflect the newbus lock introduction. Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith)
Diffstat (limited to 'sys/i386/bios')
-rw-r--r--sys/i386/bios/smapi.c2
-rw-r--r--sys/i386/bios/smbios.c2
-rw-r--r--sys/i386/bios/vpd.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c
index e572664..74cf612 100644
--- a/sys/i386/bios/smapi.c
+++ b/sys/i386/bios/smapi.c
@@ -288,10 +288,12 @@ smapi_modevent (module_t mod, int what, void *arg)
case MOD_LOAD:
break;
case MOD_UNLOAD:
+ newbus_xlock();
devclass_get_devices(smapi_devclass, &devs, &count);
for (i = 0; i < count; i++) {
device_delete_child(device_get_parent(devs[i]), devs[i]);
}
+ newbus_xunlock();
break;
default:
break;
diff --git a/sys/i386/bios/smbios.c b/sys/i386/bios/smbios.c
index f38d985..37a3b2c 100644
--- a/sys/i386/bios/smbios.c
+++ b/sys/i386/bios/smbios.c
@@ -230,10 +230,12 @@ smbios_modevent (mod, what, arg)
case MOD_LOAD:
break;
case MOD_UNLOAD:
+ newbus_xlock();
devclass_get_devices(smbios_devclass, &devs, &count);
for (i = 0; i < count; i++) {
device_delete_child(device_get_parent(devs[i]), devs[i]);
}
+ newbus_xunlock();
break;
default:
break;
diff --git a/sys/i386/bios/vpd.c b/sys/i386/bios/vpd.c
index 246b76d..f816121 100644
--- a/sys/i386/bios/vpd.c
+++ b/sys/i386/bios/vpd.c
@@ -248,10 +248,12 @@ vpd_modevent (mod, what, arg)
case MOD_LOAD:
break;
case MOD_UNLOAD:
+ newbus_xlock();
devclass_get_devices(vpd_devclass, &devs, &count);
for (i = 0; i < count; i++) {
device_delete_child(device_get_parent(devs[i]), devs[i]);
}
+ newbus_xunlock();
break;
default:
break;
OpenPOWER on IntegriCloud