From: Peter Avalos Date: Sun, 2 Dec 2007 03:41:58 +0000 (+0000) Subject: Handle some of the inquiry flags that have come into X-Git-Tag: v2.0.1~1683 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/9d4fe89a672f69f1dc216f97b49473b0a1e77df4 Handle some of the inquiry flags that have come into usage as of SPC2r20. Specifically, handle the BQueue flag which will indicate that a device supports the Basic Queueing model (no Head of Queue or Ordered tags). When this flag is set, SID_CmdQueue is clear. Obtained-from: FreeBSD --- diff --git a/sys/bus/cam/cam_xpt.c b/sys/bus/cam/cam_xpt.c index 4c4af6c089..74f0813232 100644 --- a/sys/bus/cam/cam_xpt.c +++ b/sys/bus/cam/cam_xpt.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_xpt.c,v 1.80.2.18 2002/12/09 17:31:55 gibbs Exp $ - * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.57 2007/12/02 03:01:55 pavalos Exp $ + * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.58 2007/12/02 03:41:58 pavalos Exp $ */ #include #include @@ -3389,8 +3389,7 @@ xpt_action(union ccb *start_ccb) if ((crs->release_flags & RELSIM_ADJUST_OPENINGS) != 0) { - if ((dev->inq_data.flags & SID_CmdQue) != 0) { - + if (INQ_DATA_TQ_ENABLED(&dev->inq_data)) { /* Don't ever go below one opening */ if (crs->openings > 0) { xpt_dev_ccbq_resize(crs->ccb_h.path, @@ -5765,7 +5764,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb) #ifdef CAM_NEW_TRAN_CODE xpt_devise_transport(path); #endif /* CAM_NEW_TRAN_CODE */ - if ((inq_buf->flags & SID_CmdQue) != 0) + if (INQ_DATA_TQ_ENABLED(inq_buf)) softc->action = PROBE_MODE_SENSE; else softc->action = PROBE_SERIAL_NUM; @@ -6189,7 +6188,7 @@ xpt_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, /* SCSI specific sanity checking */ if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 - || (inq_data->flags & SID_CmdQue) == 0 + || (INQ_DATA_TQ_ENABLED(inq_data)) == 0 || (device->queue_flags & SCP_QUEUE_DQUE) != 0 || (device->quirk->mintags == 0)) { /* @@ -6496,7 +6495,7 @@ xpt_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device, } if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0 - || (inq_data->flags & SID_CmdQue) == 0 + || (INQ_DATA_TQ_ENABLED(inq_data)) == 0 || (device->queue_flags & SCP_QUEUE_DQUE) != 0 || (device->quirk->mintags == 0)) { /* diff --git a/sys/bus/cam/scsi/scsi_all.h b/sys/bus/cam/scsi/scsi_all.h index 1759afaffe..e42a870af6 100644 --- a/sys/bus/cam/scsi/scsi_all.h +++ b/sys/bus/cam/scsi/scsi_all.h @@ -15,7 +15,7 @@ * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * * $FreeBSD: src/sys/cam/scsi/scsi_all.h,v 1.14.2.5 2003/08/24 03:26:37 ken Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_all.h,v 1.11 2007/11/24 19:19:43 pavalos Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_all.h,v 1.12 2007/12/02 03:41:58 pavalos Exp $ */ /* @@ -605,7 +605,19 @@ struct scsi_inquiry_data #define SID_AENC 0x80 #define SID_TrmIOP 0x40 u_int8_t additional_length; - u_int8_t reserved[2]; + u_int8_t reserved; + u_int8_t spc2_flags; +#define SPC2_SID_MChngr 0x08 +#define SPC2_SID_MultiP 0x10 +#define SPC2_SID_EncServ 0x40 +#define SPC2_SID_BQueue 0x80 + +#define INQ_DATA_TQ_ENABLED(iqd) \ + ((SID_ANSI_REV(iqd) < SCSI_REV_SPC2)? ((iqd)->flags & SID_CmdQue) : \ + (((iqd)->flags & SID_CmdQue) && !((iqd)->spc2_flags & SPC2_SID_BQueue)) || \ + (!((iqd)->flags & SID_CmdQue) && ((iqd)->spc2_flags & SPC2_SID_BQueue))) + + u_int8_t flags; #define SID_SftRe 0x01 #define SID_CmdQue 0x02