diff options
author | mjacob <mjacob@FreeBSD.org> | 2006-10-31 05:53:29 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2006-10-31 05:53:29 +0000 |
commit | 7e1db24f987a0a59d6a2ddc84ab0ef69d9d0370e (patch) | |
tree | 8b3b2da053646664eaa8096add01ca22cc513072 /sys/cam | |
parent | 21803ea6f1397d03bf63a4e7bf9f4aac1f9f505d (diff) | |
download | FreeBSD-src-7e1db24f987a0a59d6a2ddc84ab0ef69d9d0370e.zip FreeBSD-src-7e1db24f987a0a59d6a2ddc84ab0ef69d9d0370e.tar.gz |
The first of 3 major steps to move the CAM layer forward to using
the CAM_NEW_TRAN_CODE that has been in the tree for some years now.
This first step consists solely of adding to or correcting
CAM_NEW_TRAN_CODE pieces in the kernel source tree such
that a both a GENERIC (at least on i386) and a LINT build
with CAM_NEW_TRAN_CODE as an option will compile correctly
and run (at least with some the h/w I have).
After a short settle time, the other pieces (making
CAM_NEW_TRAN_CODE the default and updating libcam
and camcontrol) will be brought in.
This will be an incompatible change in that the size of structures
related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change
in both size and content. However, basic system operation and
basic system utilities work well enough with this change.
Reviewed by: freebsd-scsi and specific stakeholders
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/scsi/scsi_low.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sys/cam/scsi/scsi_low.c b/sys/cam/scsi/scsi_low.c index dc9a492..d767a1c 100644 --- a/sys/cam/scsi/scsi_low.c +++ b/sys/cam/scsi/scsi_low.c @@ -1084,6 +1084,10 @@ scsi_low_scsi_action_cam(sim, ccb) break; case XPT_SET_TRAN_SETTINGS: { +#ifdef CAM_NEW_TRAN_CODE + struct ccb_trans_settings_scsi *scsi; + struct ccb_trans_settings_spi *spi; +#endif struct ccb_trans_settings *cts; u_int val; @@ -1102,6 +1106,7 @@ scsi_low_scsi_action_cam(sim, ccb) lun = 0; s = SCSI_LOW_SPLSCSI(); +#ifndef CAM_NEW_TRAN_CODE if ((cts->valid & (CCB_TRANS_BUS_WIDTH_VALID | CCB_TRANS_SYNC_RATE_VALID | CCB_TRANS_SYNC_OFFSET_VALID)) != 0) @@ -1151,6 +1156,54 @@ scsi_low_scsi_action_cam(sim, ccb) if ((slp->sl_show_result & SHOW_CALCF_RES) != 0) scsi_low_calcf_show(li); } +#else + scsi = &cts->proto_specific.scsi; + spi = &cts->xport_specific.spi; + if ((spi->valid & (CTS_SPI_VALID_BUS_WIDTH | + CTS_SPI_VALID_SYNC_RATE | + CTS_SPI_VALID_SYNC_OFFSET)) != 0) + { + if (spi->valid & CTS_SPI_VALID_BUS_WIDTH) { + val = spi->bus_width; + if (val < ti->ti_width) + ti->ti_width = val; + } + if (spi->valid & CTS_SPI_VALID_SYNC_RATE) { + val = spi->sync_period; + if (val == 0 || val > ti->ti_maxsynch.period) + ti->ti_maxsynch.period = val; + } + if (spi->valid & CTS_SPI_VALID_SYNC_OFFSET) { + val = spi->sync_offset; + if (val < ti->ti_maxsynch.offset) + ti->ti_maxsynch.offset = val; + } + ti->ti_flags_valid |= SCSI_LOW_TARG_FLAGS_QUIRKS_VALID; + scsi_low_calcf_target(ti); + } + + if ((spi->valid & CTS_SPI_FLAGS_DISC_ENB) != 0 || + (scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) != 0) { + + li = scsi_low_alloc_li(ti, lun, 1); + if (spi->valid & CTS_SPI_FLAGS_DISC_ENB) { + li->li_quirks |= SCSI_LOW_DISK_DISC; + } else { + li->li_quirks &= ~SCSI_LOW_DISK_DISC; + } + + if (scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) { + li->li_quirks |= SCSI_LOW_DISK_QTAG; + } else { + li->li_quirks &= ~SCSI_LOW_DISK_QTAG; + } + li->li_flags_valid |= SCSI_LOW_LUN_FLAGS_QUIRKS_VALID; + scsi_low_calcf_target(ti); + scsi_low_calcf_lun(li); + if ((slp->sl_show_result & SHOW_CALCF_RES) != 0) + scsi_low_calcf_show(li); + } +#endif splx(s); ccb->ccb_h.status = CAM_REQ_CMP; |