cam_sim.c (d9345d3a) cam_sim.c (ae8e83e6)
1/*
2 * Common functions for SCSI Interface Modules (SIMs).
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 87 unchanged lines hidden (view full) ---

96sim_lock_sleep(void *ident, int flags, const char *wmesg, int timo,
97 sim_lock *lock)
98{
99 int retval;
100
101 if (lock != &sim_mplock) {
102 /* lock should be held already */
103 KKASSERT(lockstatus(lock, curthread) != 0);
1/*
2 * Common functions for SCSI Interface Modules (SIMs).
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 87 unchanged lines hidden (view full) ---

96sim_lock_sleep(void *ident, int flags, const char *wmesg, int timo,
97 sim_lock *lock)
98{
99 int retval;
100
101 if (lock != &sim_mplock) {
102 /* lock should be held already */
103 KKASSERT(lockstatus(lock, curthread) != 0);
104 crit_enter();
105 tsleep_interlock(ident);
104 tsleep_interlock(ident, flags);
106 lockmgr(lock, LK_RELEASE);
107 retval = tsleep(ident, flags | PINTERLOCKED, wmesg, timo);
108 } else {
109 retval = tsleep(ident, flags, wmesg, timo);
110 }
111
112 if (lock != &sim_mplock) {
113 lockmgr(lock, LK_EXCLUSIVE);
105 lockmgr(lock, LK_RELEASE);
106 retval = tsleep(ident, flags | PINTERLOCKED, wmesg, timo);
107 } else {
108 retval = tsleep(ident, flags, wmesg, timo);
109 }
110
111 if (lock != &sim_mplock) {
112 lockmgr(lock, LK_EXCLUSIVE);
114 crit_exit();
115 }
116
117 return (retval);
118}
119
120struct cam_devq *
121cam_simq_alloc(u_int32_t max_sim_transactions)
122{

--- 128 unchanged lines hidden ---
113 }
114
115 return (retval);
116}
117
118struct cam_devq *
119cam_simq_alloc(u_int32_t max_sim_transactions)
120{

--- 128 unchanged lines hidden ---