diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -1247,7 +1248,10 @@ * in the do loop below. */ if (must_poll) { - timeout = xpt_poll_setup(ccb); + if (cam_sim_pollable(ccb->ccb_h.path->bus->sim)) + timeout = xpt_poll_setup(ccb); + else + timeout = 0; } if (timeout == 0) { diff --git a/sys/cam/cam_sim.h b/sys/cam/cam_sim.h --- a/sys/cam/cam_sim.h +++ b/sys/cam/cam_sim.h @@ -142,5 +142,11 @@ return (sim->bus_id); } +static __inline bool +cam_sim_pollable(const struct cam_sim *sim) +{ + return (sim->sim_poll != NULL); +} + #endif /* _KERNEL */ #endif /* _CAM_CAM_SIM_H */ diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -3181,6 +3181,7 @@ { struct mtx *mtx; + KASSERT(cam_sim_pollable(sim), ("%s: non-pollable sim", __func__)); mtx = sim->mtx; if (mtx) mtx_lock(mtx); @@ -3203,6 +3204,8 @@ devq = sim->devq; dev = start_ccb->ccb_h.path->device; + KASSERT(cam_sim_pollable(sim), ("%s: non-pollable sim", __func__)); + /* * Steal an opening so that no other queued requests * can get it before us while we simulate interrupts. @@ -3226,6 +3229,7 @@ xpt_pollwait(union ccb *start_ccb, uint32_t timeout) { + KASSERT(cam_sim_pollable(sim), ("%s: non-pollable sim", __func__)); while (--timeout > 0) { xpt_sim_poll(start_ccb->ccb_h.path->bus->sim); if ((start_ccb->ccb_h.status & CAM_STATUS_MASK)