Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/cam_xpt.c
Context not available. | |||||
uint32_t prio; | uint32_t prio; | ||||
cam_periph_assert(periph, MA_OWNED); | cam_periph_assert(periph, MA_OWNED); | ||||
/* | |||||
* If the peripheral has been invalidated, no need to continue, | |||||
* the device is gone. | |||||
*/ | |||||
if (periph->flags & CAM_PERIPH_INVALID) | |||||
return; | |||||
if (periph->periph_allocating) | if (periph->periph_allocating) | ||||
return; | return; | ||||
periph->periph_allocating = 1; | periph->periph_allocating = 1; | ||||
/* | |||||
* This flag is set by the peripheral on the initial probe, before | |||||
* any allocation happens. If it isn't set, that means that the | |||||
* peripheral doesn't acquire a reference for allocation, and we | |||||
* need to do it here. | |||||
*/ | |||||
if ((periph->flags & CAM_PERIPH_ALLOC_REF) == 0) | |||||
cam_periph_doacquire(periph); | |||||
CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_allocq(%p)\n", periph)); | CAM_DEBUG_PRINT(CAM_DEBUG_XPT, ("xpt_run_allocq(%p)\n", periph)); | ||||
device = periph->path->device; | device = periph->path->device; | ||||
ccb = NULL; | ccb = NULL; | ||||
Context not available. | |||||
if (ccb != NULL) | if (ccb != NULL) | ||||
xpt_release_ccb(ccb); | xpt_release_ccb(ccb); | ||||
periph->periph_allocating = 0; | periph->periph_allocating = 0; | ||||
/* | |||||
* If the peripheral doesn't have an allocation reference, we need | |||||
* to release here every time. If it does, and the peripheral was | |||||
* invalidated while we were allocating, we are responsible for | |||||
* releasing the allocation reference here. | |||||
*/ | |||||
if (((periph->flags & CAM_PERIPH_ALLOC_REF) == 0) | |||||
|| (periph->flags & CAM_PERIPH_INVALID)) { | |||||
/* | |||||
* If the peripheral has a routine for releasing its | |||||
* allocation reference, call it here. | |||||
*/ | |||||
if (periph->periph_alloc_rel != NULL) | |||||
periph->periph_alloc_rel(periph); | |||||
else | |||||
cam_periph_release_locked(periph); | |||||
} | |||||
} | } | ||||
static void | static void | ||||
Context not available. |