2nd and final commit that moves us to CAM_NEW_TRAN_CODE
as the default. Reviewed by multitudes.
This commit is contained in:
parent
edc9f4ae99
commit
bd3fd815a7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163896
@ -676,16 +676,24 @@ cam_real_open_device(const char *path, int flags, struct cam_device *device,
|
||||
*/
|
||||
ccb.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
|
||||
ccb.cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
||||
ccb.cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
|
||||
if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) {
|
||||
sprintf(cam_errbuf, "%s: Get Transfer Settings CCB failed\n"
|
||||
"%s: %s", func_name, func_name, strerror(errno));
|
||||
goto crod_bailout;
|
||||
}
|
||||
device->sync_period = ccb.cts.sync_period;
|
||||
device->sync_offset = ccb.cts.sync_offset;
|
||||
device->bus_width = ccb.cts.bus_width;
|
||||
if (ccb.cts.protocol == XPORT_SPI) {
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
&ccb.cts.xport_specific.spi;
|
||||
device->sync_period = spi->sync_period;
|
||||
device->sync_offset = spi->sync_offset;
|
||||
device->bus_width = spi->bus_width;
|
||||
} else {
|
||||
device->sync_period = 0;
|
||||
device->sync_offset = 0;
|
||||
device->bus_width = 0;
|
||||
}
|
||||
|
||||
return(device);
|
||||
|
||||
|
@ -849,8 +849,8 @@ scsiserial(struct cam_device *device, int retry_count, int timeout)
|
||||
static int
|
||||
scsixferrate(struct cam_device *device)
|
||||
{
|
||||
u_int32_t freq;
|
||||
u_int32_t speed;
|
||||
u_int32_t freq = 0;
|
||||
u_int32_t speed = 0;
|
||||
union ccb *ccb;
|
||||
u_int mb;
|
||||
int retval = 0;
|
||||
@ -866,7 +866,7 @@ scsixferrate(struct cam_device *device)
|
||||
sizeof(struct ccb_trans_settings) - sizeof(struct ccb_hdr));
|
||||
|
||||
ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
ccb->cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
||||
ccb->cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
|
||||
if (((retval = cam_send_ccb(device, ccb)) < 0)
|
||||
|| ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
|
||||
@ -887,10 +887,49 @@ scsixferrate(struct cam_device *device)
|
||||
|
||||
}
|
||||
|
||||
if (((ccb->cts.valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)
|
||||
&& (ccb->cts.sync_offset != 0)) {
|
||||
freq = scsi_calc_syncsrate(ccb->cts.sync_period);
|
||||
speed = freq;
|
||||
if (ccb->cts.transport == XPORT_SPI) {
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
&ccb->cts.xport_specific.spi;
|
||||
|
||||
if ((spi->valid & CTS_SPI_VALID_SYNC_RATE) != 0) {
|
||||
freq = scsi_calc_syncsrate(spi->sync_period);
|
||||
speed = freq;
|
||||
}
|
||||
|
||||
fprintf(stdout, "%s%d: ", device->device_name,
|
||||
device->dev_unit_num);
|
||||
|
||||
if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0) {
|
||||
speed *= (0x01 << spi->bus_width);
|
||||
}
|
||||
|
||||
mb = speed / 1000;
|
||||
|
||||
if (mb > 0)
|
||||
fprintf(stdout, "%d.%03dMB/s transfers ",
|
||||
mb, speed % 1000);
|
||||
else
|
||||
fprintf(stdout, "%dKB/s transfers ",
|
||||
speed);
|
||||
|
||||
if (((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) != 0)
|
||||
&& (spi->sync_offset != 0))
|
||||
fprintf(stdout, "(%d.%03dMHz, offset %d", freq / 1000,
|
||||
freq % 1000, spi->sync_offset);
|
||||
|
||||
if (((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0)
|
||||
&& (spi->bus_width > 0)) {
|
||||
if (((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) != 0)
|
||||
&& (spi->sync_offset != 0)) {
|
||||
fprintf(stdout, ", ");
|
||||
} else {
|
||||
fprintf(stdout, " (");
|
||||
}
|
||||
fprintf(stdout, "%dbit)", 8 * (0x01 << spi->bus_width));
|
||||
} else if (((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) != 0)
|
||||
&& (spi->sync_offset != 0)) {
|
||||
fprintf(stdout, ")");
|
||||
}
|
||||
} else {
|
||||
struct ccb_pathinq cpi;
|
||||
|
||||
@ -901,46 +940,28 @@ scsixferrate(struct cam_device *device)
|
||||
|
||||
speed = cpi.base_transfer_speed;
|
||||
freq = 0;
|
||||
|
||||
mb = speed / 1000;
|
||||
|
||||
if (mb > 0)
|
||||
fprintf(stdout, "%d.%03dMB/s transfers ",
|
||||
mb, speed % 1000);
|
||||
else
|
||||
fprintf(stdout, "%dKB/s transfers ",
|
||||
speed);
|
||||
}
|
||||
|
||||
fprintf(stdout, "%s%d: ", device->device_name,
|
||||
device->dev_unit_num);
|
||||
|
||||
if ((ccb->cts.valid & CCB_TRANS_BUS_WIDTH_VALID) != 0)
|
||||
speed *= (0x01 << device->bus_width);
|
||||
|
||||
mb = speed / 1000;
|
||||
|
||||
if (mb > 0)
|
||||
fprintf(stdout, "%d.%03dMB/s transfers ",
|
||||
mb, speed % 1000);
|
||||
else
|
||||
fprintf(stdout, "%dKB/s transfers ",
|
||||
speed);
|
||||
|
||||
if (((ccb->cts.valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)
|
||||
&& (ccb->cts.sync_offset != 0))
|
||||
fprintf(stdout, "(%d.%03dMHz, offset %d", freq / 1000,
|
||||
freq % 1000, ccb->cts.sync_offset);
|
||||
|
||||
if (((ccb->cts.valid & CCB_TRANS_BUS_WIDTH_VALID) != 0)
|
||||
&& (ccb->cts.bus_width > 0)) {
|
||||
if (((ccb->cts.valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)
|
||||
&& (ccb->cts.sync_offset != 0)) {
|
||||
fprintf(stdout, ", ");
|
||||
} else {
|
||||
fprintf(stdout, " (");
|
||||
if (ccb->cts.protocol == PROTO_SCSI) {
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&ccb->cts.proto_specific.scsi;
|
||||
if (scsi->valid & CTS_SCSI_VALID_TQ) {
|
||||
if (scsi->flags & CTS_SCSI_FLAGS_TAG_ENB)
|
||||
fprintf(stdout, ", Command Queueing Enabled");
|
||||
else
|
||||
fprintf(stdout, ", Command Queueing Supported");
|
||||
}
|
||||
fprintf(stdout, "%dbit)", 8 * (0x01 << ccb->cts.bus_width));
|
||||
} else if (((ccb->cts.valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)
|
||||
&& (ccb->cts.sync_offset != 0)) {
|
||||
fprintf(stdout, ")");
|
||||
}
|
||||
|
||||
if (((ccb->cts.valid & CCB_TRANS_TQ_VALID) != 0)
|
||||
&& (ccb->cts.flags & CCB_TRANS_TAG_ENB))
|
||||
fprintf(stdout, ", Tagged Queueing Enabled");
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
xferrate_bailout:
|
||||
@ -2259,36 +2280,51 @@ cts_print(struct cam_device *device, struct ccb_trans_settings *cts)
|
||||
|
||||
cam_path_string(device, pathstr, sizeof(pathstr));
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) {
|
||||
if (cts->transport == XPORT_SPI) {
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
&cts->xport_specific.spi;
|
||||
|
||||
fprintf(stdout, "%ssync parameter: %d\n", pathstr,
|
||||
cts->sync_period);
|
||||
if ((spi->valid & CTS_SPI_VALID_SYNC_RATE) != 0) {
|
||||
|
||||
if (cts->sync_offset != 0) {
|
||||
u_int freq;
|
||||
fprintf(stdout, "%ssync parameter: %d\n", pathstr,
|
||||
spi->sync_period);
|
||||
|
||||
freq = scsi_calc_syncsrate(cts->sync_period);
|
||||
fprintf(stdout, "%sfrequency: %d.%03dMHz\n", pathstr,
|
||||
freq / 1000, freq % 1000);
|
||||
if (spi->sync_offset != 0) {
|
||||
u_int freq;
|
||||
|
||||
freq = scsi_calc_syncsrate(spi->sync_period);
|
||||
fprintf(stdout, "%sfrequency: %d.%03dMHz\n",
|
||||
pathstr, freq / 1000, freq % 1000);
|
||||
}
|
||||
}
|
||||
|
||||
if (spi->valid & CTS_SPI_VALID_SYNC_OFFSET) {
|
||||
fprintf(stdout, "%soffset: %d\n", pathstr,
|
||||
spi->sync_offset);
|
||||
}
|
||||
|
||||
if (spi->valid & CTS_SPI_VALID_BUS_WIDTH) {
|
||||
fprintf(stdout, "%sbus width: %d bits\n", pathstr,
|
||||
(0x01 << spi->bus_width) * 8);
|
||||
}
|
||||
|
||||
if (spi->valid & CTS_SPI_VALID_DISC) {
|
||||
fprintf(stdout, "%sdisconnection is %s\n", pathstr,
|
||||
(spi->flags & CTS_SPI_FLAGS_DISC_ENB) ?
|
||||
"enabled" : "disabled");
|
||||
}
|
||||
}
|
||||
|
||||
if (cts->valid & CCB_TRANS_SYNC_OFFSET_VALID)
|
||||
fprintf(stdout, "%soffset: %d\n", pathstr, cts->sync_offset);
|
||||
if (cts->protocol == PROTO_SCSI) {
|
||||
struct ccb_trans_settings_scsi *scsi=
|
||||
&cts->proto_specific.scsi;
|
||||
|
||||
if (cts->valid & CCB_TRANS_BUS_WIDTH_VALID)
|
||||
fprintf(stdout, "%sbus width: %d bits\n", pathstr,
|
||||
(0x01 << cts->bus_width) * 8);
|
||||
|
||||
if (cts->valid & CCB_TRANS_DISC_VALID)
|
||||
fprintf(stdout, "%sdisconnection is %s\n", pathstr,
|
||||
(cts->flags & CCB_TRANS_DISC_ENB) ? "enabled" :
|
||||
"disabled");
|
||||
|
||||
if (cts->valid & CCB_TRANS_TQ_VALID)
|
||||
fprintf(stdout, "%stagged queueing is %s\n", pathstr,
|
||||
(cts->flags & CCB_TRANS_TAG_ENB) ? "enabled" :
|
||||
"disabled");
|
||||
if (scsi->valid & CTS_SCSI_VALID_TQ) {
|
||||
fprintf(stdout, "%stagged queueing is %s\n", pathstr,
|
||||
(scsi->flags & CTS_SCSI_FLAGS_TAG_ENB) ?
|
||||
"enabled" : "disabled");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2500,9 +2536,9 @@ get_print_cts(struct cam_device *device, int user_settings, int quiet,
|
||||
ccb->ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
|
||||
if (user_settings == 0)
|
||||
ccb->cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
||||
ccb->cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
else
|
||||
ccb->cts.flags = CCB_TRANS_USER_SETTINGS;
|
||||
ccb->cts.type = CTS_TYPE_USER_SETTINGS;
|
||||
|
||||
if (cam_send_ccb(device, ccb) < 0) {
|
||||
perror("error sending XPT_GET_TRAN_SETTINGS CCB");
|
||||
@ -2676,16 +2712,27 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout,
|
||||
cpi_print(&cpi);
|
||||
|
||||
if (change_settings) {
|
||||
if (disc_enable != -1) {
|
||||
ccb->cts.valid |= CCB_TRANS_DISC_VALID;
|
||||
if (disc_enable == 0)
|
||||
ccb->cts.flags &= ~CCB_TRANS_DISC_ENB;
|
||||
else
|
||||
ccb->cts.flags |= CCB_TRANS_DISC_ENB;
|
||||
} else
|
||||
ccb->cts.valid &= ~CCB_TRANS_DISC_VALID;
|
||||
int didsettings = 0;
|
||||
struct ccb_trans_settings_spi *spi = NULL;
|
||||
struct ccb_trans_settings_scsi *scsi = NULL;
|
||||
|
||||
if (tag_enable != -1) {
|
||||
if (ccb->cts.transport == XPORT_SPI) {
|
||||
spi = &ccb->cts.xport_specific.spi;
|
||||
spi->valid = 0;
|
||||
}
|
||||
if (ccb->cts.protocol == PROTO_SCSI) {
|
||||
scsi = &ccb->cts.proto_specific.scsi;
|
||||
scsi->valid = 0;
|
||||
}
|
||||
if (spi && disc_enable != -1) {
|
||||
spi->valid |= CTS_SPI_VALID_DISC;
|
||||
if (disc_enable == 0)
|
||||
spi->flags &= ~CTS_SPI_FLAGS_DISC_ENB;
|
||||
else
|
||||
spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
|
||||
}
|
||||
|
||||
if (scsi && tag_enable != -1) {
|
||||
if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0) {
|
||||
warnx("HBA does not support tagged queueing, "
|
||||
"so you cannot modify tag settings");
|
||||
@ -2693,16 +2740,16 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout,
|
||||
goto ratecontrol_bailout;
|
||||
}
|
||||
|
||||
ccb->cts.valid |= CCB_TRANS_TQ_VALID;
|
||||
scsi->valid |= CTS_SCSI_VALID_TQ;
|
||||
|
||||
if (tag_enable == 0)
|
||||
ccb->cts.flags &= ~CCB_TRANS_TAG_ENB;
|
||||
scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB;
|
||||
else
|
||||
ccb->cts.flags |= CCB_TRANS_TAG_ENB;
|
||||
} else
|
||||
ccb->cts.valid &= ~CCB_TRANS_TQ_VALID;
|
||||
scsi->flags |= CTS_SCSI_FLAGS_TAG_ENB;
|
||||
didsettings++;
|
||||
}
|
||||
|
||||
if (offset != -1) {
|
||||
if (spi && offset != -1) {
|
||||
if ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) {
|
||||
warnx("HBA at %s%d is not cable of changing "
|
||||
"offset", cpi.dev_name,
|
||||
@ -2710,12 +2757,12 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout,
|
||||
retval = 1;
|
||||
goto ratecontrol_bailout;
|
||||
}
|
||||
ccb->cts.valid |= CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
ccb->cts.sync_offset = offset;
|
||||
} else
|
||||
ccb->cts.valid &= ~CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
spi->valid |= CTS_SPI_VALID_SYNC_OFFSET;
|
||||
spi->sync_offset = offset;
|
||||
didsettings++;
|
||||
}
|
||||
|
||||
if (syncrate != -1) {
|
||||
if (spi && syncrate != -1) {
|
||||
int prelim_sync_period;
|
||||
u_int freq;
|
||||
|
||||
@ -2727,7 +2774,7 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout,
|
||||
goto ratecontrol_bailout;
|
||||
}
|
||||
|
||||
ccb->cts.valid |= CCB_TRANS_SYNC_RATE_VALID;
|
||||
spi->valid |= CTS_SPI_VALID_SYNC_RATE;
|
||||
|
||||
/*
|
||||
* The sync rate the user gives us is in MHz.
|
||||
@ -2745,12 +2792,12 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout,
|
||||
else
|
||||
prelim_sync_period = 10000000 / syncrate;
|
||||
|
||||
ccb->cts.sync_period =
|
||||
spi->sync_period =
|
||||
scsi_calc_syncparam(prelim_sync_period);
|
||||
|
||||
freq = scsi_calc_syncsrate(ccb->cts.sync_period);
|
||||
} else
|
||||
ccb->cts.valid &= ~CCB_TRANS_SYNC_RATE_VALID;
|
||||
freq = scsi_calc_syncsrate(spi->sync_period);
|
||||
didsettings++;
|
||||
}
|
||||
|
||||
/*
|
||||
* The bus_width argument goes like this:
|
||||
@ -2761,7 +2808,7 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout,
|
||||
* command line right by 4, you should get the correct
|
||||
* number.
|
||||
*/
|
||||
if (bus_width != -1) {
|
||||
if (spi && bus_width != -1) {
|
||||
|
||||
/*
|
||||
* We might as well validate things here with a
|
||||
@ -2787,11 +2834,14 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout,
|
||||
goto ratecontrol_bailout;
|
||||
}
|
||||
|
||||
ccb->cts.valid |= CCB_TRANS_BUS_WIDTH_VALID;
|
||||
ccb->cts.bus_width = bus_width >> 4;
|
||||
} else
|
||||
ccb->cts.valid &= ~CCB_TRANS_BUS_WIDTH_VALID;
|
||||
spi->valid |= CTS_SPI_VALID_BUS_WIDTH;
|
||||
spi->bus_width = bus_width >> 4;
|
||||
didsettings++;
|
||||
}
|
||||
|
||||
if (didsettings == 0) {
|
||||
goto ratecontrol_bailout;
|
||||
}
|
||||
ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
|
||||
|
||||
if (cam_send_ccb(device, ccb) < 0) {
|
||||
|
@ -34,9 +34,7 @@
|
||||
#include <sys/queue.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/time.h>
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
#include <sys/limits.h>
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
#ifndef _KERNEL
|
||||
#include <sys/callout.h>
|
||||
#endif
|
||||
@ -209,7 +207,6 @@ typedef enum {
|
||||
#define XPT_FC_IS_QUEUED(ccb) \
|
||||
(((ccb)->ccb_h.func_code & XPT_FC_QUEUED) != 0)
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
typedef enum {
|
||||
PROTO_UNKNOWN,
|
||||
PROTO_UNSPECIFIED,
|
||||
@ -234,7 +231,6 @@ typedef enum {
|
||||
#define PROTO_VERSION_UNSPECIFIED UINT_MAX
|
||||
#define XPORT_VERSION_UNKNOWN (UINT_MAX - 1)
|
||||
#define XPORT_VERSION_UNSPECIFIED UINT_MAX
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
typedef union {
|
||||
LIST_ENTRY(ccb_hdr) le;
|
||||
@ -518,7 +514,6 @@ typedef enum {
|
||||
PIM_SEQSCAN = 0x04 /* Do bus scans sequentially, not in parallel */
|
||||
} pi_miscflag;
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
/* Path Inquiry CCB */
|
||||
struct ccb_pathinq_settings_spi {
|
||||
u_int8_t ppr_options;
|
||||
@ -533,7 +528,6 @@ struct ccb_pathinq_settings_sas {
|
||||
u_int32_t bitrate; /* Mbps */
|
||||
};
|
||||
#define PATHINQ_SETTINGS_SIZE 128
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
struct ccb_pathinq {
|
||||
struct ccb_hdr ccb_h;
|
||||
@ -555,7 +549,6 @@ struct ccb_pathinq {
|
||||
u_int32_t unit_number; /* Unit number for SIM */
|
||||
u_int32_t bus_id; /* Bus ID for SIM */
|
||||
u_int32_t base_transfer_speed;/* Base bus speed in KB/sec */
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cam_proto protocol;
|
||||
u_int protocol_version;
|
||||
cam_xport transport;
|
||||
@ -566,7 +559,6 @@ struct ccb_pathinq {
|
||||
struct ccb_pathinq_settings_sas sas;
|
||||
char ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE];
|
||||
} xport_specific;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
};
|
||||
|
||||
/* Path Statistics CCB */
|
||||
@ -704,27 +696,6 @@ struct ccb_termio {
|
||||
union ccb *termio_ccb; /* Pointer to CCB to terminate */
|
||||
};
|
||||
|
||||
#ifndef CAM_NEW_TRAN_CODE
|
||||
/* Get/Set transfer rate/width/disconnection/tag queueing settings */
|
||||
struct ccb_trans_settings {
|
||||
struct ccb_hdr ccb_h;
|
||||
u_int valid; /* Which fields to honor */
|
||||
#define CCB_TRANS_SYNC_RATE_VALID 0x01
|
||||
#define CCB_TRANS_SYNC_OFFSET_VALID 0x02
|
||||
#define CCB_TRANS_BUS_WIDTH_VALID 0x04
|
||||
#define CCB_TRANS_DISC_VALID 0x08
|
||||
#define CCB_TRANS_TQ_VALID 0x10
|
||||
u_int flags;
|
||||
#define CCB_TRANS_CURRENT_SETTINGS 0x01
|
||||
#define CCB_TRANS_USER_SETTINGS 0x02
|
||||
#define CCB_TRANS_DISC_ENB 0x04
|
||||
#define CCB_TRANS_TAG_ENB 0x08
|
||||
u_int sync_period;
|
||||
u_int sync_offset;
|
||||
u_int bus_width;
|
||||
};
|
||||
|
||||
#else /* CAM_NEW_TRAN_CODE */
|
||||
typedef enum {
|
||||
CTS_TYPE_CURRENT_SETTINGS,
|
||||
CTS_TYPE_USER_SETTINGS
|
||||
@ -794,7 +765,6 @@ struct ccb_trans_settings {
|
||||
} xport_specific;
|
||||
};
|
||||
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
/*
|
||||
* Calculate the geometry parameters for a device
|
||||
|
@ -127,12 +127,10 @@ struct cam_ed {
|
||||
struct cam_periph *owner; /* Peripheral driver's ownership tag */
|
||||
struct xpt_quirk_entry *quirk; /* Oddities about this device */
|
||||
/* Storage for the inquiry data */
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cam_proto protocol;
|
||||
u_int protocol_version;
|
||||
cam_xport transport;
|
||||
u_int transport_version;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
struct scsi_inquiry_data inq_data;
|
||||
u_int8_t inq_flags; /*
|
||||
* Current settings for inquiry flags.
|
||||
@ -876,9 +874,7 @@ static void proberequestdefaultnegotiation(struct cam_periph *periph);
|
||||
static void probedone(struct cam_periph *periph, union ccb *done_ccb);
|
||||
static void probecleanup(struct cam_periph *periph);
|
||||
static void xpt_find_quirk(struct cam_ed *device);
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
static void xpt_devise_transport(struct cam_path *path);
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
static void xpt_set_transfer_settings(struct ccb_trans_settings *cts,
|
||||
struct cam_ed *device,
|
||||
int async_update);
|
||||
@ -1573,7 +1569,6 @@ xpt_remove_periph(struct cam_periph *periph)
|
||||
|
||||
}
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
|
||||
void
|
||||
xpt_announce_periph(struct cam_periph *periph, char *announce_string)
|
||||
@ -1708,113 +1703,6 @@ xpt_announce_periph(struct cam_periph *periph, char *announce_string)
|
||||
periph->unit_number, announce_string);
|
||||
splx(s);
|
||||
}
|
||||
#else /* CAM_NEW_TRAN_CODE */
|
||||
void
|
||||
xpt_announce_periph(struct cam_periph *periph, char *announce_string)
|
||||
{
|
||||
int s;
|
||||
u_int mb;
|
||||
struct cam_path *path;
|
||||
struct ccb_trans_settings cts;
|
||||
|
||||
GIANT_REQUIRED;
|
||||
|
||||
path = periph->path;
|
||||
/*
|
||||
* To ensure that this is printed in one piece,
|
||||
* mask out CAM interrupts.
|
||||
*/
|
||||
s = splsoftcam();
|
||||
printf("%s%d at %s%d bus %d target %d lun %d\n",
|
||||
periph->periph_name, periph->unit_number,
|
||||
path->bus->sim->sim_name,
|
||||
path->bus->sim->unit_number,
|
||||
path->bus->sim->bus_id,
|
||||
path->target->target_id,
|
||||
path->device->lun_id);
|
||||
printf("%s%d: ", periph->periph_name, periph->unit_number);
|
||||
scsi_print_inquiry(&path->device->inq_data);
|
||||
if ((bootverbose)
|
||||
&& (path->device->serial_num_len > 0)) {
|
||||
/* Don't wrap the screen - print only the first 60 chars */
|
||||
printf("%s%d: Serial Number %.60s\n", periph->periph_name,
|
||||
periph->unit_number, path->device->serial_num);
|
||||
}
|
||||
xpt_setup_ccb(&cts.ccb_h, path, /*priority*/1);
|
||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
||||
xpt_action((union ccb*)&cts);
|
||||
if (cts.ccb_h.status == CAM_REQ_CMP) {
|
||||
u_int speed;
|
||||
u_int freq;
|
||||
|
||||
if ((cts.valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0
|
||||
&& cts.sync_offset != 0) {
|
||||
freq = scsi_calc_syncsrate(cts.sync_period);
|
||||
speed = freq;
|
||||
} else {
|
||||
struct ccb_pathinq cpi;
|
||||
|
||||
/* Ask the SIM for its base transfer speed */
|
||||
xpt_setup_ccb(&cpi.ccb_h, path, /*priority*/1);
|
||||
cpi.ccb_h.func_code = XPT_PATH_INQ;
|
||||
xpt_action((union ccb *)&cpi);
|
||||
|
||||
speed = cpi.base_transfer_speed;
|
||||
freq = 0;
|
||||
}
|
||||
if ((cts.valid & CCB_TRANS_BUS_WIDTH_VALID) != 0)
|
||||
speed *= (0x01 << cts.bus_width);
|
||||
mb = speed / 1000;
|
||||
if (mb > 0)
|
||||
printf("%s%d: %d.%03dMB/s transfers",
|
||||
periph->periph_name, periph->unit_number,
|
||||
mb, speed % 1000);
|
||||
else
|
||||
printf("%s%d: %dKB/s transfers", periph->periph_name,
|
||||
periph->unit_number, speed);
|
||||
if ((cts.valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0
|
||||
&& cts.sync_offset != 0) {
|
||||
printf(" (%d.%03dMHz, offset %d", freq / 1000,
|
||||
freq % 1000, cts.sync_offset);
|
||||
}
|
||||
if ((cts.valid & CCB_TRANS_BUS_WIDTH_VALID) != 0
|
||||
&& cts.bus_width > 0) {
|
||||
if ((cts.valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0
|
||||
&& cts.sync_offset != 0) {
|
||||
printf(", ");
|
||||
} else {
|
||||
printf(" (");
|
||||
}
|
||||
printf("%dbit)", 8 * (0x01 << cts.bus_width));
|
||||
} else if ((cts.valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0
|
||||
&& cts.sync_offset != 0) {
|
||||
printf(")");
|
||||
}
|
||||
|
||||
if (path->device->inq_flags & SID_CmdQue
|
||||
|| path->device->flags & CAM_DEV_TAG_AFTER_COUNT) {
|
||||
printf(", Tagged Queueing Enabled");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
} else if (path->device->inq_flags & SID_CmdQue
|
||||
|| path->device->flags & CAM_DEV_TAG_AFTER_COUNT) {
|
||||
printf("%s%d: Tagged Queueing Enabled\n",
|
||||
periph->periph_name, periph->unit_number);
|
||||
}
|
||||
|
||||
/*
|
||||
* We only want to print the caller's announce string if they've
|
||||
* passed one in..
|
||||
*/
|
||||
if (announce_string != NULL)
|
||||
printf("%s%d: %s\n", periph->periph_name,
|
||||
periph->unit_number, announce_string);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
static dev_match_ret
|
||||
xptbusmatch(struct dev_match_pattern *patterns, u_int num_patterns,
|
||||
@ -3028,9 +2916,7 @@ xpt_action(union ccb *start_ccb)
|
||||
switch (start_ccb->ccb_h.func_code) {
|
||||
case XPT_SCSI_IO:
|
||||
{
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct cam_ed *device;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
#ifdef CAMDEBUG
|
||||
char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1];
|
||||
struct cam_path *path;
|
||||
@ -3054,12 +2940,8 @@ xpt_action(union ccb *start_ccb)
|
||||
* This means that this code will be exercised while probing
|
||||
* devices with an ANSI revision greater than 2.
|
||||
*/
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
device = start_ccb->ccb_h.path->device;
|
||||
if (device->protocol_version <= SCSI_REV_2
|
||||
#else /* CAM_NEW_TRAN_CODE */
|
||||
if (SID_ANSI_REV(&start_ccb->ccb_h.path->device->inq_data) <= 2
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
&& start_ccb->ccb_h.target_lun < 8
|
||||
&& (start_ccb->ccb_h.flags & CAM_CDB_POINTER) == 0) {
|
||||
|
||||
@ -5112,9 +4994,7 @@ xpt_release_target(struct cam_eb *bus, struct cam_et *target)
|
||||
static struct cam_ed *
|
||||
xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
|
||||
{
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct cam_path path;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
struct cam_ed *device;
|
||||
struct cam_devq *devq;
|
||||
cam_status status;
|
||||
@ -5195,7 +5075,6 @@ xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
|
||||
TAILQ_INSERT_TAIL(&target->ed_entries, device, links);
|
||||
}
|
||||
target->generation++;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
if (lun_id != CAM_LUN_WILDCARD) {
|
||||
xpt_compile_path(&path,
|
||||
NULL,
|
||||
@ -5205,7 +5084,6 @@ xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
|
||||
xpt_devise_transport(&path);
|
||||
xpt_release_path(&path);
|
||||
}
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
}
|
||||
return (device);
|
||||
}
|
||||
@ -5955,19 +5833,10 @@ proberequestdefaultnegotiation(struct cam_periph *periph)
|
||||
|
||||
xpt_setup_ccb(&cts.ccb_h, periph->path, /*priority*/1);
|
||||
cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts.type = CTS_TYPE_USER_SETTINGS;
|
||||
#else /* CAM_NEW_TRAN_CODE */
|
||||
cts.flags = CCB_TRANS_USER_SETTINGS;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
xpt_action((union ccb *)&cts);
|
||||
cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
#else /* CAM_NEW_TRAN_CODE */
|
||||
cts.flags &= ~CCB_TRANS_USER_SETTINGS;
|
||||
cts.flags |= CCB_TRANS_CURRENT_SETTINGS;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
xpt_action((union ccb *)&cts);
|
||||
}
|
||||
|
||||
@ -6043,9 +5912,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
|
||||
|
||||
xpt_find_quirk(path->device);
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
xpt_devise_transport(path);
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
if (INQ_DATA_TQ_ENABLED(inq_buf))
|
||||
softc->action = PROBE_MODE_SENSE;
|
||||
else
|
||||
@ -6298,7 +6165,6 @@ sysctl_cam_search_luns(SYSCTL_HANDLER_ARGS)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
|
||||
static void
|
||||
xpt_devise_transport(struct cam_path *path)
|
||||
@ -6668,194 +6534,6 @@ xpt_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device,
|
||||
(*(sim->sim_action))(sim, (union ccb *)cts);
|
||||
}
|
||||
|
||||
#else /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
static void
|
||||
xpt_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_ed *device,
|
||||
int async_update)
|
||||
{
|
||||
struct cam_sim *sim;
|
||||
int qfrozen;
|
||||
|
||||
sim = cts->ccb_h.path->bus->sim;
|
||||
if (async_update == FALSE) {
|
||||
struct scsi_inquiry_data *inq_data;
|
||||
struct ccb_pathinq cpi;
|
||||
struct ccb_trans_settings cur_cts;
|
||||
|
||||
if (device == NULL) {
|
||||
cts->ccb_h.status = CAM_PATH_INVALID;
|
||||
xpt_done((union ccb *)cts);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform sanity checking against what the
|
||||
* controller and device can do.
|
||||
*/
|
||||
xpt_setup_ccb(&cpi.ccb_h, cts->ccb_h.path, /*priority*/1);
|
||||
cpi.ccb_h.func_code = XPT_PATH_INQ;
|
||||
xpt_action((union ccb *)&cpi);
|
||||
xpt_setup_ccb(&cur_cts.ccb_h, cts->ccb_h.path, /*priority*/1);
|
||||
cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
|
||||
cur_cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
||||
xpt_action((union ccb *)&cur_cts);
|
||||
inq_data = &device->inq_data;
|
||||
|
||||
/* Fill in any gaps in what the user gave us */
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) == 0)
|
||||
cts->sync_period = cur_cts.sync_period;
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) == 0)
|
||||
cts->sync_offset = cur_cts.sync_offset;
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) == 0)
|
||||
cts->bus_width = cur_cts.bus_width;
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) == 0) {
|
||||
cts->flags &= ~CCB_TRANS_DISC_ENB;
|
||||
cts->flags |= cur_cts.flags & CCB_TRANS_DISC_ENB;
|
||||
}
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) == 0) {
|
||||
cts->flags &= ~CCB_TRANS_TAG_ENB;
|
||||
cts->flags |= cur_cts.flags & CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
|
||||
if (((device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0
|
||||
&& (inq_data->flags & SID_Sync) == 0)
|
||||
|| ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0)
|
||||
|| (cts->sync_offset == 0)
|
||||
|| (cts->sync_period == 0)) {
|
||||
/* Force async */
|
||||
cts->sync_period = 0;
|
||||
cts->sync_offset = 0;
|
||||
} else if ((device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0
|
||||
&& (inq_data->spi3data & SID_SPI_CLOCK_DT) == 0
|
||||
&& cts->sync_period <= 0x9) {
|
||||
/*
|
||||
* Don't allow DT transmission rates if the
|
||||
* device does not support it.
|
||||
*/
|
||||
cts->sync_period = 0xa;
|
||||
}
|
||||
|
||||
switch (cts->bus_width) {
|
||||
case MSG_EXT_WDTR_BUS_32_BIT:
|
||||
if (((device->flags & CAM_DEV_INQUIRY_DATA_VALID) == 0
|
||||
|| (inq_data->flags & SID_WBus32) != 0)
|
||||
&& (cpi.hba_inquiry & PI_WIDE_32) != 0)
|
||||
break;
|
||||
/* FALLTHROUGH to 16-bit */
|
||||
case MSG_EXT_WDTR_BUS_16_BIT:
|
||||
if (((device->flags & CAM_DEV_INQUIRY_DATA_VALID) == 0
|
||||
|| (inq_data->flags & SID_WBus16) != 0)
|
||||
&& (cpi.hba_inquiry & PI_WIDE_16) != 0) {
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH to 8-bit */
|
||||
default: /* New bus width?? */
|
||||
case MSG_EXT_WDTR_BUS_8_BIT:
|
||||
/* All targets can do this */
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) == 0) {
|
||||
/*
|
||||
* Can't tag queue without disconnection.
|
||||
*/
|
||||
cts->flags &= ~CCB_TRANS_TAG_ENB;
|
||||
cts->valid |= CCB_TRANS_TQ_VALID;
|
||||
}
|
||||
|
||||
if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0
|
||||
|| (INQ_DATA_TQ_ENABLED(inq_data)) == 0
|
||||
|| (device->queue_flags & SCP_QUEUE_DQUE) != 0
|
||||
|| (device->quirk->mintags == 0)) {
|
||||
/*
|
||||
* Can't tag on hardware that doesn't support,
|
||||
* doesn't have it enabled, or has broken tag support.
|
||||
*/
|
||||
cts->flags &= ~CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
}
|
||||
|
||||
qfrozen = FALSE;
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
int device_tagenb;
|
||||
|
||||
/*
|
||||
* If we are transitioning from tags to no-tags or
|
||||
* vice-versa, we need to carefully freeze and restart
|
||||
* the queue so that we don't overlap tagged and non-tagged
|
||||
* commands. We also temporarily stop tags if there is
|
||||
* a change in transfer negotiation settings to allow
|
||||
* "tag-less" negotiation.
|
||||
*/
|
||||
if ((device->flags & CAM_DEV_TAG_AFTER_COUNT) != 0
|
||||
|| (device->inq_flags & SID_CmdQue) != 0)
|
||||
device_tagenb = TRUE;
|
||||
else
|
||||
device_tagenb = FALSE;
|
||||
|
||||
if (((cts->flags & CCB_TRANS_TAG_ENB) != 0
|
||||
&& device_tagenb == FALSE)
|
||||
|| ((cts->flags & CCB_TRANS_TAG_ENB) == 0
|
||||
&& device_tagenb == TRUE)) {
|
||||
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0) {
|
||||
/*
|
||||
* Delay change to use tags until after a
|
||||
* few commands have gone to this device so
|
||||
* the controller has time to perform transfer
|
||||
* negotiations without tagged messages getting
|
||||
* in the way.
|
||||
*/
|
||||
device->tag_delay_count = CAM_TAG_DELAY_COUNT;
|
||||
device->flags |= CAM_DEV_TAG_AFTER_COUNT;
|
||||
} else {
|
||||
xpt_freeze_devq(cts->ccb_h.path, /*count*/1);
|
||||
qfrozen = TRUE;
|
||||
device->inq_flags &= ~SID_CmdQue;
|
||||
xpt_dev_ccbq_resize(cts->ccb_h.path,
|
||||
sim->max_dev_openings);
|
||||
device->flags &= ~CAM_DEV_TAG_AFTER_COUNT;
|
||||
device->tag_delay_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (async_update == FALSE) {
|
||||
/*
|
||||
* If we are currently performing tagged transactions to
|
||||
* this device and want to change its negotiation parameters,
|
||||
* go non-tagged for a bit to give the controller a chance to
|
||||
* negotiate unhampered by tag messages.
|
||||
*/
|
||||
if ((device->inq_flags & SID_CmdQue) != 0
|
||||
&& (cts->flags & (CCB_TRANS_SYNC_RATE_VALID|
|
||||
CCB_TRANS_SYNC_OFFSET_VALID|
|
||||
CCB_TRANS_BUS_WIDTH_VALID)) != 0)
|
||||
xpt_toggle_tags(cts->ccb_h.path);
|
||||
|
||||
(*(sim->sim_action))(sim, (union ccb *)cts);
|
||||
}
|
||||
|
||||
if (qfrozen) {
|
||||
struct ccb_relsim crs;
|
||||
|
||||
xpt_setup_ccb(&crs.ccb_h, cts->ccb_h.path,
|
||||
/*priority*/1);
|
||||
crs.ccb_h.func_code = XPT_REL_SIMQ;
|
||||
crs.release_flags = RELSIM_RELEASE_AFTER_QEMPTY;
|
||||
crs.openings
|
||||
= crs.release_timeout
|
||||
= crs.qfrozen_cnt
|
||||
= 0;
|
||||
xpt_action((union ccb *)&crs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
static void
|
||||
xpt_toggle_tags(struct cam_path *path)
|
||||
@ -6876,24 +6554,15 @@ xpt_toggle_tags(struct cam_path *path)
|
||||
struct ccb_trans_settings cts;
|
||||
|
||||
xpt_setup_ccb(&cts.ccb_h, path, 1);
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts.protocol = PROTO_SCSI;
|
||||
cts.protocol_version = PROTO_VERSION_UNSPECIFIED;
|
||||
cts.transport = XPORT_UNSPECIFIED;
|
||||
cts.transport_version = XPORT_VERSION_UNSPECIFIED;
|
||||
cts.proto_specific.scsi.flags = 0;
|
||||
cts.proto_specific.scsi.valid = CTS_SCSI_VALID_TQ;
|
||||
#else /* CAM_NEW_TRAN_CODE */
|
||||
cts.flags = 0;
|
||||
cts.valid = CCB_TRANS_TQ_VALID;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
xpt_set_transfer_settings(&cts, path->device,
|
||||
/*async_update*/TRUE);
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts.proto_specific.scsi.flags = CTS_SCSI_FLAGS_TAG_ENB;
|
||||
#else /* CAM_NEW_TRAN_CODE */
|
||||
cts.flags = CCB_TRANS_TAG_ENB;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
xpt_set_transfer_settings(&cts, path->device,
|
||||
/*async_update*/TRUE);
|
||||
}
|
||||
@ -7157,12 +6826,10 @@ xptaction(struct cam_sim *sim, union ccb *work_ccb)
|
||||
cpi->unit_number = sim->unit_number;
|
||||
cpi->bus_id = sim->bus_id;
|
||||
cpi->base_transfer_speed = 0;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->protocol = PROTO_UNSPECIFIED;
|
||||
cpi->protocol_version = PROTO_VERSION_UNSPECIFIED;
|
||||
cpi->transport = XPORT_UNSPECIFIED;
|
||||
cpi->transport_version = XPORT_VERSION_UNSPECIFIED;
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
cpi->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(work_ccb);
|
||||
break;
|
||||
|
@ -1084,10 +1084,8 @@ 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;
|
||||
|
||||
@ -1106,57 +1104,6 @@ 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)
|
||||
{
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) {
|
||||
val = cts->bus_width;
|
||||
if (val < ti->ti_width)
|
||||
ti->ti_width = val;
|
||||
}
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) {
|
||||
val = cts->sync_period;
|
||||
if (val == 0 || val > ti->ti_maxsynch.period)
|
||||
ti->ti_maxsynch.period = val;
|
||||
}
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) {
|
||||
val = cts->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 ((cts->valid & (CCB_TRANS_DISC_VALID |
|
||||
CCB_TRANS_TQ_VALID)) != 0)
|
||||
{
|
||||
li = scsi_low_alloc_li(ti, lun, 1);
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0)
|
||||
{
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
li->li_quirks |= SCSI_LOW_DISK_DISC;
|
||||
else
|
||||
li->li_quirks &= ~SCSI_LOW_DISK_DISC;
|
||||
}
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0)
|
||||
{
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
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);
|
||||
}
|
||||
#else
|
||||
scsi = &cts->proto_specific.scsi;
|
||||
spi = &cts->xport_specific.spi;
|
||||
if ((spi->valid & (CTS_SPI_VALID_BUS_WIDTH |
|
||||
@ -1203,7 +1150,6 @@ scsi_low_scsi_action_cam(sim, ccb)
|
||||
if ((slp->sl_show_result & SHOW_CALCF_RES) != 0)
|
||||
scsi_low_calcf_show(li);
|
||||
}
|
||||
#endif
|
||||
splx(s);
|
||||
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
@ -1231,7 +1177,6 @@ scsi_low_scsi_action_cam(sim, ccb)
|
||||
|
||||
s = SCSI_LOW_SPLSCSI();
|
||||
li = scsi_low_alloc_li(ti, lun, 1);
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
if (li != NULL && cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
@ -1275,65 +1220,6 @@ scsi_low_scsi_action_cam(sim, ccb)
|
||||
scsi->valid = 0;
|
||||
} else
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0)
|
||||
{
|
||||
#ifdef SCSI_LOW_DIAGNOSTIC
|
||||
if ((li->li_flags_valid & SCSI_LOW_LUN_FLAGS_DISK_VALID) == 0)
|
||||
{
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
printf("%s: invalid GET_TRANS_USER_SETTINGS call\n",
|
||||
slp->sl_xname);
|
||||
goto settings_out;
|
||||
}
|
||||
#endif /* SCSI_LOW_DIAGNOSTIC */
|
||||
diskflags = li->li_diskflags & li->li_cfgflags;
|
||||
if ((diskflags & SCSI_LOW_DISK_DISC) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
else
|
||||
cts->flags &= ~CCB_TRANS_DISC_ENB;
|
||||
if ((diskflags & SCSI_LOW_DISK_QTAG) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
else
|
||||
cts->flags &= ~CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
else if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0)
|
||||
{
|
||||
#ifdef SCSI_LOW_DIAGNOSTIC
|
||||
if (li->li_flags_valid != SCSI_LOW_LUN_FLAGS_ALL_VALID)
|
||||
{
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
printf("%s: invalid GET_TRANS_CURRENT_SETTINGS call\n",
|
||||
slp->sl_xname);
|
||||
goto settings_out;
|
||||
}
|
||||
#endif /* SCSI_LOW_DIAGNOSTIC */
|
||||
if ((li->li_flags & SCSI_LOW_DISC) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
else
|
||||
cts->flags &= ~CCB_TRANS_DISC_ENB;
|
||||
if ((li->li_flags & SCSI_LOW_QTAG) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
else
|
||||
cts->flags &= ~CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
else
|
||||
{
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
goto settings_out;
|
||||
}
|
||||
|
||||
cts->sync_period = ti->ti_maxsynch.period;
|
||||
cts->sync_offset = ti->ti_maxsynch.offset;
|
||||
cts->bus_width = ti->ti_width;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
#endif
|
||||
settings_out:
|
||||
splx(s);
|
||||
xpt_done(ccb);
|
||||
@ -1414,12 +1300,10 @@ scsi_low_scsi_action_cam(sim, ccb)
|
||||
cpi->initiator_id = slp->sl_hostid;
|
||||
cpi->bus_id = cam_sim_bus(sim);
|
||||
cpi->base_transfer_speed = 3300;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2;
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
|
||||
strncpy(cpi->hba_vid, "SCSI_LOW", HBA_IDLEN);
|
||||
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
||||
|
@ -1137,8 +1137,6 @@ device pass #CAM passthrough driver
|
||||
# CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB
|
||||
#
|
||||
# CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
|
||||
# CAM_NEW_TRAN_CODE: this is the new transport layer code that will be switched
|
||||
# to soon
|
||||
# SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
|
||||
# SCSI_NO_OP_STRINGS: When defined disables opcode descriptions
|
||||
# SCSI_DELAY: The number of MILLISECONDS to freeze the SIM (scsi adapter)
|
||||
|
@ -278,7 +278,6 @@ CAM_DEBUG_BUS opt_cam.h
|
||||
CAM_DEBUG_TARGET opt_cam.h
|
||||
CAM_DEBUG_LUN opt_cam.h
|
||||
CAM_DEBUG_FLAGS opt_cam.h
|
||||
CAM_NEW_TRAN_CODE opt_cam.h
|
||||
SCSI_DELAY opt_scsi.h
|
||||
SCSI_NO_SENSE_STRINGS opt_scsi.h
|
||||
SCSI_NO_OP_STRINGS opt_scsi.h
|
||||
|
@ -263,19 +263,16 @@ aac_cam_action(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
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
}
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
{
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&ccb->cts.proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -290,10 +287,6 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
} else {
|
||||
scsi->valid = 0;
|
||||
}
|
||||
#else
|
||||
ccb->cts.flags &= ~(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB);
|
||||
ccb->cts.valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
return;
|
||||
|
@ -288,19 +288,12 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
#define IS_CURRENT_SETTINGS(c) (c->type == CTS_TYPE_CURRENT_SETTINGS)
|
||||
#define IS_USER_SETTINGS(c) (c->type == CTS_TYPE_USER_SETTINGS)
|
||||
#else
|
||||
#define IS_CURRENT_SETTINGS(c) (c->flags & CCB_TRANS_CURRENT_SETTINGS)
|
||||
#define IS_USER_SETTINGS(c) (c->flags & CCB_TRANS_USER_SETTINGS)
|
||||
#endif
|
||||
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;
|
||||
target_bit_vector targ_mask;
|
||||
struct adv_transinfo *tconf;
|
||||
@ -327,7 +320,6 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
|
||||
}
|
||||
|
||||
s = splcam();
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
scsi = &cts->proto_specific.scsi;
|
||||
spi = &cts->xport_specific.spi;
|
||||
if ((update_type & ADV_TRANS_GOAL) != 0) {
|
||||
@ -393,71 +385,6 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cts->ccb_h.target_id, spi->sync_period,
|
||||
spi->sync_offset, update_type);
|
||||
}
|
||||
#else
|
||||
if ((update_type & ADV_TRANS_GOAL) != 0) {
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
adv->disc_enable |= targ_mask;
|
||||
else
|
||||
adv->disc_enable &= ~targ_mask;
|
||||
adv_write_lram_8(adv, ADVV_DISC_ENABLE_B,
|
||||
adv->disc_enable);
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
adv->cmd_qng_enabled |= targ_mask;
|
||||
else
|
||||
adv->cmd_qng_enabled &= ~targ_mask;
|
||||
}
|
||||
}
|
||||
|
||||
if ((update_type & ADV_TRANS_USER) != 0) {
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
adv->user_disc_enable |= targ_mask;
|
||||
else
|
||||
adv->user_disc_enable &= ~targ_mask;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
adv->user_cmd_qng_enabled |= targ_mask;
|
||||
else
|
||||
adv->user_cmd_qng_enabled &= ~targ_mask;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the user specifies either the sync rate, or offset,
|
||||
* but not both, the unspecified parameter defaults to its
|
||||
* current value in transfer negotiations.
|
||||
*/
|
||||
if (((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0)
|
||||
|| ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)) {
|
||||
/*
|
||||
* If the user provided a sync rate but no offset,
|
||||
* use the current offset.
|
||||
*/
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) == 0)
|
||||
cts->sync_offset = tconf->offset;
|
||||
|
||||
/*
|
||||
* If the user provided an offset but no sync rate,
|
||||
* use the current sync rate.
|
||||
*/
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) == 0)
|
||||
cts->sync_period = tconf->period;
|
||||
|
||||
adv_period_offset_to_sdtr(adv, &cts->sync_period,
|
||||
&cts->sync_offset,
|
||||
cts->ccb_h.target_id);
|
||||
|
||||
adv_set_syncrate(adv, /*struct cam_path */NULL,
|
||||
cts->ccb_h.target_id, cts->sync_period,
|
||||
cts->sync_offset, update_type);
|
||||
}
|
||||
#endif
|
||||
|
||||
splx(s);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
@ -467,10 +394,8 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
/* Get default/user set transfer settings for the target */
|
||||
{
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
struct ccb_trans_settings_spi *spi;
|
||||
#endif
|
||||
struct ccb_trans_settings *cts;
|
||||
struct adv_transinfo *tconf;
|
||||
target_bit_vector target_mask;
|
||||
@ -479,7 +404,6 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cts = &ccb->cts;
|
||||
target_mask = ADV_TID_TO_TARGET_MASK(cts->ccb_h.target_id);
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
scsi = &cts->proto_specific.scsi;
|
||||
spi = &cts->xport_specific.spi;
|
||||
|
||||
@ -514,34 +438,6 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
|
||||
| CTS_SPI_VALID_BUS_WIDTH
|
||||
| CTS_SPI_VALID_DISC;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB);
|
||||
s = splcam();
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
tconf = &adv->tinfo[cts->ccb_h.target_id].current;
|
||||
if ((adv->disc_enable & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
if ((adv->cmd_qng_enabled & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
} else {
|
||||
tconf = &adv->tinfo[cts->ccb_h.target_id].user;
|
||||
if ((adv->user_disc_enable & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
if ((adv->user_cmd_qng_enabled & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
|
||||
cts->sync_period = tconf->period;
|
||||
cts->sync_offset = tconf->offset;
|
||||
splx(s);
|
||||
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
@ -593,12 +489,10 @@ adv_action(struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
||||
cpi->unit_number = cam_sim_unit(sim);
|
||||
cpi->ccb_h.status = CAM_REQ_CMP;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2;
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
}
|
||||
|
@ -1136,7 +1136,6 @@ adv_set_syncrate(struct adv_softc *adv, struct cam_path *path,
|
||||
*/
|
||||
struct ccb_trans_settings neg;
|
||||
memset(&neg, 0, sizeof (neg));
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
&neg.xport_specific.spi;
|
||||
|
||||
@ -1149,12 +1148,6 @@ adv_set_syncrate(struct adv_softc *adv, struct cam_path *path,
|
||||
spi->sync_period = period;
|
||||
spi->valid |= CTS_SPI_VALID_SYNC_OFFSET;
|
||||
spi->valid |= CTS_SPI_VALID_SYNC_RATE;
|
||||
#else
|
||||
neg.sync_period = period;
|
||||
neg.sync_offset = offset;
|
||||
neg.valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
#endif
|
||||
xpt_setup_ccb(&neg.ccb_h, path, /*priority*/1);
|
||||
xpt_async(AC_TRANSFER_NEG, path, &neg);
|
||||
}
|
||||
|
@ -525,10 +525,8 @@ adw_action(struct cam_sim *sim, union ccb *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 target_mask;
|
||||
int s;
|
||||
@ -537,7 +535,6 @@ adw_action(struct cam_sim *sim, union ccb *ccb)
|
||||
target_mask = 0x01 << ccb->ccb_h.target_id;
|
||||
|
||||
s = splcam();
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
scsi = &cts->proto_specific.scsi;
|
||||
spi = &cts->xport_specific.spi;
|
||||
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
||||
@ -649,117 +646,6 @@ adw_action(struct cam_sim *sim, union ccb *ccb)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
u_int sdtrdone;
|
||||
|
||||
sdtrdone = adw_lram_read_16(adw, ADW_MC_SDTR_DONE);
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
u_int discenb;
|
||||
|
||||
discenb =
|
||||
adw_lram_read_16(adw, ADW_MC_DISC_ENABLE);
|
||||
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
discenb |= target_mask;
|
||||
else
|
||||
discenb &= ~target_mask;
|
||||
|
||||
adw_lram_write_16(adw, ADW_MC_DISC_ENABLE,
|
||||
discenb);
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
adw->tagenb |= target_mask;
|
||||
else
|
||||
adw->tagenb &= ~target_mask;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) {
|
||||
u_int wdtrenb_orig;
|
||||
u_int wdtrenb;
|
||||
u_int wdtrdone;
|
||||
|
||||
wdtrenb_orig =
|
||||
adw_lram_read_16(adw, ADW_MC_WDTR_ABLE);
|
||||
wdtrenb = wdtrenb_orig;
|
||||
wdtrdone = adw_lram_read_16(adw,
|
||||
ADW_MC_WDTR_DONE);
|
||||
switch (cts->bus_width) {
|
||||
case MSG_EXT_WDTR_BUS_32_BIT:
|
||||
case MSG_EXT_WDTR_BUS_16_BIT:
|
||||
wdtrenb |= target_mask;
|
||||
break;
|
||||
case MSG_EXT_WDTR_BUS_8_BIT:
|
||||
default:
|
||||
wdtrenb &= ~target_mask;
|
||||
break;
|
||||
}
|
||||
if (wdtrenb != wdtrenb_orig) {
|
||||
adw_lram_write_16(adw,
|
||||
ADW_MC_WDTR_ABLE,
|
||||
wdtrenb);
|
||||
wdtrdone &= ~target_mask;
|
||||
adw_lram_write_16(adw,
|
||||
ADW_MC_WDTR_DONE,
|
||||
wdtrdone);
|
||||
/* Wide negotiation forces async */
|
||||
sdtrdone &= ~target_mask;
|
||||
adw_lram_write_16(adw,
|
||||
ADW_MC_SDTR_DONE,
|
||||
sdtrdone);
|
||||
}
|
||||
}
|
||||
|
||||
if (((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0)
|
||||
|| ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)) {
|
||||
u_int sdtr_orig;
|
||||
u_int sdtr;
|
||||
u_int sdtrable_orig;
|
||||
u_int sdtrable;
|
||||
|
||||
sdtr = adw_get_chip_sdtr(adw,
|
||||
ccb->ccb_h.target_id);
|
||||
sdtr_orig = sdtr;
|
||||
sdtrable = adw_lram_read_16(adw,
|
||||
ADW_MC_SDTR_ABLE);
|
||||
sdtrable_orig = sdtrable;
|
||||
|
||||
if ((cts->valid
|
||||
& CCB_TRANS_SYNC_RATE_VALID) != 0) {
|
||||
|
||||
sdtr =
|
||||
adw_find_sdtr(adw,
|
||||
cts->sync_period);
|
||||
}
|
||||
|
||||
if ((cts->valid
|
||||
& CCB_TRANS_SYNC_OFFSET_VALID) != 0) {
|
||||
if (cts->sync_offset == 0)
|
||||
sdtr = ADW_MC_SDTR_ASYNC;
|
||||
}
|
||||
|
||||
if (sdtr == ADW_MC_SDTR_ASYNC)
|
||||
sdtrable &= ~target_mask;
|
||||
else
|
||||
sdtrable |= target_mask;
|
||||
if (sdtr != sdtr_orig
|
||||
|| sdtrable != sdtrable_orig) {
|
||||
adw_set_chip_sdtr(adw,
|
||||
ccb->ccb_h.target_id,
|
||||
sdtr);
|
||||
sdtrdone &= ~target_mask;
|
||||
adw_lram_write_16(adw, ADW_MC_SDTR_ABLE,
|
||||
sdtrable);
|
||||
adw_lram_write_16(adw, ADW_MC_SDTR_DONE,
|
||||
sdtrdone);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
splx(s);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
@ -768,16 +654,13 @@ adw_action(struct cam_sim *sim, union ccb *ccb)
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
/* Get default/user set transfer settings for the target */
|
||||
{
|
||||
#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 target_mask;
|
||||
|
||||
cts = &ccb->cts;
|
||||
target_mask = 0x01 << ccb->ccb_h.target_id;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts->protocol = PROTO_SCSI;
|
||||
cts->protocol_version = SCSI_REV_2;
|
||||
cts->transport = XPORT_SPI;
|
||||
@ -845,72 +728,6 @@ adw_action(struct cam_sim *sim, union ccb *ccb)
|
||||
| CTS_SPI_VALID_BUS_WIDTH
|
||||
| CTS_SPI_VALID_DISC;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
u_int mc_sdtr;
|
||||
|
||||
cts->flags = 0;
|
||||
if ((adw->user_discenb & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
|
||||
if ((adw->user_tagenb & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
|
||||
if ((adw->user_wdtr & target_mask) != 0)
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
else
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
|
||||
mc_sdtr = adw_get_user_sdtr(adw, ccb->ccb_h.target_id);
|
||||
cts->sync_period = adw_find_period(adw, mc_sdtr);
|
||||
if (cts->sync_period != 0)
|
||||
cts->sync_offset = 15; /* XXX ??? */
|
||||
else
|
||||
cts->sync_offset = 0;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
} else {
|
||||
u_int targ_tinfo;
|
||||
|
||||
cts->flags = 0;
|
||||
if ((adw_lram_read_16(adw, ADW_MC_DISC_ENABLE)
|
||||
& target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
|
||||
if ((adw->tagenb & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
|
||||
targ_tinfo =
|
||||
adw_lram_read_16(adw,
|
||||
ADW_MC_DEVICE_HSHK_CFG_TABLE
|
||||
+ (2 * ccb->ccb_h.target_id));
|
||||
|
||||
if ((targ_tinfo & ADW_HSHK_CFG_WIDE_XFR) != 0)
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
else
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
|
||||
cts->sync_period =
|
||||
adw_hshk_cfg_period_factor(targ_tinfo);
|
||||
|
||||
cts->sync_offset = targ_tinfo & ADW_HSHK_CFG_OFFSET;
|
||||
if (cts->sync_period == 0)
|
||||
cts->sync_offset = 0;
|
||||
|
||||
if (cts->sync_offset == 0)
|
||||
cts->sync_period = 0;
|
||||
}
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
@ -965,12 +782,10 @@ adw_action(struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(cpi->hba_vid, "AdvanSys", 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;
|
||||
|
@ -901,7 +901,6 @@ ahaaction(struct cam_sim *sim, union ccb *ccb)
|
||||
{
|
||||
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 =
|
||||
@ -936,32 +935,6 @@ ahaaction(struct cam_sim *sim, union ccb *ccb)
|
||||
} else {
|
||||
ahafetchtransinfo(aha, cts);
|
||||
}
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
cts->flags = 0;
|
||||
if ((aha->disc_permitted & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
if ((aha->sync_permitted & target_mask) != 0) {
|
||||
if (aha->boardid >= BOARD_1542CF)
|
||||
cts->sync_period = 25;
|
||||
else
|
||||
cts->sync_period = 50;
|
||||
} else
|
||||
cts->sync_period = 0;
|
||||
|
||||
if (cts->sync_period != 0)
|
||||
cts->sync_offset = 15;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
} else {
|
||||
ahafetchtransinfo(aha, cts);
|
||||
}
|
||||
#endif
|
||||
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
@ -1022,12 +995,10 @@ 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;
|
||||
@ -1714,9 +1685,7 @@ 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);
|
||||
@ -1738,7 +1707,6 @@ 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
|
||||
@ -1761,30 +1729,6 @@ ahafetchtransinfo(struct aha_softc *aha, struct ccb_trans_settings* cts)
|
||||
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
|
||||
cts->sync_offset = sync_info.offset;
|
||||
|
||||
cts->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 (cts->sync_offset != 0)
|
||||
cts->sync_period = scsi_calc_syncparam(sync_period);
|
||||
else
|
||||
cts->sync_period = 0;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -728,24 +728,17 @@ 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);
|
||||
@ -1142,7 +1135,6 @@ ahbaction(struct cam_sim *sim, union ccb *ccb)
|
||||
{
|
||||
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 =
|
||||
@ -1175,29 +1167,6 @@ ahbaction(struct cam_sim *sim, union ccb *ccb)
|
||||
} 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)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
if ((ahb->tags_permitted & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
cts->sync_period = 25; /* 10MHz */
|
||||
|
||||
if (cts->sync_period != 0)
|
||||
cts->sync_offset = 15;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
}
|
||||
#endif
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
}
|
||||
@ -1259,12 +1228,10 @@ 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;
|
||||
|
@ -167,7 +167,6 @@ aic_action(struct cam_sim *sim, union ccb *ccb)
|
||||
{
|
||||
struct ccb_trans_settings *cts = cts = &ccb->cts;
|
||||
struct aic_tinfo *ti = &aic->tinfo[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 =
|
||||
@ -213,47 +212,6 @@ aic_action(struct cam_sim *sim, union ccb *ccb)
|
||||
ti->flags |= TINFO_SDTR_NEGO;
|
||||
|
||||
splx(s);
|
||||
#else
|
||||
s = splcam();
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0 &&
|
||||
(aic->flags & AIC_DISC_ENABLE) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
ti->flags |= TINFO_DISC_ENB;
|
||||
else
|
||||
ti->flags &= ~TINFO_DISC_ENB;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
ti->flags |= TINFO_TAG_ENB;
|
||||
else
|
||||
ti->flags &= ~TINFO_TAG_ENB;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) {
|
||||
ti->goal.period = cts->sync_period;
|
||||
|
||||
if (ti->goal.period > aic->min_period) {
|
||||
ti->goal.period = 0;
|
||||
ti->goal.offset = 0;
|
||||
} else if (ti->goal.period < aic->max_period)
|
||||
ti->goal.period = aic->max_period;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) {
|
||||
ti->goal.offset = cts->sync_offset;
|
||||
if (ti->goal.offset == 0)
|
||||
ti->goal.period = 0;
|
||||
else if (ti->goal.offset > AIC_SYNC_OFFSET)
|
||||
ti->goal.offset = AIC_SYNC_OFFSET;
|
||||
}
|
||||
|
||||
if ((ti->goal.period != ti->current.period)
|
||||
|| (ti->goal.offset != ti->current.offset))
|
||||
ti->flags |= TINFO_SDTR_NEGO;
|
||||
|
||||
splx(s);
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
@ -262,7 +220,6 @@ aic_action(struct cam_sim *sim, union ccb *ccb)
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
struct aic_tinfo *ti = &aic->tinfo[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 =
|
||||
@ -296,31 +253,6 @@ aic_action(struct cam_sim *sim, union ccb *ccb)
|
||||
| CTS_SPI_VALID_BUS_WIDTH
|
||||
| CTS_SPI_VALID_DISC;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
s = splcam();
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB);
|
||||
if ((ti->flags & TINFO_DISC_ENB) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
if ((ti->flags & TINFO_TAG_ENB) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
cts->sync_period = ti->current.period;
|
||||
cts->sync_offset = ti->current.offset;
|
||||
} else {
|
||||
cts->sync_period = ti->user.period;
|
||||
cts->sync_offset = ti->user.offset;
|
||||
}
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
|
||||
splx(s);
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
@ -355,12 +287,10 @@ aic_action(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;
|
||||
@ -678,9 +608,7 @@ aic_handle_msgin(struct aic_softc *aic)
|
||||
struct ccb_hdr *ccb_h;
|
||||
struct aic_tinfo *ti;
|
||||
struct ccb_trans_settings neg;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_spi *spi = &neg.xport_specific.spi;
|
||||
#endif
|
||||
|
||||
if (aic->state == AIC_RESELECTED) {
|
||||
if (!MSG_ISIDENTIFY(aic->msg_buf[0])) {
|
||||
@ -767,7 +695,6 @@ aic_handle_msgin(struct aic_softc *aic)
|
||||
((ti->current.period * 4 + 49) / 50 - 2) << 4 : 0;
|
||||
aic_outb(aic, SCSIRATE, ti->scsirate);
|
||||
memset(&neg, 0, sizeof (neg));
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
neg.protocol = PROTO_SCSI;
|
||||
neg.protocol_version = SCSI_REV_2;
|
||||
neg.transport = XPORT_SPI;
|
||||
@ -776,12 +703,6 @@ aic_handle_msgin(struct aic_softc *aic)
|
||||
spi->sync_offset = ti->goal.offset = ti->current.offset;
|
||||
spi->valid = CTS_SPI_VALID_SYNC_RATE
|
||||
| CTS_SPI_VALID_SYNC_OFFSET;
|
||||
#else
|
||||
neg.sync_period = ti->goal.period = ti->current.period;
|
||||
neg.sync_offset = ti->goal.offset = ti->current.offset;
|
||||
neg.valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
#endif
|
||||
ccb_h = &scb->ccb->ccb_h;
|
||||
xpt_setup_ccb(&neg.ccb_h, ccb_h->path, 1);
|
||||
xpt_async(AC_TRANSFER_NEG, ccb_h->path, &neg);
|
||||
@ -818,7 +739,6 @@ aic_handle_msgin(struct aic_softc *aic)
|
||||
ti->scsirate = 0;
|
||||
aic_outb(aic, SCSIRATE, ti->scsirate);
|
||||
memset(&neg, 0, sizeof (neg));
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
neg.protocol = PROTO_SCSI;
|
||||
neg.protocol_version = SCSI_REV_2;
|
||||
neg.transport = XPORT_SPI;
|
||||
@ -827,12 +747,6 @@ aic_handle_msgin(struct aic_softc *aic)
|
||||
spi->sync_offset = ti->current.offset;
|
||||
spi->valid = CTS_SPI_VALID_SYNC_RATE
|
||||
| CTS_SPI_VALID_SYNC_OFFSET;
|
||||
#else
|
||||
neg.sync_period = ti->current.period;
|
||||
neg.sync_offset = ti->current.offset;
|
||||
neg.valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
#endif
|
||||
ccb_h = &scb->ccb->ccb_h;
|
||||
xpt_setup_ccb(&neg.ccb_h, ccb_h->path, 1);
|
||||
xpt_async(AC_TRANSFER_NEG, ccb_h->path, &neg);
|
||||
|
@ -604,7 +604,6 @@ ahd_action(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 AHD_NEW_TRAN_SETTINGS
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
cpi->transport = XPORT_SPI;
|
||||
@ -612,7 +611,6 @@ ahd_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->xport_specific.spi.ppr_options = SID_SPI_CLOCK_ST;
|
||||
cpi->transport_version = 4;
|
||||
cpi->xport_specific.spi.ppr_options = SID_SPI_CLOCK_DT_ST;
|
||||
#endif
|
||||
cpi->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
@ -629,7 +627,6 @@ static void
|
||||
ahd_set_tran_settings(struct ahd_softc *ahd, int our_id, char channel,
|
||||
struct ccb_trans_settings *cts)
|
||||
{
|
||||
#ifdef AHD_NEW_TRAN_SETTINGS
|
||||
struct ahd_devinfo devinfo;
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
struct ccb_trans_settings_spi *spi;
|
||||
@ -740,124 +737,12 @@ ahd_set_tran_settings(struct ahd_softc *ahd, int our_id, char channel,
|
||||
update_type, /*paused*/FALSE);
|
||||
}
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
#else
|
||||
struct ahd_devinfo devinfo;
|
||||
struct ahd_initiator_tinfo *tinfo;
|
||||
struct ahd_tmode_tstate *tstate;
|
||||
uint16_t *discenable;
|
||||
uint16_t *tagenable;
|
||||
u_int update_type;
|
||||
|
||||
ahd_compile_devinfo(&devinfo, SIM_SCSI_ID(ahd, sim),
|
||||
cts->ccb_h.target_id,
|
||||
cts->ccb_h.target_lun,
|
||||
SIM_CHANNEL(ahd, sim),
|
||||
ROLE_UNKNOWN);
|
||||
tinfo = ahd_fetch_transinfo(ahd, devinfo.channel,
|
||||
devinfo.our_scsiid,
|
||||
devinfo.target, &tstate);
|
||||
update_type = 0;
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
update_type |= AHD_TRANS_GOAL;
|
||||
discenable = &tstate->discenable;
|
||||
tagenable = &tstate->tagenable;
|
||||
} else if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
update_type |= AHD_TRANS_USER;
|
||||
discenable = &ahd->user_discenable;
|
||||
tagenable = &ahd->user_tagenable;
|
||||
} else {
|
||||
cts->ccb_h.status = CAM_REQ_INVALID;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
*discenable |= devinfo.target_mask;
|
||||
else
|
||||
*discenable &= ~devinfo.target_mask;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
*tagenable |= devinfo.target_mask;
|
||||
else
|
||||
*tagenable &= ~devinfo.target_mask;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) {
|
||||
ahd_validate_width(ahd, /*tinfo limit*/NULL,
|
||||
&cts->bus_width, ROLE_UNKNOWN);
|
||||
ahd_set_width(ahd, &devinfo, cts->bus_width,
|
||||
update_type, /*paused*/FALSE);
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) == 0) {
|
||||
if (update_type == AHD_TRANS_USER)
|
||||
cts->sync_offset = tinfo->user.offset;
|
||||
else
|
||||
cts->sync_offset = tinfo->goal.offset;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) == 0) {
|
||||
if (update_type == AHD_TRANS_USER)
|
||||
cts->sync_period = tinfo->user.period;
|
||||
else
|
||||
cts->sync_period = tinfo->goal.period;
|
||||
}
|
||||
|
||||
if (((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0)
|
||||
|| ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)
|
||||
|| ((cts->valid & CCB_TRANS_TQ_VALID) != 0)
|
||||
|| ((cts->valid & CCB_TRANS_DISC_VALID) != 0)) {
|
||||
u_int ppr_options;
|
||||
u_int maxsync;
|
||||
|
||||
maxsync = AHD_SYNCRATE_MAX;
|
||||
ppr_options = 0;
|
||||
if (cts->sync_period <= AHD_SYNCRATE_DT
|
||||
&& cts->bus_width == MSG_EXT_WDTR_BUS_16_BIT) {
|
||||
ppr_options = tinfo->user.ppr_options
|
||||
| MSG_EXT_PPR_DT_REQ;
|
||||
}
|
||||
|
||||
if ((*tagenable & devinfo.target_mask) == 0
|
||||
|| (*discenable & devinfo.target_mask) == 0)
|
||||
ppr_options &= ~MSG_EXT_PPR_IU_REQ;
|
||||
|
||||
ahd_find_syncrate(ahd, &cts->sync_period,
|
||||
&ppr_options, maxsync);
|
||||
ahd_validate_offset(ahd, /*tinfo limit*/NULL,
|
||||
cts->sync_period, &cts->sync_offset,
|
||||
MSG_EXT_WDTR_BUS_8_BIT,
|
||||
ROLE_UNKNOWN);
|
||||
|
||||
/* We use a period of 0 to represent async */
|
||||
if (cts->sync_offset == 0) {
|
||||
cts->sync_period = 0;
|
||||
ppr_options = 0;
|
||||
}
|
||||
|
||||
if (ppr_options != 0
|
||||
&& tinfo->user.transport_version >= 3) {
|
||||
tinfo->goal.transport_version =
|
||||
tinfo->user.transport_version;
|
||||
tinfo->curr.transport_version =
|
||||
tinfo->user.transport_version;
|
||||
}
|
||||
|
||||
ahd_set_syncrate(ahd, &devinfo, cts->sync_period,
|
||||
cts->sync_offset, ppr_options,
|
||||
update_type, /*paused*/FALSE);
|
||||
}
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
ahd_get_tran_settings(struct ahd_softc *ahd, int our_id, char channel,
|
||||
struct ccb_trans_settings *cts)
|
||||
{
|
||||
#ifdef AHD_NEW_TRAN_SETTINGS
|
||||
struct ahd_devinfo devinfo;
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
struct ccb_trans_settings_spi *spi;
|
||||
@ -918,52 +803,6 @@ ahd_get_tran_settings(struct ahd_softc *ahd, int our_id, char channel,
|
||||
}
|
||||
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
#else
|
||||
struct ahd_devinfo devinfo;
|
||||
struct ahd_initiator_tinfo *targ_info;
|
||||
struct ahd_tmode_tstate *tstate;
|
||||
struct ahd_transinfo *tinfo;
|
||||
|
||||
ahd_compile_devinfo(&devinfo, our_id,
|
||||
cts->ccb_h.target_id,
|
||||
cts->ccb_h.target_lun,
|
||||
channel, ROLE_UNKNOWN);
|
||||
targ_info = ahd_fetch_transinfo(ahd, devinfo.channel,
|
||||
devinfo.our_scsiid,
|
||||
devinfo.target, &tstate);
|
||||
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0)
|
||||
tinfo = &targ_info->curr;
|
||||
else
|
||||
tinfo = &targ_info->user;
|
||||
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB);
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) == 0) {
|
||||
if ((ahd->user_discenable & devinfo.target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
|
||||
if ((ahd->user_tagenable & devinfo.target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
} else {
|
||||
if ((tstate->discenable & devinfo.target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
|
||||
if ((tstate->tagenable & devinfo.target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
cts->sync_period = tinfo->period;
|
||||
cts->sync_offset = tinfo->offset;
|
||||
cts->bus_width = tinfo->width;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID;
|
||||
|
||||
if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD)
|
||||
cts->valid |= CCB_TRANS_DISC_VALID|CCB_TRANS_TQ_VALID;
|
||||
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1362,36 +1201,22 @@ ahd_send_async(struct ahd_softc *ahd, char channel, u_int target,
|
||||
switch (code) {
|
||||
case AC_TRANSFER_NEG:
|
||||
{
|
||||
#ifdef AHD_NEW_TRAN_SETTINGS
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
scsi = &cts.proto_specific.scsi;
|
||||
#else
|
||||
cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
||||
#endif
|
||||
cts.ccb_h.path = path;
|
||||
cts.ccb_h.target_id = target;
|
||||
cts.ccb_h.target_lun = lun;
|
||||
ahd_get_tran_settings(ahd, ahd->our_id, channel, &cts);
|
||||
arg = &cts;
|
||||
#ifdef AHD_NEW_TRAN_SETTINGS
|
||||
scsi->valid &= ~CTS_SCSI_VALID_TQ;
|
||||
scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB;
|
||||
#else
|
||||
cts.valid &= ~CCB_TRANS_TQ_VALID;
|
||||
cts.flags &= ~CCB_TRANS_TAG_ENB;
|
||||
#endif
|
||||
if (opt_arg == NULL)
|
||||
break;
|
||||
if (*((ahd_queue_alg *)opt_arg) == AHD_QUEUE_TAGGED)
|
||||
#ifdef AHD_NEW_TRAN_SETTINGS
|
||||
scsi->flags |= ~CTS_SCSI_FLAGS_TAG_ENB;
|
||||
scsi->valid |= CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
cts.flags |= CCB_TRANS_TAG_ENB;
|
||||
cts.valid |= CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case AC_SENT_BDR:
|
||||
|
@ -77,10 +77,6 @@
|
||||
#include <cam/scsi/scsi_message.h>
|
||||
#include <cam/scsi/scsi_iu.h>
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
#define AHD_NEW_TRAN_SETTINGS
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
/****************************** Platform Macros *******************************/
|
||||
#define SIM_IS_SCSIBUS_B(ahd, sim) \
|
||||
(0)
|
||||
|
@ -602,7 +602,6 @@ ahc_action(struct cam_sim *sim, union ccb *ccb)
|
||||
}
|
||||
case XPT_SET_TRAN_SETTINGS:
|
||||
{
|
||||
#ifdef AHC_NEW_TRAN_SETTINGS
|
||||
struct ahc_devinfo devinfo;
|
||||
struct ccb_trans_settings *cts;
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
@ -731,126 +730,6 @@ ahc_action(struct cam_sim *sim, union ccb *ccb)
|
||||
ahc_unlock(ahc, &s);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
#else
|
||||
struct ahc_devinfo devinfo;
|
||||
struct ccb_trans_settings *cts;
|
||||
struct ahc_initiator_tinfo *tinfo;
|
||||
struct ahc_tmode_tstate *tstate;
|
||||
uint16_t *discenable;
|
||||
uint16_t *tagenable;
|
||||
u_int update_type;
|
||||
long s;
|
||||
|
||||
cts = &ccb->cts;
|
||||
ahc_compile_devinfo(&devinfo, SIM_SCSI_ID(ahc, sim),
|
||||
cts->ccb_h.target_id,
|
||||
cts->ccb_h.target_lun,
|
||||
SIM_CHANNEL(ahc, sim),
|
||||
ROLE_UNKNOWN);
|
||||
tinfo = ahc_fetch_transinfo(ahc, devinfo.channel,
|
||||
devinfo.our_scsiid,
|
||||
devinfo.target, &tstate);
|
||||
update_type = 0;
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
update_type |= AHC_TRANS_GOAL;
|
||||
discenable = &tstate->discenable;
|
||||
tagenable = &tstate->tagenable;
|
||||
} else if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
update_type |= AHC_TRANS_USER;
|
||||
discenable = &ahc->user_discenable;
|
||||
tagenable = &ahc->user_tagenable;
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_REQ_INVALID;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
}
|
||||
|
||||
ahc_lock(ahc, &s);
|
||||
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
*discenable |= devinfo.target_mask;
|
||||
else
|
||||
*discenable &= ~devinfo.target_mask;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
*tagenable |= devinfo.target_mask;
|
||||
else
|
||||
*tagenable &= ~devinfo.target_mask;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) {
|
||||
ahc_validate_width(ahc, /*tinfo limit*/NULL,
|
||||
&cts->bus_width, ROLE_UNKNOWN);
|
||||
ahc_set_width(ahc, &devinfo, cts->bus_width,
|
||||
update_type, /*paused*/FALSE);
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) == 0) {
|
||||
if (update_type == AHC_TRANS_USER)
|
||||
cts->sync_offset = tinfo->user.offset;
|
||||
else
|
||||
cts->sync_offset = tinfo->goal.offset;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) == 0) {
|
||||
if (update_type == AHC_TRANS_USER)
|
||||
cts->sync_period = tinfo->user.period;
|
||||
else
|
||||
cts->sync_period = tinfo->goal.period;
|
||||
}
|
||||
|
||||
if (((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0)
|
||||
|| ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)) {
|
||||
struct ahc_syncrate *syncrate;
|
||||
u_int ppr_options;
|
||||
u_int maxsync;
|
||||
|
||||
if ((ahc->features & AHC_ULTRA2) != 0)
|
||||
maxsync = AHC_SYNCRATE_DT;
|
||||
else if ((ahc->features & AHC_ULTRA) != 0)
|
||||
maxsync = AHC_SYNCRATE_ULTRA;
|
||||
else
|
||||
maxsync = AHC_SYNCRATE_FAST;
|
||||
|
||||
ppr_options = 0;
|
||||
if (cts->sync_period <= 9
|
||||
&& cts->bus_width == MSG_EXT_WDTR_BUS_16_BIT)
|
||||
ppr_options = MSG_EXT_PPR_DT_REQ;
|
||||
|
||||
syncrate = ahc_find_syncrate(ahc, &cts->sync_period,
|
||||
&ppr_options,
|
||||
maxsync);
|
||||
ahc_validate_offset(ahc, /*tinfo limit*/NULL,
|
||||
syncrate, &cts->sync_offset,
|
||||
MSG_EXT_WDTR_BUS_8_BIT,
|
||||
ROLE_UNKNOWN);
|
||||
|
||||
/* We use a period of 0 to represent async */
|
||||
if (cts->sync_offset == 0) {
|
||||
cts->sync_period = 0;
|
||||
ppr_options = 0;
|
||||
}
|
||||
|
||||
if (ppr_options == MSG_EXT_PPR_DT_REQ
|
||||
&& tinfo->user.transport_version >= 3) {
|
||||
tinfo->goal.transport_version =
|
||||
tinfo->user.transport_version;
|
||||
tinfo->curr.transport_version =
|
||||
tinfo->user.transport_version;
|
||||
}
|
||||
|
||||
ahc_set_syncrate(ahc, &devinfo, syncrate,
|
||||
cts->sync_period, cts->sync_offset,
|
||||
ppr_options, update_type,
|
||||
/*paused*/FALSE);
|
||||
}
|
||||
ahc_unlock(ahc, &s);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
@ -931,7 +810,6 @@ ahc_action(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 AHC_NEW_TRAN_SETTINGS
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
cpi->transport = XPORT_SPI;
|
||||
@ -942,7 +820,6 @@ ahc_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->xport_specific.spi.ppr_options =
|
||||
SID_SPI_CLOCK_DT_ST;
|
||||
}
|
||||
#endif
|
||||
cpi->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
@ -958,7 +835,6 @@ static void
|
||||
ahc_get_tran_settings(struct ahc_softc *ahc, int our_id, char channel,
|
||||
struct ccb_trans_settings *cts)
|
||||
{
|
||||
#ifdef AHC_NEW_TRAN_SETTINGS
|
||||
struct ahc_devinfo devinfo;
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
struct ccb_trans_settings_spi *spi;
|
||||
@ -1019,52 +895,6 @@ ahc_get_tran_settings(struct ahc_softc *ahc, int our_id, char channel,
|
||||
}
|
||||
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
#else
|
||||
struct ahc_devinfo devinfo;
|
||||
struct ahc_initiator_tinfo *targ_info;
|
||||
struct ahc_tmode_tstate *tstate;
|
||||
struct ahc_transinfo *tinfo;
|
||||
|
||||
ahc_compile_devinfo(&devinfo, our_id,
|
||||
cts->ccb_h.target_id,
|
||||
cts->ccb_h.target_lun,
|
||||
channel, ROLE_UNKNOWN);
|
||||
targ_info = ahc_fetch_transinfo(ahc, devinfo.channel,
|
||||
devinfo.our_scsiid,
|
||||
devinfo.target, &tstate);
|
||||
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0)
|
||||
tinfo = &targ_info->curr;
|
||||
else
|
||||
tinfo = &targ_info->user;
|
||||
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB);
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) == 0) {
|
||||
if ((ahc->user_discenable & devinfo.target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
|
||||
if ((ahc->user_tagenable & devinfo.target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
} else {
|
||||
if ((tstate->discenable & devinfo.target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
|
||||
if ((tstate->tagenable & devinfo.target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
cts->sync_period = tinfo->period;
|
||||
cts->sync_offset = tinfo->offset;
|
||||
cts->bus_width = tinfo->width;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID;
|
||||
|
||||
if (cts->ccb_h.target_lun != CAM_LUN_WILDCARD)
|
||||
cts->valid |= CCB_TRANS_DISC_VALID|CCB_TRANS_TQ_VALID;
|
||||
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1538,14 +1368,10 @@ ahc_send_async(struct ahc_softc *ahc, char channel, u_int target,
|
||||
switch (code) {
|
||||
case AC_TRANSFER_NEG:
|
||||
{
|
||||
#ifdef AHC_NEW_TRAN_SETTINGS
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
scsi = &cts.proto_specific.scsi;
|
||||
#else
|
||||
cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
||||
#endif
|
||||
cts.ccb_h.path = path;
|
||||
cts.ccb_h.target_id = target;
|
||||
cts.ccb_h.target_lun = lun;
|
||||
@ -1553,23 +1379,13 @@ ahc_send_async(struct ahc_softc *ahc, char channel, u_int target,
|
||||
: ahc->our_id_b,
|
||||
channel, &cts);
|
||||
arg = &cts;
|
||||
#ifdef AHC_NEW_TRAN_SETTINGS
|
||||
scsi->valid &= ~CTS_SCSI_VALID_TQ;
|
||||
scsi->flags &= ~CTS_SCSI_FLAGS_TAG_ENB;
|
||||
#else
|
||||
cts.valid &= ~CCB_TRANS_TQ_VALID;
|
||||
cts.flags &= ~CCB_TRANS_TAG_ENB;
|
||||
#endif
|
||||
if (opt_arg == NULL)
|
||||
break;
|
||||
if (*((ahc_queue_alg *)opt_arg) == AHC_QUEUE_TAGGED)
|
||||
#ifdef AHC_NEW_TRAN_SETTINGS
|
||||
scsi->flags |= ~CTS_SCSI_FLAGS_TAG_ENB;
|
||||
scsi->valid |= CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
cts.flags |= CCB_TRANS_TAG_ENB;
|
||||
cts.valid |= CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case AC_SENT_BDR:
|
||||
|
@ -85,10 +85,6 @@
|
||||
#include <cam/scsi/scsi_all.h>
|
||||
#include <cam/scsi/scsi_message.h>
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
#define AHC_NEW_TRAN_SETTINGS
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
/*************************** Attachment Bookkeeping ***************************/
|
||||
extern devclass_t ahc_devclass;
|
||||
|
||||
|
@ -504,12 +504,10 @@ amd_action(struct cam_sim * psim, union ccb * pccb)
|
||||
strncpy(cpi->hba_vid, "TRM-AMD", HBA_IDLEN);
|
||||
strncpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN);
|
||||
cpi->unit_number = cam_sim_unit(psim);
|
||||
#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(pccb);
|
||||
break;
|
||||
@ -549,7 +547,6 @@ amd_action(struct cam_sim * psim, union ccb * pccb)
|
||||
struct amd_target_info *targ_info = &amd->tinfo[target_id];
|
||||
struct amd_transinfo *tinfo;
|
||||
int intflag;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -598,54 +595,12 @@ amd_action(struct cam_sim * psim, union ccb * pccb)
|
||||
| CTS_SPI_VALID_BUS_WIDTH
|
||||
| CTS_SPI_VALID_DISC;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
intflag = splcam();
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
/* current transfer settings */
|
||||
if (targ_info->disc_tag & AMD_CUR_DISCENB) {
|
||||
cts->flags = CCB_TRANS_DISC_ENB;
|
||||
} else {
|
||||
cts->flags = 0; /* no tag & disconnect */
|
||||
}
|
||||
if (targ_info->disc_tag & AMD_CUR_TAGENB) {
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
tinfo = &targ_info->current;
|
||||
} else {
|
||||
/* default(user) transfer settings */
|
||||
if (targ_info->disc_tag & AMD_USR_DISCENB) {
|
||||
cts->flags = CCB_TRANS_DISC_ENB;
|
||||
} else {
|
||||
cts->flags = 0;
|
||||
}
|
||||
if (targ_info->disc_tag & AMD_USR_TAGENB) {
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
tinfo = &targ_info->user;
|
||||
}
|
||||
|
||||
cts->sync_period = tinfo->period;
|
||||
cts->sync_offset = tinfo->offset;
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
splx(intflag);
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
pccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(pccb);
|
||||
break;
|
||||
}
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
#define IS_CURRENT_SETTINGS(c) (c->type == CTS_TYPE_CURRENT_SETTINGS)
|
||||
#define IS_USER_SETTINGS(c) (c->type == CTS_TYPE_USER_SETTINGS)
|
||||
#else
|
||||
#define IS_CURRENT_SETTINGS(c) (c->flags & CCB_TRANS_CURRENT_SETTINGS)
|
||||
#define IS_USER_SETTINGS(c) (c->flags & CCB_TRANS_USER_SETTINGS)
|
||||
#endif
|
||||
case XPT_SET_TRAN_SETTINGS:
|
||||
{
|
||||
struct ccb_trans_settings *cts = &pccb->cts;
|
||||
@ -653,12 +608,10 @@ amd_action(struct cam_sim * psim, union ccb * pccb)
|
||||
u_int update_type = 0;
|
||||
int intflag;
|
||||
int last_entry;
|
||||
#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;
|
||||
#endif
|
||||
if (IS_CURRENT_SETTINGS(cts)) {
|
||||
update_type |= AMD_TRANS_GOAL;
|
||||
} else if (IS_USER_SETTINGS(cts)) {
|
||||
@ -670,7 +623,6 @@ amd_action(struct cam_sim * psim, union ccb * pccb)
|
||||
xpt_done(pccb);
|
||||
}
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
intflag = splcam();
|
||||
targ_info = &amd->tinfo[target_id];
|
||||
|
||||
@ -745,78 +697,6 @@ amd_action(struct cam_sim * psim, union ccb * pccb)
|
||||
targ_info->goal.period = spi->sync_period;
|
||||
targ_info->goal.offset = spi->sync_offset;
|
||||
}
|
||||
#else
|
||||
intflag = splcam();
|
||||
targ_info = &amd->tinfo[target_id];
|
||||
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
if (update_type & AMD_TRANS_GOAL) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0) {
|
||||
targ_info->disc_tag |= AMD_CUR_DISCENB;
|
||||
} else {
|
||||
targ_info->disc_tag &= ~AMD_CUR_DISCENB;
|
||||
}
|
||||
}
|
||||
if (update_type & AMD_TRANS_USER) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0) {
|
||||
targ_info->disc_tag |= AMD_USR_DISCENB;
|
||||
} else {
|
||||
targ_info->disc_tag &= ~AMD_USR_DISCENB;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if (update_type & AMD_TRANS_GOAL) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0) {
|
||||
targ_info->disc_tag |= AMD_CUR_TAGENB;
|
||||
} else {
|
||||
targ_info->disc_tag &= ~AMD_CUR_TAGENB;
|
||||
}
|
||||
}
|
||||
if (update_type & AMD_TRANS_USER) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0) {
|
||||
targ_info->disc_tag |= AMD_USR_TAGENB;
|
||||
} else {
|
||||
targ_info->disc_tag &= ~AMD_USR_TAGENB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) == 0) {
|
||||
if (update_type & AMD_TRANS_GOAL)
|
||||
cts->sync_offset = targ_info->goal.offset;
|
||||
else
|
||||
cts->sync_offset = targ_info->user.offset;
|
||||
}
|
||||
|
||||
if (cts->sync_offset > AMD_MAX_SYNC_OFFSET)
|
||||
cts->sync_offset = AMD_MAX_SYNC_OFFSET;
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) == 0) {
|
||||
if (update_type & AMD_TRANS_GOAL)
|
||||
cts->sync_period = targ_info->goal.period;
|
||||
else
|
||||
cts->sync_period = targ_info->user.period;
|
||||
}
|
||||
|
||||
last_entry = sizeof(tinfo_sync_period) - 1;
|
||||
if ((cts->sync_period != 0)
|
||||
&& (cts->sync_period < tinfo_sync_period[0]))
|
||||
cts->sync_period = tinfo_sync_period[0];
|
||||
if (cts->sync_period > tinfo_sync_period[last_entry])
|
||||
cts->sync_period = 0;
|
||||
if (cts->sync_offset == 0)
|
||||
cts->sync_period = 0;
|
||||
|
||||
if ((update_type & AMD_TRANS_USER) != 0) {
|
||||
targ_info->user.period = cts->sync_period;
|
||||
targ_info->user.offset = cts->sync_offset;
|
||||
}
|
||||
if ((update_type & AMD_TRANS_GOAL) != 0) {
|
||||
targ_info->goal.period = cts->sync_period;
|
||||
targ_info->goal.offset = cts->sync_offset;
|
||||
}
|
||||
#endif
|
||||
splx(intflag);
|
||||
pccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(pccb);
|
||||
@ -959,23 +839,14 @@ amdsetsync(struct amd_softc *amd, u_int target, u_int clockrate,
|
||||
cam_sim_path(amd->psim), target,
|
||||
CAM_LUN_WILDCARD) == CAM_REQ_CMP) {
|
||||
struct ccb_trans_settings neg;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
&neg.xport_specific.spi;
|
||||
#endif
|
||||
xpt_setup_ccb(&neg.ccb_h, path, /*priority*/1);
|
||||
memset(&neg, 0, sizeof (neg));
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
spi->sync_period = period;
|
||||
spi->sync_offset = offset;
|
||||
spi->valid = CTS_SPI_VALID_SYNC_RATE
|
||||
| CTS_SPI_VALID_SYNC_OFFSET;
|
||||
#else
|
||||
neg.sync_period = period;
|
||||
neg.sync_offset = offset;
|
||||
neg.valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
#endif
|
||||
xpt_async(AC_TRANSFER_NEG, path, &neg);
|
||||
xpt_free_path(path);
|
||||
}
|
||||
@ -1627,21 +1498,14 @@ amdhandlemsgreject(struct amd_softc *amd)
|
||||
} else if ((srb != NULL)
|
||||
&& (srb->pccb->ccb_h.flags & CAM_TAG_ACTION_VALID) != 0) {
|
||||
struct ccb_trans_settings neg;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi = &neg.proto_specific.scsi;
|
||||
#endif
|
||||
|
||||
printf("amd%d:%d: refuses tagged commands. Performing "
|
||||
"non-tagged I/O\n", amd->unit, amd->cur_target);
|
||||
|
||||
amdsettags(amd, amd->cur_target, FALSE);
|
||||
memset(&neg, 0, sizeof (neg));
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
neg.flags = 0;
|
||||
neg.valid = CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
xpt_setup_ccb(&neg.ccb_h, srb->pccb->ccb_h.path, /*priority*/1);
|
||||
xpt_async(AC_TRANSFER_NEG, srb->pccb->ccb_h.path, &neg);
|
||||
|
||||
|
@ -291,12 +291,10 @@ amr_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->unit_number = cam_sim_unit(sim);
|
||||
cpi->bus_id = cam_sim_bus(sim);
|
||||
cpi->base_transfer_speed = 132 * 1024; /* XXX get from controller? */
|
||||
#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;
|
||||
|
||||
break;
|
||||
@ -324,7 +322,6 @@ amr_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
|
||||
debug(3, "XPT_GET_TRAN_SETTINGS");
|
||||
|
||||
#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;
|
||||
|
||||
@ -348,23 +345,6 @@ amr_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
| CTS_SPI_VALID_BUS_WIDTH
|
||||
| CTS_SPI_VALID_DISC;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) == 0) {
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
cts->flags = CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB;
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_32_BIT;
|
||||
cts->sync_period = 6; /* 40MHz how wide is this bus? */
|
||||
cts->sync_offset = 31; /* How to extract this from board? */
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
break;
|
||||
}
|
||||
|
@ -1891,12 +1891,10 @@ static VOID arcmsr_action(struct cam_sim * psim,union ccb * pccb)
|
||||
strncpy(cpi->dev_name,cam_sim_name(psim),DEV_IDLEN);
|
||||
cpi->unit_number=cam_sim_unit(psim);
|
||||
cpi->ccb_h.status=CAM_REQ_CMP;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2;
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
xpt_done(pccb);
|
||||
break;
|
||||
}
|
||||
@ -1966,7 +1964,6 @@ static VOID arcmsr_action(struct cam_sim * psim,union ccb * pccb)
|
||||
{
|
||||
struct ccb_trans_settings *cts = &pccb->cts;
|
||||
ULONG s;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -1977,14 +1974,12 @@ static VOID arcmsr_action(struct cam_sim * psim,union ccb * pccb)
|
||||
cts->transport = XPORT_SPI;
|
||||
cts->transport_version = 2;
|
||||
|
||||
#endif
|
||||
|
||||
#if ARCMSR_DEBUG0
|
||||
printf("arcmsr_action: XPT_GET_TRAN_SETTINGS\n" );
|
||||
#endif
|
||||
|
||||
s=splcam();
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
spi->flags = CTS_SPI_FLAGS_DISC_ENB;
|
||||
spi->sync_period=3;
|
||||
spi->sync_offset=32;
|
||||
@ -1994,13 +1989,6 @@ static VOID arcmsr_action(struct cam_sim * psim,union ccb * pccb)
|
||||
| CTS_SPI_VALID_SYNC_OFFSET
|
||||
| CTS_SPI_VALID_BUS_WIDTH;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
cts->flags=(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB);
|
||||
cts->sync_period=3;
|
||||
cts->sync_offset=32;
|
||||
cts->bus_width=MSG_EXT_WDTR_BUS_16_BIT;
|
||||
cts->valid=CCB_TRANS_SYNC_RATE_VALID | CCB_TRANS_SYNC_OFFSET_VALID | CCB_TRANS_BUS_WIDTH_VALID | CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
splx(s);
|
||||
pccb->ccb_h.status=CAM_REQ_CMP;
|
||||
xpt_done(pccb);
|
||||
|
@ -2792,7 +2792,6 @@ asr_action(struct cam_sim *sim, union ccb *ccb)
|
||||
/* Get default/user set transfer settings for the target */
|
||||
{
|
||||
struct ccb_trans_settings *cts = &(ccb->cts);
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -2819,23 +2818,6 @@ asr_action(struct cam_sim *sim, union ccb *ccb)
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
}
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
cts->flags = CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB;
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
cts->sync_period = 6; /* 40MHz */
|
||||
cts->sync_offset = 15;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
}
|
||||
#endif
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
}
|
||||
@ -2902,12 +2884,10 @@ asr_action(struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
||||
cpi->unit_number = cam_sim_unit(sim);
|
||||
cpi->ccb_h.status = CAM_REQ_CMP;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2;
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
}
|
||||
|
@ -363,12 +363,10 @@ atapi_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->unit_number = cam_sim_unit(sim);
|
||||
cpi->bus_id = cam_sim_bus(sim);
|
||||
cpi->base_transfer_speed = 3300;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_ATA;
|
||||
cpi->transport_version = 2;
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
|
||||
if (softc->ata_ch && tid != CAM_TARGET_WILDCARD) {
|
||||
mtx_lock(&softc->state_lock);
|
||||
@ -442,7 +440,6 @@ atapi_action(struct cam_sim *sim, union ccb *ccb)
|
||||
|
||||
case XPT_GET_TRAN_SETTINGS: {
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts->protocol = PROTO_SCSI;
|
||||
cts->protocol_version = SCSI_REV_2;
|
||||
cts->transport = XPORT_ATA;
|
||||
@ -450,15 +447,6 @@ atapi_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cts->proto_specific.valid = 0;
|
||||
cts->xport_specific.valid = 0;
|
||||
/* nothing more to do */
|
||||
#else
|
||||
/*
|
||||
* The default CAM transport code is very SCSI-specific and
|
||||
* doesn't understand IDE speeds very well. Be silent about it
|
||||
* here and let it default to what is set in XPT_PATH_INQ
|
||||
*/
|
||||
cts->valid = (CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID);
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB);
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_SUBTRACE, ("GET_TRAN_SETTINGS\n"));
|
||||
xpt_done(ccb);
|
||||
|
@ -1290,7 +1290,6 @@ btaction(struct cam_sim *sim, union ccb *ccb)
|
||||
|
||||
cts = &ccb->cts;
|
||||
target_mask = 0x01 << ccb->ccb_h.target_id;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
@ -1336,36 +1335,6 @@ btaction(struct cam_sim *sim, union ccb *ccb)
|
||||
} else
|
||||
scsi->valid = 0;
|
||||
} else {
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
cts->flags = 0;
|
||||
if ((bt->disc_permitted & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
if ((bt->tags_permitted & target_mask) != 0)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
if ((bt->wide_permitted & target_mask) != 0)
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
else
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
if ((bt->ultra_permitted & target_mask) != 0)
|
||||
cts->sync_period = 12;
|
||||
else if ((bt->fast_permitted & target_mask) != 0)
|
||||
cts->sync_period = 25;
|
||||
else if ((bt->sync_permitted & target_mask) != 0)
|
||||
cts->sync_period = 50;
|
||||
else
|
||||
cts->sync_period = 0;
|
||||
|
||||
if (cts->sync_period != 0)
|
||||
cts->sync_offset = 15;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
} else {
|
||||
#endif
|
||||
btfetchtransinfo(bt, cts);
|
||||
}
|
||||
|
||||
@ -1436,12 +1405,10 @@ btaction(struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
||||
cpi->unit_number = cam_sim_unit(sim);
|
||||
cpi->ccb_h.status = CAM_REQ_CMP;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2;
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
}
|
||||
@ -1757,7 +1724,6 @@ btdone(struct bt_softc *bt, struct bt_ccb *bccb, bt_mbi_comp_code_t comp_code)
|
||||
case BTSTAT_TAGGED_MSG_REJECTED:
|
||||
{
|
||||
struct ccb_trans_settings neg;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&neg.proto_specific.scsi;
|
||||
|
||||
@ -1767,11 +1733,6 @@ btdone(struct bt_softc *bt, struct bt_ccb *bccb, bt_mbi_comp_code_t comp_code)
|
||||
neg.transport_version = 2;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
scsi->flags = 0;
|
||||
#else
|
||||
|
||||
neg.flags = 0;
|
||||
neg.valid = CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
xpt_print_path(csio->ccb_h.path);
|
||||
printf("refuses tagged commands. Performing "
|
||||
"non-tagged I/O\n");
|
||||
@ -2214,7 +2175,6 @@ btfetchtransinfo(struct bt_softc *bt, struct ccb_trans_settings *cts)
|
||||
int error;
|
||||
u_int8_t param;
|
||||
targ_syncinfo_t sync_info;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -2222,10 +2182,6 @@ btfetchtransinfo(struct bt_softc *bt, struct ccb_trans_settings *cts)
|
||||
|
||||
spi->valid = 0;
|
||||
scsi->valid = 0;
|
||||
#else
|
||||
|
||||
cts->valid = 0;
|
||||
#endif
|
||||
|
||||
target = cts->ccb_h.target_id;
|
||||
targ_offset = (target & 0x7);
|
||||
@ -2306,7 +2262,6 @@ btfetchtransinfo(struct bt_softc *bt, struct ccb_trans_settings *cts)
|
||||
sync_period = 2000 + (500 * sync_info.period);
|
||||
}
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts->protocol = PROTO_SCSI;
|
||||
cts->protocol_version = SCSI_REV_2;
|
||||
cts->transport = XPORT_SPI;
|
||||
@ -2326,20 +2281,6 @@ btfetchtransinfo(struct bt_softc *bt, struct ccb_trans_settings *cts)
|
||||
} else
|
||||
scsi->valid = 0;
|
||||
|
||||
#else
|
||||
/* Convert ns value to standard SCSI sync rate */
|
||||
if (cts->sync_offset != 0)
|
||||
cts->sync_period = scsi_calc_syncparam(sync_period);
|
||||
else
|
||||
cts->sync_period = 0;
|
||||
cts->sync_offset = sync_offset;
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2648,12 +2648,10 @@ ciss_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->unit_number = cam_sim_unit(sim);
|
||||
cpi->bus_id = cam_sim_bus(sim);
|
||||
cpi->base_transfer_speed = 132 * 1024; /* XXX what to set this to? */
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2;
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
break;
|
||||
}
|
||||
@ -2662,17 +2660,14 @@ ciss_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
int bus, target;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
&cts->xport_specific.spi;
|
||||
#endif
|
||||
|
||||
bus = cam_sim_bus(sim);
|
||||
target = cts->ccb_h.target_id;
|
||||
|
||||
debug(1, "XPT_GET_TRAN_SETTINGS %d:%d", bus, target);
|
||||
/* disconnect always OK */
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts->protocol = PROTO_SCSI;
|
||||
cts->protocol_version = SCSI_REV_2;
|
||||
cts->transport = XPORT_SPI;
|
||||
@ -2680,10 +2675,6 @@ ciss_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
|
||||
spi->valid = CTS_SPI_VALID_DISC;
|
||||
spi->flags = CTS_SPI_FLAGS_DISC_ENB;
|
||||
#else
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
cts->valid = CCB_TRANS_DISC_VALID;
|
||||
#endif
|
||||
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
break;
|
||||
|
@ -1005,7 +1005,6 @@ dpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
/* Get default/user set transfer settings for the target */
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -1036,27 +1035,6 @@ dpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
}
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
cts->flags = CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB;
|
||||
cts->bus_width = (dpt->max_id > 7)
|
||||
? MSG_EXT_WDTR_BUS_8_BIT
|
||||
: MSG_EXT_WDTR_BUS_16_BIT;
|
||||
cts->sync_period = 25; /* 10MHz */
|
||||
|
||||
if (cts->sync_period != 0)
|
||||
cts->sync_offset = 15;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
}
|
||||
#endif
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
}
|
||||
@ -1102,12 +1080,10 @@ dpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(cpi->hba_vid, "DPT", 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;
|
||||
|
@ -928,12 +928,10 @@ ncr53c9x_action(struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(cpi->hba_vid, "Sun", 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
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mtx_unlock(&sc->sc_lock);
|
||||
xpt_done(ccb);
|
||||
@ -943,7 +941,6 @@ ncr53c9x_action(struct cam_sim *sim, union ccb *ccb)
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[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 =
|
||||
@ -978,29 +975,6 @@ ncr53c9x_action(struct cam_sim *sim, union ccb *ccb)
|
||||
CTS_SPI_VALID_SYNC_OFFSET |
|
||||
CTS_SPI_VALID_DISC;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
cts->sync_period = ti->period;
|
||||
cts->sync_offset = ti->offset;
|
||||
cts->bus_width = ti->width;
|
||||
if ((ti->flags & T_TAG) != 0)
|
||||
cts->flags |=
|
||||
(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB);
|
||||
else
|
||||
cts->flags &=
|
||||
~(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB);
|
||||
} else {
|
||||
cts->sync_period = sc->sc_maxsync;
|
||||
cts->sync_offset = sc->sc_maxoffset;
|
||||
cts->bus_width = sc->sc_maxwidth;
|
||||
cts->flags |= (CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB);
|
||||
}
|
||||
cts->valid = CCB_TRANS_BUS_WIDTH_VALID |
|
||||
CCB_TRANS_SYNC_RATE_VALID |
|
||||
CCB_TRANS_SYNC_OFFSET_VALID |
|
||||
CCB_TRANS_DISC_VALID |
|
||||
CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
mtx_unlock(&sc->sc_lock);
|
||||
xpt_done(ccb);
|
||||
@ -1081,7 +1055,6 @@ ncr53c9x_action(struct cam_sim *sim, union ccb *ccb)
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
int target = ccb->ccb_h.target_id;
|
||||
struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[target];
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -1125,46 +1098,6 @@ ncr53c9x_action(struct cam_sim *sim, union ccb *ccb)
|
||||
ti->flags |= T_NEGOTIATE;
|
||||
ti->offset = spi->sync_offset;
|
||||
}
|
||||
#else
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if ((sc->sc_cfflags & (1<<((target & 7) + 16))) == 0 &&
|
||||
(cts->flags & CCB_TRANS_TAG_ENB)) {
|
||||
NCR_MISC(("%s: target %d: tagged queuing\n",
|
||||
device_get_nameunit(sc->sc_dev), target));
|
||||
ti->flags |= T_TAG;
|
||||
} else
|
||||
ti->flags &= ~T_TAG;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) {
|
||||
if (cts->bus_width != 0) {
|
||||
NCR_MISC(("%s: target %d: wide negotiation\n",
|
||||
device_get_nameunit(sc->sc_dev), target));
|
||||
if (sc->sc_rev == NCR_VARIANT_FAS366) {
|
||||
ti->flags |= T_WIDE;
|
||||
ti->width = 1;
|
||||
}
|
||||
} else {
|
||||
ti->flags &= ~T_WIDE;
|
||||
ti->width = 0;
|
||||
}
|
||||
ti->flags |= T_NEGOTIATE;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) {
|
||||
NCR_MISC(("%s: target %d: sync period negotiation\n",
|
||||
device_get_nameunit(sc->sc_dev), target));
|
||||
ti->flags |= T_NEGOTIATE;
|
||||
ti->period = cts->sync_period;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) {
|
||||
NCR_MISC(("%s: target %d: sync offset negotiation\n",
|
||||
device_get_nameunit(sc->sc_dev), target));
|
||||
ti->flags |= T_NEGOTIATE;
|
||||
ti->offset = cts->sync_offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
mtx_unlock(&sc->sc_lock);
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
|
@ -2527,12 +2527,10 @@ END_DEBUG
|
||||
strncpy(cpi->hba_vid, "SBP", HBA_IDLEN);
|
||||
strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
|
||||
cpi->unit_number = sim->unit_number;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI; /* XX should have a FireWire */
|
||||
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);
|
||||
@ -2541,7 +2539,6 @@ END_DEBUG
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -2555,11 +2552,6 @@ END_DEBUG
|
||||
spi->flags = CTS_SPI_FLAGS_DISC_ENB;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
scsi->flags = CTS_SCSI_FLAGS_TAG_ENB;
|
||||
#else
|
||||
/* Enable disconnect and tagged queuing */
|
||||
cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
cts->flags = CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB;
|
||||
#endif
|
||||
SBP_DEBUG(1)
|
||||
printf("%s:%d:%d XPT_GET_TRAN_SETTINGS:.\n",
|
||||
device_get_nameunit(sbp->fd.dev),
|
||||
|
@ -1349,7 +1349,6 @@ iir_action( struct cam_sim *sim, union ccb *ccb )
|
||||
/* Get default/user set transfer settings for the target */
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
#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;
|
||||
|
||||
@ -1375,24 +1374,6 @@ iir_action( struct cam_sim *sim, union ccb *ccb )
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
}
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
cts->flags = CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB;
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
cts->sync_period = 25; /* 10MHz */
|
||||
if (cts->sync_period != 0)
|
||||
cts->sync_offset = 15;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
} else {
|
||||
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
|
||||
}
|
||||
#endif
|
||||
--gdt_stat.io_count_act;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
@ -1454,12 +1435,10 @@ iir_action( struct cam_sim *sim, union ccb *ccb )
|
||||
else
|
||||
strncpy(cpi->hba_vid, "ICP vortex ", HBA_IDLEN);
|
||||
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
||||
#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;
|
||||
--gdt_stat.io_count_act;
|
||||
xpt_done(ccb);
|
||||
|
@ -2422,11 +2422,7 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
}
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
#define IS_CURRENT_SETTINGS(c) (c->type == CTS_TYPE_CURRENT_SETTINGS)
|
||||
#else
|
||||
#define IS_CURRENT_SETTINGS(c) (c->flags & CCB_TRANS_CURRENT_SETTINGS)
|
||||
#endif
|
||||
case XPT_SET_TRAN_SETTINGS: /* Nexus Settings */
|
||||
cts = &ccb->cts;
|
||||
if (!IS_CURRENT_SETTINGS(cts)) {
|
||||
@ -2437,66 +2433,6 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
tgt = cts->ccb_h.target_id;
|
||||
CAMLOCK_2_ISPLOCK(isp);
|
||||
if (IS_SCSI(isp)) {
|
||||
#ifndef CAM_NEW_TRAN_CODE
|
||||
sdparam *sdp = isp->isp_param;
|
||||
uint16_t *dptr;
|
||||
|
||||
bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path));
|
||||
|
||||
sdp += bus;
|
||||
/*
|
||||
* We always update (internally) from goal_flags
|
||||
* so any request to change settings just gets
|
||||
* vectored to that location.
|
||||
*/
|
||||
dptr = &sdp->isp_devparam[tgt].goal_flags;
|
||||
|
||||
/*
|
||||
* Note that these operations affect the
|
||||
* the goal flags (goal_flags)- not
|
||||
* the current state flags. Then we mark
|
||||
* things so that the next operation to
|
||||
* this HBA will cause the update to occur.
|
||||
*/
|
||||
if (cts->valid & CCB_TRANS_DISC_VALID) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0) {
|
||||
*dptr |= DPARM_DISC;
|
||||
} else {
|
||||
*dptr &= ~DPARM_DISC;
|
||||
}
|
||||
}
|
||||
if (cts->valid & CCB_TRANS_TQ_VALID) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0) {
|
||||
*dptr |= DPARM_TQING;
|
||||
} else {
|
||||
*dptr &= ~DPARM_TQING;
|
||||
}
|
||||
}
|
||||
if (cts->valid & CCB_TRANS_BUS_WIDTH_VALID) {
|
||||
switch (cts->bus_width) {
|
||||
case MSG_EXT_WDTR_BUS_16_BIT:
|
||||
*dptr |= DPARM_WIDE;
|
||||
break;
|
||||
default:
|
||||
*dptr &= ~DPARM_WIDE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Any SYNC RATE of nonzero and SYNC_OFFSET
|
||||
* of nonzero will cause us to go to the
|
||||
* selected (from NVRAM) maximum value for
|
||||
* this device. At a later point, we'll
|
||||
* allow finer control.
|
||||
*/
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) &&
|
||||
(cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) &&
|
||||
(cts->sync_offset > 0)) {
|
||||
*dptr |= DPARM_SYNC;
|
||||
} else {
|
||||
*dptr &= ~DPARM_SYNC;
|
||||
}
|
||||
*dptr |= DPARM_SAFE_DFLT;
|
||||
#else
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -2551,7 +2487,6 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
} else {
|
||||
*dptr &= ~DPARM_SYNC;
|
||||
}
|
||||
#endif
|
||||
isp_prt(isp, ISP_LOGDEBUG0,
|
||||
"SET bus %d targ %d to flags %x off %x per %x",
|
||||
bus, tgt, sdp->isp_devparam[tgt].goal_flags,
|
||||
@ -2569,21 +2504,6 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
tgt = cts->ccb_h.target_id;
|
||||
CAMLOCK_2_ISPLOCK(isp);
|
||||
if (IS_FC(isp)) {
|
||||
#ifndef CAM_NEW_TRAN_CODE
|
||||
/*
|
||||
* a lot of normal SCSI things don't make sense.
|
||||
*/
|
||||
cts->flags = CCB_TRANS_TAG_ENB | CCB_TRANS_DISC_ENB;
|
||||
cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
/*
|
||||
* How do you measure the width of a high
|
||||
* speed serial bus? Well, in bytes.
|
||||
*
|
||||
* Offset and period make no sense, though, so we set
|
||||
* (above) a 'base' transfer speed to be gigabit.
|
||||
*/
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
#else
|
||||
fcparam *fcp = isp->isp_param;
|
||||
struct ccb_trans_settings_fc *fc =
|
||||
&cts->xport_specific.fc;
|
||||
@ -2606,14 +2526,11 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
fc->valid |= CTS_FC_VALID_WWNN |
|
||||
CTS_FC_VALID_WWPN | CTS_FC_VALID_PORT;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
#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;
|
||||
#endif
|
||||
sdparam *sdp = isp->isp_param;
|
||||
int bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path));
|
||||
uint16_t dval, pval, oval;
|
||||
@ -2634,31 +2551,6 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
pval = sdp->isp_devparam[tgt].nvrm_period;
|
||||
}
|
||||
|
||||
#ifndef CAM_NEW_TRAN_CODE
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB);
|
||||
|
||||
if (dval & DPARM_DISC) {
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
}
|
||||
if (dval & DPARM_TQING) {
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
if (dval & DPARM_WIDE) {
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
} else {
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
}
|
||||
cts->valid = CCB_TRANS_BUS_WIDTH_VALID |
|
||||
CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
|
||||
if ((dval & DPARM_SYNC) && oval != 0) {
|
||||
cts->sync_period = pval;
|
||||
cts->sync_offset = oval;
|
||||
cts->valid |=
|
||||
CCB_TRANS_SYNC_RATE_VALID |
|
||||
CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
}
|
||||
#else
|
||||
cts->protocol = PROTO_SCSI;
|
||||
cts->protocol_version = SCSI_REV_2;
|
||||
cts->transport = XPORT_SPI;
|
||||
@ -2690,7 +2582,6 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
} else {
|
||||
scsi->valid = 0;
|
||||
}
|
||||
#endif
|
||||
isp_prt(isp, ISP_LOGDEBUG0,
|
||||
"GET %s bus %d targ %d to flags %x off %x per %x",
|
||||
IS_CURRENT_SETTINGS(cts)? "ACTIVE" : "NVRAM",
|
||||
@ -2790,10 +2681,8 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
else
|
||||
cpi->base_transfer_speed = 100000;
|
||||
cpi->hba_inquiry = PI_TAG_ABLE;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_FC;
|
||||
cpi->transport_version = 0; /* WHAT'S THIS FOR? */
|
||||
#endif
|
||||
} else {
|
||||
sdparam *sdp = isp->isp_param;
|
||||
sdp += cam_sim_bus(xpt_path_sim(cpi->ccb_h.path));
|
||||
@ -2801,15 +2690,11 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->hba_misc = 0;
|
||||
cpi->initiator_id = sdp->isp_initiator_id;
|
||||
cpi->base_transfer_speed = 3300;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2; /* WHAT'S THIS FOR? */
|
||||
#endif
|
||||
}
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
|
||||
strncpy(cpi->hba_vid, "Qlogic", HBA_IDLEN);
|
||||
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
||||
@ -2885,10 +2770,8 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, void *arg)
|
||||
switch (cmd) {
|
||||
case ISPASYNC_NEW_TGT_PARAMS:
|
||||
{
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
struct ccb_trans_settings_spi *spi;
|
||||
#endif
|
||||
int flags, tgt;
|
||||
sdparam *sdp = isp->isp_param;
|
||||
struct ccb_trans_settings cts;
|
||||
@ -2913,7 +2796,6 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, void *arg)
|
||||
}
|
||||
CAMLOCK_2_ISPLOCK(isp);
|
||||
flags = sdp->isp_devparam[tgt].actv_flags;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts.type = CTS_TYPE_CURRENT_SETTINGS;
|
||||
cts.protocol = PROTO_SCSI;
|
||||
cts.transport = XPORT_SPI;
|
||||
@ -2942,26 +2824,6 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, void *arg)
|
||||
spi->sync_period = sdp->isp_devparam[tgt].actv_period;
|
||||
spi->sync_offset = sdp->isp_devparam[tgt].actv_offset;
|
||||
}
|
||||
#else
|
||||
cts.flags = CCB_TRANS_CURRENT_SETTINGS;
|
||||
cts.valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
if (flags & DPARM_DISC) {
|
||||
cts.flags |= CCB_TRANS_DISC_ENB;
|
||||
}
|
||||
if (flags & DPARM_TQING) {
|
||||
cts.flags |= CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
cts.valid |= CCB_TRANS_BUS_WIDTH_VALID;
|
||||
cts.bus_width = (flags & DPARM_WIDE)?
|
||||
MSG_EXT_WDTR_BUS_8_BIT : MSG_EXT_WDTR_BUS_16_BIT;
|
||||
cts.sync_period = sdp->isp_devparam[tgt].actv_period;
|
||||
cts.sync_offset = sdp->isp_devparam[tgt].actv_offset;
|
||||
if (flags & DPARM_SYNC) {
|
||||
cts.valid |=
|
||||
CCB_TRANS_SYNC_RATE_VALID |
|
||||
CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
}
|
||||
#endif
|
||||
isp_prt(isp, ISP_LOGDEBUG2,
|
||||
"NEW_TGT_PARAMS bus %d tgt %d period %x offset %x flags %x",
|
||||
bus, tgt, sdp->isp_devparam[tgt].actv_period,
|
||||
|
@ -2097,12 +2097,10 @@ mly_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->unit_number = cam_sim_unit(sim);
|
||||
cpi->bus_id = cam_sim_bus(sim);
|
||||
cpi->base_transfer_speed = 132 * 1024; /* XXX what to set this to? */
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2;
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
break;
|
||||
}
|
||||
@ -2111,7 +2109,6 @@ mly_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
int bus, target;
|
||||
#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;
|
||||
|
||||
@ -2168,57 +2165,6 @@ mly_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
/* disconnect always OK */
|
||||
spi->flags |= CTS_SPI_FLAGS_DISC_ENB;
|
||||
spi->valid |= CTS_SPI_VALID_DISC;
|
||||
#else
|
||||
cts->valid = 0;
|
||||
|
||||
bus = cam_sim_bus(sim);
|
||||
target = cts->ccb_h.target_id;
|
||||
/* XXX validate bus/target? */
|
||||
|
||||
debug(2, "XPT_GET_TRAN_SETTINGS %d:%d", bus, target);
|
||||
|
||||
/* logical device? */
|
||||
if (sc->mly_btl[bus][target].mb_flags & MLY_BTL_LOGICAL) {
|
||||
/* nothing special for these */
|
||||
|
||||
/* physical device? */
|
||||
} else if (sc->mly_btl[bus][target].mb_flags & MLY_BTL_PHYSICAL) {
|
||||
/* allow CAM to try tagged transactions */
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
cts->valid |= CCB_TRANS_TQ_VALID;
|
||||
|
||||
/* convert speed (MHz) to usec */
|
||||
if (sc->mly_btl[bus][target].mb_speed == 0) {
|
||||
cts->sync_period = 1000000 / 5;
|
||||
} else {
|
||||
cts->sync_period = 1000000 / sc->mly_btl[bus][target].mb_speed;
|
||||
}
|
||||
|
||||
/* convert bus width to CAM internal encoding */
|
||||
switch (sc->mly_btl[bus][target].mb_width) {
|
||||
case 32:
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_32_BIT;
|
||||
break;
|
||||
case 16:
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
break;
|
||||
}
|
||||
cts->valid |= CCB_TRANS_SYNC_RATE_VALID | CCB_TRANS_BUS_WIDTH_VALID;
|
||||
|
||||
/* not a device, bail out */
|
||||
} else {
|
||||
cts->ccb_h.status = CAM_REQ_CMP_ERR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* disconnect always OK */
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
cts->valid |= CCB_TRANS_DISC_VALID;
|
||||
#endif
|
||||
|
||||
cts->ccb_h.status = CAM_REQ_CMP;
|
||||
break;
|
||||
|
@ -2944,11 +2944,7 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
#define IS_CURRENT_SETTINGS(c) ((c)->type == CTS_TYPE_CURRENT_SETTINGS)
|
||||
#else
|
||||
#define IS_CURRENT_SETTINGS(c) ((c)->flags & CCB_TRANS_CURRENT_SETTINGS)
|
||||
#endif
|
||||
#define DP_DISC_ENABLE 0x1
|
||||
#define DP_DISC_DISABL 0x2
|
||||
#define DP_DISC (DP_DISC_ENABLE|DP_DISC_DISABL)
|
||||
@ -2965,10 +2961,8 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
|
||||
case XPT_SET_TRAN_SETTINGS: /* Nexus Settings */
|
||||
{
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi;
|
||||
struct ccb_trans_settings_spi *spi;
|
||||
#endif
|
||||
uint8_t dval;
|
||||
u_int period;
|
||||
u_int offset;
|
||||
@ -3009,28 +3003,6 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
period = 0;
|
||||
offset = 0;
|
||||
|
||||
#ifndef CAM_NEW_TRAN_CODE
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
dval |= (cts->flags & CCB_TRANS_DISC_ENB) ?
|
||||
DP_DISC_ENABLE : DP_DISC_DISABL;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
dval |= (cts->flags & CCB_TRANS_TAG_ENB) ?
|
||||
DP_TQING_ENABLE : DP_TQING_DISABL;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) {
|
||||
dval |= cts->bus_width ? DP_WIDE : DP_NARROW;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) &&
|
||||
(cts->valid & CCB_TRANS_SYNC_OFFSET_VALID)) {
|
||||
dval |= DP_SYNC;
|
||||
period = cts->sync_period;
|
||||
offset = cts->sync_offset;
|
||||
}
|
||||
#else
|
||||
scsi = &cts->proto_specific.scsi;
|
||||
spi = &cts->xport_specific.spi;
|
||||
|
||||
@ -3056,7 +3028,6 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
period = spi->sync_period;
|
||||
offset = spi->sync_offset;
|
||||
}
|
||||
#endif
|
||||
CAMLOCK_2_MPTLOCK(mpt);
|
||||
if (dval & DP_DISC_ENABLE) {
|
||||
mpt->mpt_disc_enable |= (1 << tgt);
|
||||
@ -3088,21 +3059,6 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
cts = &ccb->cts;
|
||||
if (mpt->is_fc) {
|
||||
#ifndef CAM_NEW_TRAN_CODE
|
||||
/*
|
||||
* a lot of normal SCSI things don't make sense.
|
||||
*/
|
||||
cts->flags = CCB_TRANS_TAG_ENB | CCB_TRANS_DISC_ENB;
|
||||
cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
/*
|
||||
* How do you measure the width of a high
|
||||
* speed serial bus? Well, in bytes.
|
||||
*
|
||||
* Offset and period make no sense, though, so we set
|
||||
* (above) a 'base' transfer speed to be gigabit.
|
||||
*/
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
#else
|
||||
struct ccb_trans_settings_fc *fc =
|
||||
&cts->xport_specific.fc;
|
||||
|
||||
@ -3114,20 +3070,7 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
fc->valid = CTS_FC_VALID_SPEED;
|
||||
fc->bitrate = 100000; /* XXX: Need for 2Gb/s */
|
||||
/* XXX: need a port database for each target */
|
||||
#endif
|
||||
} else if (mpt->is_sas) {
|
||||
#ifndef CAM_NEW_TRAN_CODE
|
||||
cts->flags = CCB_TRANS_TAG_ENB | CCB_TRANS_DISC_ENB;
|
||||
cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
/*
|
||||
* How do you measure the width of a high
|
||||
* speed serial bus? Well, in bytes.
|
||||
*
|
||||
* Offset and period make no sense, though, so we set
|
||||
* (above) a 'base' transfer speed to be gigabit.
|
||||
*/
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
#else
|
||||
struct ccb_trans_settings_sas *sas =
|
||||
&cts->xport_specific.sas;
|
||||
|
||||
@ -3138,7 +3081,6 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
|
||||
sas->valid = CTS_SAS_VALID_SPEED;
|
||||
sas->bitrate = 300000; /* XXX: Default 3Gbps */
|
||||
#endif
|
||||
} else if (mpt_get_spi_settings(mpt, cts) != 0) {
|
||||
mpt_set_ccb_status(ccb, CAM_REQ_CMP_ERR);
|
||||
break;
|
||||
@ -3197,32 +3139,24 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->base_transfer_speed =
|
||||
mpt->mpt_fcport_speed * 100000;
|
||||
cpi->hba_inquiry = PI_TAG_ABLE;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_FC;
|
||||
cpi->transport_version = 0;
|
||||
#endif
|
||||
} else if (mpt->is_sas) {
|
||||
cpi->hba_misc = PIM_NOBUSRESET;
|
||||
cpi->base_transfer_speed = 300000;
|
||||
cpi->hba_inquiry = PI_TAG_ABLE;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SAS;
|
||||
cpi->transport_version = 0;
|
||||
#endif
|
||||
} else {
|
||||
cpi->hba_misc = PIM_SEQSCAN;
|
||||
cpi->base_transfer_speed = 3300;
|
||||
cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->transport = XPORT_SPI;
|
||||
cpi->transport_version = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
/*
|
||||
* We give our fake RAID passhtru bus a width that is MaxVolumes
|
||||
* wide, restrict it to one lun and have it *not* be a bus
|
||||
@ -3326,10 +3260,8 @@ mpt_action(struct cam_sim *sim, union ccb *ccb)
|
||||
static int
|
||||
mpt_get_spi_settings(struct mpt_softc *mpt, struct ccb_trans_settings *cts)
|
||||
{
|
||||
#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;
|
||||
#endif
|
||||
target_id_t tgt;
|
||||
uint8_t dval, pval, oval;
|
||||
int rv;
|
||||
@ -3380,28 +3312,6 @@ mpt_get_spi_settings(struct mpt_softc *mpt, struct ccb_trans_settings *cts)
|
||||
oval = (mpt->mpt_port_page0.Capabilities >> 16) & 0xff;
|
||||
pval = (mpt->mpt_port_page0.Capabilities >> 8) & 0xff;
|
||||
}
|
||||
#ifndef CAM_NEW_TRAN_CODE
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB);
|
||||
if (dval & DP_DISC_ENABLE) {
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
}
|
||||
if (dval & DP_TQING_ENABLE) {
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
if (dval & DP_WIDE) {
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_16_BIT;
|
||||
} else {
|
||||
cts->bus_width = MSG_EXT_WDTR_BUS_8_BIT;
|
||||
}
|
||||
cts->valid = CCB_TRANS_BUS_WIDTH_VALID |
|
||||
CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID;
|
||||
if (oval) {
|
||||
cts->sync_period = pval;
|
||||
cts->sync_offset = oval;
|
||||
cts->valid |=
|
||||
CCB_TRANS_SYNC_RATE_VALID | CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
}
|
||||
#else
|
||||
cts->protocol = PROTO_SCSI;
|
||||
cts->protocol_version = SCSI_REV_2;
|
||||
cts->transport = XPORT_SPI;
|
||||
@ -3433,7 +3343,6 @@ mpt_get_spi_settings(struct mpt_softc *mpt, struct ccb_trans_settings *cts)
|
||||
} else {
|
||||
scsi->valid = 0;
|
||||
}
|
||||
#endif
|
||||
mpt_lprt(mpt, MPT_PRT_NEGOTIATION,
|
||||
"mpt_get_spi_settings[%d]: %s 0x%x period 0x%x offset %d\n", tgt,
|
||||
IS_CURRENT_SETTINGS(cts)? "ACTIVE" : "NVRAM ", dval, pval, oval);
|
||||
|
@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$");
|
||||
#define SYM_DRIVER_NAME "sym-1.6.5-20000902"
|
||||
|
||||
/* #define SYM_DEBUG_GENERIC_SUPPORT */
|
||||
/* #define CAM_NEW_TRAN_CODE */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
@ -111,13 +110,6 @@ typedef u_int8_t u8;
|
||||
typedef u_int16_t u16;
|
||||
typedef u_int32_t u32;
|
||||
|
||||
/*
|
||||
* From 'cam.error_recovery_diffs.20010313.context' patch.
|
||||
*/
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
#define FreeBSD_New_Tran_Settings
|
||||
#endif /* CAM_NEW_TRAN_CODE */
|
||||
|
||||
/*
|
||||
* Driver definitions.
|
||||
*/
|
||||
@ -1076,10 +1068,8 @@ typedef struct sym_hcb *hcb_p;
|
||||
* Gather negotiable parameters value
|
||||
*/
|
||||
struct sym_trans {
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
u8 scsi_version;
|
||||
u8 spi_version;
|
||||
#endif
|
||||
u8 period;
|
||||
u8 offset;
|
||||
u8 width;
|
||||
@ -2758,10 +2748,8 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram)
|
||||
for (i = 0 ; i < SYM_CONF_MAX_TARGET ; i++) {
|
||||
tcb_p tp = &np->target[i];
|
||||
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
tp->tinfo.user.scsi_version = tp->tinfo.current.scsi_version= 2;
|
||||
tp->tinfo.user.spi_version = tp->tinfo.current.spi_version = 2;
|
||||
#endif
|
||||
tp->tinfo.user.period = np->minsync;
|
||||
tp->tinfo.user.offset = np->maxoffs;
|
||||
tp->tinfo.user.width = np->maxwide ? BUS_16_BIT : BUS_8_BIT;
|
||||
@ -2779,9 +2767,7 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram)
|
||||
tp->tinfo.user.width == BUS_16_BIT) {
|
||||
tp->tinfo.user.options |= PPR_OPT_DT;
|
||||
tp->tinfo.user.offset = np->maxoffs_dt;
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
tp->tinfo.user.spi_version = 3;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -3468,7 +3454,6 @@ sym_xpt_async_transfer_neg(hcb_p np, int target, u_int spi_valid)
|
||||
|
||||
bzero(&cts, sizeof(cts));
|
||||
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
#define cts__scsi (cts.proto_specific.scsi)
|
||||
#define cts__spi (cts.xport_specific.spi)
|
||||
|
||||
@ -3489,21 +3474,11 @@ sym_xpt_async_transfer_neg(hcb_p np, int target, u_int spi_valid)
|
||||
cts__spi.ppr_options = tp->tinfo.current.options;
|
||||
#undef cts__spi
|
||||
#undef cts__scsi
|
||||
#else
|
||||
cts.valid = spi_valid;
|
||||
if (spi_valid & CCB_TRANS_SYNC_RATE_VALID)
|
||||
cts.sync_period = tp->tinfo.current.period;
|
||||
if (spi_valid & CCB_TRANS_SYNC_OFFSET_VALID)
|
||||
cts.sync_offset = tp->tinfo.current.offset;
|
||||
if (spi_valid & CCB_TRANS_BUS_WIDTH_VALID)
|
||||
cts.bus_width = tp->tinfo.current.width;
|
||||
#endif
|
||||
xpt_setup_ccb(&cts.ccb_h, path, /*priority*/1);
|
||||
xpt_async(AC_TRANSFER_NEG, path, &cts);
|
||||
xpt_free_path(path);
|
||||
}
|
||||
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
#define SYM_SPI_VALID_WDTR \
|
||||
CTS_SPI_VALID_BUS_WIDTH | \
|
||||
CTS_SPI_VALID_SYNC_RATE | \
|
||||
@ -3516,19 +3491,6 @@ sym_xpt_async_transfer_neg(hcb_p np, int target, u_int spi_valid)
|
||||
CTS_SPI_VALID_BUS_WIDTH | \
|
||||
CTS_SPI_VALID_SYNC_RATE | \
|
||||
CTS_SPI_VALID_SYNC_OFFSET
|
||||
#else
|
||||
#define SYM_SPI_VALID_WDTR \
|
||||
CCB_TRANS_BUS_WIDTH_VALID | \
|
||||
CCB_TRANS_SYNC_RATE_VALID | \
|
||||
CCB_TRANS_SYNC_OFFSET_VALID
|
||||
#define SYM_SPI_VALID_SDTR \
|
||||
CCB_TRANS_SYNC_RATE_VALID | \
|
||||
CCB_TRANS_SYNC_OFFSET_VALID
|
||||
#define SYM_SPI_VALID_PPR \
|
||||
CCB_TRANS_BUS_WIDTH_VALID | \
|
||||
CCB_TRANS_SYNC_RATE_VALID | \
|
||||
CCB_TRANS_SYNC_OFFSET_VALID
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We received a WDTR.
|
||||
@ -4815,10 +4777,8 @@ static void sym_sir_bad_scsi_status(hcb_p np, int num, ccb_p cp)
|
||||
*/
|
||||
cp->sensecmd[0] = 0x03;
|
||||
cp->sensecmd[1] = cp->lun << 5;
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
if (tp->tinfo.current.scsi_version > 2 || cp->lun > 7)
|
||||
cp->sensecmd[1] = 0;
|
||||
#endif
|
||||
cp->sensecmd[4] = SYM_SNS_BBUF_LEN;
|
||||
cp->data_len = SYM_SNS_BBUF_LEN;
|
||||
|
||||
@ -8073,20 +8033,12 @@ static void sym_action2(struct cam_sim *sim, union ccb *ccb)
|
||||
* Update SCSI device settings in LUN control block.
|
||||
*/
|
||||
lp = sym_lp(np, tp, ccb_h->target_lun);
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
#endif
|
||||
sym_update_trans(np, tp, &tp->tinfo.goal, cts);
|
||||
if (lp)
|
||||
sym_update_dflags(np, &lp->current_flags, cts);
|
||||
}
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
if (cts->type == CTS_TYPE_USER_SETTINGS) {
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0) {
|
||||
#endif
|
||||
sym_update_trans(np, tp, &tp->tinfo.user, cts);
|
||||
if (lp)
|
||||
sym_update_dflags(np, &lp->user_flags, cts);
|
||||
@ -8105,7 +8057,6 @@ static void sym_action2(struct cam_sim *sim, union ccb *ccb)
|
||||
tp = &np->target[ccb_h->target_id];
|
||||
lp = sym_lp(np, tp, ccb_h->target_lun);
|
||||
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
#define cts__scsi (&cts->proto_specific.scsi)
|
||||
#define cts__spi (&cts->xport_specific.spi)
|
||||
if (cts->type == CTS_TYPE_CURRENT_SETTINGS) {
|
||||
@ -8143,35 +8094,6 @@ static void sym_action2(struct cam_sim *sim, union ccb *ccb)
|
||||
cts__scsi->valid |= CTS_SCSI_VALID_TQ;
|
||||
#undef cts__spi
|
||||
#undef cts__scsi
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
tip = &tp->tinfo.current;
|
||||
dflags = lp ? lp->current_flags : 0;
|
||||
}
|
||||
else {
|
||||
tip = &tp->tinfo.user;
|
||||
dflags = lp ? lp->user_flags : tp->usrflags;
|
||||
}
|
||||
|
||||
cts->sync_period = tip->period;
|
||||
cts->sync_offset = tip->offset;
|
||||
cts->bus_width = tip->width;
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID;
|
||||
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB|CCB_TRANS_TAG_ENB);
|
||||
|
||||
if (dflags & SYM_DISC_ENABLED)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
|
||||
if (dflags & SYM_TAGS_ENABLED)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
|
||||
cts->valid |= CCB_TRANS_DISC_VALID;
|
||||
cts->valid |= CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
sym_xpt_done2(np, ccb, CAM_REQ_CMP);
|
||||
break;
|
||||
}
|
||||
@ -8208,7 +8130,6 @@ static void sym_action2(struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
||||
cpi->unit_number = cam_sim_unit(sim);
|
||||
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
cpi->protocol = PROTO_SCSI;
|
||||
cpi->protocol_version = SCSI_REV_2;
|
||||
cpi->transport = XPORT_SPI;
|
||||
@ -8219,7 +8140,6 @@ static void sym_action2(struct cam_sim *sim, union ccb *ccb)
|
||||
cpi->xport_specific.spi.ppr_options =
|
||||
SID_SPI_CLOCK_DT_ST;
|
||||
}
|
||||
#endif
|
||||
sym_xpt_done2(np, ccb, CAM_REQ_CMP);
|
||||
break;
|
||||
}
|
||||
@ -8318,7 +8238,6 @@ static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip,
|
||||
/*
|
||||
* Update the infos.
|
||||
*/
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
#define cts__spi (&cts->xport_specific.spi)
|
||||
if ((cts__spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0)
|
||||
tip->width = cts__spi->bus_width;
|
||||
@ -8335,14 +8254,6 @@ static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip,
|
||||
cts->transport_version != XPORT_VERSION_UNKNOWN)
|
||||
tip->spi_version = cts->transport_version;
|
||||
#undef cts__spi
|
||||
#else
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0)
|
||||
tip->width = cts->bus_width;
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)
|
||||
tip->offset = cts->sync_offset;
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0)
|
||||
tip->period = cts->sync_period;
|
||||
#endif
|
||||
/*
|
||||
* Scale against driver configuration limits.
|
||||
*/
|
||||
@ -8356,7 +8267,6 @@ static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip,
|
||||
if (tip->width > np->maxwide)
|
||||
tip->width = np->maxwide;
|
||||
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
/*
|
||||
* Only accept DT if controller supports and SYNC/WIDE asked.
|
||||
*/
|
||||
@ -8364,16 +8274,6 @@ static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip,
|
||||
!(tip->width == BUS_16_BIT && tip->offset)) {
|
||||
tip->options &= ~PPR_OPT_DT;
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* For now, only assume DT if period <= 9, BUS 16 and offset != 0.
|
||||
*/
|
||||
tip->options = 0;
|
||||
if ((np->features & (FE_C10|FE_ULTRA3)) == (FE_C10|FE_ULTRA3) &&
|
||||
tip->period <= 9 && tip->width == BUS_16_BIT && tip->offset) {
|
||||
tip->options |= PPR_OPT_DT;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Scale period factor and offset against controller limits.
|
||||
@ -8402,7 +8302,6 @@ static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip,
|
||||
static void
|
||||
sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts)
|
||||
{
|
||||
#ifdef FreeBSD_New_Tran_Settings
|
||||
#define cts__scsi (&cts->proto_specific.scsi)
|
||||
#define cts__spi (&cts->xport_specific.spi)
|
||||
if ((cts__spi->valid & CTS_SPI_VALID_DISC) != 0) {
|
||||
@ -8420,21 +8319,6 @@ sym_update_dflags(hcb_p np, u_char *flags, struct ccb_trans_settings *cts)
|
||||
}
|
||||
#undef cts__spi
|
||||
#undef cts__scsi
|
||||
#else
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
*flags |= SYM_DISC_ENABLED;
|
||||
else
|
||||
*flags &= ~SYM_DISC_ENABLED;
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
*flags |= SYM_TAGS_ENABLED;
|
||||
else
|
||||
*flags &= ~SYM_TAGS_ENABLED;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -711,12 +711,10 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
|
||||
strncpy(cpi->hba_vid, "Tekram_TRM", HBA_IDLEN);
|
||||
strncpy(cpi->dev_name, cam_sim_name(psim), DEV_IDLEN);
|
||||
cpi->unit_number = cam_sim_unit(psim);
|
||||
#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(pccb);
|
||||
}
|
||||
@ -839,7 +837,6 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
|
||||
int intflag;
|
||||
struct trm_transinfo *tinfo;
|
||||
PDCB pDCB;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -894,53 +891,6 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
|
||||
CTS_SPI_VALID_BUS_WIDTH |
|
||||
CTS_SPI_VALID_DISC;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
|
||||
TRM_DPRINTF(" XPT_GET_TRAN_SETTINGS \n");
|
||||
pDCB = &pACB->DCBarray[target_id][target_lun];
|
||||
intflag = splcam();
|
||||
/*
|
||||
* disable interrupt
|
||||
*/
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
/* current transfer settings */
|
||||
if (pDCB->tinfo.disc_tag & TRM_CUR_DISCENB)
|
||||
cts->flags = CCB_TRANS_DISC_ENB;
|
||||
else
|
||||
cts->flags = 0;/* no tag & disconnect */
|
||||
if (pDCB->tinfo.disc_tag & TRM_CUR_TAGENB)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
tinfo = &pDCB->tinfo.current;
|
||||
TRM_DPRINTF("CURRENT: cts->flags= %2x \n",
|
||||
cts->flags);
|
||||
} else {
|
||||
/* default(user) transfer settings */
|
||||
if (pDCB->tinfo.disc_tag & TRM_USR_DISCENB)
|
||||
cts->flags = CCB_TRANS_DISC_ENB;
|
||||
else
|
||||
cts->flags = 0;
|
||||
if (pDCB->tinfo.disc_tag & TRM_USR_TAGENB)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
tinfo = &pDCB->tinfo.user;
|
||||
TRM_DPRINTF("USER: cts->flags= %2x \n",
|
||||
cts->flags);
|
||||
}
|
||||
cts->sync_period = tinfo->period;
|
||||
cts->sync_offset = tinfo->offset;
|
||||
cts->bus_width = tinfo->width;
|
||||
TRM_DPRINTF("pDCB->SyncPeriod: %d \n",
|
||||
pDCB->SyncPeriod);
|
||||
TRM_DPRINTF("period: %d \n", tinfo->period);
|
||||
TRM_DPRINTF("offset: %d \n", tinfo->offset);
|
||||
TRM_DPRINTF("width: %d \n", tinfo->width);
|
||||
|
||||
splx(intflag);
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID |
|
||||
CCB_TRANS_SYNC_OFFSET_VALID |
|
||||
CCB_TRANS_BUS_WIDTH_VALID |
|
||||
CCB_TRANS_DISC_VALID |
|
||||
CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
pccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(pccb);
|
||||
}
|
||||
@ -955,7 +905,6 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
|
||||
u_int update_type;
|
||||
int intflag;
|
||||
PDCB pDCB;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -1041,88 +990,6 @@ trm_action(struct cam_sim *psim, union ccb *pccb)
|
||||
pDCB->tinfo.goal.width = spi->bus_width;
|
||||
}
|
||||
splx(intflag);
|
||||
#else
|
||||
TRM_DPRINTF(" XPT_SET_TRAN_SETTINGS \n");
|
||||
update_type = 0;
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0)
|
||||
update_type |= TRM_TRANS_GOAL;
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0)
|
||||
update_type |= TRM_TRANS_USER;
|
||||
intflag = splcam();
|
||||
pDCB = &pACB->DCBarray[target_id][target_lun];
|
||||
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
/*ccb disc enables */
|
||||
if (update_type & TRM_TRANS_GOAL) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB)
|
||||
!= 0)
|
||||
pDCB->tinfo.disc_tag
|
||||
|= TRM_CUR_DISCENB;
|
||||
else
|
||||
pDCB->tinfo.disc_tag &=
|
||||
~TRM_CUR_DISCENB;
|
||||
}
|
||||
if (update_type & TRM_TRANS_USER) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB)
|
||||
!= 0)
|
||||
pDCB->tinfo.disc_tag
|
||||
|= TRM_USR_DISCENB;
|
||||
else
|
||||
pDCB->tinfo.disc_tag &=
|
||||
~TRM_USR_DISCENB;
|
||||
}
|
||||
}
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
/* if ccb tag q active */
|
||||
if (update_type & TRM_TRANS_GOAL) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB)
|
||||
!= 0)
|
||||
pDCB->tinfo.disc_tag |=
|
||||
TRM_CUR_TAGENB;
|
||||
else
|
||||
pDCB->tinfo.disc_tag &=
|
||||
~TRM_CUR_TAGENB;
|
||||
}
|
||||
if (update_type & TRM_TRANS_USER) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB)
|
||||
!= 0)
|
||||
pDCB->tinfo.disc_tag |=
|
||||
TRM_USR_TAGENB;
|
||||
else
|
||||
pDCB->tinfo.disc_tag &=
|
||||
~TRM_USR_TAGENB;
|
||||
}
|
||||
}
|
||||
/* Minimum sync period factor */
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) {
|
||||
/* if ccb sync active */
|
||||
/* TRM-S1040 MinSyncPeriod = 4 clocks/byte */
|
||||
if ((cts->sync_period != 0) &&
|
||||
(cts->sync_period < 125))
|
||||
cts->sync_period = 125;
|
||||
/* 1/(125*4) minsync 2 MByte/sec */
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID)
|
||||
!= 0) {
|
||||
if (cts->sync_offset == 0)
|
||||
cts->sync_period = 0;
|
||||
/* TRM-S1040 MaxSyncOffset = 15 bytes*/
|
||||
if (cts->sync_offset > 15)
|
||||
cts->sync_offset = 15;
|
||||
}
|
||||
}
|
||||
if ((update_type & TRM_TRANS_USER) != 0) {
|
||||
pDCB->tinfo.user.period = cts->sync_period;
|
||||
pDCB->tinfo.user.offset = cts->sync_offset;
|
||||
pDCB->tinfo.user.width = cts->bus_width;
|
||||
}
|
||||
if ((update_type & TRM_TRANS_GOAL) != 0) {
|
||||
pDCB->tinfo.goal.period = cts->sync_period;
|
||||
pDCB->tinfo.goal.offset = cts->sync_offset;
|
||||
pDCB->tinfo.goal.width = cts->bus_width;
|
||||
}
|
||||
splx(intflag);
|
||||
#endif
|
||||
pccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(pccb);
|
||||
break;
|
||||
@ -2431,16 +2298,10 @@ trm_SetXferRate(PACB pACB,PSRB pSRB, PDCB pDCB)
|
||||
TRM_DPRINTF("trm_SetXferRate\n");
|
||||
pccb = pSRB->pccb;
|
||||
memset(&neg, 0, sizeof (neg));
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
neg.xport_specific.spi.sync_period = pDCB->tinfo.goal.period;
|
||||
neg.xport_specific.spi.sync_offset = pDCB->tinfo.goal.offset;
|
||||
neg.xport_specific.spi.valid =
|
||||
CTS_SPI_VALID_SYNC_RATE | CTS_SPI_VALID_SYNC_OFFSET;
|
||||
#else
|
||||
neg.sync_period = pDCB->tinfo.goal.period;
|
||||
neg.sync_offset = pDCB->tinfo.goal.offset;
|
||||
neg.valid = CCB_TRANS_SYNC_RATE_VALID | CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
#endif
|
||||
xpt_setup_ccb(&neg.ccb_h, pccb->ccb_h.path, /* priority */1);
|
||||
xpt_async(AC_TRANSFER_NEG, pccb->ccb_h.path, &neg);
|
||||
if (!(pDCB->IdentifyMsg & 0x07)) {
|
||||
|
@ -420,7 +420,6 @@ twa_action(struct cam_sim *sim, union ccb *ccb)
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -435,10 +434,6 @@ twa_action(struct cam_sim *sim, union ccb *ccb)
|
||||
spi->flags = CTS_SPI_FLAGS_DISC_ENB;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
scsi->flags = CTS_SCSI_FLAGS_TAG_ENB;
|
||||
#else
|
||||
cts->valid = (CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID);
|
||||
cts->flags &= ~(CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB);
|
||||
#endif
|
||||
tw_osli_dbg_dprintf(3, sc, "XPT_GET_TRAN_SETTINGS");
|
||||
ccb_h->status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
@ -471,12 +466,10 @@ twa_action(struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(path_inq->sim_vid, "FreeBSD", SIM_IDLEN);
|
||||
strncpy(path_inq->hba_vid, "3ware", HBA_IDLEN);
|
||||
strncpy(path_inq->dev_name, cam_sim_name(sim), DEV_IDLEN);
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
path_inq->transport = XPORT_SPI;
|
||||
path_inq->transport_version = 2;
|
||||
path_inq->protocol = PROTO_SCSI;
|
||||
path_inq->protocol_version = SCSI_REV_2;
|
||||
#endif
|
||||
ccb_h->status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
|
@ -2606,21 +2606,12 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb)
|
||||
case XPT_GET_TRAN_SETTINGS:
|
||||
{
|
||||
struct ccb_trans_settings *cts = &ccb->cts;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
cts->protocol = PROTO_SCSI;
|
||||
cts->protocol_version = SCSI_REV_2;
|
||||
cts->transport = XPORT_USB;
|
||||
cts->transport_version = XPORT_VERSION_UNSPECIFIED;
|
||||
cts->xport_specific.valid = 0;
|
||||
|
||||
#else
|
||||
DPRINTF(UDMASS_SCSI, ("%s:%d:%d:%d:XPT_GET_TRAN_SETTINGS:.\n",
|
||||
device_get_nameunit(sc->sc_dev), cam_sim_path(sc->umass_sim),
|
||||
ccb->ccb_h.target_id, ccb->ccb_h.target_lun));
|
||||
|
||||
cts->valid = 0;
|
||||
cts->flags = 0; /* no disconnection, tagging */
|
||||
#endif
|
||||
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
|
143
sys/pci/ncr.c
143
sys/pci/ncr.c
@ -4190,15 +4190,12 @@ ncr_action (struct cam_sim *sim, union ccb *ccb)
|
||||
tcb_p tp;
|
||||
u_int update_type;
|
||||
int s;
|
||||
#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;
|
||||
#endif
|
||||
|
||||
update_type = 0;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
if (cts->type == CTS_TYPE_CURRENT_SETTINGS)
|
||||
update_type |= NCR_TRANS_GOAL;
|
||||
if (cts->type == CTS_TYPE_USER_SETTINGS)
|
||||
@ -4279,88 +4276,6 @@ ncr_action (struct cam_sim *sim, union ccb *ccb)
|
||||
tp->tinfo.goal.width = spi->bus_width;
|
||||
}
|
||||
splx(s);
|
||||
#else
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0)
|
||||
update_type |= NCR_TRANS_GOAL;
|
||||
if ((cts->flags & CCB_TRANS_USER_SETTINGS) != 0)
|
||||
update_type |= NCR_TRANS_USER;
|
||||
|
||||
s = splcam();
|
||||
tp = &np->target[ccb->ccb_h.target_id];
|
||||
/* Tag and disc enables */
|
||||
if ((cts->valid & CCB_TRANS_DISC_VALID) != 0) {
|
||||
if (update_type & NCR_TRANS_GOAL) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
tp->tinfo.disc_tag |= NCR_CUR_DISCENB;
|
||||
else
|
||||
tp->tinfo.disc_tag &= ~NCR_CUR_DISCENB;
|
||||
}
|
||||
|
||||
if (update_type & NCR_TRANS_USER) {
|
||||
if ((cts->flags & CCB_TRANS_DISC_ENB) != 0)
|
||||
tp->tinfo.disc_tag |= NCR_USR_DISCENB;
|
||||
else
|
||||
tp->tinfo.disc_tag &= ~NCR_USR_DISCENB;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((cts->valid & CCB_TRANS_TQ_VALID) != 0) {
|
||||
if (update_type & NCR_TRANS_GOAL) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
tp->tinfo.disc_tag |= NCR_CUR_TAGENB;
|
||||
else
|
||||
tp->tinfo.disc_tag &= ~NCR_CUR_TAGENB;
|
||||
}
|
||||
|
||||
if (update_type & NCR_TRANS_USER) {
|
||||
if ((cts->flags & CCB_TRANS_TAG_ENB) != 0)
|
||||
tp->tinfo.disc_tag |= NCR_USR_TAGENB;
|
||||
else
|
||||
tp->tinfo.disc_tag &= ~NCR_USR_TAGENB;
|
||||
}
|
||||
}
|
||||
|
||||
/* Filter bus width and sync negotiation settings */
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0) {
|
||||
if (cts->bus_width > np->maxwide)
|
||||
cts->bus_width = np->maxwide;
|
||||
}
|
||||
|
||||
if (((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0)
|
||||
|| ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)) {
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0) {
|
||||
if (cts->sync_period != 0
|
||||
&& (cts->sync_period < np->minsync))
|
||||
cts->sync_period = np->minsync;
|
||||
}
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0) {
|
||||
if (cts->sync_offset == 0)
|
||||
cts->sync_period = 0;
|
||||
if (cts->sync_offset > np->maxoffs)
|
||||
cts->sync_offset = np->maxoffs;
|
||||
}
|
||||
}
|
||||
if ((update_type & NCR_TRANS_USER) != 0) {
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0)
|
||||
tp->tinfo.user.period = cts->sync_period;
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)
|
||||
tp->tinfo.user.offset = cts->sync_offset;
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0)
|
||||
tp->tinfo.user.width = cts->bus_width;
|
||||
}
|
||||
if ((update_type & NCR_TRANS_GOAL) != 0) {
|
||||
if ((cts->valid & CCB_TRANS_SYNC_RATE_VALID) != 0)
|
||||
tp->tinfo.goal.period = cts->sync_period;
|
||||
|
||||
if ((cts->valid & CCB_TRANS_SYNC_OFFSET_VALID) != 0)
|
||||
tp->tinfo.goal.offset = cts->sync_offset;
|
||||
|
||||
if ((cts->valid & CCB_TRANS_BUS_WIDTH_VALID) != 0)
|
||||
tp->tinfo.goal.width = cts->bus_width;
|
||||
}
|
||||
splx(s);
|
||||
#endif
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
break;
|
||||
@ -4372,7 +4287,6 @@ ncr_action (struct cam_sim *sim, union ccb *ccb)
|
||||
struct ncr_transinfo *tinfo;
|
||||
tcb_p tp = &np->target[ccb->ccb_h.target_id];
|
||||
int s;
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
struct ccb_trans_settings_scsi *scsi =
|
||||
&cts->proto_specific.scsi;
|
||||
struct ccb_trans_settings_spi *spi =
|
||||
@ -4418,44 +4332,6 @@ ncr_action (struct cam_sim *sim, union ccb *ccb)
|
||||
| CTS_SPI_VALID_BUS_WIDTH
|
||||
| CTS_SPI_VALID_DISC;
|
||||
scsi->valid = CTS_SCSI_VALID_TQ;
|
||||
#else
|
||||
s = splcam();
|
||||
if ((cts->flags & CCB_TRANS_CURRENT_SETTINGS) != 0) {
|
||||
tinfo = &tp->tinfo.current;
|
||||
if (tp->tinfo.disc_tag & NCR_CUR_DISCENB)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
else
|
||||
cts->flags &= ~CCB_TRANS_DISC_ENB;
|
||||
|
||||
if (tp->tinfo.disc_tag & NCR_CUR_TAGENB)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
else
|
||||
cts->flags &= ~CCB_TRANS_TAG_ENB;
|
||||
} else {
|
||||
tinfo = &tp->tinfo.user;
|
||||
if (tp->tinfo.disc_tag & NCR_USR_DISCENB)
|
||||
cts->flags |= CCB_TRANS_DISC_ENB;
|
||||
else
|
||||
cts->flags &= ~CCB_TRANS_DISC_ENB;
|
||||
|
||||
if (tp->tinfo.disc_tag & NCR_USR_TAGENB)
|
||||
cts->flags |= CCB_TRANS_TAG_ENB;
|
||||
else
|
||||
cts->flags &= ~CCB_TRANS_TAG_ENB;
|
||||
}
|
||||
|
||||
cts->sync_period = tinfo->period;
|
||||
cts->sync_offset = tinfo->offset;
|
||||
cts->bus_width = tinfo->width;
|
||||
|
||||
splx(s);
|
||||
|
||||
cts->valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID
|
||||
| CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_DISC_VALID
|
||||
| CCB_TRANS_TQ_VALID;
|
||||
#endif
|
||||
|
||||
ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
xpt_done(ccb);
|
||||
@ -4504,12 +4380,10 @@ ncr_action (struct cam_sim *sim, union ccb *ccb)
|
||||
strncpy(cpi->hba_vid, "Symbios", 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;
|
||||
@ -5085,7 +4959,6 @@ ncr_setsync(ncb_p np, nccb_p cp, u_char scntl3, u_char sxfer, u_char period)
|
||||
** new transfer parameters.
|
||||
*/
|
||||
memset(&neg, 0, sizeof (neg));
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
neg.protocol = PROTO_SCSI;
|
||||
neg.protocol_version = SCSI_REV_2;
|
||||
neg.transport = XPORT_SPI;
|
||||
@ -5094,12 +4967,6 @@ ncr_setsync(ncb_p np, nccb_p cp, u_char scntl3, u_char sxfer, u_char period)
|
||||
neg.xport_specific.spi.sync_offset = sxfer & 0x1f;
|
||||
neg.xport_specific.spi.valid = CTS_SPI_VALID_SYNC_RATE
|
||||
| CTS_SPI_VALID_SYNC_OFFSET;
|
||||
#else
|
||||
neg.sync_period = period;
|
||||
neg.sync_offset = sxfer & 0x1f;
|
||||
neg.valid = CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
#endif
|
||||
xpt_setup_ccb(&neg.ccb_h, ccb->ccb_h.path,
|
||||
/*priority*/1);
|
||||
xpt_async(AC_TRANSFER_NEG, ccb->ccb_h.path, &neg);
|
||||
@ -5169,7 +5036,6 @@ static void ncr_setwide (ncb_p np, nccb_p cp, u_char wide, u_char ack)
|
||||
|
||||
/* Tell the SCSI layer about the new transfer params */
|
||||
memset(&neg, 0, sizeof (neg));
|
||||
#ifdef CAM_NEW_TRAN_CODE
|
||||
neg.protocol = PROTO_SCSI;
|
||||
neg.protocol_version = SCSI_REV_2;
|
||||
neg.transport = XPORT_SPI;
|
||||
@ -5181,15 +5047,6 @@ static void ncr_setwide (ncb_p np, nccb_p cp, u_char wide, u_char ack)
|
||||
neg.xport_specific.spi.valid = CTS_SPI_VALID_SYNC_RATE
|
||||
| CTS_SPI_VALID_SYNC_OFFSET
|
||||
| CTS_SPI_VALID_BUS_WIDTH;
|
||||
#else
|
||||
neg.bus_width = (scntl3 & EWS) ? MSG_EXT_WDTR_BUS_16_BIT
|
||||
: MSG_EXT_WDTR_BUS_8_BIT;
|
||||
neg.sync_period = 0;
|
||||
neg.sync_offset = 0;
|
||||
neg.valid = CCB_TRANS_BUS_WIDTH_VALID
|
||||
| CCB_TRANS_SYNC_RATE_VALID
|
||||
| CCB_TRANS_SYNC_OFFSET_VALID;
|
||||
#endif
|
||||
xpt_setup_ccb(&neg.ccb_h, ccb->ccb_h.path, /*priority*/1);
|
||||
xpt_async(AC_TRANSFER_NEG, ccb->ccb_h.path, &neg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user