summaryrefslogtreecommitdiffstats
path: root/sys/dev/aha/aha.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/aha/aha.c')
-rw-r--r--sys/dev/aha/aha.c76
1 files changed, 72 insertions, 4 deletions
diff --git a/sys/dev/aha/aha.c b/sys/dev/aha/aha.c
index b828a9d..6678e1c 100644
--- a/sys/dev/aha/aha.c
+++ b/sys/dev/aha/aha.c
@@ -899,11 +899,44 @@ ahaaction(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;
+ 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;
+
+ cts->protocol = PROTO_SCSI;
+ cts->protocol_version = SCSI_REV_2;
+ cts->transport = XPORT_SPI;
+ cts->transport_version = 2;
+ if (cts->type == CTS_TYPE_USER_SETTINGS) {
+ spi->flags = 0;
+ if ((aha->disc_permitted & target_mask) != 0)
+ spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
+ spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
+ if ((aha->sync_permitted & target_mask) != 0) {
+ if (aha->boardid >= BOARD_1542CF)
+ spi->sync_period = 25;
+ else
+ spi->sync_period = 50;
+ } else {
+ spi->sync_period = 0;
+ }
- cts = &ccb->cts;
- target_mask = 0x01 << ccb->ccb_h.target_id;
+ 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;
+ } else {
+ ahafetchtransinfo(aha, cts);
+ }
+#else
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
cts->flags = 0;
if ((aha->disc_permitted & target_mask) != 0)
@@ -928,6 +961,7 @@ ahaaction(struct cam_sim *sim, union ccb *ccb)
} else {
ahafetchtransinfo(aha, cts);
}
+#endif
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
@@ -988,6 +1022,12 @@ ahaaction(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;
@@ -1674,6 +1714,9 @@ ahafetchtransinfo(struct aha_softc *aha, struct ccb_trans_settings* cts)
int error;
uint8_t param;
targ_syncinfo_t sync_info;
+#ifdef CAM_NEW_TRAN_CODE
+ struct ccb_trans_settings_spi *spi = &cts->xport_specific.spi;
+#endif
target = cts->ccb_h.target_id;
targ_offset = (target & 0x7);
@@ -1695,6 +1738,30 @@ ahafetchtransinfo(struct aha_softc *aha, struct ccb_trans_settings* cts)
sync_info = setup_info.syncinfo[targ_offset];
+#ifdef CAM_NEW_TRAN_CODE
+ if (sync_info.sync == 0)
+ spi->sync_offset = 0;
+ else
+ spi->sync_offset = sync_info.offset;
+
+ spi->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
+
+ if (aha->boardid >= BOARD_1542CF)
+ sync_period = 1000;
+ else
+ sync_period = 2000;
+ sync_period += 500 * sync_info.period;
+
+ /* Convert ns value to standard SCSI sync rate */
+ if (spi->sync_offset != 0)
+ spi->sync_period = scsi_calc_syncparam(sync_period);
+ else
+ spi->sync_period = 0;
+
+ spi->valid = CTS_SPI_VALID_SYNC_RATE
+ | CTS_SPI_VALID_SYNC_OFFSET
+ | CTS_SPI_VALID_BUS_WIDTH;
+#else
if (sync_info.sync == 0)
cts->sync_offset = 0;
else
@@ -1717,6 +1784,7 @@ ahafetchtransinfo(struct aha_softc *aha, struct ccb_trans_settings* cts)
cts->valid = CCB_TRANS_SYNC_RATE_VALID
| CCB_TRANS_SYNC_OFFSET_VALID
| CCB_TRANS_BUS_WIDTH_VALID;
+#endif
xpt_async(AC_TRANSFER_NEG, cts->ccb_h.path, cts);
}
OpenPOWER on IntegriCloud