Rip off target mode support for parallel SCSI QLogic adapters.

Hacks to enable target mode there complicated code, while didn't really
work.  And for outdated hardware fixing it is not really interesting.

Initiator mode tested with Qlogic 1080 adapter is still working fine.
This commit is contained in:
Alexander Motin 2015-11-23 10:06:19 +00:00
parent 0981c67bd8
commit 3e6deb330e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291188
18 changed files with 162 additions and 8908 deletions

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 29, 2015
.Dd November 22, 2015
.Dt ISP 4
.Os
.Sh NAME
@ -60,31 +60,20 @@ devices.
SCSI features include support for Ultra SCSI and wide mode transactions
for
.Tn SCSI ,
Ultra2 LVD (ISP1080, ISP1280), and Ultra3 LVD (ISP12160).
Ultra2 LVD (1080, 1280), and Ultra3 LVD (10160, 12160).
.Pp
Fibre Channel support uses FCP SCSI profile for
.Tn FibreChannel ,
and utilizes Class 3 and Class 2 connections (Qlogic 2100 is Class
3 only, minor patches to the Qlogic 2200 to force Class 2 mode).
Support is available for Public and Private loops, and for
point-to-point connections (Qlogic 2200 only).
and utilizes Class 3 and Class 2 (2200 and later) connections.
Support is available for Public and Private loops, Point-to-Point
and Fabric connections.
The newer 2-Gigabit cards (2300, 2312, 2322), 4-Gigabit (2422, 2432)
and 8-Gigabit (2532) are also supported.
Command tagging is supported for all (in fact,
.Tn FibreChannel
requires tagging).
Fabric support is enabled by default for other than 2100 cards.
Fabric support for 2100 cards has been so problematic and these cards are so
old now that it is just not worth your time to try it.
and 8-Gigabit (2532) are supported in both initiator and target modes.
.Sh FIRMWARE
Firmware is available if the
Firmware loading is supported if the
.Xr ispfw 4
module is loaded during bootstrap (q.v.).
.Pp
It is
.Ar strongly
recommended that you use the firmware available
from
module is loaded.
It is strongly recommended that you use the firmware available from
.Xr ispfw 4
as it is the most likely to have been tested with this driver.
.Sh HARDWARE
@ -92,53 +81,47 @@ Cards supported by the
.Nm
driver include:
.Bl -tag -width xxxxxx -offset indent
.It ISP1000
SBus Fast Wide, Ultra Fast Wide cards, Single Ended or Differential
cards.
.It ISP1020
Qlogic 1020 Fast Wide and Differential Fast Wide PCI cards.
.It ISP1040
Qlogic 1040 Ultra Wide and Differential Ultra Wide PCI cards.
Also known as the DEC KZPBA-CA (single ended) and KZPBA-CB (HVD differential).
.It Qlogic 1000
Fast Wide, Ultra Fast Wide cards, Single Ended or Differential SBus cards.
.It Qlogic 1020
Qlogic 1020 SCSI cards.
Fast Wide and Differential Fast Wide SCSI PCI cards.
.It Qlogic 1040
Qlogic 1040 Ultra SCSI cards.
Ultra Wide and Differential Ultra Wide SCSI PCI cards.
Also known as the DEC KZPBA-CA (single ended) and KZPBA-CB (HVD differential).
.It Qlogic 1080
Qlogic 1080 LVD Ultra2 Wide SCSI cards.
LVD Ultra2 Wide SCSI PCI cards.
.It Qlogic 10160
Qlogic 10160 LVD Ultra3 Wide PCI cards.
LVD Ultra3 Wide SCSI PCI cards.
.It Qlogic 1240
Qlogic 1240 Dual Bus Ultra Wide and Differential Ultra Wide PCI cards.
Dual Bus Ultra Wide and Differential Ultra Wide SCSI PCI cards.
.It Qlogic 1280
Qlogic 1280 Dual Bus LVD Ultra2 Wide PCI cards.
Dual Bus LVD Ultra2 Wide SCSI PCI cards.
.It Qlogic 12160
Qlogic 12160 Dual Bus LVD Ultra3 Wide PCI cards.
Dual Bus LVD Ultra3 Wide SCSI PCI cards.
.It Qlogic 210X
Qlogic 2100 and 2100A Copper and Optical Fibre Channel Arbitrated
Loop (single, dual).
Copper and Optical Fibre Channel Arbitrated Loop PCI cards (single, dual).
.It Qlogic 220X
Qlogic 2200 Copper and Optical Fibre Channel Arbitrated Loop PCI
cards (single, dual, quad).
Copper and Optical Fibre Channel Arbitrated Loop PCI cards (single, dual, quad).
.It Qlogic 2300
Qlogic 2300 Optical 2Gb Fibre Channel PCI cards.
Optical 2Gb Fibre Channel PCI cards.
.It Qlogic 2312
Qlogic 2312 Optical 2Gb Fibre Channel PCI cards.
Optical 2Gb Fibre Channel PCI cards.
.It Qlogic 234X
Qlogic 234X Optical 2Gb Fibre Channel PCI cards (2312 chipset, single and dual attach).
Optical 2Gb Fibre Channel PCI cards (2312 chipset, single and dual attach).
.It Qlogic 2322
Qlogic 2322 Optical 2Gb Fibre Channel PCIe cards.
Optical 2Gb Fibre Channel PCIe cards.
.It Qlogic 200
Dell branded version of the QLogic 2312.
.It Qlogic 2422
Qlogic 2422 Optical 4Gb Fibre Channel PCI cards.
Optical 4Gb Fibre Channel PCI cards.
.It Qlogic 2432
Qlogic 2432 Optical 4Gb Fibre Channel PCIe cards.
Optical 4Gb Fibre Channel PCIe cards.
.It Qlogic 2532
Qlogic 2532 Optical 8Gb Fibre Channel PCIe cards.
Optical 8Gb Fibre Channel PCIe cards.
.El
.Sh CONFIGURATION OPTIONS
Target mode support may be enabled with the
Target mode support for 23xx and above Fibre Channel adapters may be
enabled with the
.Pp
.Cd options ISP_TARGET_MODE
.Pp
@ -192,7 +175,8 @@ cards in Local Loop topologies it is
.Ar strongly
recommended that you set this value to non-zero.
.It Va hint.isp.0.role
A hint to define default role for isp instance (target, initiator, both).
A hint to define default role for isp instance (0 -- none, 1 -- target,
2 -- initiator, 3 -- both).
.It Va hint.isp.0.debug
A hint value for a driver debug level (see the file
.Pa /usr/src/sys/dev/isp/ispvar.h
@ -236,5 +220,5 @@ Some later improvement was done by
.Sh BUGS
The driver currently ignores some NVRAM settings.
.Pp
Target mode support works reasonably well for 23xx and above Fibre Channel
cards, but not really tested on older ones.
Fabric support for 2100 cards has been so problematic, and these cards are so
old now that it is just not worth your time to try it.

View File

@ -1089,12 +1089,8 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
(((uint64_t) mbs.param[17]) << 48);
}
}
} else if (IS_SCSI(isp)) {
#ifndef ISP_TARGET_MODE
isp->isp_fwattr = ISP_FW_ATTR_TMODE;
#else
} else {
isp->isp_fwattr = 0;
#endif
}
isp_prt(isp, ISP_LOGCONFIG, "Board Type %s, Chip Revision 0x%x, %s F/W Revision %d.%d.%d",
@ -1907,10 +1903,10 @@ isp_fibre_init(ispsoftc_t *isp)
icbp->icb_logintime = ICB_LOGIN_TOV;
#ifdef ISP_TARGET_MODE
if (IS_23XX(isp) && (icbp->icb_fwoptions & ICBOPT_TGT_ENABLE)) {
if (icbp->icb_fwoptions & ICBOPT_TGT_ENABLE) {
icbp->icb_lunenables = 0xffff;
icbp->icb_ccnt = DFLT_CMND_CNT;
icbp->icb_icnt = DFLT_INOT_CNT;
icbp->icb_ccnt = 0xff;
icbp->icb_icnt = 0xff;
icbp->icb_lunetimeout = ICB_LUN_ENABLE_TOV;
}
#endif
@ -4144,14 +4140,6 @@ isp_start(XS_T *xs)
}
} else {
sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs));
if ((sdp->role & ISP_ROLE_INITIATOR) == 0) {
isp_prt(isp, ISP_LOGDEBUG1,
"%d.%d.%jx I am not an initiator",
XS_CHANNEL(xs), target, (uintmax_t)XS_LUN(xs));
XS_SETERR(xs, HBA_SELTIMEOUT);
return (CMD_COMPLETE);
}
if (isp->isp_state != ISP_RUNSTATE) {
isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
XS_SETERR(xs, HBA_BOTCH);
@ -4759,21 +4747,17 @@ isp_control(ispsoftc_t *isp, ispctl_t ctl, ...)
return (r);
}
case ISPCTL_CHANGE_ROLE:
{
int role, r;
va_start(ap, ctl);
chan = va_arg(ap, int);
role = va_arg(ap, int);
va_end(ap);
if (IS_FC(isp)) {
int role, r;
va_start(ap, ctl);
chan = va_arg(ap, int);
role = va_arg(ap, int);
va_end(ap);
r = isp_fc_change_role(isp, chan, role);
} else {
SDPARAM(isp, chan)->role = role;
r = 0;
return (r);
}
return (r);
}
break;
default:
isp_prt(isp, ISP_LOGERR, "Unknown Control Opcode 0x%x", ctl);
break;
@ -7446,13 +7430,10 @@ isp_setdfltsdparm(ispsoftc_t *isp)
sdparam *sdp, *sdp1;
sdp = SDPARAM(isp, 0);
sdp->role = GET_DEFAULT_ROLE(isp, 0);
if (IS_DUALBUS(isp)) {
if (IS_DUALBUS(isp))
sdp1 = sdp + 1;
sdp1->role = GET_DEFAULT_ROLE(isp, 1);
} else {
else
sdp1 = NULL;
}
/*
* Establish some default parameters.
@ -7586,7 +7567,7 @@ isp_setdfltfcparm(ispsoftc_t *isp, int chan)
/*
* Establish some default parameters.
*/
fcp->role = GET_DEFAULT_ROLE(isp, chan);
fcp->role = DEFAULT_ROLE(isp, chan);
fcp->isp_maxalloc = ICB_DFLT_ALLOC;
fcp->isp_retry_delay = ICB_DFLT_RDELAY;
fcp->isp_retry_count = ICB_DFLT_RCOUNT;

View File

@ -441,11 +441,13 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
if (IS_FC(isp)) {
*(int *)addr = FCPARAM(isp, chan)->role;
} else {
*(int *)addr = SDPARAM(isp, chan)->role;
*(int *)addr = ISP_ROLE_INITIATOR;
}
retval = 0;
break;
case ISP_SETROLE:
if (IS_SCSI(isp))
break;
nr = *(int *)addr;
chan = nr >> 8;
if (chan < 0 || chan >= isp->isp_nchan) {
@ -458,10 +460,7 @@ ispioctl(struct cdev *dev, u_long c, caddr_t addr, int flags, struct thread *td)
break;
}
ISP_LOCK(isp);
if (IS_FC(isp))
*(int *)addr = FCPARAM(isp, chan)->role;
else
*(int *)addr = SDPARAM(isp, chan)->role;
*(int *)addr = FCPARAM(isp, chan)->role;
retval = isp_control(isp, ISPCTL_CHANGE_ROLE, chan, nr);
ISP_UNLOCK(isp);
retval = 0;
@ -774,18 +773,15 @@ isp_intr_enable(void *arg)
int chan;
ispsoftc_t *isp = arg;
ISP_LOCK(isp);
for (chan = 0; chan < isp->isp_nchan; chan++) {
if (IS_FC(isp)) {
if (IS_FC(isp)) {
for (chan = 0; chan < isp->isp_nchan; chan++) {
if (FCPARAM(isp, chan)->role != ISP_ROLE_NONE) {
ISP_ENABLE_INTS(isp);
break;
}
} else {
if (SDPARAM(isp, chan)->role != ISP_ROLE_NONE) {
ISP_ENABLE_INTS(isp);
break;
}
}
} else {
ISP_ENABLE_INTS(isp);
}
isp->isp_osinfo.ehook_active = 0;
ISP_UNLOCK(isp);
@ -831,9 +827,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb *ccb)
* Put the target mode functions here, because some are inlines
*/
#ifdef ISP_TARGET_MODE
static ISP_INLINE void isp_tmlock(ispsoftc_t *, const char *);
static ISP_INLINE void isp_tmunlk(ispsoftc_t *);
static ISP_INLINE int is_any_lun_enabled(ispsoftc_t *, int);
static ISP_INLINE int is_lun_enabled(ispsoftc_t *, int, lun_id_t);
static ISP_INLINE tstate_t *get_lun_statep(ispsoftc_t *, int, lun_id_t);
static ISP_INLINE tstate_t *get_lun_statep_from_tag(ispsoftc_t *, int, uint32_t);
@ -848,23 +841,16 @@ static ISP_INLINE void isp_put_ntpd(ispsoftc_t *, tstate_t *, inot_private_data_
static cam_status create_lun_state(ispsoftc_t *, int, struct cam_path *, tstate_t **);
static void destroy_lun_state(ispsoftc_t *, tstate_t *);
static void isp_enable_lun(ispsoftc_t *, union ccb *);
static cam_status isp_enable_deferred_luns(ispsoftc_t *, int);
static cam_status isp_enable_deferred(ispsoftc_t *, int, lun_id_t);
static void isp_disable_lun(ispsoftc_t *, union ccb *);
static int isp_enable_target_mode(ispsoftc_t *, int);
static int isp_disable_target_mode(ispsoftc_t *, int);
static void isp_ledone(ispsoftc_t *, lun_entry_t *);
static timeout_t isp_refire_putback_atio;
static timeout_t isp_refire_notify_ack;
static void isp_complete_ctio(union ccb *);
static void isp_target_putback_atio(union ccb *);
enum Start_Ctio_How { FROM_CAM, FROM_TIMER, FROM_SRR, FROM_CTIO_DONE };
static void isp_target_start_ctio(ispsoftc_t *, union ccb *, enum Start_Ctio_How);
static void isp_handle_platform_atio(ispsoftc_t *, at_entry_t *);
static void isp_handle_platform_atio2(ispsoftc_t *, at2_entry_t *);
static void isp_handle_platform_atio7(ispsoftc_t *, at7_entry_t *);
static void isp_handle_platform_ctio(ispsoftc_t *, void *);
static void isp_handle_platform_notify_scsi(ispsoftc_t *, in_entry_t *);
static void isp_handle_platform_notify_fc(ispsoftc_t *, in_fcentry_t *);
static void isp_handle_platform_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *);
static int isp_handle_platform_target_notify_ack(ispsoftc_t *, isp_notify_t *);
@ -872,40 +858,6 @@ static void isp_handle_platform_target_tmf(ispsoftc_t *, isp_notify_t *);
static void isp_target_mark_aborted(ispsoftc_t *, union ccb *);
static void isp_target_mark_aborted_early(ispsoftc_t *, tstate_t *, uint32_t);
static ISP_INLINE void
isp_tmlock(ispsoftc_t *isp, const char *msg)
{
while (isp->isp_osinfo.tmbusy) {
isp->isp_osinfo.tmwanted = 1;
mtx_sleep(isp, &isp->isp_lock, PRIBIO, msg, 0);
}
isp->isp_osinfo.tmbusy = 1;
}
static ISP_INLINE void
isp_tmunlk(ispsoftc_t *isp)
{
isp->isp_osinfo.tmbusy = 0;
if (isp->isp_osinfo.tmwanted) {
isp->isp_osinfo.tmwanted = 0;
wakeup(isp);
}
}
static ISP_INLINE int
is_any_lun_enabled(ispsoftc_t *isp, int bus)
{
struct tslist *lhp;
int i;
for (i = 0; i < LUN_HASH_SIZE; i++) {
ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp);
if (SLIST_FIRST(lhp))
return (1);
}
return (0);
}
static ISP_INLINE int
is_lun_enabled(ispsoftc_t *isp, int bus, lun_id_t lun)
{
@ -1222,233 +1174,59 @@ destroy_lun_state(ispsoftc_t *isp, tstate_t *tptr)
free(tptr, M_DEVBUF);
}
/*
* Enable a lun.
*/
static void
isp_enable_lun(ispsoftc_t *isp, union ccb *ccb)
{
tstate_t *tptr = NULL;
int bus, tm_enabled, target_role;
tstate_t *tptr;
int bus;
target_id_t target;
lun_id_t lun;
if (!IS_FC(isp) || !ISP_CAP_TMODE(isp) || !ISP_CAP_SCCFW(isp)) {
xpt_print(ccb->ccb_h.path, "Target mode is not supported\n");
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
xpt_done(ccb);
return;
}
/*
* We only support either a wildcard target/lun or a target ID of zero and a non-wildcard lun
* We only support either target and lun both wildcard
* or target and lun both non-wildcard.
*/
bus = XS_CHANNEL(ccb);
target = ccb->ccb_h.target_id;
lun = ccb->ccb_h.target_lun;
ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path,
"enabling lun %jx\n", (uintmax_t)lun);
if (target == CAM_TARGET_WILDCARD && lun != CAM_LUN_WILDCARD) {
if ((target == CAM_TARGET_WILDCARD) != (lun == CAM_LUN_WILDCARD)) {
ccb->ccb_h.status = CAM_LUN_INVALID;
xpt_done(ccb);
return;
}
if (target != CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) {
ccb->ccb_h.status = CAM_LUN_INVALID;
xpt_done(ccb);
return;
}
if (isp->isp_dblev & ISP_LOGTDEBUG0) {
xpt_print(ccb->ccb_h.path,
"enabling lun 0x%jx on channel %d\n", (uintmax_t)lun, bus);
}
/*
* Wait until we're not busy with the lun enables subsystem
*/
isp_tmlock(isp, "isp_enable_lun");
/*
* This is as a good a place as any to check f/w capabilities.
*/
if (IS_FC(isp)) {
if (ISP_CAP_TMODE(isp) == 0) {
xpt_print(ccb->ccb_h.path, "firmware does not support target mode\n");
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
goto done;
}
/*
* We *could* handle non-SCCLUN f/w, but we'd have to
* dork with our already fragile enable/disable code.
*/
if (ISP_CAP_SCCFW(isp) == 0) {
xpt_print(ccb->ccb_h.path, "firmware not SCCLUN capable\n");
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
goto done;
}
target_role = (FCPARAM(isp, bus)->role & ISP_ROLE_TARGET) != 0;
} else {
target_role = (SDPARAM(isp, bus)->role & ISP_ROLE_TARGET) != 0;
}
/*
* Create the state pointer.
* It should not already exist.
*/
/* Create the state pointer. It should not already exist. */
tptr = get_lun_statep(isp, bus, lun);
if (tptr) {
ccb->ccb_h.status = CAM_LUN_ALRDY_ENA;
goto done;
xpt_done(ccb);
return;
}
ccb->ccb_h.status = create_lun_state(isp, bus, ccb->ccb_h.path, &tptr);
if (ccb->ccb_h.status != CAM_REQ_CMP) {
goto done;
xpt_done(ccb);
return;
}
/*
* We have a tricky maneuver to perform here.
*
* If target mode isn't already enabled here,
* *and* our current role includes target mode,
* we enable target mode here.
*
*/
ISP_GET_PC(isp, bus, tm_enabled, tm_enabled);
if (tm_enabled == 0 && target_role != 0) {
if (isp_enable_target_mode(isp, bus)) {
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
destroy_lun_state(isp, tptr);
tptr = NULL;
goto done;
}
tm_enabled = 1;
}
/*
* Now check to see whether this bus is in target mode already.
*
* If not, a later role change into target mode will finish the job.
*/
if (tm_enabled == 0) {
ISP_SET_PC(isp, bus, tm_enable_defer, 1);
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_print(ccb->ccb_h.path, "Target Mode not enabled yet- lun enable deferred\n");
goto done1;
}
/*
* Enable the lun.
*/
ccb->ccb_h.status = isp_enable_deferred(isp, bus, lun);
done:
if (ccb->ccb_h.status != CAM_REQ_CMP) {
if (tptr) {
destroy_lun_state(isp, tptr);
tptr = NULL;
}
} else {
tptr->enabled = 1;
}
done1:
if (tptr) {
rls_lun_statep(isp, tptr);
}
/*
* And we're outta here....
*/
isp_tmunlk(isp);
rls_lun_statep(isp, tptr);
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
}
static cam_status
isp_enable_deferred_luns(ispsoftc_t *isp, int bus)
{
tstate_t *tptr = NULL;
struct tslist *lhp;
int i, n;
ISP_GET_PC(isp, bus, tm_enabled, i);
if (i == 1) {
return (CAM_REQ_CMP);
}
ISP_GET_PC(isp, bus, tm_enable_defer, i);
if (i == 0) {
return (CAM_REQ_CMP);
}
/*
* If this succeeds, it will set tm_enable
*/
if (isp_enable_target_mode(isp, bus)) {
return (CAM_REQ_CMP_ERR);
}
isp_tmlock(isp, "isp_enable_deferred_luns");
for (n = i = 0; i < LUN_HASH_SIZE; i++) {
ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp);
SLIST_FOREACH(tptr, lhp, next) {
tptr->hold++;
if (tptr->enabled == 0) {
if (isp_enable_deferred(isp, bus, tptr->ts_lun) == CAM_REQ_CMP) {
tptr->enabled = 1;
n++;
}
} else {
n++;
}
tptr->hold--;
}
}
isp_tmunlk(isp);
if (n == 0) {
return (CAM_REQ_CMP_ERR);
}
ISP_SET_PC(isp, bus, tm_enable_defer, 0);
return (CAM_REQ_CMP);
}
static cam_status
isp_enable_deferred(ispsoftc_t *isp, int bus, lun_id_t lun)
{
cam_status status;
int luns_already_enabled;
ISP_GET_PC(isp, bus, tm_luns_enabled, luns_already_enabled);
isp_prt(isp, ISP_LOGTINFO, "%s: bus %d lun %jx luns_enabled %d", __func__, bus, (uintmax_t)lun, luns_already_enabled);
if (IS_23XX(isp) || IS_24XX(isp) ||
(IS_FC(isp) && luns_already_enabled)) {
status = CAM_REQ_CMP;
} else {
int cmd_cnt, not_cnt;
if (IS_23XX(isp)) {
cmd_cnt = DFLT_CMND_CNT;
not_cnt = DFLT_INOT_CNT;
} else {
cmd_cnt = 64;
not_cnt = 8;
}
status = CAM_REQ_INPROG;
isp->isp_osinfo.rptr = &status;
if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun == CAM_LUN_WILDCARD? 0 : lun, cmd_cnt, not_cnt)) {
status = CAM_RESRC_UNAVAIL;
} else {
mtx_sleep(&status, &isp->isp_lock, PRIBIO, "isp_enable_deferred", 0);
}
isp->isp_osinfo.rptr = NULL;
}
if (status == CAM_REQ_CMP) {
ISP_SET_PC(isp, bus, tm_luns_enabled, 1);
isp_prt(isp, ISP_LOGCONFIG|ISP_LOGTINFO, "bus %d lun %jx now enabled for target mode", bus, (uintmax_t)lun);
}
return (status);
}
static void
isp_disable_lun(ispsoftc_t *isp, union ccb *ccb)
{
tstate_t *tptr = NULL;
int bus;
cam_status status;
target_id_t target;
lun_id_t lun;
@ -1457,143 +1235,24 @@ isp_disable_lun(ispsoftc_t *isp, union ccb *ccb)
lun = ccb->ccb_h.target_lun;
ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path,
"disabling lun %jx\n", (uintmax_t)lun);
if (target == CAM_TARGET_WILDCARD && lun != CAM_LUN_WILDCARD) {
if ((target == CAM_TARGET_WILDCARD) != (lun == CAM_LUN_WILDCARD)) {
ccb->ccb_h.status = CAM_LUN_INVALID;
xpt_done(ccb);
return;
}
if (target != CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) {
ccb->ccb_h.status = CAM_LUN_INVALID;
xpt_done(ccb);
return;
}
/*
* See if we're busy disabling a lun now.
*/
isp_tmlock(isp, "isp_disable_lun");
status = CAM_REQ_INPROG;
/*
* Find the state pointer.
*/
/* Find the state pointer. */
if ((tptr = get_lun_statep(isp, bus, lun)) == NULL) {
status = CAM_PATH_INVALID;
goto done;
ccb->ccb_h.status = CAM_PATH_INVALID;
xpt_done(ccb);
return;
}
/*
* If we're a 24XX card, we're done.
*/
if (IS_23XX(isp) || IS_24XX(isp)) {
status = CAM_REQ_CMP;
goto done;
}
/*
* For SCC FW, we only deal with lun zero.
*/
if (IS_FC(isp) && lun > 0) {
status = CAM_REQ_CMP;
goto done;
}
isp->isp_osinfo.rptr = &status;
if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun, 0, 0)) {
status = CAM_RESRC_UNAVAIL;
} else {
mtx_sleep(&status, &isp->isp_lock, PRIBIO, "isp_disable_lun", 0);
}
isp->isp_osinfo.rptr = NULL;
done:
if (status == CAM_REQ_CMP) {
tptr->enabled = 0;
if (is_any_lun_enabled(isp, bus) == 0) {
if (isp_disable_target_mode(isp, bus)) {
status = CAM_REQ_CMP_ERR;
}
}
}
ccb->ccb_h.status = status;
if (status == CAM_REQ_CMP) {
destroy_lun_state(isp, tptr);
xpt_print(ccb->ccb_h.path, "lun now disabled for target mode\n");
} else {
if (tptr)
rls_lun_statep(isp, tptr);
}
isp_tmunlk(isp);
destroy_lun_state(isp, tptr);
ccb->ccb_h.status = CAM_REQ_CMP;
xpt_done(ccb);
}
static int
isp_enable_target_mode(ispsoftc_t *isp, int bus)
{
int tm_enabled;
ISP_GET_PC(isp, bus, tm_enabled, tm_enabled);
if (tm_enabled != 0) {
return (0);
}
if (IS_SCSI(isp)) {
mbreg_t mbs;
MBSINIT(&mbs, MBOX_ENABLE_TARGET_MODE, MBLOGALL, 0);
mbs.param[0] = MBOX_ENABLE_TARGET_MODE;
mbs.param[1] = ENABLE_TARGET_FLAG|ENABLE_TQING_FLAG;
mbs.param[2] = bus << 7;
if (isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs) < 0 || mbs.param[0] != MBOX_COMMAND_COMPLETE) {
isp_prt(isp, ISP_LOGERR, "Unable to enable Target Role on Bus %d", bus);
return (EIO);
}
}
ISP_SET_PC(isp, bus, tm_enabled, 1);
isp_prt(isp, ISP_LOGINFO, "Target Role enabled on Bus %d", bus);
return (0);
}
static int
isp_disable_target_mode(ispsoftc_t *isp, int bus)
{
int tm_enabled;
ISP_GET_PC(isp, bus, tm_enabled, tm_enabled);
if (tm_enabled == 0) {
return (0);
}
if (IS_SCSI(isp)) {
mbreg_t mbs;
MBSINIT(&mbs, MBOX_ENABLE_TARGET_MODE, MBLOGALL, 0);
mbs.param[2] = bus << 7;
if (isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs) < 0 || mbs.param[0] != MBOX_COMMAND_COMPLETE) {
isp_prt(isp, ISP_LOGERR, "Unable to disable Target Role on Bus %d", bus);
return (EIO);
}
}
ISP_SET_PC(isp, bus, tm_enabled, 0);
isp_prt(isp, ISP_LOGINFO, "Target Role disabled on Bus %d", bus);
return (0);
}
static void
isp_ledone(ispsoftc_t *isp, lun_entry_t *lep)
{
uint32_t *rptr;
rptr = isp->isp_osinfo.rptr;
if (lep->le_status != LUN_OK) {
isp_prt(isp, ISP_LOGERR, "ENABLE/MODIFY LUN returned 0x%x", lep->le_status);
if (rptr) {
*rptr = CAM_REQ_CMP_ERR;
wakeup_one(rptr);
}
} else {
if (rptr) {
*rptr = CAM_REQ_CMP;
wakeup_one(rptr);
}
}
}
static void
isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
{
@ -1891,7 +1550,7 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x xfrlen=%u off=%u", __func__,
cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, xfrlen, atp->bytes_xfered);
}
} else if (IS_FC(isp)) {
} else {
ct2_entry_t *cto = (ct2_entry_t *) local;
if (isp->isp_osinfo.sixtyfourbit)
@ -2040,41 +1699,6 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
}
isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[%x] seq %u nc %d CDB0=%x scsi status %x flags %x resid %d xfrlen %u offset %u", __func__, cto->ct_rxid,
ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->dxfer_len, atp->bytes_xfered);
} else {
ct_entry_t *cto = (ct_entry_t *) local;
cto->ct_header.rqs_entry_type = RQSTYPE_CTIO;
cto->ct_header.rqs_entry_count = 1;
cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM;
ATPD_SET_SEQNO(cto, atp);
cto->ct_iid = cso->init_id;
cto->ct_iid |= XS_CHANNEL(ccb) << 7;
cto->ct_tgt = ccb->ccb_h.target_id;
cto->ct_lun = ccb->ccb_h.target_lun;
cto->ct_fwhandle = cso->tag_id;
if (atp->rxid) {
cto->ct_tag_val = atp->rxid;
cto->ct_flags |= CT_TQAE;
}
if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) {
cto->ct_flags |= CT_NODISC;
}
if (cso->dxfer_len == 0) {
cto->ct_flags |= CT_NO_DATA;
} else if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
cto->ct_flags |= CT_DATA_IN;
} else {
cto->ct_flags |= CT_DATA_OUT;
}
if (ccb->ccb_h.flags & CAM_SEND_STATUS) {
cto->ct_flags |= CT_SENDSTATUS|CT_CCINCR;
cto->ct_scsi_status = cso->scsi_status;
cto->ct_resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit - xfrlen;
isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO[%x] seq %u nc %d scsi status %x resid %d tag_id %x", __func__,
cto->ct_fwhandle, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), cso->scsi_status, cso->resid, cso->tag_id);
}
ccb->ccb_h.flags &= ~CAM_SEND_SENSE;
cto->ct_timeout = 10;
}
if (isp_get_pcmd(isp, ccb)) {
@ -2104,11 +1728,8 @@ isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how)
if (IS_24XX(isp)) {
ct7_entry_t *cto = (ct7_entry_t *) local;
cto->ct_syshandle = handle;
} else if (IS_FC(isp)) {
ct2_entry_t *cto = (ct2_entry_t *) local;
cto->ct_syshandle = handle;
} else {
ct_entry_t *cto = (ct_entry_t *) local;
ct2_entry_t *cto = (ct2_entry_t *) local;
cto->ct_syshandle = handle;
}
@ -2167,6 +1788,7 @@ isp_target_putback_atio(union ccb *ccb)
ispsoftc_t *isp;
struct ccb_scsiio *cso;
void *qe;
at2_entry_t local, *at = &local;
isp = XS_ISP(ccb);
@ -2180,38 +1802,22 @@ isp_target_putback_atio(union ccb *ccb)
}
memset(qe, 0, QENTRY_LEN);
cso = &ccb->csio;
if (IS_FC(isp)) {
at2_entry_t local, *at = &local;
ISP_MEMZERO(at, sizeof (at2_entry_t));
at->at_header.rqs_entry_type = RQSTYPE_ATIO2;
at->at_header.rqs_entry_count = 1;
if (ISP_CAP_SCCFW(isp)) {
at->at_scclun = (uint16_t) ccb->ccb_h.target_lun;
ISP_MEMZERO(at, sizeof (at2_entry_t));
at->at_header.rqs_entry_type = RQSTYPE_ATIO2;
at->at_header.rqs_entry_count = 1;
if (ISP_CAP_SCCFW(isp)) {
at->at_scclun = (uint16_t) ccb->ccb_h.target_lun;
#if __FreeBSD_version < 1000700
if (at->at_scclun >= 256)
at->at_scclun |= 0x4000;
if (at->at_scclun >= 256)
at->at_scclun |= 0x4000;
#endif
} else {
at->at_lun = (uint8_t) ccb->ccb_h.target_lun;
}
at->at_status = CT_OK;
at->at_rxid = cso->tag_id;
at->at_iid = cso->ccb_h.target_id;
isp_put_atio2(isp, at, qe);
} else {
at_entry_t local, *at = &local;
ISP_MEMZERO(at, sizeof (at_entry_t));
at->at_header.rqs_entry_type = RQSTYPE_ATIO;
at->at_header.rqs_entry_count = 1;
at->at_iid = cso->init_id;
at->at_iid |= XS_CHANNEL(ccb) << 7;
at->at_tgt = cso->ccb_h.target_id;
at->at_lun = cso->ccb_h.target_lun;
at->at_status = CT_OK;
at->at_tag_val = AT_GET_TAG(cso->tag_id);
at->at_handle = AT_GET_HANDLE(cso->tag_id);
isp_put_atio(isp, at, qe);
at->at_lun = (uint8_t) ccb->ccb_h.target_lun;
}
at->at_status = CT_OK;
at->at_rxid = cso->tag_id;
at->at_iid = cso->ccb_h.target_id;
isp_put_atio2(isp, at, qe);
ISP_TDQE(isp, "isp_target_putback_atio", isp->isp_reqidx, qe);
ISP_SYNC_REQUEST(isp);
isp_complete_ctio(ccb);
@ -2226,131 +1832,6 @@ isp_complete_ctio(union ccb *ccb)
}
}
/*
* Handle ATIO stuff that the generic code can't.
* This means handling CDBs.
*/
static void
isp_handle_platform_atio(ispsoftc_t *isp, at_entry_t *aep)
{
tstate_t *tptr;
int status, bus;
struct ccb_accept_tio *atiop;
atio_private_data_t *atp;
/*
* The firmware status (except for the QLTM_SVALID bit)
* indicates why this ATIO was sent to us.
*
* If QLTM_SVALID is set, the firmware has recommended Sense Data.
*
* If the DISCONNECTS DISABLED bit is set in the flags field,
* we're still connected on the SCSI bus.
*/
status = aep->at_status;
if ((status & ~QLTM_SVALID) == AT_PHASE_ERROR) {
/*
* Bus Phase Sequence error. We should have sense data
* suggested by the f/w. I'm not sure quite yet what
* to do about this for CAM.
*/
isp_prt(isp, ISP_LOGWARN, "PHASE ERROR");
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
return;
}
if ((status & ~QLTM_SVALID) != AT_CDB) {
isp_prt(isp, ISP_LOGWARN, "bad atio (0x%x) leaked to platform", status);
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
return;
}
bus = GET_BUS_VAL(aep->at_iid);
tptr = get_lun_statep(isp, bus, aep->at_lun);
if (tptr == NULL) {
tptr = get_lun_statep(isp, bus, CAM_LUN_WILDCARD);
if (tptr == NULL) {
/*
* Because we can't autofeed sense data back with
* a command for parallel SCSI, we can't give back
* a CHECK CONDITION. We'll give back a BUSY status
* instead. This works out okay because the only
* time we should, in fact, get this, is in the
* case that somebody configured us without the
* blackhole driver, so they get what they deserve.
*/
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
return;
}
}
atp = isp_get_atpd(isp, tptr, aep->at_handle);
atiop = (struct ccb_accept_tio *) SLIST_FIRST(&tptr->atios);
if (atiop == NULL || atp == NULL) {
/*
* Because we can't autofeed sense data back with
* a command for parallel SCSI, we can't give back
* a CHECK CONDITION. We'll give back a QUEUE FULL status
* instead. This works out okay because the only time we
* should, in fact, get this, is in the case that we've
* run out of ATIOS.
*/
xpt_print(tptr->owner, "no %s for lun %x from initiator %d\n", (atp == NULL && atiop == NULL)? "ATIOs *or* ATPS" :
((atp == NULL)? "ATPs" : "ATIOs"), aep->at_lun, aep->at_iid);
isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
if (atp) {
isp_put_atpd(isp, tptr, atp);
}
rls_lun_statep(isp, tptr);
return;
}
atp->rxid = aep->at_tag_val;
atp->state = ATPD_STATE_ATIO;
SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle);
tptr->atio_count--;
ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, atiop->ccb_h.path, "Take FREE ATIO count now %d\n", tptr->atio_count);
atiop->ccb_h.target_id = aep->at_tgt;
atiop->ccb_h.target_lun = aep->at_lun;
if (aep->at_flags & AT_NODISC) {
atiop->ccb_h.flags |= CAM_DIS_DISCONNECT;
} else {
atiop->ccb_h.flags &= ~CAM_DIS_DISCONNECT;
}
if (status & QLTM_SVALID) {
size_t amt = ISP_MIN(QLTM_SENSELEN, sizeof (atiop->sense_data));
atiop->sense_len = amt;
ISP_MEMCPY(&atiop->sense_data, aep->at_sense, amt);
} else {
atiop->sense_len = 0;
}
atiop->init_id = GET_IID_VAL(aep->at_iid);
atiop->cdb_len = aep->at_cdblen;
ISP_MEMCPY(atiop->cdb_io.cdb_bytes, aep->at_cdb, aep->at_cdblen);
atiop->ccb_h.status = CAM_CDB_RECVD;
/*
* Construct a tag 'id' based upon tag value (which may be 0..255)
* and the handle (which we have to preserve).
*/
atiop->tag_id = atp->tag;
if (aep->at_flags & AT_TQAE) {
atiop->tag_action = aep->at_tag_type;
atiop->ccb_h.status |= CAM_TAG_ACTION_VALID;
}
atp->orig_datalen = 0;
atp->bytes_xfered = 0;
atp->lun = aep->at_lun;
atp->nphdl = aep->at_iid;
atp->portid = PORT_ANY;
atp->oxid = 0;
atp->cdb0 = atiop->cdb_io.cdb_bytes[0];
atp->tattr = aep->at_tag_type;
atp->state = ATPD_STATE_CAM;
isp_prt(isp, ISP_LOGTDEBUG0, "ATIO[0x%x] CDB=0x%x lun %x", aep->at_tag_val, atp->cdb0, atp->lun);
rls_lun_statep(isp, tptr);
}
static void
isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t *aep)
{
@ -2910,16 +2391,7 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
int bus;
uint32_t handle, moved_data = 0, data_requested;
/*
* CTIO handles are 16 bits.
* CTIO2 and CTIO7 are 32 bits.
*/
if (IS_SCSI(isp)) {
handle = ((ct_entry_t *)arg)->ct_syshandle;
} else {
handle = ((ct2_entry_t *)arg)->ct_syshandle;
}
handle = ((ct2_entry_t *)arg)->ct_syshandle;
ccb = isp_find_xs_tgt(isp, handle);
if (ccb == NULL) {
isp_print_bytes(isp, "null ccb in isp_handle_platform_ctio", QENTRY_LEN, arg);
@ -2944,10 +2416,8 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
if (IS_24XX(isp)) {
atp = isp_find_atpd(isp, tptr, ((ct7_entry_t *)arg)->ct_rxid);
} else if (IS_FC(isp)) {
atp = isp_find_atpd(isp, tptr, ((ct2_entry_t *)arg)->ct_rxid);
} else {
atp = isp_find_atpd(isp, tptr, ((ct_entry_t *)arg)->ct_fwhandle);
atp = isp_find_atpd(isp, tptr, ((ct2_entry_t *)arg)->ct_rxid);
}
if (atp == NULL) {
/*
@ -2990,7 +2460,7 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
}
isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO7[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct),
notify_cam, ct->ct_nphdl, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID");
} else if (IS_FC(isp)) {
} else {
ct2_entry_t *ct = arg;
if (ct->ct_status == CT_SRR) {
atp->srr_ccb = ccb;
@ -3013,22 +2483,6 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
}
isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO2[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct),
notify_cam, ct->ct_status, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID");
} else {
ct_entry_t *ct = arg;
if (ct->ct_status == (CT_HBA_RESET & 0xff)) {
failure = CAM_UNREC_HBA_ERROR;
} else {
sentstatus = ct->ct_flags & CT_SENDSTATUS;
ok = (ct->ct_status & ~QLTM_SVALID) == CT_OK;
notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0;
}
if ((ct->ct_flags & CT_DATAMASK) != CT_NO_DATA) {
resid = ct->ct_resid;
moved_data = data_requested - resid;
}
isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO[%x] seq %u nc %d tag %x S_ID 0x%x lun %x sts %x flg %x resid %d %s", __func__, ct->ct_fwhandle, ATPD_GET_SEQNO(ct),
notify_cam, ct->ct_tag_val, ct->ct_iid, ct->ct_lun, ct->ct_status, ct->ct_flags, resid, sentstatus? "FIN" : "MID");
}
if (ok) {
if (moved_data) {
@ -3081,12 +2535,6 @@ isp_handle_platform_ctio(ispsoftc_t *isp, void *arg)
}
}
static void
isp_handle_platform_notify_scsi(ispsoftc_t *isp, in_entry_t *inot)
{
isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot);
}
static void
isp_handle_platform_notify_fc(ispsoftc_t *isp, in_fcentry_t *inp)
{
@ -3618,14 +3066,10 @@ isp_cam_async(void *cbarg, uint32_t code, struct cam_path *path, void *arg)
if (tgt >= 0) {
nflags = sdp->isp_devparam[tgt].nvrm_flags;
#ifndef ISP_TARGET_MODE
nflags &= DPARM_SAFE_DFLT;
if (isp->isp_loaded_fw) {
nflags |= DPARM_NARROW | DPARM_ASYNC;
}
#else
nflags = DPARM_DEFAULT;
#endif
oflags = sdp->isp_devparam[tgt].goal_flags;
sdp->isp_devparam[tgt].goal_flags = nflags;
sdp->isp_devparam[tgt].dev_update = 1;
@ -4541,25 +3985,12 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
}
if (rchange) {
ISP_PATH_PRT(isp, ISP_LOGCONFIG, ccb->ccb_h.path, "changing role on from %d to %d\n", fcp->role, newrole);
#ifdef ISP_TARGET_MODE
ISP_SET_PC(isp, bus, tm_enabled, 0);
ISP_SET_PC(isp, bus, tm_luns_enabled, 0);
#endif
if (isp_control(isp, ISPCTL_CHANGE_ROLE,
bus, newrole) != 0) {
ccb->ccb_h.status = CAM_REQ_CMP_ERR;
xpt_done(ccb);
break;
}
#ifdef ISP_TARGET_MODE
if (newrole == ISP_ROLE_TARGET || newrole == ISP_ROLE_BOTH) {
/*
* Give the new role a chance to complain and settle
*/
msleep(isp, &isp->isp_lock, PRIBIO, "taking a breather", 2);
ccb->ccb_h.status = isp_enable_deferred_luns(isp, bus);
}
#endif
}
}
xpt_done(ccb);
@ -4605,10 +4036,11 @@ isp_action(struct cam_sim *sim, union ccb *ccb)
cpi->version_num = 1;
#ifdef ISP_TARGET_MODE
cpi->target_sprt = PIT_PROCESSOR | PIT_DISCONNECT | PIT_TERM_IO;
#else
cpi->target_sprt = 0;
if (IS_FC(isp) && ISP_CAP_TMODE(isp) && ISP_CAP_SCCFW(isp))
cpi->target_sprt = PIT_PROCESSOR | PIT_DISCONNECT | PIT_TERM_IO;
else
#endif
cpi->target_sprt = 0;
cpi->hba_eng_cnt = 0;
cpi->max_target = ISP_MAX_TARGETS(isp) - 1;
cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ?
@ -5098,20 +4530,14 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
isp_prt(isp, ISP_LOGWARN, "%s: unhandled target action 0x%x", __func__, hp->rqs_entry_type);
break;
case RQSTYPE_NOTIFY:
if (IS_SCSI(isp)) {
isp_handle_platform_notify_scsi(isp, (in_entry_t *) hp);
} else if (IS_24XX(isp)) {
if (IS_24XX(isp)) {
isp_handle_platform_notify_24xx(isp, (in_fcentry_24xx_t *) hp);
} else {
isp_handle_platform_notify_fc(isp, (in_fcentry_t *) hp);
}
break;
case RQSTYPE_ATIO:
if (IS_24XX(isp)) {
isp_handle_platform_atio7(isp, (at7_entry_t *) hp);
} else {
isp_handle_platform_atio(isp, (at_entry_t *) hp);
}
isp_handle_platform_atio7(isp, (at7_entry_t *) hp);
break;
case RQSTYPE_ATIO2:
isp_handle_platform_atio2(isp, (at2_entry_t *) hp);
@ -5176,10 +4602,6 @@ isp_async(ispsoftc_t *isp, ispasync_t cmd, ...)
isp_handle_platform_target_tmf(isp, nt);
break;
}
case RQSTYPE_ENABLE_LUN:
case RQSTYPE_MODIFY_LUN:
isp_ledone(isp, (lun_entry_t *) hp);
break;
}
break;
}

View File

@ -169,11 +169,9 @@ typedef struct tstate {
struct isp_ccbq waitq; /* waiting CCBs */
struct ccb_hdr_slist atios;
struct ccb_hdr_slist inots;
uint32_t hold;
uint32_t
enabled : 1,
atio_count : 15,
inot_count : 15;
uint32_t hold;
uint16_t atio_count;
uint16_t inot_count;
inot_private_data_t * restart_queue;
inot_private_data_t * ntfree;
inot_private_data_t ntpool[ATPDPSIZE];
@ -239,11 +237,6 @@ struct isp_fc {
struct isp_nexus *nexus_hash[NEXUS_HASH_WIDTH];
struct isp_nexus *nexus_free_list;
uint32_t
#ifdef ISP_TARGET_MODE
tm_luns_enabled : 1,
tm_enable_defer : 1,
tm_enabled : 1,
#endif
simqfrozen : 3,
default_id : 8,
hysteresis : 8,
@ -269,13 +262,7 @@ struct isp_spi {
struct cam_sim *sim;
struct cam_path *path;
uint32_t
#ifdef ISP_TARGET_MODE
tm_luns_enabled : 1,
tm_enable_defer : 1,
tm_enabled : 1,
#endif
simqfrozen : 3,
def_role : 2,
iid : 4;
#ifdef ISP_TARGET_MODE
struct tslist lun_hash[LUN_HASH_SIZE];
@ -339,10 +326,6 @@ struct isposinfo {
int exec_throttle;
int cont_max;
#ifdef ISP_TARGET_MODE
cam_status * rptr;
#endif
bus_addr_t ecmd_dma;
isp_ecmd_t * ecmd_base;
isp_ecmd_t * ecmd_free;
@ -617,14 +600,8 @@ default: \
#define DEFAULT_FRAMESIZE(isp) isp->isp_osinfo.framesize
#define DEFAULT_EXEC_THROTTLE(isp) isp->isp_osinfo.exec_throttle
#define GET_DEFAULT_ROLE(isp, chan) \
(IS_FC(isp)? ISP_FC_PC(isp, chan)->def_role : ISP_SPI_PC(isp, chan)->def_role)
#define SET_DEFAULT_ROLE(isp, chan, val) \
if (IS_FC(isp)) { \
ISP_FC_PC(isp, chan)->def_role = val; \
} else { \
ISP_SPI_PC(isp, chan)->def_role = val; \
}
#define DEFAULT_ROLE(isp, chan) \
(IS_FC(isp)? ISP_FC_PC(isp, chan)->def_role : ISP_ROLE_INITIATOR)
#define DEFAULT_IID(isp, chan) isp->isp_osinfo.pc.spi[chan].iid

View File

@ -778,16 +778,11 @@ isp_clear_commands(ispsoftc_t *isp)
ctio->ct_syshandle = hdp->handle;
ctio->ct_nphdl = CT_HBA_RESET;
ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
} else if (IS_FC(isp)) {
} else {
ct2_entry_t *ctio = (ct2_entry_t *) local;
ctio->ct_syshandle = hdp->handle;
ctio->ct_status = CT_HBA_RESET;
ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
} else {
ct_entry_t *ctio = (ct_entry_t *) local;
ctio->ct_syshandle = hdp->handle;
ctio->ct_status = CT_HBA_RESET & 0xff;
ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO;
}
isp_async(isp, ISPASYNC_TARGET_ACTION, local);
}
@ -2264,10 +2259,6 @@ isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_
* First, figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry.
*/
switch (type) {
case RQSTYPE_CTIO:
dsp = ((ct_entry_t *)fqe)->ct_dataseg;
seglim = ISP_RQDSEG;
break;
case RQSTYPE_CTIO2:
dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg;
seglim = ISP_RQDSEG_T2;
@ -2355,10 +2346,6 @@ isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_
*/
((isphdr_t *)fqe)->rqs_entry_count = nqe;
switch (type) {
case RQSTYPE_CTIO:
((ct_entry_t *)fqe)->ct_seg_count = nsegs;
isp_put_ctio(isp, fqe, qe0);
break;
case RQSTYPE_CTIO2:
case RQSTYPE_CTIO3:
if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) {
@ -2820,76 +2807,6 @@ isp_del_wwn_entries(ispsoftc_t *isp, isp_notify_t *mp)
mp->nt_channel, mp->nt_wwn, mp->nt_sid, mp->nt_nphdl);
}
void
isp_put_atio(ispsoftc_t *isp, at_entry_t *src, at_entry_t *dst)
{
int i;
isp_put_hdr(isp, &src->at_header, &dst->at_header);
ISP_IOXPUT_16(isp, src->at_reserved, &dst->at_reserved);
ISP_IOXPUT_16(isp, src->at_handle, &dst->at_handle);
if (ISP_IS_SBUS(isp)) {
ISP_IOXPUT_8(isp, src->at_lun, &dst->at_iid);
ISP_IOXPUT_8(isp, src->at_iid, &dst->at_lun);
ISP_IOXPUT_8(isp, src->at_cdblen, &dst->at_tgt);
ISP_IOXPUT_8(isp, src->at_tgt, &dst->at_cdblen);
ISP_IOXPUT_8(isp, src->at_status, &dst->at_scsi_status);
ISP_IOXPUT_8(isp, src->at_scsi_status, &dst->at_status);
ISP_IOXPUT_8(isp, src->at_tag_val, &dst->at_tag_type);
ISP_IOXPUT_8(isp, src->at_tag_type, &dst->at_tag_val);
} else {
ISP_IOXPUT_8(isp, src->at_lun, &dst->at_lun);
ISP_IOXPUT_8(isp, src->at_iid, &dst->at_iid);
ISP_IOXPUT_8(isp, src->at_cdblen, &dst->at_cdblen);
ISP_IOXPUT_8(isp, src->at_tgt, &dst->at_tgt);
ISP_IOXPUT_8(isp, src->at_status, &dst->at_status);
ISP_IOXPUT_8(isp, src->at_scsi_status, &dst->at_scsi_status);
ISP_IOXPUT_8(isp, src->at_tag_val, &dst->at_tag_val);
ISP_IOXPUT_8(isp, src->at_tag_type, &dst->at_tag_type);
}
ISP_IOXPUT_32(isp, src->at_flags, &dst->at_flags);
for (i = 0; i < ATIO_CDBLEN; i++) {
ISP_IOXPUT_8(isp, src->at_cdb[i], &dst->at_cdb[i]);
}
for (i = 0; i < QLTM_SENSELEN; i++) {
ISP_IOXPUT_8(isp, src->at_sense[i], &dst->at_sense[i]);
}
}
void
isp_get_atio(ispsoftc_t *isp, at_entry_t *src, at_entry_t *dst)
{
int i;
isp_get_hdr(isp, &src->at_header, &dst->at_header);
ISP_IOXGET_16(isp, &src->at_reserved, dst->at_reserved);
ISP_IOXGET_16(isp, &src->at_handle, dst->at_handle);
if (ISP_IS_SBUS(isp)) {
ISP_IOXGET_8(isp, &src->at_lun, dst->at_iid);
ISP_IOXGET_8(isp, &src->at_iid, dst->at_lun);
ISP_IOXGET_8(isp, &src->at_cdblen, dst->at_tgt);
ISP_IOXGET_8(isp, &src->at_tgt, dst->at_cdblen);
ISP_IOXGET_8(isp, &src->at_status, dst->at_scsi_status);
ISP_IOXGET_8(isp, &src->at_scsi_status, dst->at_status);
ISP_IOXGET_8(isp, &src->at_tag_val, dst->at_tag_type);
ISP_IOXGET_8(isp, &src->at_tag_type, dst->at_tag_val);
} else {
ISP_IOXGET_8(isp, &src->at_lun, dst->at_lun);
ISP_IOXGET_8(isp, &src->at_iid, dst->at_iid);
ISP_IOXGET_8(isp, &src->at_cdblen, dst->at_cdblen);
ISP_IOXGET_8(isp, &src->at_tgt, dst->at_tgt);
ISP_IOXGET_8(isp, &src->at_status, dst->at_status);
ISP_IOXGET_8(isp, &src->at_scsi_status, dst->at_scsi_status);
ISP_IOXGET_8(isp, &src->at_tag_val, dst->at_tag_val);
ISP_IOXGET_8(isp, &src->at_tag_type, dst->at_tag_type);
}
ISP_IOXGET_32(isp, &src->at_flags, dst->at_flags);
for (i = 0; i < ATIO_CDBLEN; i++) {
ISP_IOXGET_8(isp, &src->at_cdb[i], dst->at_cdb[i]);
}
for (i = 0; i < QLTM_SENSELEN; i++) {
ISP_IOXGET_8(isp, &src->at_sense[i], dst->at_sense[i]);
}
}
void
isp_put_atio2(ispsoftc_t *isp, at2_entry_t *src, at2_entry_t *dst)
{
@ -3015,81 +2932,6 @@ isp_get_atio7(ispsoftc_t *isp, at7_entry_t *src, at7_entry_t *dst)
isp_get_fcp_cmnd_iu(isp, &src->at_cmnd, &dst->at_cmnd);
}
void
isp_put_ctio(ispsoftc_t *isp, ct_entry_t *src, ct_entry_t *dst)
{
int i;
isp_put_hdr(isp, &src->ct_header, &dst->ct_header);
ISP_IOXPUT_16(isp, src->ct_syshandle, &dst->ct_syshandle);
ISP_IOXPUT_16(isp, src->ct_fwhandle, &dst->ct_fwhandle);
if (ISP_IS_SBUS(isp)) {
ISP_IOXPUT_8(isp, src->ct_iid, &dst->ct_lun);
ISP_IOXPUT_8(isp, src->ct_lun, &dst->ct_iid);
ISP_IOXPUT_8(isp, src->ct_tgt, &dst->ct_reserved2);
ISP_IOXPUT_8(isp, src->ct_reserved2, &dst->ct_tgt);
ISP_IOXPUT_8(isp, src->ct_status, &dst->ct_scsi_status);
ISP_IOXPUT_8(isp, src->ct_scsi_status, &dst->ct_status);
ISP_IOXPUT_8(isp, src->ct_tag_type, &dst->ct_tag_val);
ISP_IOXPUT_8(isp, src->ct_tag_val, &dst->ct_tag_type);
} else {
ISP_IOXPUT_8(isp, src->ct_iid, &dst->ct_iid);
ISP_IOXPUT_8(isp, src->ct_lun, &dst->ct_lun);
ISP_IOXPUT_8(isp, src->ct_tgt, &dst->ct_tgt);
ISP_IOXPUT_8(isp, src->ct_reserved2, &dst->ct_reserved2);
ISP_IOXPUT_8(isp, src->ct_scsi_status,
&dst->ct_scsi_status);
ISP_IOXPUT_8(isp, src->ct_status, &dst->ct_status);
ISP_IOXPUT_8(isp, src->ct_tag_type, &dst->ct_tag_type);
ISP_IOXPUT_8(isp, src->ct_tag_val, &dst->ct_tag_val);
}
ISP_IOXPUT_32(isp, src->ct_flags, &dst->ct_flags);
ISP_IOXPUT_32(isp, src->ct_xfrlen, &dst->ct_xfrlen);
ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid);
ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout);
ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count);
for (i = 0; i < ISP_RQDSEG; i++) {
ISP_IOXPUT_32(isp, src->ct_dataseg[i].ds_base, &dst->ct_dataseg[i].ds_base);
ISP_IOXPUT_32(isp, src->ct_dataseg[i].ds_count, &dst->ct_dataseg[i].ds_count);
}
}
void
isp_get_ctio(ispsoftc_t *isp, ct_entry_t *src, ct_entry_t *dst)
{
int i;
isp_get_hdr(isp, &src->ct_header, &dst->ct_header);
ISP_IOXGET_16(isp, &src->ct_syshandle, dst->ct_syshandle);
ISP_IOXGET_16(isp, &src->ct_fwhandle, dst->ct_fwhandle);
if (ISP_IS_SBUS(isp)) {
ISP_IOXGET_8(isp, &src->ct_lun, dst->ct_iid);
ISP_IOXGET_8(isp, &src->ct_iid, dst->ct_lun);
ISP_IOXGET_8(isp, &src->ct_reserved2, dst->ct_tgt);
ISP_IOXGET_8(isp, &src->ct_tgt, dst->ct_reserved2);
ISP_IOXGET_8(isp, &src->ct_status, dst->ct_scsi_status);
ISP_IOXGET_8(isp, &src->ct_scsi_status, dst->ct_status);
ISP_IOXGET_8(isp, &src->ct_tag_val, dst->ct_tag_type);
ISP_IOXGET_8(isp, &src->ct_tag_type, dst->ct_tag_val);
} else {
ISP_IOXGET_8(isp, &src->ct_lun, dst->ct_lun);
ISP_IOXGET_8(isp, &src->ct_iid, dst->ct_iid);
ISP_IOXGET_8(isp, &src->ct_reserved2, dst->ct_reserved2);
ISP_IOXGET_8(isp, &src->ct_tgt, dst->ct_tgt);
ISP_IOXGET_8(isp, &src->ct_status, dst->ct_status);
ISP_IOXGET_8(isp, &src->ct_scsi_status, dst->ct_scsi_status);
ISP_IOXGET_8(isp, &src->ct_tag_val, dst->ct_tag_val);
ISP_IOXGET_8(isp, &src->ct_tag_type, dst->ct_tag_type);
}
ISP_IOXGET_32(isp, &src->ct_flags, dst->ct_flags);
ISP_IOXGET_32(isp, &src->ct_xfrlen, dst->ct_xfrlen);
ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid);
ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout);
ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count);
for (i = 0; i < ISP_RQDSEG; i++) {
ISP_IOXGET_32(isp, &src->ct_dataseg[i].ds_base, dst->ct_dataseg[i].ds_base);
ISP_IOXGET_32(isp, &src->ct_dataseg[i].ds_count, dst->ct_dataseg[i].ds_count);
}
}
void
isp_put_ctio2(ispsoftc_t *isp, ct2_entry_t *src, ct2_entry_t *dst)
{
@ -3507,82 +3349,6 @@ isp_get_enable_lun(ispsoftc_t *isp, lun_entry_t *lesrc, lun_entry_t *ledst)
}
}
void
isp_put_notify(ispsoftc_t *isp, in_entry_t *src, in_entry_t *dst)
{
int i;
isp_put_hdr(isp, &src->in_header, &dst->in_header);
ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved);
if (ISP_IS_SBUS(isp)) {
ISP_IOXPUT_8(isp, src->in_lun, &dst->in_iid);
ISP_IOXPUT_8(isp, src->in_iid, &dst->in_lun);
ISP_IOXPUT_8(isp, src->in_reserved2, &dst->in_tgt);
ISP_IOXPUT_8(isp, src->in_tgt, &dst->in_reserved2);
ISP_IOXPUT_8(isp, src->in_status, &dst->in_rsvd2);
ISP_IOXPUT_8(isp, src->in_rsvd2, &dst->in_status);
ISP_IOXPUT_8(isp, src->in_tag_val, &dst->in_tag_type);
ISP_IOXPUT_8(isp, src->in_tag_type, &dst->in_tag_val);
} else {
ISP_IOXPUT_8(isp, src->in_lun, &dst->in_lun);
ISP_IOXPUT_8(isp, src->in_iid, &dst->in_iid);
ISP_IOXPUT_8(isp, src->in_reserved2, &dst->in_reserved2);
ISP_IOXPUT_8(isp, src->in_tgt, &dst->in_tgt);
ISP_IOXPUT_8(isp, src->in_status, &dst->in_status);
ISP_IOXPUT_8(isp, src->in_rsvd2, &dst->in_rsvd2);
ISP_IOXPUT_8(isp, src->in_tag_val, &dst->in_tag_val);
ISP_IOXPUT_8(isp, src->in_tag_type, &dst->in_tag_type);
}
ISP_IOXPUT_32(isp, src->in_flags, &dst->in_flags);
ISP_IOXPUT_16(isp, src->in_seqid, &dst->in_seqid);
for (i = 0; i < IN_MSGLEN; i++) {
ISP_IOXPUT_8(isp, src->in_msg[i], &dst->in_msg[i]);
}
for (i = 0; i < IN_RSVDLEN; i++) {
ISP_IOXPUT_8(isp, src->in_reserved3[i], &dst->in_reserved3[i]);
}
for (i = 0; i < QLTM_SENSELEN; i++) {
ISP_IOXPUT_8(isp, src->in_sense[i], &dst->in_sense[i]);
}
}
void
isp_get_notify(ispsoftc_t *isp, in_entry_t *src, in_entry_t *dst)
{
int i;
isp_get_hdr(isp, &src->in_header, &dst->in_header);
ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved);
if (ISP_IS_SBUS(isp)) {
ISP_IOXGET_8(isp, &src->in_lun, dst->in_iid);
ISP_IOXGET_8(isp, &src->in_iid, dst->in_lun);
ISP_IOXGET_8(isp, &src->in_reserved2, dst->in_tgt);
ISP_IOXGET_8(isp, &src->in_tgt, dst->in_reserved2);
ISP_IOXGET_8(isp, &src->in_status, dst->in_rsvd2);
ISP_IOXGET_8(isp, &src->in_rsvd2, dst->in_status);
ISP_IOXGET_8(isp, &src->in_tag_val, dst->in_tag_type);
ISP_IOXGET_8(isp, &src->in_tag_type, dst->in_tag_val);
} else {
ISP_IOXGET_8(isp, &src->in_lun, dst->in_lun);
ISP_IOXGET_8(isp, &src->in_iid, dst->in_iid);
ISP_IOXGET_8(isp, &src->in_reserved2, dst->in_reserved2);
ISP_IOXGET_8(isp, &src->in_tgt, dst->in_tgt);
ISP_IOXGET_8(isp, &src->in_status, dst->in_status);
ISP_IOXGET_8(isp, &src->in_rsvd2, dst->in_rsvd2);
ISP_IOXGET_8(isp, &src->in_tag_val, dst->in_tag_val);
ISP_IOXGET_8(isp, &src->in_tag_type, dst->in_tag_type);
}
ISP_IOXGET_32(isp, &src->in_flags, dst->in_flags);
ISP_IOXGET_16(isp, &src->in_seqid, dst->in_seqid);
for (i = 0; i < IN_MSGLEN; i++) {
ISP_IOXGET_8(isp, &src->in_msg[i], dst->in_msg[i]);
}
for (i = 0; i < IN_RSVDLEN; i++) {
ISP_IOXGET_8(isp, &src->in_reserved3[i], dst->in_reserved3[i]);
}
for (i = 0; i < QLTM_SENSELEN; i++) {
ISP_IOXGET_8(isp, &src->in_sense[i], dst->in_sense[i]);
}
}
void
isp_put_notify_fc(ispsoftc_t *isp, in_fcentry_t *src, in_fcentry_t *dst)
{
@ -3709,52 +3475,6 @@ isp_get_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *
ISP_IOXGET_16(isp, &src->in_oxid, dst->in_oxid);
}
void
isp_put_notify_ack(ispsoftc_t *isp, na_entry_t *src, na_entry_t *dst)
{
int i;
isp_put_hdr(isp, &src->na_header, &dst->na_header);
ISP_IOXPUT_32(isp, src->na_reserved, &dst->na_reserved);
if (ISP_IS_SBUS(isp)) {
ISP_IOXPUT_8(isp, src->na_lun, &dst->na_iid);
ISP_IOXPUT_8(isp, src->na_iid, &dst->na_lun);
ISP_IOXPUT_8(isp, src->na_status, &dst->na_event);
ISP_IOXPUT_8(isp, src->na_event, &dst->na_status);
} else {
ISP_IOXPUT_8(isp, src->na_lun, &dst->na_lun);
ISP_IOXPUT_8(isp, src->na_iid, &dst->na_iid);
ISP_IOXPUT_8(isp, src->na_status, &dst->na_status);
ISP_IOXPUT_8(isp, src->na_event, &dst->na_event);
}
ISP_IOXPUT_32(isp, src->na_flags, &dst->na_flags);
for (i = 0; i < NA_RSVDLEN; i++) {
ISP_IOXPUT_16(isp, src->na_reserved3[i], &dst->na_reserved3[i]);
}
}
void
isp_get_notify_ack(ispsoftc_t *isp, na_entry_t *src, na_entry_t *dst)
{
int i;
isp_get_hdr(isp, &src->na_header, &dst->na_header);
ISP_IOXGET_32(isp, &src->na_reserved, dst->na_reserved);
if (ISP_IS_SBUS(isp)) {
ISP_IOXGET_8(isp, &src->na_lun, dst->na_iid);
ISP_IOXGET_8(isp, &src->na_iid, dst->na_lun);
ISP_IOXGET_8(isp, &src->na_status, dst->na_event);
ISP_IOXGET_8(isp, &src->na_event, dst->na_status);
} else {
ISP_IOXGET_8(isp, &src->na_lun, dst->na_lun);
ISP_IOXGET_8(isp, &src->na_iid, dst->na_iid);
ISP_IOXGET_8(isp, &src->na_status, dst->na_status);
ISP_IOXGET_8(isp, &src->na_event, dst->na_event);
}
ISP_IOXGET_32(isp, &src->na_flags, dst->na_flags);
for (i = 0; i < NA_RSVDLEN; i++) {
ISP_IOXGET_16(isp, &src->na_reserved3[i], dst->na_reserved3[i]);
}
}
void
isp_put_notify_ack_fc(ispsoftc_t *isp, na_fcentry_t *src, na_fcentry_t *dst)
{

View File

@ -182,15 +182,11 @@ void isp_del_wwn_entry(ispsoftc_t *, int, uint64_t, uint16_t, uint32_t);
void isp_del_all_wwn_entries(ispsoftc_t *, int);
void isp_del_wwn_entries(ispsoftc_t *, isp_notify_t *);
void isp_put_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
void isp_get_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
void isp_put_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
void isp_put_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
void isp_get_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
void isp_get_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
void isp_get_atio7(ispsoftc_t *isp, at7_entry_t *, at7_entry_t *);
void isp_put_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
void isp_get_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
void isp_put_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
void isp_put_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
void isp_put_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
@ -199,16 +195,12 @@ void isp_get_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
void isp_get_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
void isp_put_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
void isp_get_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
void isp_put_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
void isp_get_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
void isp_put_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
void isp_put_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
void isp_put_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
void isp_get_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
void isp_get_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
void isp_get_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
void isp_put_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
void isp_get_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
void isp_put_notify_24xx_ack(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
void isp_put_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
void isp_put_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);

View File

@ -551,6 +551,9 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp)
isp->isp_confopts |= ISP_CFG_OWNLOOPID;
}
if (IS_SCSI(isp))
return;
tval = -1;
snprintf(name, sizeof(name), "%srole", prefix);
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
@ -570,11 +573,6 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp)
if (tval == -1) {
tval = ISP_DEFAULT_ROLES;
}
if (IS_SCSI(isp)) {
ISP_SPI_PC(isp, chan)->def_role = tval;
return;
}
ISP_FC_PC(isp, chan)->def_role = tval;
tval = 0;
@ -889,14 +887,7 @@ isp_pci_attach(device_t dev)
isp_get_specific_options(dev, i, isp);
}
/*
* The 'it' suffix really only matters for SCSI cards in target mode.
*/
isp->isp_osinfo.fw = NULL;
if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->def_role & ISP_ROLE_TARGET)) {
snprintf(fwname, sizeof (fwname), "isp_%04x_it", did);
isp->isp_osinfo.fw = firmware_get(fwname);
}
if (isp->isp_osinfo.fw == NULL) {
snprintf(fwname, sizeof (fwname), "isp_%04x", did);
isp->isp_osinfo.fw = firmware_get(fwname);
@ -1587,17 +1578,6 @@ isp_pci_mbxdma(ispsoftc_t *isp)
} else {
nsegs = ISP_NSEG_MAX;
}
#ifdef ISP_TARGET_MODE
/*
* XXX: We don't really support 64 bit target mode for parallel scsi yet
*/
if (IS_SCSI(isp) && isp->isp_osinfo.sixtyfourbit) {
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
isp_prt(isp, ISP_LOGERR, "we cannot do DAC for SPI cards yet");
ISP_LOCK(isp);
return (1);
}
#endif
if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, nsegs, slim, 0, &isp->isp_osinfo.dmat)) {
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);

View File

@ -203,7 +203,8 @@ isp_sbus_attach(device_t dev)
isp->isp_revision = 0; /* XXX */
isp->isp_dev = dev;
isp->isp_nchan = 1;
ISP_SET_PC(isp, 0, def_role, role);
if (IS_FC(isp))
ISP_FC_PC(isp, 0)->def_role = role;
/*
* Get the clock frequency and convert it from HZ to MHz,

View File

@ -56,12 +56,9 @@ static const char atiocope[] = "ATIO returned for LUN %x because it was in the m
static const char atior[] = "ATIO returned for LUN %x from handle 0x%x because a Bus Reset occurred on bus %d";
static const char rqo[] = "%s: Request Queue Overflow";
static void isp_got_msg(ispsoftc_t *, in_entry_t *);
static void isp_got_msg_fc(ispsoftc_t *, in_fcentry_t *);
static void isp_got_tmf_24xx(ispsoftc_t *, at7_entry_t *);
static void isp_handle_atio(ispsoftc_t *, at_entry_t *);
static void isp_handle_atio2(ispsoftc_t *, at2_entry_t *);
static void isp_handle_ctio(ispsoftc_t *, ct_entry_t *);
static void isp_handle_ctio2(ispsoftc_t *, ct2_entry_t *);
static void isp_handle_ctio7(ispsoftc_t *, ct7_entry_t *);
static void isp_handle_24xx_inotify(ispsoftc_t *, in_fcentry_24xx_t *);
@ -118,20 +115,16 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
uint16_t status;
uint32_t seqid;
union {
at_entry_t *atiop;
at2_entry_t *at2iop;
at2e_entry_t *at2eiop;
at7_entry_t *at7iop;
ct_entry_t *ctiop;
ct2_entry_t *ct2iop;
ct2e_entry_t *ct2eiop;
ct7_entry_t *ct7iop;
lun_entry_t *lunenp;
in_entry_t *inotp;
in_fcentry_t *inot_fcp;
in_fcentry_e_t *inote_fcp;
in_fcentry_24xx_t *inot_24xx;
na_entry_t *nackp;
na_fcentry_t *nack_fcp;
na_fcentry_e_t *nacke_fcp;
na_fcentry_24xx_t *nack_24xx;
@ -140,20 +133,16 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
abts_rsp_t *abts_rsp;
els_t *els;
void * *vp;
#define atiop unp.atiop
#define at2iop unp.at2iop
#define at2eiop unp.at2eiop
#define at7iop unp.at7iop
#define ctiop unp.ctiop
#define ct2iop unp.ct2iop
#define ct2eiop unp.ct2eiop
#define ct7iop unp.ct7iop
#define lunenp unp.lunenp
#define inotp unp.inotp
#define inot_fcp unp.inot_fcp
#define inote_fcp unp.inote_fcp
#define inot_24xx unp.inot_24xx
#define nackp unp.nackp
#define nack_fcp unp.nack_fcp
#define nacke_fcp unp.nacke_fcp
#define nack_24xx unp.nack_24xx
@ -164,7 +153,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
} unp;
uint8_t local[QENTRY_LEN];
uint16_t iid;
int bus, type, level, rval = 1;
int bus, type, len, level, rval = 1;
isp_notify_t notify;
type = isp_get_response_type(isp, (isphdr_t *)vptr);
@ -174,44 +163,32 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
switch (type) {
case RQSTYPE_ATIO:
if (IS_24XX(isp)) {
int len;
isp_get_atio7(isp, at7iop, (at7_entry_t *) local);
at7iop = (at7_entry_t *) local;
/*
* Check for and do something with commands whose
* IULEN extends past a single queue entry.
*/
len = at7iop->at_ta_len & 0xfffff;
if (len > (QENTRY_LEN - 8)) {
len -= (QENTRY_LEN - 8);
isp_prt(isp, ISP_LOGINFO, "long IU length (%d) ignored", len);
while (len > 0) {
*optrp = ISP_NXT_QENTRY(*optrp, RESULT_QUEUE_LEN(isp));
len -= QENTRY_LEN;
}
isp_get_atio7(isp, at7iop, (at7_entry_t *) local);
at7iop = (at7_entry_t *) local;
/*
* Check for and do something with commands whose
* IULEN extends past a single queue entry.
*/
len = at7iop->at_ta_len & 0xfffff;
if (len > (QENTRY_LEN - 8)) {
len -= (QENTRY_LEN - 8);
isp_prt(isp, ISP_LOGINFO, "long IU length (%d) ignored", len);
while (len > 0) {
*optrp = ISP_NXT_QENTRY(*optrp, RESULT_QUEUE_LEN(isp));
len -= QENTRY_LEN;
}
/*
* Check for a task management function
*/
if (at7iop->at_cmnd.fcp_cmnd_task_management) {
isp_got_tmf_24xx(isp, at7iop);
break;
}
/*
* Just go straight to outer layer for this one.
*/
isp_async(isp, ISPASYNC_TARGET_ACTION, local);
} else {
isp_get_atio(isp, atiop, (at_entry_t *) local);
isp_handle_atio(isp, (at_entry_t *) local);
}
break;
case RQSTYPE_CTIO:
isp_get_ctio(isp, ctiop, (ct_entry_t *) local);
isp_handle_ctio(isp, (ct_entry_t *) local);
/*
* Check for a task management function
*/
if (at7iop->at_cmnd.fcp_cmnd_task_management) {
isp_got_tmf_24xx(isp, at7iop);
break;
}
/*
* Just go straight to outer layer for this one.
*/
isp_async(isp, ISPASYNC_TARGET_ACTION, local);
break;
case RQSTYPE_ATIO2:
@ -251,8 +228,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
inot_24xx = (in_fcentry_24xx_t *) local;
isp_handle_24xx_inotify(isp, inot_24xx);
break;
}
if (IS_FC(isp)) {
} else {
if (ISP_CAP_2KLOGIN(isp)) {
in_fcentry_e_t *ecp = (in_fcentry_e_t *)local;
isp_get_notify_fc_e(isp, inote_fcp, ecp);
@ -266,16 +242,6 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
status = fcp->in_status;
seqid = fcp->in_seqid;
}
} else {
in_entry_t *inp = (in_entry_t *)local;
isp_get_notify(isp, inotp, inp);
status = inp->in_status & 0xff;
seqid = inp->in_seqid;
iid = inp->in_iid;
if (IS_DUALBUS(isp)) {
bus = GET_BUS_VAL(inp->in_iid);
SET_BUS_VAL(inp->in_iid, 0);
}
}
isp_prt(isp, ISP_LOGTDEBUG0, "Immediate Notify On Bus %d, status=0x%x seqid=0x%x", bus, status, seqid);
@ -283,11 +249,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
switch (status) {
case IN_MSG_RECEIVED:
case IN_IDE_RECEIVED:
if (IS_FC(isp)) {
isp_got_msg_fc(isp, (in_fcentry_t *)local);
} else {
isp_got_msg(isp, (in_entry_t *)local);
}
isp_got_msg_fc(isp, (in_fcentry_t *)local);
break;
case IN_RSRC_UNAVAIL:
isp_prt(isp, ISP_LOGINFO, "Firmware out of ATIOs");
@ -387,7 +349,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
level = ISP_LOGTDEBUG1;
}
isp_prt(isp, level, "Notify Ack Status=0x%x; Subcode 0x%x seqid=0x%x", nack_24xx->na_status, nack_24xx->na_status_subcode, nack_24xx->na_rxid);
} else if (IS_FC(isp)) {
} else {
if (ISP_CAP_2KLOGIN(isp)) {
isp_get_notify_ack_fc_e(isp, nacke_fcp, (na_fcentry_e_t *)local);
} else {
@ -400,15 +362,6 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
level = ISP_LOGTDEBUG1;
}
isp_prt(isp, level, "Notify Ack Status=0x%x seqid 0x%x", nack_fcp->na_status, nack_fcp->na_seqid);
} else {
isp_get_notify_ack(isp, nackp, (na_entry_t *)local);
nackp = (na_entry_t *)local;
if (nackp->na_status != NA_OK) {
level = ISP_LOGINFO;
} else {
level = ISP_LOGTDEBUG1;
}
isp_prt(isp, level, "Notify Ack event 0x%x status=0x%x seqid 0x%x", nackp->na_event, nackp->na_status, nackp->na_seqid);
}
break;
@ -456,72 +409,6 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
return (rval);
}
/*
* Toggle (on/off) target mode for bus/target/lun.
*
* The caller has checked for overlap and legality.
*
* Note that not all of bus, target or lun can be paid attention to.
* Note also that this action will not be complete until the f/w writes
* a response entry. The caller is responsible for synchronizing with this.
*/
int
isp_lun_cmd(ispsoftc_t *isp, int cmd, int bus, int lun, int cmd_cnt, int inot_cnt)
{
lun_entry_t el;
void *outp;
ISP_MEMZERO(&el, sizeof (el));
if (IS_DUALBUS(isp)) {
el.le_rsvd = (bus & 0x1) << 7;
}
el.le_cmd_count = (cmd_cnt < 0)? -cmd_cnt : cmd_cnt;
el.le_in_count = (inot_cnt < 0)? -inot_cnt : inot_cnt;
if (cmd == RQSTYPE_ENABLE_LUN) {
if (IS_SCSI(isp)) {
el.le_flags = LUN_TQAE|LUN_DISAD;
el.le_cdb6len = 12;
el.le_cdb7len = 12;
}
} else if (cmd == RQSTYPE_MODIFY_LUN) {
if (cmd_cnt == 0 && inot_cnt == 0) {
isp_prt(isp, ISP_LOGWARN, "makes no sense to modify a lun with both command and immediate notify counts as zero");
return (0);
}
if (cmd_cnt < 0)
el.le_ops |= LUN_CCDECR;
else
el.le_ops |= LUN_CCINCR;
if (inot_cnt < 0)
el.le_ops |= LUN_INDECR;
else
el.le_ops |= LUN_ININCR;
} else {
isp_prt(isp, ISP_LOGWARN, "unknown cmd (0x%x) in %s", cmd, __func__);
return (-1);
}
el.le_header.rqs_entry_type = cmd;
el.le_header.rqs_entry_count = 1;
if (IS_SCSI(isp)) {
el.le_tgt = SDPARAM(isp, bus)->isp_initiator_id;
el.le_lun = lun;
} else if (ISP_CAP_SCCFW(isp) == 0) {
el.le_lun = lun;
}
el.le_timeout = 30;
outp = isp_getrqentry(isp);
if (outp == NULL) {
isp_prt(isp, ISP_LOGERR, rqo, __func__);
return (-1);
}
isp_put_enable_lun(isp, &el, outp);
ISP_TDQE(isp, "isp_lun_cmd", isp->isp_reqidx, &el);
ISP_SYNC_REQUEST(isp);
return (0);
}
int
isp_target_put_entry(ispsoftc_t *isp, void *ap)
{
@ -534,9 +421,6 @@ isp_target_put_entry(ispsoftc_t *isp, void *ap)
return (-1);
}
switch (etype) {
case RQSTYPE_ATIO:
isp_put_atio(isp, (at_entry_t *) ap, (at_entry_t *) outp);
break;
case RQSTYPE_ATIO2:
if (ISP_CAP_2KLOGIN(isp)) {
isp_put_atio2e(isp, (at2e_entry_t *) ap, (at2e_entry_t *) outp);
@ -544,9 +428,6 @@ isp_target_put_entry(ispsoftc_t *isp, void *ap)
isp_put_atio2(isp, (at2_entry_t *) ap, (at2_entry_t *) outp);
}
break;
case RQSTYPE_CTIO:
isp_put_ctio(isp, (ct_entry_t *) ap, (ct_entry_t *) outp);
break;
case RQSTYPE_CTIO2:
if (ISP_CAP_2KLOGIN(isp)) {
isp_put_ctio2e(isp, (ct2e_entry_t *) ap, (ct2e_entry_t *) outp);
@ -569,42 +450,27 @@ isp_target_put_entry(ispsoftc_t *isp, void *ap)
int
isp_target_put_atio(ispsoftc_t *isp, void *arg)
{
at2_entry_t *aep = arg;
union {
at_entry_t _atio;
at2_entry_t _atio2;
at2e_entry_t _atio2e;
} atun;
ISP_MEMZERO(&atun, sizeof atun);
if (IS_FC(isp)) {
at2_entry_t *aep = arg;
atun._atio2.at_header.rqs_entry_type = RQSTYPE_ATIO2;
atun._atio2.at_header.rqs_entry_count = 1;
if (ISP_CAP_SCCFW(isp)) {
atun._atio2.at_scclun = aep->at_scclun;
} else {
atun._atio2.at_lun = (uint8_t) aep->at_lun;
}
if (ISP_CAP_2KLOGIN(isp)) {
atun._atio2e.at_iid = ((at2e_entry_t *)aep)->at_iid;
} else {
atun._atio2.at_iid = aep->at_iid;
}
atun._atio2.at_rxid = aep->at_rxid;
atun._atio2.at_status = CT_OK;
atun._atio2.at_header.rqs_entry_type = RQSTYPE_ATIO2;
atun._atio2.at_header.rqs_entry_count = 1;
if (ISP_CAP_SCCFW(isp)) {
atun._atio2.at_scclun = aep->at_scclun;
} else {
at_entry_t *aep = arg;
atun._atio.at_header.rqs_entry_type = RQSTYPE_ATIO;
atun._atio.at_header.rqs_entry_count = 1;
atun._atio.at_handle = aep->at_handle;
atun._atio.at_iid = aep->at_iid;
atun._atio.at_tgt = aep->at_tgt;
atun._atio.at_lun = aep->at_lun;
atun._atio.at_tag_type = aep->at_tag_type;
atun._atio.at_tag_val = aep->at_tag_val;
atun._atio.at_status = (aep->at_flags & AT_TQAE);
atun._atio.at_status |= CT_OK;
atun._atio2.at_lun = (uint8_t) aep->at_lun;
}
if (ISP_CAP_2KLOGIN(isp)) {
atun._atio2e.at_iid = ((at2e_entry_t *)aep)->at_iid;
} else {
atun._atio2.at_iid = aep->at_iid;
}
atun._atio2.at_rxid = aep->at_rxid;
atun._atio2.at_status = CT_OK;
return (isp_target_put_entry(isp, &atun));
}
@ -632,7 +498,6 @@ isp_endcmd(ispsoftc_t *isp, ...)
uint32_t code, hdl;
uint8_t sts;
union {
ct_entry_t _ctio;
ct2_entry_t _ctio2;
ct2e_entry_t _ctio2e;
ct7_entry_t _ctio7;
@ -693,7 +558,7 @@ isp_endcmd(ispsoftc_t *isp, ...)
}
}
cto->ct_syshandle = hdl;
} else if (IS_FC(isp)) {
} else {
at2_entry_t *aep;
ct2_entry_t *cto = &un._ctio2;
@ -736,35 +601,6 @@ isp_endcmd(ispsoftc_t *isp, ...)
cto->rsp.m1.ct_scsi_status |= CT2_SNSLEN_VALID;
}
cto->ct_syshandle = hdl;
} else {
at_entry_t *aep;
ct_entry_t *cto = &un._ctio;
va_start(ap, isp);
aep = va_arg(ap, at_entry_t *);
code = va_arg(ap, uint32_t);
hdl = va_arg(ap, uint32_t);
va_end(ap);
isp_prt(isp, ISP_LOGTDEBUG0, "%s: [IID %d] code %x", __func__, aep->at_iid, code);
sts = code;
cto->ct_header.rqs_entry_type = RQSTYPE_CTIO;
cto->ct_header.rqs_entry_count = 1;
cto->ct_fwhandle = aep->at_handle;
cto->ct_iid = aep->at_iid;
cto->ct_tgt = aep->at_tgt;
cto->ct_lun = aep->at_lun;
cto->ct_tag_type = aep->at_tag_type;
cto->ct_tag_val = aep->at_tag_val;
if (aep->at_flags & AT_TQAE) {
cto->ct_flags |= CT_TQAE;
}
cto->ct_flags = CT_SENDSTATUS | CT_NO_DATA;
if (hdl == 0) {
cto->ct_flags |= CT_CCINCR;
}
cto->ct_scsi_status = sts;
cto->ct_syshandle = hdl;
}
return (isp_target_put_entry(isp, &un));
}
@ -832,21 +668,13 @@ isp_target_async(ispsoftc_t *isp, int bus, int event)
ct->ct_nphdl = CT7_OK;
ct->ct_syshandle = bus;
ct->ct_flags = CT7_SENDSTATUS;
} else if (IS_FC(isp)) {
} else {
/* This should also suffice for 2K login code */
ct2_entry_t *ct = (ct2_entry_t *) storage;
ct->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
ct->ct_status = CT_OK;
ct->ct_syshandle = bus;
ct->ct_flags = CT2_SENDSTATUS|CT2_FASTPOST;
} else {
ct_entry_t *ct = (ct_entry_t *) storage;
ct->ct_header.rqs_entry_type = RQSTYPE_CTIO;
ct->ct_status = CT_OK;
ct->ct_syshandle = bus;
/* we skip fwhandle here */
ct->ct_fwhandle = 0;
ct->ct_flags = CT_SENDSTATUS;
}
isp_async(isp, ISPASYNC_TARGET_ACTION, storage);
break;
@ -861,69 +689,6 @@ isp_target_async(ispsoftc_t *isp, int bus, int event)
return (0);
}
/*
* Process a received message.
* The ISP firmware can handle most messages, there are only
* a few that we need to deal with:
* - abort: clean up the current command
* - abort tag and clear queue
*/
static void
isp_got_msg(ispsoftc_t *isp, in_entry_t *inp)
{
isp_notify_t notify;
uint8_t status = inp->in_status & ~QLTM_SVALID;
ISP_MEMZERO(&notify, sizeof (notify));
notify.nt_hba = isp;
notify.nt_wwn = INI_ANY;
notify.nt_nphdl = GET_IID_VAL(inp->in_iid);
notify.nt_sid = PORT_ANY;
notify.nt_did = PORT_ANY;
notify.nt_channel = GET_BUS_VAL(inp->in_iid);
notify.nt_tgt = inp->in_tgt;
notify.nt_lun = inp->in_lun;
IN_MAKE_TAGID(notify.nt_tagval, inp);
notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
notify.nt_lreserved = inp;
if (status == IN_IDE_RECEIVED || status == IN_MSG_RECEIVED) {
switch (inp->in_msg[0]) {
case MSG_ABORT:
notify.nt_ncode = NT_ABORT_TASK_SET;
break;
case MSG_BUS_DEV_RESET:
notify.nt_ncode = NT_TARGET_RESET;
break;
case MSG_ABORT_TAG:
notify.nt_ncode = NT_ABORT_TASK;
break;
case MSG_CLEAR_QUEUE:
notify.nt_ncode = NT_CLEAR_TASK_SET;
break;
case MSG_REL_RECOVERY:
notify.nt_ncode = NT_CLEAR_ACA;
break;
case MSG_TERM_IO_PROC:
notify.nt_ncode = NT_ABORT_TASK;
break;
case MSG_LUN_RESET:
notify.nt_ncode = NT_LUN_RESET;
break;
default:
isp_prt(isp, ISP_LOGERR, "%s: unhandled message 0x%x", __func__, inp->in_msg[0]);
isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
return;
}
isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
} else {
isp_prt(isp, ISP_LOGERR, "%s: unknown immediate notify status 0x%x", __func__, inp->in_status);
isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
}
}
/*
* Synthesize a message from the task management flags in a FCP_CMND_IU.
*/
@ -1111,7 +876,7 @@ isp_notify_ack(ispsoftc_t *isp, void *arg)
}
}
isp_put_notify_24xx_ack(isp, na, (na_fcentry_24xx_t *)outp);
} else if (IS_FC(isp)) {
} else {
na_fcentry_t *na = (na_fcentry_t *) storage;
int iid = 0;
@ -1148,25 +913,6 @@ isp_notify_ack(ispsoftc_t *isp, void *arg)
}
isp_prt(isp, ISP_LOGTDEBUG0, "notify ack handle %x seqid %x flags %x tflags %x response %x", iid, na->na_seqid,
na->na_flags, na->na_task_flags, na->na_response);
} else {
na_entry_t *na = (na_entry_t *) storage;
if (arg) {
in_entry_t *inp = arg;
ISP_MEMCPY(storage, arg, sizeof (isphdr_t));
na->na_iid = inp->in_iid;
na->na_lun = inp->in_lun;
na->na_tgt = inp->in_tgt;
na->na_seqid = inp->in_seqid;
if (inp->in_status == IN_RESET) {
na->na_event = NA_RST_CLRD;
}
} else {
na->na_event = NA_RST_CLRD;
}
na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK;
na->na_header.rqs_entry_count = 1;
isp_put_notify_ack(isp, na, (na_entry_t *)outp);
isp_prt(isp, ISP_LOGTDEBUG0, "notify ack handle %x lun %x tgt %u seqid %x event %x", na->na_iid, na->na_lun, na->na_tgt, na->na_seqid, na->na_event);
}
ISP_TDQE(isp, "isp_notify_ack", isp->isp_reqidx, storage);
ISP_SYNC_REQUEST(isp);
@ -1252,80 +998,6 @@ isp_acknak_abts(ispsoftc_t *isp, void *arg, int errno)
return (0);
}
static void
isp_handle_atio(ispsoftc_t *isp, at_entry_t *aep)
{
int lun;
lun = aep->at_lun;
/*
* The firmware status (except for the QLTM_SVALID bit) indicates
* why this ATIO was sent to us.
*
* If QLTM_SVALID is set, the firware has recommended Sense Data.
*
* If the DISCONNECTS DISABLED bit is set in the flags field,
* we're still connected on the SCSI bus - i.e. the initiator
* did not set DiscPriv in the identify message. We don't care
* about this so it's ignored.
*/
switch (aep->at_status & ~QLTM_SVALID) {
case AT_PATH_INVALID:
/*
* ATIO rejected by the firmware due to disabled lun.
*/
isp_prt(isp, ISP_LOGERR, "rejected ATIO for disabled lun %x", lun);
break;
case AT_NOCAP:
/*
* Requested Capability not available
* We sent an ATIO that overflowed the firmware's
* command resource count.
*/
isp_prt(isp, ISP_LOGERR, "rejected ATIO for lun %x because of command count overflow", lun);
break;
case AT_BDR_MSG:
/*
* If we send an ATIO to the firmware to increment
* its command resource count, and the firmware is
* recovering from a Bus Device Reset, it returns
* the ATIO with this status. We set the command
* resource count in the Enable Lun entry and do
* not increment it. Therefore we should never get
* this status here.
*/
isp_prt(isp, ISP_LOGERR, atiocope, lun, GET_BUS_VAL(aep->at_iid));
break;
case AT_CDB: /* Got a CDB */
case AT_PHASE_ERROR: /* Bus Phase Sequence Error */
/*
* Punt to platform specific layer.
*/
isp_async(isp, ISPASYNC_TARGET_ACTION, aep);
break;
case AT_RESET:
/*
* A bus reset came along and blew away this command. Why
* they do this in addition the async event code stuff,
* I dunno.
*
* Ignore it because the async event will clear things
* up for us.
*/
isp_prt(isp, ISP_LOGWARN, atior, lun, GET_IID_VAL(aep->at_iid), GET_BUS_VAL(aep->at_iid));
break;
default:
isp_prt(isp, ISP_LOGERR, "Unknown ATIO status 0x%x from handle %x for lun %x", aep->at_status, aep->at_iid, lun);
(void) isp_target_put_atio(isp, aep);
break;
}
}
static void
isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep)
{
@ -1414,156 +1086,6 @@ isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep)
}
}
static void
isp_handle_ctio(ispsoftc_t *isp, ct_entry_t *ct)
{
void *xs;
int pl = ISP_LOGTDEBUG2;
char *fmsg = NULL;
if (ct->ct_syshandle) {
xs = isp_find_xs_tgt(isp, ct->ct_syshandle);
if (xs == NULL) {
pl = ISP_LOGALL;
}
} else {
xs = NULL;
}
switch (ct->ct_status & ~QLTM_SVALID) {
case CT_OK:
/*
* There are generally 3 possibilities as to why we'd get
* this condition:
* We disconnected after receiving a CDB.
* We sent or received data.
* We sent status & command complete.
*/
if (ct->ct_flags & CT_SENDSTATUS) {
break;
} else if ((ct->ct_flags & CT_DATAMASK) == CT_NO_DATA) {
/*
* Nothing to do in this case.
*/
isp_prt(isp, pl, "CTIO- iid %d disconnected OK", ct->ct_iid);
return;
}
break;
case CT_BDR_MSG:
/*
* Bus Device Reset message received or the SCSI Bus has
* been Reset; the firmware has gone to Bus Free.
*
* The firmware generates an async mailbox interrupt to
* notify us of this and returns outstanding CTIOs with this
* status. These CTIOs are handled in that same way as
* CT_ABORTED ones, so just fall through here.
*/
fmsg = "Bus Device Reset";
/*FALLTHROUGH*/
case CT_RESET:
if (fmsg == NULL)
fmsg = "Bus Reset";
/*FALLTHROUGH*/
case CT_ABORTED:
/*
* When an Abort message is received the firmware goes to
* Bus Free and returns all outstanding CTIOs with the status
* set, then sends us an Immediate Notify entry.
*/
if (fmsg == NULL)
fmsg = "ABORT TAG message sent by Initiator";
isp_prt(isp, ISP_LOGTDEBUG0, "CTIO destroyed by %s", fmsg);
break;
case CT_INVAL:
/*
* CTIO rejected by the firmware due to disabled lun.
* "Cannot Happen".
*/
isp_prt(isp, ISP_LOGERR, "Firmware rejected CTIO for disabled lun %x", ct->ct_lun);
break;
case CT_NOPATH:
/*
* CTIO rejected by the firmware due "no path for the
* nondisconnecting nexus specified". This means that
* we tried to access the bus while a non-disconnecting
* command is in process.
*/
isp_prt(isp, ISP_LOGERR, "Firmware rejected CTIO for bad nexus %d/%d/%x", ct->ct_iid, ct->ct_tgt, ct->ct_lun);
break;
case CT_RSELTMO:
fmsg = "Reselection";
/*FALLTHROUGH*/
case CT_TIMEOUT:
if (fmsg == NULL)
fmsg = "Command";
isp_prt(isp, ISP_LOGWARN, "Firmware timed out on %s", fmsg);
break;
case CT_PANIC:
if (fmsg == NULL)
fmsg = "Unrecoverable Error";
/*FALLTHROUGH*/
case CT_ERR:
if (fmsg == NULL)
fmsg = "Completed with Error";
/*FALLTHROUGH*/
case CT_PHASE_ERROR:
if (fmsg == NULL)
fmsg = "Phase Sequence Error";
/*FALLTHROUGH*/
case CT_TERMINATED:
if (fmsg == NULL)
fmsg = "terminated by TERMINATE TRANSFER";
/*FALLTHROUGH*/
case CT_NOACK:
if (fmsg == NULL)
fmsg = "unacknowledged Immediate Notify pending";
isp_prt(isp, ISP_LOGERR, "CTIO returned by f/w- %s", fmsg);
break;
default:
isp_prt(isp, ISP_LOGERR, "Unknown CTIO status 0x%x", ct->ct_status & ~QLTM_SVALID);
break;
}
if (xs == NULL) {
/*
* There may be more than one CTIO for a data transfer,
* or this may be a status CTIO we're not monitoring.
*
* The assumption is that they'll all be returned in the
* order we got them.
*/
if (ct->ct_syshandle == 0) {
if ((ct->ct_flags & CT_SENDSTATUS) == 0) {
isp_prt(isp, pl, "intermediate CTIO completed ok");
} else {
isp_prt(isp, pl, "unmonitored CTIO completed ok");
}
} else {
isp_prt(isp, pl, "NO xs for CTIO (handle 0x%x) status 0x%x", ct->ct_syshandle, ct->ct_status & ~QLTM_SVALID);
}
} else {
/*
* Final CTIO completed. Release DMA resources and
* notify platform dependent layers.
*/
if ((ct->ct_flags & CT_DATAMASK) != CT_NO_DATA) {
ISP_DMAFREE(isp, xs, ct->ct_syshandle);
}
isp_prt(isp, pl, "final CTIO complete");
/*
* The platform layer will destroy the handle if appropriate.
*/
isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
}
}
static void
isp_handle_ctio2(ispsoftc_t *isp, ct2_entry_t *ct)
{

View File

@ -171,7 +171,6 @@ typedef struct {
uint32_t : 8,
update : 1,
sendmarker : 1,
role : 2,
isp_req_ack_active_neg : 1,
isp_data_line_active_neg: 1,
isp_cmd_dma_burst_enable: 1,
@ -1070,8 +1069,7 @@ void isp_prt_endcmd(ispsoftc_t *, XS_T *);
* DEFAULT_FRAMESIZE(ispsoftc_t *) Default Frame Size
* DEFAULT_EXEC_THROTTLE(ispsoftc_t *) Default Execution Throttle
*
* GET_DEFAULT_ROLE(ispsoftc_t *, int) Get Default Role for a channel
* SET_DEFAULT_ROLE(ispsoftc_t *, int, int) Set Default Role for a channel
* DEFAULT_ROLE(ispsoftc_t *, int) Get Default Role for a channel
* DEFAULT_IID(ispsoftc_t *, int) Default SCSI initiator ID
* DEFAULT_LOOPID(ispsoftc_t *, int) Default FC Loop ID
*
@ -1128,14 +1126,6 @@ int isp_notify_ack(ispsoftc_t *, void *);
*/
int isp_acknak_abts(ispsoftc_t *, void *, int);
/*
* Enable/Disable/Modify a logical unit.
* (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt)
*/
#define DFLT_CMND_CNT 0xff /* unmonitored */
#define DFLT_INOT_CNT 0xff /* unmonitored */
int isp_lun_cmd(ispsoftc_t *, int, int, int, int, int);
/*
* General request queue 'put' routine for target mode entries.
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -99,21 +99,12 @@ static int isp_1000_loaded;
#if defined(ISP_1040)
static int isp_1040_loaded;
#endif
#if defined(ISP_1040_IT)
static int isp_1040_it_loaded;
#endif
#if defined(ISP_1080)
static int isp_1080_loaded;
#endif
#if defined(ISP_1080_IT)
static int isp_1080_it_loaded;
#endif
#if defined(ISP_12160)
static int isp_12160_loaded;
#endif
#if defined(ISP_12160_IT)
static int isp_12160_it_loaded;
#endif
#if defined(ISP_2100)
static int isp_2100_loaded;
#endif
@ -165,21 +156,12 @@ do_load_fw(void)
#if defined(ISP_1040)
RMACRO(isp_1040);
#endif
#if defined(ISP_1040_IT)
RMACRO(isp_1040_it);
#endif
#if defined(ISP_1080)
RMACRO(isp_1080);
#endif
#if defined(ISP_1080_IT)
RMACRO(isp_1080_it);
#endif
#if defined(ISP_12160)
RMACRO(isp_12160);
#endif
#if defined(ISP_12160_IT)
RMACRO(isp_12160_it);
#endif
#if defined(ISP_2100)
RMACRO(isp_2100);
#endif
@ -212,21 +194,12 @@ do_unload_fw(void)
#if defined(ISP_1040)
UMACRO(isp_1040);
#endif
#if defined(ISP_1040_IT)
UMACRO(isp_1040_it);
#endif
#if defined(ISP_1080)
UMACRO(isp_1080);
#endif
#if defined(ISP_1080_IT)
UMACRO(isp_1080_it);
#endif
#if defined(ISP_12160)
UMACRO(isp_12160);
#endif
#if defined(ISP_12160_IT)
UMACRO(isp_12160_it);
#endif
#if defined(ISP_2100)
UMACRO(isp_2100);
#endif
@ -269,16 +242,10 @@ DECLARE_MODULE(ispfw, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
DECLARE_MODULE(isp_1000, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_1040)
DECLARE_MODULE(isp_1040, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_1040_IT)
DECLARE_MODULE(isp_1040_it, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_1080)
DECLARE_MODULE(isp_1080, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_1080_IT)
DECLARE_MODULE(isp_1080_it, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_12160)
DECLARE_MODULE(isp_12160, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_12160_IT)
DECLARE_MODULE(isp_12160_IT, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_2100)
DECLARE_MODULE(isp_2100, ispfw_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD);
#elif defined(ISP_2200)

View File

@ -29,11 +29,8 @@
SUBDIR = ispfw
SUBDIR += isp_1040
SUBDIR += isp_1040_it
SUBDIR += isp_1080
SUBDIR += isp_1080_it
SUBDIR += isp_12160
SUBDIR += isp_12160_it
SUBDIR += isp_2100
SUBDIR += isp_2200
SUBDIR += isp_2300

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${.CURDIR}/../../../dev/ispfw
KMOD= isp_1040_it
SRCS= ispfw.c
CFLAGS += -DISP_1040_IT -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${.CURDIR}/../../../dev/ispfw
KMOD= isp_1080_it
SRCS= ispfw.c
CFLAGS += -DISP_1080_IT -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>

View File

@ -1,36 +0,0 @@
#-
# Copyright (c) 2006 by Matthew Jacob
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice immediately at the beginning of the file, without modification,
# this list of conditions, and the following disclaimer.
# 2. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
.PATH: ${.CURDIR}/../../../dev/ispfw
KMOD= isp_12160_it
SRCS= ispfw.c
CFLAGS += -DISP_12160_IT -DMODULE_NAME=\"${KMOD}\"
.include <bsd.kmod.mk>