diff options
author | Matt Jacob <mjacob@FreeBSD.org> | 2006-10-31 05:53:29 +0000 |
---|---|---|
committer | Matt Jacob <mjacob@FreeBSD.org> | 2006-10-31 05:53:29 +0000 |
commit | fa9ed865067ef325f013a8174c94eff345a4f4ed (patch) | |
tree | 8b3b2da053646664eaa8096add01ca22cc513072 /sys/dev/ahb/ahb.c | |
parent | 9df92bda761535b468b198dc0bc23dc059051e8a (diff) | |
download | src-fa9ed865067ef325f013a8174c94eff345a4f4ed.tar.gz src-fa9ed865067ef325f013a8174c94eff345a4f4ed.zip |
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
Notes
Notes:
svn path=/head/; revision=163816
Diffstat (limited to 'sys/dev/ahb/ahb.c')
-rw-r--r-- | sys/dev/ahb/ahb.c | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/sys/dev/ahb/ahb.c b/sys/dev/ahb/ahb.c index f056f08189e6..213fa1155eb2 100644 --- a/sys/dev/ahb/ahb.c +++ b/sys/dev/ahb/ahb.c @@ -728,12 +728,24 @@ ahbprocesserror(struct ahb_softc *ahb, struct ecb *ecb, union ccb *ccb) case HS_TAG_MSG_REJECTED: { struct ccb_trans_settings neg; +#ifdef CAM_NEW_TRAN_CODE + struct ccb_trans_settings_scsi *scsi = &neg.proto_specific.scsi; +#endif xpt_print_path(ccb->ccb_h.path); printf("refuses tagged commands. Performing " "non-tagged I/O\n"); + memset(&neg, 0, sizeof (neg)); +#ifdef CAM_NEW_TRAN_CODE + neg.protocol = PROTO_SCSI; + neg.protocol_version = SCSI_REV_2; + neg.transport = XPORT_SPI; + neg.transport_version = 2; + scsi->flags = CTS_SCSI_VALID_TQ; +#else neg.flags = 0; neg.valid = CCB_TRANS_TQ_VALID; +#endif xpt_setup_ccb(&neg.ccb_h, ccb->ccb_h.path, /*priority*/1); xpt_async(AC_TRANSFER_NEG, ccb->ccb_h.path, &neg); ahb->tags_permitted &= ~(0x01 << ccb->ccb_h.target_id); @@ -1128,11 +1140,42 @@ ahbaction(struct cam_sim *sim, union ccb *ccb) case XPT_GET_TRAN_SETTINGS: /* Get default/user set transfer settings for the target */ { - struct ccb_trans_settings *cts; - u_int target_mask; - - cts = &ccb->cts; - target_mask = 0x01 << ccb->ccb_h.target_id; + struct ccb_trans_settings *cts = &ccb->cts; + u_int target_mask = 0x01 << ccb->ccb_h.target_id; +#ifdef CAM_NEW_TRAN_CODE + struct ccb_trans_settings_scsi *scsi = + &cts->proto_specific.scsi; + struct ccb_trans_settings_spi *spi = + &cts->xport_specific.spi; + + if (cts->type == CTS_TYPE_USER_SETTINGS) { + cts->protocol = PROTO_SCSI; + cts->protocol_version = SCSI_REV_2; + cts->transport = XPORT_SPI; + cts->transport_version = 2; + + scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB; + spi->flags &= ~CTS_SPI_FLAGS_DISC_ENB; + if ((ahb->disc_permitted & target_mask) != 0) + spi->flags |= CTS_SPI_FLAGS_DISC_ENB; + if ((ahb->tags_permitted & target_mask) != 0) + scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB; + spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT; + spi->sync_period = 25; /* 10MHz */ + + if (spi->sync_period != 0) + spi->sync_offset = 15; + + spi->valid = CTS_SPI_VALID_SYNC_RATE + | CTS_SPI_VALID_SYNC_OFFSET + | CTS_SPI_VALID_BUS_WIDTH + | CTS_SPI_VALID_DISC; + scsi->valid = CTS_SCSI_VALID_TQ; + ccb->ccb_h.status = CAM_REQ_CMP; + } else { + ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; + } +#else if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) { cts->flags = 0; if ((ahb->disc_permitted & target_mask) != 0) @@ -1154,6 +1197,7 @@ ahbaction(struct cam_sim *sim, union ccb *ccb) } else { ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; } +#endif xpt_done(ccb); break; } @@ -1215,6 +1259,12 @@ ahbaction(struct cam_sim *sim, union ccb *ccb) strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); +#ifdef CAM_NEW_TRAN_CODE + cpi->transport = XPORT_SPI; + cpi->transport_version = 2; + cpi->protocol = PROTO_SCSI; + cpi->protocol_version = SCSI_REV_2; +#endif cpi->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; |