Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/ata/ata_xpt.c
Show First 20 Lines • Show All 1,000 Lines • ▼ Show 20 Lines | if (ident_buf->satacapabilities & ATA_SUPPORT_NCQ) { | ||||
path->device->mintags = 2; | path->device->mintags = 2; | ||||
path->device->maxtags = | path->device->maxtags = | ||||
ATA_QUEUE_LEN(ident_buf->queue) + 1; | ATA_QUEUE_LEN(ident_buf->queue) + 1; | ||||
} | } | ||||
ata_find_quirk(path->device); | ata_find_quirk(path->device); | ||||
if (path->device->mintags != 0 && | if (path->device->mintags != 0 && | ||||
path->bus->sim->max_tagged_dev_openings != 0) { | path->bus->sim->max_tagged_dev_openings != 0) { | ||||
/* Check if the SIM does not want queued commands. */ | /* Check if the SIM does not want queued commands. */ | ||||
bzero(&cpi, sizeof(cpi)); | xpt_path_inq(&cpi, path, CAM_PRIORITY_NONE); | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); | |||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | |||||
xpt_action((union ccb *)&cpi); | |||||
if (cpi.ccb_h.status == CAM_REQ_CMP && | if (cpi.ccb_h.status == CAM_REQ_CMP && | ||||
(cpi.hba_inquiry & PI_TAG_ABLE)) { | (cpi.hba_inquiry & PI_TAG_ABLE)) { | ||||
/* Report SIM which tags are allowed. */ | /* Report SIM which tags are allowed. */ | ||||
bzero(&cts, sizeof(cts)); | bzero(&cts, sizeof(cts)); | ||||
xpt_setup_ccb(&cts.ccb_h, 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.xport_specific.sata.tags = path->device->maxtags; | cts.xport_specific.sata.tags = path->device->maxtags; | ||||
▲ Show 20 Lines • Show All 386 Lines • ▼ Show 20 Lines | ata_scan_bus(struct cam_periph *periph, union ccb *request_ccb) | ||||
case XPT_SCAN_TGT: | case XPT_SCAN_TGT: | ||||
/* Find out the characteristics of the bus */ | /* Find out the characteristics of the bus */ | ||||
work_ccb = xpt_alloc_ccb_nowait(); | work_ccb = xpt_alloc_ccb_nowait(); | ||||
if (work_ccb == NULL) { | if (work_ccb == NULL) { | ||||
request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; | request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; | ||||
xpt_done(request_ccb); | xpt_done(request_ccb); | ||||
return; | return; | ||||
} | } | ||||
xpt_setup_ccb(&work_ccb->ccb_h, request_ccb->ccb_h.path, | xpt_path_inq(&work_ccb->cpi, request_ccb->ccb_h.path, | ||||
request_ccb->ccb_h.pinfo.priority); | request_ccb->ccb_h.pinfo.priority); | ||||
work_ccb->ccb_h.func_code = XPT_PATH_INQ; | |||||
xpt_action(work_ccb); | |||||
if (work_ccb->ccb_h.status != CAM_REQ_CMP) { | if (work_ccb->ccb_h.status != CAM_REQ_CMP) { | ||||
request_ccb->ccb_h.status = work_ccb->ccb_h.status; | request_ccb->ccb_h.status = work_ccb->ccb_h.status; | ||||
xpt_free_ccb(work_ccb); | xpt_free_ccb(work_ccb); | ||||
xpt_done(request_ccb); | xpt_done(request_ccb); | ||||
return; | return; | ||||
} | } | ||||
/* We may need to reset bus first, if we haven't done it yet. */ | /* We may need to reset bus first, if we haven't done it yet. */ | ||||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | ata_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, ("xpt_scan_lun\n")); | CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_scan_lun\n")); | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); | xpt_path_inq(&cpi, path, CAM_PRIORITY_NONE); | ||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | |||||
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); | ||||
} | } | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
ata_device_transport(struct cam_path *path) | ata_device_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 = NULL; | struct scsi_inquiry_data *inq_buf = NULL; | ||||
struct ata_params *ident_buf = NULL; | struct ata_params *ident_buf = NULL; | ||||
/* Get transport information from the SIM */ | /* Get transport information from the SIM */ | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); | xpt_path_inq(&cpi, path, CAM_PRIORITY_NONE); | ||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | |||||
xpt_action((union ccb *)&cpi); | |||||
path->device->transport = cpi.transport; | path->device->transport = cpi.transport; | ||||
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; | ||||
if ((path->device->flags & CAM_DEV_IDENTIFY_DATA_VALID) != 0) | if ((path->device->flags & CAM_DEV_IDENTIFY_DATA_VALID) != 0) | ||||
ident_buf = &path->device->ident_data; | ident_buf = &path->device->ident_data; | ||||
if (path->device->protocol == PROTO_ATA) { | if (path->device->protocol == PROTO_ATA) { | ||||
path->device->protocol_version = ident_buf ? | path->device->protocol_version = ident_buf ? | ||||
▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path, | ||||
if (cts->protocol == PROTO_ATA) | if (cts->protocol == PROTO_ATA) | ||||
ata = &cts->proto_specific.ata; | ata = &cts->proto_specific.ata; | ||||
else | else | ||||
ata = NULL; | ata = NULL; | ||||
if (cts->protocol == PROTO_SCSI) | if (cts->protocol == PROTO_SCSI) | ||||
scsi = &cts->proto_specific.scsi; | scsi = &cts->proto_specific.scsi; | ||||
else | else | ||||
scsi = NULL; | scsi = NULL; | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); | xpt_path_inq(&cpi, path, CAM_PRIORITY_NONE); | ||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | |||||
xpt_action((union ccb *)&cpi); | |||||
/* Sanity checking */ | /* Sanity checking */ | ||||
if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 | if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 | ||||
|| (ata && (ident_data->satacapabilities & ATA_SUPPORT_NCQ) == 0) | || (ata && (ident_data->satacapabilities & ATA_SUPPORT_NCQ) == 0) | ||||
|| (scsi && (INQ_DATA_TQ_ENABLED(inq_data)) == 0) | || (scsi && (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)) { | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | _ata_announce_periph(struct cam_periph *periph, struct ccb_trans_settings *cts, u_int *speed) | ||||
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 ((cts->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) | if ((cts->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) | ||||
return; | return; | ||||
/* Ask the SIM for its base transfer speed */ | /* Ask the SIM for its base transfer speed */ | ||||
xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); | xpt_path_inq(&cpi, path, CAM_PRIORITY_NORMAL); | ||||
cem: was NORMAL | |||||
Not Done Inline ActionsDoh! imp: Doh!
| |||||
cpi.ccb_h.func_code = XPT_PATH_INQ; | |||||
xpt_action((union ccb *)&cpi); | |||||
/* Report connection speed */ | /* Report connection speed */ | ||||
*speed = cpi.base_transfer_speed; | *speed = cpi.base_transfer_speed; | ||||
if (cts->transport == XPORT_ATA) { | if (cts->transport == XPORT_ATA) { | ||||
struct ccb_trans_settings_pata *pata = | struct ccb_trans_settings_pata *pata = | ||||
&cts->xport_specific.ata; | &cts->xport_specific.ata; | ||||
if (pata->valid & CTS_ATA_VALID_MODE) | if (pata->valid & CTS_ATA_VALID_MODE) | ||||
*speed = ata_mode2speed(pata->mode); | *speed = ata_mode2speed(pata->mode); | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |
was NORMAL