Skip to content

Commit 5437e31

Browse files
author
Matthew Macy
committed
assert that no locks are held when calling swfw_sync
1 parent 1603fa9 commit 5437e31

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

sys/dev/e1000/e1000_80003es2lan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
408408
s32 timeout = 50;
409409

410410
DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan");
411-
411+
ASSERT_NO_LOCKS();
412412
while (i < timeout) {
413413
if (e1000_get_hw_semaphore_generic(hw))
414414
return -E1000_ERR_SWFW_SYNC;

sys/dev/e1000/e1000_82575.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
10581058
s32 i = 0, timeout = 200;
10591059

10601060
DEBUGFUNC("e1000_acquire_swfw_sync_82575");
1061-
1061+
ASSERT_NO_LOCKS();
10621062
while (i < timeout) {
10631063
if (e1000_get_hw_semaphore_generic(hw)) {
10641064
ret_val = -E1000_ERR_SWFW_SYNC;

sys/dev/e1000/e1000_i210.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask)
9191
u32 swmask = mask;
9292
u32 fwmask = mask << 16;
9393
s32 ret_val = E1000_SUCCESS;
94+
/* Uhh the following line should read 'FIXME: this is a blazing tire fire' */
9495
s32 i = 0, timeout = 200; /* FIXME: find real value to use here */
9596

9697
DEBUGFUNC("e1000_acquire_swfw_sync_i210");
98+
ASSERT_NO_LOCKS();
9799

98100
while (i < timeout) {
99101
if (e1000_get_hw_semaphore_i210(hw)) {

sys/dev/e1000/e1000_osdep.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,13 @@ struct e1000_osdep
216216
bus_space_write_2(((struct e1000_osdep *)(hw)->back)->flash_bus_space_tag, \
217217
((struct e1000_osdep *)(hw)->back)->flash_bus_space_handle, reg, value)
218218

219+
#include <sys/proc.h>
220+
#define ASSERT_NO_LOCKS() \
221+
do { \
222+
MPASS(curthread->td_locks == 0); \
223+
MPASS(curthread->td_rw_rlocks == 0); \
224+
MPASS(curthread->td_lk_slocks == 0); \
225+
} while (0)
226+
219227
#endif /* _FREEBSD_OS_H_ */
220228

0 commit comments

Comments
 (0)