svn commit: r312844 - in stable/11/sys/cam: . ctl scsi
Alexander Motin
mav at FreeBSD.org
Thu Jan 26 21:07:01 UTC 2017
Author: mav
Date: Thu Jan 26 21:06:59 2017
New Revision: 312844
URL: https://svnweb.freebsd.org/changeset/base/312844
Log:
MFC r312026: Improve CAM_CDB_POINTER support.
Modified:
stable/11/sys/cam/cam_ccb.h
stable/11/sys/cam/cam_periph.c
stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c
stable/11/sys/cam/ctl/scsi_ctl.c
stable/11/sys/cam/scsi/scsi_all.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/cam/cam_ccb.h
==============================================================================
--- stable/11/sys/cam/cam_ccb.h Thu Jan 26 21:02:06 2017 (r312843)
+++ stable/11/sys/cam/cam_ccb.h Thu Jan 26 21:06:59 2017 (r312844)
@@ -780,6 +780,13 @@ struct ccb_accept_tio {
struct scsi_sense_data sense_data;
};
+static __inline uint8_t *
+atio_cdb_ptr(struct ccb_accept_tio *ccb)
+{
+ return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
+ ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes);
+}
+
/* Release SIM Queue */
struct ccb_relsim {
struct ccb_hdr ccb_h;
Modified: stable/11/sys/cam/cam_periph.c
==============================================================================
--- stable/11/sys/cam/cam_periph.c Thu Jan 26 21:02:06 2017 (r312843)
+++ stable/11/sys/cam/cam_periph.c Thu Jan 26 21:06:59 2017 (r312844)
@@ -1925,10 +1925,7 @@ cam_periph_devctl_notify(union ccb *ccb)
if (ccb->ccb_h.func_code == XPT_SCSI_IO) {
sbuf_printf(&sb, "CDB=\"");
- if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0)
- scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb);
- else
- scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb);
+ scsi_cdb_sbuf(scsiio_cdb_ptr(&ccb->csio), &sb);
sbuf_printf(&sb, "\" ");
} else if (ccb->ccb_h.func_code == XPT_ATA_IO) {
sbuf_printf(&sb, "ACB=\"");
Modified: stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c
==============================================================================
--- stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:02:06 2017 (r312843)
+++ stable/11/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Jan 26 21:06:59 2017 (r312844)
@@ -587,8 +587,7 @@ cfcs_action(struct cam_sim *sim, union c
__func__, csio->cdb_len, sizeof(io->scsiio.cdb));
}
io->scsiio.cdb_len = min(csio->cdb_len, sizeof(io->scsiio.cdb));
- bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb,
- io->scsiio.cdb_len);
+ bcopy(scsiio_cdb_ptr(csio), io->scsiio.cdb, io->scsiio.cdb_len);
ccb->ccb_h.status |= CAM_SIM_QUEUED;
err = ctl_queue(io);
Modified: stable/11/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- stable/11/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:02:06 2017 (r312843)
+++ stable/11/sys/cam/ctl/scsi_ctl.c Thu Jan 26 21:06:59 2017 (r312844)
@@ -941,7 +941,7 @@ ctlfestart(struct cam_periph *periph, un
&& (csio->sglist_cnt != 0))) {
printf("%s: tag %04x cdb %02x flags %#x dxfer_len "
"%d sg %u\n", __func__, atio->tag_id,
- atio->cdb_io.cdb_bytes[0], flags, dxfer_len,
+ atio_cdb_ptr(atio)[0], flags, dxfer_len,
csio->sglist_cnt);
printf("%s: tag %04x io status %#x\n", __func__,
atio->tag_id, io->io_hdr.status);
@@ -1027,8 +1027,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio *
{
uint64_t lba;
uint32_t num_blocks, nbc;
- uint8_t *cmdbyt = (atio->ccb_h.flags & CAM_CDB_POINTER)?
- atio->cdb_io.cdb_ptr : atio->cdb_io.cdb_bytes;
+ uint8_t *cmdbyt = atio_cdb_ptr(atio);
nbc = offset >> 9; /* ASSUMING 512 BYTE BLOCKS */
@@ -1206,8 +1205,7 @@ ctlfedone(struct cam_periph *periph, uni
__func__, atio->cdb_len, sizeof(io->scsiio.cdb));
}
io->scsiio.cdb_len = min(atio->cdb_len, sizeof(io->scsiio.cdb));
- bcopy(atio->cdb_io.cdb_bytes, io->scsiio.cdb,
- io->scsiio.cdb_len);
+ bcopy(atio_cdb_ptr(atio), io->scsiio.cdb, io->scsiio.cdb_len);
#ifdef CTLFEDEBUG
printf("%s: %u:%u:%u: tag %04x CDB %02x\n", __func__,
@@ -1388,7 +1386,7 @@ ctlfedone(struct cam_periph *periph, uni
printf("%s: tag %04x no status or "
"len cdb = %02x\n", __func__,
atio->tag_id,
- atio->cdb_io.cdb_bytes[0]);
+ atio_cdb_ptr(atio)[0]);
printf("%s: tag %04x io status %#x\n",
__func__, atio->tag_id,
io->io_hdr.status);
Modified: stable/11/sys/cam/scsi/scsi_all.c
==============================================================================
--- stable/11/sys/cam/scsi/scsi_all.c Thu Jan 26 21:02:06 2017 (r312843)
+++ stable/11/sys/cam/scsi/scsi_all.c Thu Jan 26 21:06:59 2017 (r312844)
@@ -3617,15 +3617,9 @@ scsi_command_string(struct cam_device *d
#endif /* _KERNEL/!_KERNEL */
- if ((csio->ccb_h.flags & CAM_CDB_POINTER) != 0) {
- sbuf_printf(sb, "%s. CDB: ",
- scsi_op_desc(csio->cdb_io.cdb_ptr[0], inq_data));
- scsi_cdb_sbuf(csio->cdb_io.cdb_ptr, sb);
- } else {
- sbuf_printf(sb, "%s. CDB: ",
- scsi_op_desc(csio->cdb_io.cdb_bytes[0], inq_data));
- scsi_cdb_sbuf(csio->cdb_io.cdb_bytes, sb);
- }
+ sbuf_printf(sb, "%s. CDB: ",
+ scsi_op_desc(scsiio_cdb_ptr(csio)[0], inq_data));
+ scsi_cdb_sbuf(scsiio_cdb_ptr(csio), sb);
#ifdef _KERNEL
xpt_free_ccb((union ccb *)cgd);
@@ -5030,7 +5024,6 @@ scsi_sense_sbuf(struct cam_device *devic
struct ccb_getdev *cgd;
#endif /* _KERNEL */
char path_str[64];
- uint8_t *cdb;
#ifndef _KERNEL
if (device == NULL)
@@ -5128,14 +5121,9 @@ scsi_sense_sbuf(struct cam_device *devic
sense = &csio->sense_data;
}
- if (csio->ccb_h.flags & CAM_CDB_POINTER)
- cdb = csio->cdb_io.cdb_ptr;
- else
- cdb = csio->cdb_io.cdb_bytes;
-
scsi_sense_only_sbuf(sense, csio->sense_len - csio->sense_resid, sb,
- path_str, inq_data, cdb, csio->cdb_len);
-
+ path_str, inq_data, scsiio_cdb_ptr(csio), csio->cdb_len);
+
#ifdef _KERNEL
xpt_free_ccb((union ccb*)cgd);
#endif /* _KERNEL/!_KERNEL */
More information about the svn-src-stable
mailing list