diff options
| -rw-r--r-- | sys/dev/isp/isp_freebsd.h | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h index fb1f9d438f63..c8db280d45bd 100644 --- a/sys/dev/isp/isp_freebsd.h +++ b/sys/dev/isp/isp_freebsd.h @@ -28,7 +28,10 @@ #define _ISP_FREEBSD_H #define ISP_PLATFORM_VERSION_MAJOR 5 -#define ISP_PLATFORM_VERSION_MINOR 3 +#define ISP_PLATFORM_VERSION_MINOR 4 + +#define ISP_PVS \ + ((ISP_PLATFORM_VERSION_MAJOR * 10) + ISP_PLATFORM_VERSION_MINOR) #include <sys/param.h> @@ -44,6 +47,7 @@ #include <machine/bus.h> #include <machine/clock.h> #include <machine/cpu.h> +#include <machine/mutex.h> #include <cam/cam.h> #include <cam/cam_debug.h> @@ -95,13 +99,13 @@ struct isposinfo { u_int8_t mboxwaiting; u_int8_t simqfrozen; u_int8_t drain; -#ifdef SERVICING_INTERRUPT u_int8_t intsok; +#if ISP_PVS >= 54 + struct mtx lock; #else - u_int8_t padding; -#endif volatile u_int32_t islocked; int splsaved; +#endif #ifdef ISP_TARGET_MODE #define TM_WANTED 0x01 #define TM_BUSY 0x02 @@ -273,12 +277,12 @@ extern void isp_uninit(struct ispsoftc *); * Locking macros... */ +#if ISP_PVS >= 54 +#define ISP_LOCK(x) mtx_enter(&(x)->isp_osinfo.lock, MTX_DEF) +#define ISP_UNLOCK(x) mtx_exit(&(x)->isp_osinfo.lock, MTX_DEF) +#else #define ISP_LOCK isp_lock #define ISP_UNLOCK isp_unlock - -/* not safely working yet */ -#if 0 -#define SERVICING_INTERRUPT(isp) (intr_nesting_level != 0) #endif /* @@ -305,7 +309,7 @@ extern void isp_uninit(struct ispsoftc *); /* * Platform specific inline functions */ - +#if ISP_PVS < 54 static INLINE void isp_lock(struct ispsoftc *); static INLINE void isp_lock(struct ispsoftc *isp) @@ -326,13 +330,27 @@ isp_unlock(struct ispsoftc *isp) splx(isp->isp_osinfo.splsaved); } } +#endif static INLINE void isp_mbox_wait_complete(struct ispsoftc *); static INLINE void isp_mbox_wait_complete(struct ispsoftc *isp) { -#ifdef SERVICING_INTERRUPT - if (isp->isp_osinfo.intsok == 0 || SERVICING_INTERRUPT(isp)) { + if (isp->isp_osinfo.intsok) { + isp->isp_osinfo.mboxwaiting = 1; +#if ISP_PVS >= 54 + (void) msleep(&isp->isp_osinfo.mboxwaiting, + &isp->isp_osinfo.lock, PRIBIO, "isp_mboxwaiting", 5 * hz); +#else + (void) tsleep(&isp->isp_osinfo.mboxwaiting, PRIBIO, + "isp_mboxwaiting", 5 * hz); +#endif + if (isp->isp_mboxbsy != 0) { + isp_prt(isp, ISP_LOGWARN, "interrupting mbox timeout"); + isp->isp_mboxbsy = 0; + } + isp->isp_osinfo.mboxwaiting = 0; + } else { int j; for (j = 0; j < 60 * 2000; j++) { if (isp_intr(isp) == 0) { @@ -343,29 +361,9 @@ isp_mbox_wait_complete(struct ispsoftc *isp) } } if (isp->isp_mboxbsy != 0) { - isp_prt(isp, ISP_LOGWARN, "mailbox timeout"); - } - } else { - isp->isp_osinfo.mboxwaiting = 1; - while (isp->isp_mboxbsy != 0) { - (void) tsleep(&isp->isp_osinfo.mboxwaiting, PRIBIO, - "isp_mailbox", 0); + isp_prt(isp, ISP_LOGWARN, "polled mbox timeout"); } } -#else - int j; - for (j = 0; j < 60 * 2000; j++) { - if (isp_intr(isp) == 0) { - USEC_DELAY(500); - } - if (isp->isp_mboxbsy == 0) { - break; - } - } - if (isp->isp_mboxbsy != 0) { - isp_prt(isp, ISP_LOGWARN, "mailbox timeout"); - } -#endif } static INLINE u_int64_t nanotime_sub(struct timespec *, struct timespec *); |
