--- src/sys/bus/cam/cam_xpt.c 2005/03/15 20:42:12 1.23 +++ src/sys/bus/cam/cam_xpt.c 2005/06/02 20:40:29 1.24 @@ -1126,7 +1126,7 @@ xptioctl(dev_t dev, u_long cmd, caddr_t * we never return a status of CAM_GDEVLIST_LIST_CHANGED. It is * (or rather should be) impossible for the device peripheral driver * list to change since we look at the whole thing in one pass, and - * we do it with splcam protection. + * we do it within a critical section. * */ case CAMGETPASSTHRU: { @@ -1138,14 +1138,14 @@ xptioctl(dev_t dev, u_long cmd, caddr_t int cur_generation; int base_periph_found; int splbreaknum; - int s; ccb = (union ccb *)addr; unit = ccb->cgdl.unit_number; name = ccb->cgdl.periph_name; /* - * Every 100 devices, we want to drop our spl protection to - * give the software interrupt handler a chance to run. + * Every 100 devices, we want to call splz() to check for + * and allow the software interrupt handler a chance to run. + * * Most systems won't run into this check, but this should * avoid starvation in the software interrupt handler in * large systems. @@ -1166,7 +1166,7 @@ xptioctl(dev_t dev, u_long cmd, caddr_t } /* Keep the list from changing while we traverse it */ - s = splcam(); + crit_enter(); ptstartover: cur_generation = xsoftc.generation; @@ -1177,7 +1177,7 @@ ptstartover: } if (*p_drv == NULL) { - splx(s); + crit_exit(); ccb->ccb_h.status = CAM_REQ_CMP_ERR; ccb->cgdl.status = CAM_GDEVLIST_ERROR; *ccb->cgdl.periph_name = '\0'; @@ -1199,8 +1199,7 @@ ptstartover: if (periph->unit_number == unit) { break; } else if (--splbreaknum == 0) { - splx(s); - s = splcam(); + splz(); splbreaknum = 100; if (cur_generation != xsoftc.generation) goto ptstartover; @@ -1289,7 +1288,7 @@ ptstartover: "your kernel config file\n"); } } - splx(s); + crit_exit(); break; } default: @@ -1402,22 +1401,19 @@ xpt_add_periph(struct cam_periph *periph status = CAM_REQ_CMP; if (device != NULL) { - int s; - /* * Make room for this peripheral * so it will fit in the queue * when it's scheduled to run */ - s = splsoftcam(); + crit_enter(); status = camq_resize(&device->drvq, device->drvq.array_size + 1); device->generation++; SLIST_INSERT_HEAD(periph_head, periph, periph_links); - - splx(s); + crit_exit(); } xsoftc.generation++; @@ -1433,20 +1429,18 @@ xpt_remove_periph(struct cam_periph *per device = periph->path->device; if (device != NULL) { - int s; struct periph_list *periph_head; periph_head = &device->periphs; /* Release the slot for this peripheral */ - s = splsoftcam(); + crit_enter(); camq_resize(&device->drvq, device->drvq.array_size - 1); device->generation++; SLIST_REMOVE(periph_head, periph, cam_periph, periph_links); - - splx(s); + crit_exit(); } xsoftc.generation++; @@ -1456,7 +1450,6 @@ xpt_remove_periph(struct cam_periph *per void xpt_announce_periph(struct cam_periph *periph, char *announce_string) { - int s; u_int mb; struct cam_path *path; struct ccb_trans_settings cts; @@ -1466,7 +1459,7 @@ xpt_announce_periph(struct cam_periph *p * To ensure that this is printed in one piece, * mask out CAM interrupts. */ - s = splsoftcam(); + crit_enter(); printf("%s%d at %s%d bus %d target %d lun %d\n", periph->periph_name, periph->unit_number, path->bus->sim->sim_name, @@ -1553,7 +1546,7 @@ xpt_announce_periph(struct cam_periph *p if (announce_string != NULL) printf("%s%d: %s\n", periph->periph_name, periph->unit_number, announce_string); - splx(s); + crit_exit(); } @@ -2757,13 +2750,12 @@ xptsetasyncbusfunc(struct cam_eb *bus, v void xpt_action(union ccb *start_ccb) { - int iopl; - CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action\n")); start_ccb->ccb_h.status = CAM_REQ_INPROG; - iopl = splsoftcam(); + crit_enter(); + switch (start_ccb->ccb_h.func_code) { case XPT_SCSI_IO: { @@ -2814,18 +2806,15 @@ xpt_action(union ccb *start_ccb) case XPT_ENG_EXEC: { struct cam_path *path; - int s; int runq; path = start_ccb->ccb_h.path; - s = splsoftcam(); cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); if (path->device->qfrozen_cnt == 0) runq = xpt_schedule_dev_sendq(path->bus, path->device); else runq = 0; - splx(s); if (runq != 0) xpt_run_dev_sendq(path->bus); break; @@ -2857,7 +2846,6 @@ xpt_action(union ccb *start_ccb) case XPT_ABORT: { union ccb* abort_ccb; - int s; abort_ccb = start_ccb->cab.abort_ccb; if (XPT_FC_IS_DEV_QUEUED(abort_ccb)) { @@ -2870,9 +2858,7 @@ xpt_action(union ccb *start_ccb) abort_ccb->ccb_h.status = CAM_REQ_ABORTED|CAM_DEV_QFRZN; xpt_freeze_devq(abort_ccb->ccb_h.path, 1); - s = splcam(); xpt_done(abort_ccb); - splx(s); start_ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -2935,10 +2921,8 @@ xpt_action(union ccb *start_ccb) case XPT_GDEV_TYPE: { struct cam_ed *dev; - int s; dev = start_ccb->ccb_h.path->device; - s = splcam(); if ((dev->flags & CAM_DEV_UNCONFIGURED) != 0) { start_ccb->ccb_h.status = CAM_DEV_NOT_THERE; } else { @@ -2957,16 +2941,13 @@ xpt_action(union ccb *start_ccb) bcopy(dev->serial_num, cgd->serial_num, dev->serial_num_len); } - splx(s); break; } case XPT_GDEV_STATS: { struct cam_ed *dev; - int s; dev = start_ccb->ccb_h.path->device; - s = splcam(); if ((dev->flags & CAM_DEV_UNCONFIGURED) != 0) { start_ccb->ccb_h.status = CAM_DEV_NOT_THERE; } else { @@ -2989,7 +2970,6 @@ xpt_action(union ccb *start_ccb) cgds->last_reset = bus->last_reset; cgds->ccb_h.status = CAM_REQ_CMP; } - splx(s); break; } case XPT_GDEVLIST: @@ -2998,7 +2978,6 @@ xpt_action(union ccb *start_ccb) struct periph_list *periph_head; struct ccb_getdevlist *cgdl; int i; - int s; struct cam_ed *device; int found; @@ -3008,7 +2987,6 @@ xpt_action(union ccb *start_ccb) /* * Don't want anyone mucking with our data. */ - s = splcam(); device = start_ccb->ccb_h.path->device; periph_head = &device->periphs; cgdl = &start_ccb->cgdl; @@ -3022,7 +3000,6 @@ xpt_action(union ccb *start_ccb) if ((cgdl->index != 0) && (cgdl->generation != device->generation)) { cgdl->status = CAM_GDEVLIST_LIST_CHANGED; - splx(s); break; } @@ -3043,7 +3020,6 @@ xpt_action(union ccb *start_ccb) } if (found == 0) { cgdl->status = CAM_GDEVLIST_ERROR; - splx(s); break; } @@ -3055,13 +3031,11 @@ xpt_action(union ccb *start_ccb) cgdl->index++; cgdl->generation = device->generation; - splx(s); cgdl->ccb_h.status = CAM_REQ_CMP; break; } case XPT_DEV_MATCH: { - int s; dev_pos_type position_type; struct ccb_dev_match *cdm; int ret; @@ -3071,7 +3045,6 @@ xpt_action(union ccb *start_ccb) /* * Prevent EDT changes while we traverse it. */ - s = splcam(); /* * There are two ways of getting at information in the EDT. * The first way is via the primary EDT tree. It starts @@ -3119,8 +3092,6 @@ xpt_action(union ccb *start_ccb) break; } - splx(s); - if (cdm->status == CAM_DEV_MATCH_ERROR) start_ccb->ccb_h.status = CAM_REQ_CMP_ERR; else @@ -3134,7 +3105,6 @@ xpt_action(union ccb *start_ccb) struct async_node *cur_entry; struct async_list *async_head; u_int32_t added; - int s; csa = &start_ccb->csa; added = csa->event_enable; @@ -3144,7 +3114,6 @@ xpt_action(union ccb *start_ccb) * If there is already an entry for us, simply * update it. */ - s = splcam(); cur_entry = SLIST_FIRST(async_head); while (cur_entry != NULL) { if ((cur_entry->callback_arg == csa->callback_arg) @@ -3191,7 +3160,6 @@ xpt_action(union ccb *start_ccb) */ xpt_for_all_busses(xptsetasyncbusfunc, cur_entry); } - splx(s); start_ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -3199,7 +3167,6 @@ xpt_action(union ccb *start_ccb) { struct ccb_relsim *crs; struct cam_ed *dev; - int s; crs = &start_ccb->crs; dev = crs->ccb_h.path->device; @@ -3209,8 +3176,6 @@ xpt_action(union ccb *start_ccb) break; } - s = splcam(); - if ((crs->release_flags & RELSIM_ADJUST_OPENINGS) != 0) { if ((dev->inq_data.flags & SID_CmdQue) != 0) { @@ -3282,7 +3247,6 @@ xpt_action(union ccb *start_ccb) start_ccb->ccb_h.flags |= CAM_DEV_QFREEZE; } } - splx(s); if ((start_ccb->ccb_h.flags & CAM_DEV_QFREEZE) == 0) { @@ -3303,9 +3267,6 @@ xpt_action(union ccb *start_ccb) break; case XPT_DEBUG: { #ifdef CAMDEBUG - int s; - - s = splcam(); #ifdef CAM_DEBUG_DELAY cam_debug_delay = CAM_DEBUG_DELAY; #endif @@ -3332,7 +3293,6 @@ xpt_action(union ccb *start_ccb) cam_dpath = NULL; start_ccb->ccb_h.status = CAM_REQ_CMP; } - splx(s); #else /* !CAMDEBUG */ start_ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; #endif /* CAMDEBUG */ @@ -3351,13 +3311,12 @@ xpt_action(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_PROVIDE_FAIL; break; } - splx(iopl); + crit_exit(); } void xpt_polled_action(union ccb *start_ccb) { - int s; u_int32_t timeout; struct cam_sim *sim; struct cam_devq *devq; @@ -3368,7 +3327,7 @@ xpt_polled_action(union ccb *start_ccb) devq = sim->devq; dev = start_ccb->ccb_h.path->device; - s = splcam(); + crit_enter(); /* * Steal an opening so that no other queued requests @@ -3411,7 +3370,7 @@ xpt_polled_action(union ccb *start_ccb) } else { start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; } - splx(s); + crit_exit(); } /* @@ -3422,12 +3381,11 @@ void xpt_schedule(struct cam_periph *perph, u_int32_t new_priority) { struct cam_ed *device; - int s; int runq; CAM_DEBUG(perph->path, CAM_DEBUG_TRACE, ("xpt_schedule\n")); device = perph->path->device; - s = splsoftcam(); + crit_enter(); if (periph_is_queued(perph)) { /* Simply reorder based on new priority */ CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE, @@ -3447,7 +3405,7 @@ xpt_schedule(struct cam_periph *perph, u camq_insert(&device->drvq, &perph->pinfo); runq = xpt_schedule_dev_allocq(perph->path->bus, device); } - splx(s); + crit_exit(); if (runq != 0) { CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE, (" calling xpt_run_devq\n")); @@ -3462,8 +3420,7 @@ xpt_schedule(struct cam_periph *perph, u * return 1 meaning the device queue should be run. If we * were already queued, implying someone else has already * started the queue, return 0 so the caller doesn't attempt - * to run the queue. Must be run at either splsoftcam - * (or splcam since that encompases splsoftcam). + * to run the queue. Must be run in a critical section. */ static int xpt_schedule_dev(struct camq *queue, cam_pinfo *pinfo, @@ -3507,7 +3464,6 @@ static void xpt_run_dev_allocq(struct cam_eb *bus) { struct cam_devq *devq; - int s; CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_allocq\n")); devq = bus->sim->devq; @@ -3520,7 +3476,7 @@ xpt_run_dev_allocq(struct cam_eb *bus) devq->alloc_openings, devq->alloc_active)); - s = splsoftcam(); + crit_enter(); devq->alloc_queue.qfrozen_cnt++; while ((devq->alloc_queue.entries > 0) && (devq->alloc_openings > 0) @@ -3550,7 +3506,7 @@ xpt_run_dev_allocq(struct cam_eb *bus) devq->alloc_openings--; devq->alloc_active++; drv = (struct cam_periph*)camq_remove(drvq, CAMQ_HEAD); - splx(s); + crit_exit(); xpt_setup_ccb(&work_ccb->ccb_h, drv->path, drv->pinfo.priority); CAM_DEBUG_PRINT(CAM_DEBUG_XPT, @@ -3570,7 +3526,7 @@ xpt_run_dev_allocq(struct cam_eb *bus) } /* Raise IPL for possible insertion and test at top of loop */ - s = splsoftcam(); + crit_enter(); if (drvq->entries > 0) { /* We have more work. Attempt to reschedule */ @@ -3578,34 +3534,28 @@ xpt_run_dev_allocq(struct cam_eb *bus) } } devq->alloc_queue.qfrozen_cnt--; - splx(s); + crit_exit(); } static void xpt_run_dev_sendq(struct cam_eb *bus) { struct cam_devq *devq; - int s; CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_dev_sendq\n")); devq = bus->sim->devq; - s = splcam(); + crit_enter(); devq->send_queue.qfrozen_cnt++; - splx(s); - s = splsoftcam(); while ((devq->send_queue.entries > 0) && (devq->send_openings > 0)) { struct cam_ed_qinfo *qinfo; struct cam_ed *device; union ccb *work_ccb; struct cam_sim *sim; - int ospl; - ospl = splcam(); if (devq->send_queue.qfrozen_cnt > 1) { - splx(ospl); break; } @@ -3618,7 +3568,6 @@ xpt_run_dev_sendq(struct cam_eb *bus) * to run it. */ if (device->qfrozen_cnt > 0) { - splx(ospl); continue; } @@ -3628,7 +3577,6 @@ xpt_run_dev_sendq(struct cam_eb *bus) work_ccb = cam_ccbq_peek_ccb(&device->ccbq, CAMQ_HEAD); if (work_ccb == NULL) { printf("device on run queue with no ccbs???\n"); - splx(ospl); continue; } @@ -3646,7 +3594,6 @@ xpt_run_dev_sendq(struct cam_eb *bus) &work_ccb->ccb_h, xpt_links.stqe); - splx(ospl); continue; } else { /* @@ -3660,7 +3607,6 @@ xpt_run_dev_sendq(struct cam_eb *bus) cam_ccbq_remove_ccb(&device->ccbq, work_ccb); cam_ccbq_send_ccb(&device->ccbq, work_ccb); - splx(ospl); devq->send_openings--; devq->send_active++; @@ -3673,12 +3619,8 @@ xpt_run_dev_sendq(struct cam_eb *bus) * The client wants to freeze the queue * after this CCB is sent. */ - ospl = splcam(); device->qfrozen_cnt++; - splx(ospl); } - - splx(s); /* In Target mode, the peripheral driver knows best... */ if (work_ccb->ccb_h.func_code == XPT_SCSI_IO) { @@ -3702,16 +3644,11 @@ xpt_run_dev_sendq(struct cam_eb *bus) sim = work_ccb->ccb_h.path->bus->sim; (*(sim->sim_action))(sim, work_ccb); - ospl = splcam(); devq->active_dev = NULL; - splx(ospl); /* Raise IPL for possible insertion and test at top of loop */ - s = splsoftcam(); } - splx(s); - s = splcam(); devq->send_queue.qfrozen_cnt--; - splx(s); + crit_exit(); } /* @@ -3781,7 +3718,6 @@ xpt_compile_path(struct cam_path *new_pa struct cam_et *target; struct cam_ed *device; cam_status status; - int s; status = CAM_REQ_CMP; /* Completed without error */ target = NULL; /* Wildcarded */ @@ -3791,7 +3727,7 @@ xpt_compile_path(struct cam_path *new_pa * We will potentially modify the EDT, so block interrupts * that may attempt to create cam paths. */ - s = splcam(); + crit_enter(); bus = xpt_find_bus(path_id); if (bus == NULL) { status = CAM_PATH_INVALID; @@ -3825,7 +3761,7 @@ xpt_compile_path(struct cam_path *new_pa } } } - splx(s); + crit_exit(); /* * Only touch the user's data if we are successful. @@ -3988,7 +3924,6 @@ xpt_path_periph(struct cam_path *path) void xpt_release_ccb(union ccb *free_ccb) { - int s; struct cam_path *path; struct cam_ed *device; struct cam_eb *bus; @@ -3997,7 +3932,7 @@ xpt_release_ccb(union ccb *free_ccb) path = free_ccb->ccb_h.path; device = path->device; bus = path->bus; - s = splsoftcam(); + crit_enter(); cam_ccbq_release_opening(&device->ccbq); if (xpt_ccb_count > xpt_max_ccbs) { xpt_free_ccb(free_ccb); @@ -4012,7 +3947,7 @@ xpt_release_ccb(union ccb *free_ccb) && (device->drvq.entries > 0)) { xpt_schedule_dev_allocq(bus, device); } - splx(s); + crit_exit(); if (dev_allocq_is_runnable(bus->sim->devq)) xpt_run_dev_allocq(bus); } @@ -4034,7 +3969,6 @@ xpt_bus_register(struct cam_sim *sim, u_ struct cam_eb *new_bus; struct cam_eb *old_bus; struct ccb_pathinq cpi; - int s; sim->bus_id = bus; new_bus = malloc(sizeof(*new_bus), M_DEVBUF, M_INTWAIT); @@ -4052,7 +3986,7 @@ xpt_bus_register(struct cam_sim *sim, u_ new_bus->flags = 0; new_bus->refcount = 1; /* Held until a bus_deregister event */ new_bus->generation = 0; - s = splcam(); + crit_enter(); old_bus = TAILQ_FIRST(&xpt_busses); while (old_bus != NULL && old_bus->path_id < new_bus->path_id) @@ -4062,7 +3996,7 @@ xpt_bus_register(struct cam_sim *sim, u_ else TAILQ_INSERT_TAIL(&xpt_busses, new_bus, links); bus_generation++; - splx(s); + crit_exit(); /* Notify interested parties */ if (sim->path_id != CAM_XPT_PATH_ID) { @@ -4195,7 +4129,6 @@ xpt_async(u_int32_t async_code, struct c struct cam_eb *bus; struct cam_et *target, *next_target; struct cam_ed *device, *next_device; - int s; CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_async\n")); @@ -4206,7 +4139,7 @@ xpt_async(u_int32_t async_code, struct c * deferred events with a call to xpt_async. Ensure async * notifications are serialized by blocking cam interrupts. */ - s = splcam(); + crit_enter(); bus = path->bus; @@ -4257,7 +4190,7 @@ xpt_async(u_int32_t async_code, struct c if (bus != xpt_periph->path->bus) xpt_async_bcast(&xpt_periph->path->device->asyncs, async_code, path, async_arg); - splx(s); + crit_exit(); } static void @@ -4361,10 +4294,9 @@ xpt_dev_async(u_int32_t async_code, stru u_int32_t xpt_freeze_devq(struct cam_path *path, u_int count) { - int s; struct ccb_hdr *ccbh; - s = splcam(); + crit_enter(); path->device->qfrozen_cnt += count; /* @@ -4376,14 +4308,14 @@ xpt_freeze_devq(struct cam_path *path, u * freezes the queue. To completly close the * hole, controller drives must check to see * if a ccb's status is still CAM_REQ_INPROG - * under spl protection just before they queue + * under critical section protection just before they queue * the CCB. See ahc_action/ahc_freeze_devq for * an example. */ ccbh = TAILQ_LAST(&path->device->ccbq.active_ccbs, ccb_hdr_tailq); if (ccbh && ccbh->status == CAM_REQ_INPROG) ccbh->status = CAM_REQUEUE_REQ; - splx(s); + crit_exit(); return (path->device->qfrozen_cnt); } @@ -4431,11 +4363,9 @@ static void xpt_release_devq_device(struct cam_ed *dev, u_int count, int run_queue) { int rundevq; - int s0, s1; rundevq = 0; - s0 = splsoftcam(); - s1 = splcam(); + crit_enter(); if (dev->qfrozen_cnt > 0) { @@ -4470,22 +4400,20 @@ xpt_release_devq_device(struct cam_ed *d } } } - splx(s1); if (rundevq != 0) xpt_run_dev_sendq(dev->target->bus); - splx(s0); + crit_exit(); } void xpt_release_simq(struct cam_sim *sim, int run_queue) { - int s; struct camq *sendq; sendq = &(sim->devq->send_queue); - s = splcam(); - if (sendq->qfrozen_cnt > 0) { + crit_enter(); + if (sendq->qfrozen_cnt > 0) { sendq->qfrozen_cnt--; if (sendq->qfrozen_cnt == 0) { struct cam_eb *bus; @@ -4500,7 +4428,7 @@ xpt_release_simq(struct cam_sim *sim, in sim->flags &= ~CAM_SIM_REL_TIMEOUT_PENDING; } bus = xpt_find_bus(sim->path_id); - splx(s); + crit_exit(); if (run_queue) { /* @@ -4509,18 +4437,18 @@ xpt_release_simq(struct cam_sim *sim, in xpt_run_dev_sendq(bus); } xpt_release_bus(bus); - } else - splx(s); - } else - splx(s); + } else { + crit_exit(); + } + } else { + crit_exit(); + } } void xpt_done(union ccb *done_ccb) { - int s; - - s = splcam(); + crit_enter(); CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_done\n")); if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) != 0) { @@ -4543,7 +4471,7 @@ xpt_done(union ccb *done_ccb) break; } } - splx(s); + crit_exit(); } union ccb * @@ -4576,9 +4504,8 @@ static union ccb * xpt_get_ccb(struct cam_ed *device) { union ccb *new_ccb; - int s; - s = splsoftcam(); + crit_enter(); if ((new_ccb = (union ccb *)ccb_freeq.slh_first) == NULL) { new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, M_INTWAIT); SLIST_INSERT_HEAD(&ccb_freeq, &new_ccb->ccb_h, @@ -4587,7 +4514,7 @@ xpt_get_ccb(struct cam_ed *device) } cam_ccbq_take_opening(&device->ccbq); SLIST_REMOVE_HEAD(&ccb_freeq, xpt_links.sle); - splx(s); + crit_exit(); return (new_ccb); } @@ -4788,13 +4715,13 @@ xpt_release_device(struct cam_eb *bus, s static u_int32_t xpt_dev_ccbq_resize(struct cam_path *path, int newopenings) { - int s; int diff; int result; struct cam_ed *dev; dev = path->device; - s = splsoftcam(); + + crit_enter(); diff = newopenings - (dev->ccbq.dev_active + dev->ccbq.dev_openings); result = cam_ccbq_resize(&dev->ccbq, newopenings); @@ -4803,7 +4730,7 @@ xpt_dev_ccbq_resize(struct cam_path *pat } /* Adjust the global limit */ xpt_max_ccbs += diff; - splx(s); + crit_exit(); return (result); } @@ -4978,7 +4905,7 @@ xpt_scan_bus(struct cam_periph *periph, if (request_ccb->ccb_h.status != CAM_REQ_CMP) { struct cam_ed *device; struct cam_et *target; - int s, phl; + int phl; /* * If we already probed lun 0 successfully, or @@ -4995,14 +4922,14 @@ xpt_scan_bus(struct cam_periph *periph, * path in the request ccb. */ phl = 0; - s = splcam(); + crit_enter(); device = TAILQ_FIRST(&target->ed_entries); if (device != NULL) { phl = device->quirk->quirks & CAM_QUIRK_HILUNS; if (device->lun_id == 0) device = TAILQ_NEXT(device, links); } - splx(s); + crit_exit(); if ((lun_id != 0) || (device != NULL)) { if (lun_id < (CAM_SCSI2_MAXLUN-1) || phl) lun_id++; @@ -5112,7 +5039,6 @@ xpt_scan_lun(struct cam_periph *periph, cam_status status; struct cam_path *new_path; struct cam_periph *old_periph; - int s; CAM_DEBUG(request_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_scan_lun\n")); @@ -5163,7 +5089,7 @@ xpt_scan_lun(struct cam_periph *periph, request_ccb->crcn.flags = flags; } - s = splsoftcam(); + crit_enter(); if ((old_periph = cam_periph_find(path, "probe")) != NULL) { probe_softc *softc; @@ -5185,7 +5111,7 @@ xpt_scan_lun(struct cam_periph *periph, xpt_done(request_ccb); } } - splx(s); + crit_exit(); } static void @@ -6244,16 +6170,15 @@ swi_cambio(void *arg) static void camisr(cam_isrq_t *queue) { - int s; struct ccb_hdr *ccb_h; - s = splcam(); + crit_enter(); while ((ccb_h = TAILQ_FIRST(queue)) != NULL) { int runq; TAILQ_REMOVE(queue, ccb_h, sim_links.tqe); ccb_h->pinfo.index = CAM_UNQUEUED_INDEX; - splx(s); + splz(); CAM_DEBUG(ccb_h->path, CAM_DEBUG_TRACE, ("camisr\n")); @@ -6291,12 +6216,10 @@ camisr(cam_isrq_t *queue) dev = ccb_h->path->device; - s = splcam(); cam_ccbq_ccb_done(&dev->ccbq, (union ccb *)ccb_h); ccb_h->path->bus->sim->devq->send_active--; ccb_h->path->bus->sim->devq->send_openings++; - splx(s); if ((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0 || ((dev->flags & CAM_DEV_REL_ON_QUEUE_EMPTY) != 0 @@ -6336,9 +6259,6 @@ camisr(cam_isrq_t *queue) /* Call the peripheral driver's callback */ (*ccb_h->cbfcnp)(ccb_h->path->periph, (union ccb *)ccb_h); - - /* Raise IPL for while test */ - s = splcam(); } - splx(s); + crit_exit(); }