Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/scsi/scsi_xpt.c
Show First 20 Lines • Show All 1,030 Lines • ▼ Show 20 Lines | done: | ||||
xpt_action(start_ccb); | xpt_action(start_ccb); | ||||
} | } | ||||
static void | static void | ||||
proberequestdefaultnegotiation(struct cam_periph *periph) | proberequestdefaultnegotiation(struct cam_periph *periph) | ||||
{ | { | ||||
struct ccb_trans_settings cts; | struct ccb_trans_settings cts; | ||||
memset(&cts, 0, sizeof(cts)); | xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), periph->path, | ||||
xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); | CAM_PRIORITY_NONE); | ||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; | cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; | ||||
cts.type = CTS_TYPE_USER_SETTINGS; | cts.type = CTS_TYPE_USER_SETTINGS; | ||||
xpt_action((union ccb *)&cts); | xpt_action((union ccb *)&cts); | ||||
if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) { | if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) { | ||||
return; | return; | ||||
} | } | ||||
cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; | cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; | ||||
cts.type = CTS_TYPE_CURRENT_SETTINGS; | cts.type = CTS_TYPE_CURRENT_SETTINGS; | ||||
xpt_action((union ccb *)&cts); | xpt_action((union ccb *)&cts); | ||||
} | } | ||||
/* | /* | ||||
* Backoff Negotiation Code- only pertinent for SPI devices. | * Backoff Negotiation Code- only pertinent for SPI devices. | ||||
*/ | */ | ||||
static int | static int | ||||
proberequestbackoff(struct cam_periph *periph, struct cam_ed *device) | proberequestbackoff(struct cam_periph *periph, struct cam_ed *device) | ||||
{ | { | ||||
struct ccb_trans_settings cts; | struct ccb_trans_settings cts; | ||||
struct ccb_trans_settings_spi *spi; | struct ccb_trans_settings_spi *spi; | ||||
memset(&cts, 0, sizeof (cts)); | xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), periph->path, | ||||
xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); | CAM_PRIORITY_NONE); | ||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; | cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; | ||||
cts.type = CTS_TYPE_CURRENT_SETTINGS; | cts.type = CTS_TYPE_CURRENT_SETTINGS; | ||||
xpt_action((union ccb *)&cts); | xpt_action((union ccb *)&cts); | ||||
if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) { | if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) { | ||||
if (bootverbose) { | if (bootverbose) { | ||||
xpt_print(periph->path, | xpt_print(periph->path, | ||||
"failed to get current device settings\n"); | "failed to get current device settings\n"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,227 Lines • ▼ Show 20 Lines | scsi_scan_lun(struct cam_periph *periph, struct cam_path *path, | ||||
struct ccb_pathinq cpi; | struct ccb_pathinq cpi; | ||||
cam_status status; | cam_status status; | ||||
struct cam_path *new_path; | struct cam_path *new_path; | ||||
struct cam_periph *old_periph; | struct cam_periph *old_periph; | ||||
int lock; | int lock; | ||||
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("scsi_scan_lun\n")); | CAM_DEBUG(path, CAM_DEBUG_TRACE, ("scsi_scan_lun\n")); | ||||
memset(&cpi, 0, sizeof(cpi)); | xpt_setup_stack_ccb(&cpi.ccb_h, sizeof(cpi), path, CAM_PRIORITY_NONE); | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); | |||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | cpi.ccb_h.func_code = XPT_PATH_INQ; | ||||
xpt_action((union ccb *)&cpi); | xpt_action((union ccb *)&cpi); | ||||
if (cpi.ccb_h.status != CAM_REQ_CMP) { | if (cpi.ccb_h.status != CAM_REQ_CMP) { | ||||
if (request_ccb != NULL) { | if (request_ccb != NULL) { | ||||
request_ccb->ccb_h.status = cpi.ccb_h.status; | request_ccb->ccb_h.status = cpi.ccb_h.status; | ||||
xpt_done(request_ccb); | xpt_done(request_ccb); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
scsi_devise_transport(struct cam_path *path) | scsi_devise_transport(struct cam_path *path) | ||||
{ | { | ||||
struct ccb_pathinq cpi; | struct ccb_pathinq cpi; | ||||
struct ccb_trans_settings cts; | struct ccb_trans_settings cts; | ||||
struct scsi_inquiry_data *inq_buf; | struct scsi_inquiry_data *inq_buf; | ||||
/* Get transport information from the SIM */ | /* Get transport information from the SIM */ | ||||
memset(&cpi, 0, sizeof(cpi)); | xpt_setup_stack_ccb(&cpi.ccb_h, sizeof(cpi), path, CAM_PRIORITY_NONE); | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); | |||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | cpi.ccb_h.func_code = XPT_PATH_INQ; | ||||
xpt_action((union ccb *)&cpi); | xpt_action((union ccb *)&cpi); | ||||
inq_buf = NULL; | inq_buf = NULL; | ||||
if ((path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0) | if ((path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0) | ||||
inq_buf = &path->device->inq_data; | inq_buf = &path->device->inq_data; | ||||
path->device->protocol = PROTO_SCSI; | path->device->protocol = PROTO_SCSI; | ||||
path->device->protocol_version = | path->device->protocol_version = | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | scsi_devise_transport(struct cam_path *path) | ||||
* XXX | * XXX | ||||
* For a device compliant with SPC-2 we should be able | * For a device compliant with SPC-2 we should be able | ||||
* to determine the transport version supported by | * to determine the transport version supported by | ||||
* scrutinizing the version descriptors in the | * scrutinizing the version descriptors in the | ||||
* inquiry buffer. | * inquiry buffer. | ||||
*/ | */ | ||||
/* Tell the controller what we think */ | /* Tell the controller what we think */ | ||||
memset(&cts, 0, sizeof(cts)); | xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, CAM_PRIORITY_NONE); | ||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); | |||||
cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; | cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; | ||||
cts.type = CTS_TYPE_CURRENT_SETTINGS; | cts.type = CTS_TYPE_CURRENT_SETTINGS; | ||||
cts.transport = path->device->transport; | cts.transport = path->device->transport; | ||||
cts.transport_version = path->device->transport_version; | cts.transport_version = path->device->transport_version; | ||||
cts.protocol = path->device->protocol; | cts.protocol = path->device->protocol; | ||||
cts.protocol_version = path->device->protocol_version; | cts.protocol_version = path->device->protocol_version; | ||||
cts.proto_specific.valid = 0; | cts.proto_specific.valid = 0; | ||||
cts.xport_specific.valid = 0; | cts.xport_specific.valid = 0; | ||||
▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path, | ||||
if (cts->protocol != PROTO_SCSI) { | if (cts->protocol != PROTO_SCSI) { | ||||
if (async_update == FALSE) | if (async_update == FALSE) | ||||
xpt_action_default((union ccb *)cts); | xpt_action_default((union ccb *)cts); | ||||
return; | return; | ||||
} | } | ||||
inq_data = &device->inq_data; | inq_data = &device->inq_data; | ||||
scsi = &cts->proto_specific.scsi; | scsi = &cts->proto_specific.scsi; | ||||
memset(&cpi, 0, sizeof(cpi)); | xpt_setup_stack_ccb(&cpi.ccb_h, sizeof(cpi), path, CAM_PRIORITY_NONE); | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); | |||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | cpi.ccb_h.func_code = XPT_PATH_INQ; | ||||
xpt_action((union ccb *)&cpi); | xpt_action((union ccb *)&cpi); | ||||
/* SCSI specific sanity checking */ | /* SCSI specific sanity checking */ | ||||
if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 | if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 | ||||
|| (INQ_DATA_TQ_ENABLED(inq_data)) == 0 | || (INQ_DATA_TQ_ENABLED(inq_data)) == 0 | ||||
|| (device->queue_flags & SCP_QUEUE_DQUE) != 0 | || (device->queue_flags & SCP_QUEUE_DQUE) != 0 | ||||
|| (device->mintags == 0)) { | || (device->mintags == 0)) { | ||||
/* | /* | ||||
* Can't tag on hardware that doesn't support tags, | * Can't tag on hardware that doesn't support tags, | ||||
* doesn't have it enabled, or has broken tag support. | * doesn't have it enabled, or has broken tag support. | ||||
*/ | */ | ||||
scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; | scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; | ||||
} | } | ||||
if (async_update == FALSE) { | if (async_update == FALSE) { | ||||
/* | /* | ||||
* Perform sanity checking against what the | * Perform sanity checking against what the | ||||
* controller and device can do. | * controller and device can do. | ||||
*/ | */ | ||||
memset(&cur_cts, 0, sizeof(cur_cts)); | xpt_setup_stack_ccb(&cur_cts.ccb_h, sizeof(cur_cts), path, | ||||
xpt_setup_ccb(&cur_cts.ccb_h, path, CAM_PRIORITY_NONE); | CAM_PRIORITY_NONE); | ||||
cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; | cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; | ||||
cur_cts.type = cts->type; | cur_cts.type = cts->type; | ||||
xpt_action((union ccb *)&cur_cts); | xpt_action((union ccb *)&cur_cts); | ||||
if (cam_ccb_status((union ccb *)&cur_cts) != CAM_REQ_CMP) { | if (cam_ccb_status((union ccb *)&cur_cts) != CAM_REQ_CMP) { | ||||
return; | return; | ||||
} | } | ||||
cur_scsi = &cur_cts.proto_specific.scsi; | cur_scsi = &cur_cts.proto_specific.scsi; | ||||
if ((scsi->valid & CTS_SCSI_VALID_TQ) == 0) { | if ((scsi->valid & CTS_SCSI_VALID_TQ) == 0) { | ||||
▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | scsi_toggle_tags(struct cam_path *path) | ||||
* counter to come into effect. | * counter to come into effect. | ||||
*/ | */ | ||||
dev = path->device; | dev = path->device; | ||||
if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 | if ((dev->flags & CAM_DEV_TAG_AFTER_COUNT) != 0 | ||||
|| ((dev->inq_flags & SID_CmdQue) != 0 | || ((dev->inq_flags & SID_CmdQue) != 0 | ||||
&& (dev->inq_flags & (SID_Sync|SID_WBus16|SID_WBus32)) != 0)) { | && (dev->inq_flags & (SID_Sync|SID_WBus16|SID_WBus32)) != 0)) { | ||||
struct ccb_trans_settings cts; | struct ccb_trans_settings cts; | ||||
memset(&cts, 0, sizeof(cts)); | xpt_setup_stack_ccb(&cts.ccb_h, sizeof(cts), path, | ||||
xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); | CAM_PRIORITY_NONE); | ||||
cts.protocol = PROTO_SCSI; | cts.protocol = PROTO_SCSI; | ||||
cts.protocol_version = PROTO_VERSION_UNSPECIFIED; | cts.protocol_version = PROTO_VERSION_UNSPECIFIED; | ||||
cts.transport = XPORT_UNSPECIFIED; | cts.transport = XPORT_UNSPECIFIED; | ||||
cts.transport_version = XPORT_VERSION_UNSPECIFIED; | cts.transport_version = XPORT_VERSION_UNSPECIFIED; | ||||
cts.proto_specific.scsi.flags = 0; | cts.proto_specific.scsi.flags = 0; | ||||
cts.proto_specific.scsi.valid = CTS_SCSI_VALID_TQ; | cts.proto_specific.scsi.valid = CTS_SCSI_VALID_TQ; | ||||
scsi_set_transfer_settings(&cts, path, | scsi_set_transfer_settings(&cts, path, | ||||
/*async_update*/TRUE); | /*async_update*/TRUE); | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | _scsi_announce_periph(struct cam_periph *periph, u_int *speed, u_int *freq, struct ccb_trans_settings *cts) | ||||
xpt_setup_ccb(&cts->ccb_h, path, CAM_PRIORITY_NORMAL); | xpt_setup_ccb(&cts->ccb_h, path, CAM_PRIORITY_NORMAL); | ||||
cts->ccb_h.func_code = XPT_GET_TRAN_SETTINGS; | cts->ccb_h.func_code = XPT_GET_TRAN_SETTINGS; | ||||
cts->type = CTS_TYPE_CURRENT_SETTINGS; | cts->type = CTS_TYPE_CURRENT_SETTINGS; | ||||
xpt_action((union ccb*)cts); | xpt_action((union ccb*)cts); | ||||
if (cam_ccb_status((union ccb *)cts) != CAM_REQ_CMP) | if (cam_ccb_status((union ccb *)cts) != CAM_REQ_CMP) | ||||
return; | return; | ||||
/* Ask the SIM for its base transfer speed */ | /* Ask the SIM for its base transfer speed */ | ||||
memset(&cpi, 0, sizeof(cpi)); | xpt_setup_stack_ccb(&cpi.ccb_h, sizeof(cpi), path, | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); | CAM_PRIORITY_NORMAL); | ||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | cpi.ccb_h.func_code = XPT_PATH_INQ; | ||||
xpt_action((union ccb *)&cpi); | xpt_action((union ccb *)&cpi); | ||||
/* Report connection speed */ | /* Report connection speed */ | ||||
*speed = cpi.base_transfer_speed; | *speed = cpi.base_transfer_speed; | ||||
*freq = 0; | *freq = 0; | ||||
if (cts->ccb_h.status == CAM_REQ_CMP && cts->transport == XPORT_SPI) { | if (cts->ccb_h.status == CAM_REQ_CMP && cts->transport == XPORT_SPI) { | ||||
▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines |