Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146446801
D54634.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
995 B
Referenced Files
None
Subscribers
None
D54634.diff
View Options
diff --git a/sys/x86/isa/clock.c b/sys/x86/isa/clock.c
--- a/sys/x86/isa/clock.c
+++ b/sys/x86/isa/clock.c
@@ -163,8 +163,11 @@
mode = TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT;
- if (timer2_state != RELEASED)
+ mtx_lock_spin(&clock_lock);
+ if (timer2_state != RELEASED) {
+ mtx_unlock_spin(&clock_lock);
return (-1);
+ }
timer2_state = ACQUIRED;
/*
@@ -175,8 +178,9 @@
* careful with it as with timer0.
*/
outb(TIMER_MODE, TIMER_SEL2 | (mode & 0x3f));
-
ppi_spkr_on(); /* enable counter2 output to speaker */
+ mtx_unlock_spin(&clock_lock);
+
return (0);
}
@@ -184,12 +188,16 @@
timer_spkr_release(void)
{
- if (timer2_state != ACQUIRED)
+ mtx_lock_spin(&clock_lock);
+ if (timer2_state != ACQUIRED) {
+ mtx_unlock_spin(&clock_lock);
return (-1);
+ }
timer2_state = RELEASED;
outb(TIMER_MODE, TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT);
-
ppi_spkr_off(); /* disable counter2 output to speaker */
+ mtx_unlock_spin(&clock_lock);
+
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 3, 6:36 PM (9 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28999665
Default Alt Text
D54634.diff (995 B)
Attached To
Mode
D54634: clock: Replace Giant lock with fine-grained locking
Attached
Detach File
Event Timeline
Log In to Comment