Fix various buglets that really were seriously bad and resync with FreeBSD tree.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@831 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Dotan Barak
2009-05-10 17:18:00 +00:00
parent 647f7febc9
commit 3206819128
11 changed files with 245 additions and 226 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: isp.c,v 1.216 2009/04/03 04:56:00 mjacob Exp $ */
/* $Id: isp.c,v 1.219 2009/05/10 16:25:09 mjacob Exp $ */
/*-
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
@@ -4261,8 +4261,7 @@ isp_start(XS_T *xs)
/*
* Try again later.
*/
if (fcp->isp_fwstate != FW_READY ||
fcp->isp_loopstate != LOOP_READY) {
if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate != LOOP_READY) {
return (CMD_RQLATER);
}
@@ -5256,8 +5255,26 @@ again:
switch (etype) {
case RQSTYPE_RESPONSE:
if (resp && rlen >= 4 && resp[FCP_RSPNS_CODE_OFFSET] != 0) {
isp_prt(isp, ISP_LOGWARN, "%d.%d.%d FCP RESPONSE: 0x%x", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), resp[FCP_RSPNS_CODE_OFFSET]);
XS_SETERR(xs, HBA_BOTCH);
const char *ptr;
char lb[64];
const char *rnames[6] = {
"Task Management Function Done",
"Data Length Differs From Burst Length",
"Invalid FCP Cmnd",
"FCP DATA RO mismatch with FCP DATA_XFR_RDY RO",
"Task Management Function Rejected",
"Task Management Function Failed",
};
if (resp[FCP_RSPNS_CODE_OFFSET] > 5) {
ISP_SNPRINTF(lb, sizeof lb, "Unknown FCP Response Code 0x%x", resp[FCP_RSPNS_CODE_OFFSET]);
ptr = lb;
} else {
ptr = rnames[resp[FCP_RSPNS_CODE_OFFSET]];
}
isp_prt(isp, ISP_LOGWARN, "%d.%d.%d FCP RESPONSE, LENGTH %u: %s CDB0=0x%02x", XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), rlen, ptr, XS_CDBP(xs)[0] & 0xff);
if (resp[FCP_RSPNS_CODE_OFFSET] != 0) {
XS_SETERR(xs, HBA_BOTCH);
}
}
if (IS_24XX(isp)) {
isp_parse_status_24xx(isp, (isp24xx_statusreq_t *)sp, xs, &resid);

View File

@@ -1,4 +1,4 @@
/* $Id: isp_library.c,v 1.57 2009/03/30 04:19:19 mjacob Exp $ */
/* $Id: isp_library.c,v 1.61 2009/05/10 16:25:09 mjacob Exp $ */
/*-
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
@@ -139,7 +139,7 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t to
seglim = ISP_RQDSEG_T3;
break;
case RQSTYPE_T3RQS:
ddf = (ddir == ISP_TO_DEVICE)? CT2_DATA_OUT : CT2_DATA_IN;
ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
dsp64 = ((ispreqt3_t *)fqe)->req_dataseg;
seglim = ISP_RQDSEG_T3;
break;
@@ -239,7 +239,7 @@ copy_and_sync:
((ispreqt2_t *)fqe)->req_flags |= ddf;
((ispreqt2_t *)fqe)->req_seg_count = nsegs;
((ispreqt2_t *)fqe)->req_totalcnt = totalcnt;
if (ISP_CAP_SCCFW(isp)) {
if (ISP_CAP_2KLOGIN(isp)) {
isp_put_request_t2e(isp, fqe, qe0);
} else {
isp_put_request_t2(isp, fqe, qe0);
@@ -250,7 +250,7 @@ copy_and_sync:
((ispreqt3_t *)fqe)->req_flags |= ddf;
((ispreqt3_t *)fqe)->req_seg_count = nsegs;
((ispreqt3_t *)fqe)->req_totalcnt = totalcnt;
if (ISP_CAP_SCCFW(isp)) {
if (ISP_CAP_2KLOGIN(isp)) {
isp_put_request_t3e(isp, fqe, qe0);
} else {
isp_put_request_t3(isp, fqe, qe0);
@@ -416,8 +416,7 @@ isp_fc_runstate(ispsoftc_t *isp, int chan, int tval)
if (fcp->role == ISP_ROLE_NONE) {
return (0);
}
if (fcp->isp_fwstate < FW_READY ||
fcp->isp_loopstate < LOOP_PDB_RCVD) {
if (fcp->isp_fwstate < FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) {
if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) {
isp_prt(isp, ISP_LOGSANCFG, "isp_fc_runstate: linktest failed for channel %d", chan);
return (-1);
@@ -491,6 +490,157 @@ isp_dump_portdb(ispsoftc_t *isp, int chan)
}
}
const char *
isp_fc_fw_statename(int state)
{
switch (state) {
case FW_CONFIG_WAIT: return "Config Wait";
case FW_WAIT_AL_PA: return "Waiting for AL_PA";
case FW_WAIT_LOGIN: return "Wait Login";
case FW_READY: return "Ready";
case FW_LOSS_OF_SYNC: return "Loss Of Sync";
case FW_ERROR: return "Error";
case FW_REINIT: return "Re-Init";
case FW_NON_PART: return "Nonparticipating";
default: return "?????";
}
}
const char *
isp_fc_loop_statename(int state)
{
switch (state) {
case LOOP_NIL: return "NIL";
case LOOP_LIP_RCVD: return "LIP Received";
case LOOP_PDB_RCVD: return "PDB Received";
case LOOP_SCANNING_LOOP: return "Scanning";
case LOOP_LSCAN_DONE: return "Loop Scan Done";
case LOOP_SCANNING_FABRIC: return "Scanning Fabric";
case LOOP_FSCAN_DONE: return "Fabric Scan Done";
case LOOP_SYNCING_PDB: return "Syncing PDB";
case LOOP_READY: return "Ready";
default: return "?????";
}
}
const char *
isp_fc_toponame(fcparam *fcp)
{
if (fcp->isp_fwstate != FW_READY) {
return "Unavailable";
}
switch (fcp->isp_topo) {
case TOPO_NL_PORT: return "Private Loop";
case TOPO_FL_PORT: return "FL Port";
case TOPO_N_PORT: return "N-Port to N-Port";
case TOPO_F_PORT: return "F Port";
case TOPO_PTP_STUB: return "F Port (no FLOGI_ACC response)";
default: return "?????";
}
}
/*
* Change Roles
*/
int
isp_fc_change_role(ispsoftc_t *isp, int chan, int new_role)
{
fcparam *fcp = FCPARAM(isp, chan);
if (chan >= isp->isp_nchan) {
isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan);
return (ENXIO);
}
if (chan == 0) {
#ifdef ISP_TARGET_MODE
isp_del_all_wwn_entries(isp, chan);
#endif
isp_clear_commands(isp);
isp_reset(isp, 0);
if (isp->isp_state != ISP_RESETSTATE) {
isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__);
return (EIO);
}
fcp->role = new_role;
isp_init(isp);
if (isp->isp_state != ISP_INITSTATE) {
isp_prt(isp, ISP_LOGERR, "%s: cannot init card", __func__);
return (EIO);
}
isp->isp_state = ISP_RUNSTATE;
return (0);
} else if (ISP_CAP_MULTI_ID(isp)) {
mbreg_t mbs;
vp_modify_t *vp;
uint8_t qe[QENTRY_LEN], *scp;
ISP_MEMZERO(qe, QENTRY_LEN);
/* Acquire Scratch */
if (FC_SCRATCH_ACQUIRE(isp, chan)) {
return (EBUSY);
}
scp = fcp->isp_scratch;
/*
* Build a VP MODIFY command in memory
*/
vp = (vp_modify_t *) qe;
vp->vp_mod_hdr.rqs_entry_type = RQSTYPE_VP_MODIFY;
vp->vp_mod_hdr.rqs_entry_count = 1;
vp->vp_mod_cnt = 1;
vp->vp_mod_idx0 = chan;
vp->vp_mod_cmd = VP_MODIFY_ENA;
vp->vp_mod_ports[0].options = ICB2400_VPOPT_ENABLED;
if (new_role & ISP_ROLE_INITIATOR) {
vp->vp_mod_ports[0].options |= ICB2400_VPOPT_INI_ENABLE;
}
if ((new_role & ISP_ROLE_TARGET) == 0) {
vp->vp_mod_ports[0].options |= ICB2400_VPOPT_TGT_DISABLE;
}
MAKE_NODE_NAME_FROM_WWN(vp->vp_mod_ports[0].wwpn, fcp->isp_wwpn);
MAKE_NODE_NAME_FROM_WWN(vp->vp_mod_ports[0].wwnn, fcp->isp_wwnn);
isp_put_vp_modify(isp, vp, (vp_modify_t *) scp);
/*
* Build a EXEC IOCB A64 command that points to the VP MODIFY command
*/
MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0);
mbs.param[1] = QENTRY_LEN;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
mbs.param[3] = DMA_WD0(fcp->isp_scdma);
mbs.param[6] = DMA_WD3(fcp->isp_scdma);
mbs.param[7] = DMA_WD2(fcp->isp_scdma);
MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN);
isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
FC_SCRATCH_RELEASE(isp, chan);
return (EIO);
}
MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN);
isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp);
#ifdef ISP_TARGET_MODE
isp_del_all_wwn_entries(isp, chan);
#endif
/*
* Release Scratch
*/
FC_SCRATCH_RELEASE(isp, chan);
if (vp->vp_mod_status != VP_STS_OK) {
isp_prt(isp, ISP_LOGERR, "%s: VP_MODIFY of Chan %d failed with status %d", __func__, chan, vp->vp_mod_status);
return (EIO);
}
fcp->role = new_role;
return (0);
} else {
return (EINVAL);
}
}
void
isp_clear_commands(ispsoftc_t *isp)
{
@@ -569,56 +719,6 @@ isp_clear_commands(ispsoftc_t *isp)
#endif
}
const char *
isp_fc_fw_statename(int state)
{
switch (state) {
case FW_CONFIG_WAIT: return "Config Wait";
case FW_WAIT_AL_PA: return "Waiting for AL_PA";
case FW_WAIT_LOGIN: return "Wait Login";
case FW_READY: return "Ready";
case FW_LOSS_OF_SYNC: return "Loss Of Sync";
case FW_ERROR: return "Error";
case FW_REINIT: return "Re-Init";
case FW_NON_PART: return "Nonparticipating";
default: return "?????";
}
}
const char *
isp_fc_loop_statename(int state)
{
switch (state) {
case LOOP_NIL: return "NIL";
case LOOP_LIP_RCVD: return "LIP Received";
case LOOP_PDB_RCVD: return "PDB Received";
case LOOP_SCANNING_LOOP: return "Scanning";
case LOOP_LSCAN_DONE: return "Loop Scan Done";
case LOOP_SCANNING_FABRIC: return "Scanning Fabric";
case LOOP_FSCAN_DONE: return "Fabric Scan Done";
case LOOP_SYNCING_PDB: return "Syncing PDB";
case LOOP_READY: return "Ready";
default: return "?????";
}
}
const char *
isp_fc_toponame(fcparam *fcp)
{
if (fcp->isp_fwstate != FW_READY) {
return "Unavailable";
}
switch (fcp->isp_topo) {
case TOPO_NL_PORT: return "Private Loop";
case TOPO_FL_PORT: return "FL Port";
case TOPO_N_PORT: return "N-Port to N-Port";
case TOPO_F_PORT: return "F Port";
case TOPO_PTP_STUB: return "F Port (no FLOGI_ACC response)";
default: return "?????";
}
}
void
isp_shutdown(ispsoftc_t *isp)
{
@@ -2534,129 +2634,23 @@ isp_del_wwn_entries(ispsoftc_t *isp, isp_notify_t *mp)
if (mp->nt_nphdl != NIL_HANDLE) {
if (isp_find_pdb_by_loopid(isp, mp->nt_channel, mp->nt_nphdl, &lp)) {
isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid);
} else {
isp_prt(isp, ISP_LOGWARN, "unable to find entry to delete for N-port handle 0x%x", mp->nt_nphdl);
return;
}
return;
}
if (mp->nt_wwn != INI_ANY) {
if (isp_find_pdb_by_wwn(isp, mp->nt_channel, mp->nt_wwn, &lp)) {
isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid);
} else {
isp_prt(isp, ISP_LOGWARN, "unable to find entry to delete for initiator WWN 0x%016llx", (unsigned long long)mp->nt_wwn);
return;
}
return;
}
if (mp->nt_sid != PORT_ANY) {
if (mp->nt_sid != PORT_ANY && mp->nt_sid != PORT_NONE) {
if (isp_find_pdb_by_sid(isp, mp->nt_channel, mp->nt_sid, &lp)) {
isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid);
} else {
isp_prt(isp, ISP_LOGWARN, "unable to find entry to delete for Initiator S_ID 0x%x", mp->nt_sid);
return;
}
return;
}
isp_prt(isp, ISP_LOGWARN, "%s: unable to find entries to delete", __func__);
}
/*
* Change Roles
*/
int
isp_fc_change_role(ispsoftc_t *isp, int chan, int new_role)
{
fcparam *fcp = FCPARAM(isp, chan);
if (chan >= isp->isp_nchan) {
isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan);
return (ENXIO);
}
if (chan == 0) {
#ifdef ISP_TARGET_MODE
isp_del_all_wwn_entries(isp, chan);
#endif
isp_clear_commands(isp);
isp_reset(isp, 0);
if (isp->isp_state != ISP_RESETSTATE) {
isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__);
return (EIO);
}
fcp->role = new_role;
isp_init(isp);
if (isp->isp_state != ISP_INITSTATE) {
isp_prt(isp, ISP_LOGERR, "%s: cannot init card", __func__);
return (EIO);
}
isp->isp_state = ISP_RUNSTATE;
return (0);
} else if (ISP_CAP_MULTI_ID(isp)) {
mbreg_t mbs;
vp_modify_t *vp;
uint8_t qe[QENTRY_LEN], *scp;
ISP_MEMZERO(qe, QENTRY_LEN);
/* Acquire Scratch */
if (FC_SCRATCH_ACQUIRE(isp, chan)) {
return (EBUSY);
}
scp = fcp->isp_scratch;
/*
* Build a VP MODIFY command in memory
*/
vp = (vp_modify_t *) qe;
vp->vp_mod_hdr.rqs_entry_type = RQSTYPE_VP_MODIFY;
vp->vp_mod_hdr.rqs_entry_count = 1;
vp->vp_mod_cnt = 1;
vp->vp_mod_idx0 = chan;
vp->vp_mod_cmd = VP_MODIFY_ENA;
vp->vp_mod_ports[0].options = ICB2400_VPOPT_ENABLED;
if (new_role & ISP_ROLE_INITIATOR) {
vp->vp_mod_ports[0].options |= ICB2400_VPOPT_INI_ENABLE;
}
if ((new_role & ISP_ROLE_TARGET) == 0) {
vp->vp_mod_ports[0].options |= ICB2400_VPOPT_TGT_DISABLE;
}
MAKE_NODE_NAME_FROM_WWN(vp->vp_mod_ports[0].wwpn, fcp->isp_wwpn);
MAKE_NODE_NAME_FROM_WWN(vp->vp_mod_ports[0].wwnn, fcp->isp_wwnn);
isp_put_vp_modify(isp, vp, (vp_modify_t *) scp);
/*
* Build a EXEC IOCB A64 command that points to the VP MODIFY command
*/
MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0);
mbs.param[1] = QENTRY_LEN;
mbs.param[2] = DMA_WD1(fcp->isp_scdma);
mbs.param[3] = DMA_WD0(fcp->isp_scdma);
mbs.param[6] = DMA_WD3(fcp->isp_scdma);
mbs.param[7] = DMA_WD2(fcp->isp_scdma);
MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN);
isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
FC_SCRATCH_RELEASE(isp, chan);
return (EIO);
}
MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN);
isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp);
#ifdef ISP_TARGET_MODE
isp_del_all_wwn_entries(isp, chan);
#endif
/*
* Release Scratch
*/
FC_SCRATCH_RELEASE(isp, chan);
if (vp->vp_mod_status != VP_STS_OK) {
isp_prt(isp, ISP_LOGERR, "%s: VP_MODIFY of Chan %d failed with status %d", __func__, chan, vp->vp_mod_status);
return (EIO);
}
fcp->role = new_role;
return (0);
} else {
return (EINVAL);
}
isp_prt(isp, ISP_LOGWARN, "%s: Chan %d unable to find entry to delete N-port handle 0x%04x initiator WWN 0x%016llx Port ID 0x%06x", __func__,
mp->nt_channel, mp->nt_nphdl, (unsigned long long) mp->nt_wwn, mp->nt_sid);
}
void

View File

@@ -1,4 +1,4 @@
/* $Id: isp_library.h,v 1.31 2009/03/30 04:19:19 mjacob Exp $ */
/* $Id: isp_library.h,v 1.35 2009/05/10 16:25:09 mjacob Exp $ */
/*-
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
@@ -97,6 +97,8 @@ const char *isp_fc_fw_statename(int);
const char *isp_fc_loop_statename(int);
const char *isp_fc_toponame(fcparam *);
int isp_fc_change_role(ispsoftc_t *, int, int);
/*
* Cleanup
@@ -195,7 +197,6 @@ void isp_add_wwn_entry(ispsoftc_t *, int, uint64_t, uint16_t, uint32_t);
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 *);
int isp_fc_change_role(ispsoftc_t *, int, int);
void isp_put_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
void isp_get_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);

View File

@@ -1,4 +1,4 @@
/* $Id: isp_target.c,v 1.86 2009/03/30 04:19:19 mjacob Exp $ */
/* $Id: isp_target.c,v 1.87 2009/05/01 22:34:13 mjacob Exp $ */
/*-
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.

View File

@@ -1,4 +1,4 @@
/* $Id: isp_target.h,v 1.65 2009/03/30 04:19:19 mjacob Exp $ */
/* $Id: isp_target.h,v 1.67 2009/05/02 23:18:31 mjacob Exp $ */
/*-
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.

View File

@@ -1,4 +1,4 @@
/* $Id: ispmbox.h,v 1.78 2009/04/03 04:56:00 mjacob Exp $ */
/* $Id: ispmbox.h,v 1.79 2009/05/01 22:34:13 mjacob Exp $ */
/*-
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.

View File

@@ -1,4 +1,4 @@
/* $Id: ispvar.h,v 1.107 2009/04/03 04:56:00 mjacob Exp $ */
/* $Id: ispvar.h,v 1.109 2009/05/10 16:25:09 mjacob Exp $ */
/*-
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
@@ -965,6 +965,9 @@ void isp_async(ispsoftc_t *, ispasync_t, ...);
* ISP_DELAY(usecs) microsecond spindelay function
* ISP_SLEEP(isp, usecs) microsecond sleep function
*
* ISP_INLINE ___inline or not- depending on how
* good your debugger is
*
* NANOTIME_T nanosecond time type
*
* GET_NANOTIME(NANOTIME_T *) get current nanotime.

View File

@@ -1,4 +1,4 @@
/* $Id: isp_cb_ops.c,v 1.100 2009/03/30 04:17:13 mjacob Exp $ */
/* $Id: isp_cb_ops.c,v 1.101 2009/05/01 22:34:13 mjacob Exp $ */
/*
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.

View File

@@ -1,4 +1,4 @@
/* $Id: isp_linux.c,v 1.243 2009/04/03 04:56:00 mjacob Exp $ */
/* $Id: isp_linux.c,v 1.247 2009/05/10 16:25:09 mjacob Exp $ */
/*
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
@@ -115,7 +115,7 @@ static char *isp_wwnns;
hba->isp_osinfo.pending_x = xact
extern void ISP_PARENT_TARGET (qact_e, void *);
static inline tmd_cmd_t *isp_find_tmd(ispsoftc_t *, uint64_t);
static ISP_INLINE tmd_cmd_t *isp_find_tmd(ispsoftc_t *, uint64_t);
static void isp_taction(qact_e, void *);
static void isp_target_start_ctio(ispsoftc_t *, tmd_xact_t *);
static void isp_handle_platform_atio(ispsoftc_t *, at_entry_t *);
@@ -175,7 +175,7 @@ isplinux_info(struct Scsi_Host *host)
}
}
static inline void
static ISP_INLINE void
isplinux_append_to_waitq(ispsoftc_t *isp, Scsi_Cmnd *Cmnd)
{
/*
@@ -220,7 +220,7 @@ isplinux_append_to_waitq(ispsoftc_t *isp, Scsi_Cmnd *Cmnd)
}
}
static inline void
static ISP_INLINE void
isplinux_insert_head_waitq(ispsoftc_t *isp, Scsi_Cmnd *Cmnd)
{
isp->isp_osinfo.wqcnt++;
@@ -233,7 +233,7 @@ isplinux_insert_head_waitq(ispsoftc_t *isp, Scsi_Cmnd *Cmnd)
}
}
static inline Scsi_Cmnd *
static ISP_INLINE Scsi_Cmnd *
isp_remove_from_waitq(Scsi_Cmnd *Cmnd)
{
ispsoftc_t *isp;
@@ -265,7 +265,7 @@ isp_remove_from_waitq(Scsi_Cmnd *Cmnd)
return (f);
}
static inline void
static ISP_INLINE void
isplinux_runwaitq(ispsoftc_t *isp)
{
Scsi_Cmnd *f;
@@ -338,7 +338,7 @@ isplinux_runwaitq(ispsoftc_t *isp)
}
}
static inline void
static ISP_INLINE void
isplinux_flushwaitq(ispsoftc_t *isp)
{
Scsi_Cmnd *Cmnd, *Ncmnd;
@@ -367,7 +367,7 @@ isplinux_flushwaitq(ispsoftc_t *isp)
ISP_IGET_LK_SOFTC(isp);
}
static inline Scsi_Cmnd *
static ISP_INLINE Scsi_Cmnd *
isplinux_remove_from_doneq(Scsi_Cmnd *Cmnd)
{
Scsi_Cmnd *f;
@@ -513,7 +513,7 @@ isplinux_queuecommand(Scsi_Cmnd *Cmnd, void (*donecmd)(Scsi_Cmnd *))
return (result);
}
static inline void
static ISP_INLINE void
isplinux_scsi_probe_done(Scsi_Cmnd *Cmnd)
{
ispsoftc_t *isp = XS_ISP(Cmnd);
@@ -974,7 +974,7 @@ isp_tgt_tq(ispsoftc_t *isp)
}
}
static inline tmd_cmd_t *
static ISP_INLINE tmd_cmd_t *
isp_find_tmd(ispsoftc_t *isp, uint64_t tagval)
{
int i;
@@ -1317,7 +1317,7 @@ nolunsenabled(ispsoftc_t *isp, uint16_t bus)
return (1);
}
static inline void
static ISP_INLINE void
addlun(ispsoftc_t *isp, tgt_enalun_t *axl, uint16_t bus, uint16_t lun)
{
axl->lun = lun;
@@ -1326,7 +1326,7 @@ addlun(ispsoftc_t *isp, tgt_enalun_t *axl, uint16_t bus, uint16_t lun)
isp->isp_osinfo.luns = axl;
}
static inline tgt_enalun_t *
static ISP_INLINE tgt_enalun_t *
remlun(ispsoftc_t *isp, uint16_t bus, uint16_t lun)
{
tgt_enalun_t *axl, *axy = NULL;

View File

@@ -1,4 +1,4 @@
/* $Id: isp_linux.h,v 1.171 2009/03/30 04:17:25 mjacob Exp $ */
/* $Id: isp_linux.h,v 1.173 2009/05/10 16:25:09 mjacob Exp $ */
/*
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
@@ -424,6 +424,8 @@ struct isposinfo {
(void) schedule_timeout(_usec_to_jiffies(x)); \
ISP_IGET_LK_SOFTC(isp)
#define ISP_INLINE inline
#define NANOTIME_T struct timeval
/* for prior to 2.2.19, use do_gettimeofday, and, well, it'll be inaccurate */
#define GET_NANOTIME(ptr) (ptr)->tv_sec = 0, (ptr)->tv_usec = 0, do_gettimeofday(ptr)
@@ -640,12 +642,12 @@ void isplinux_sqd(struct Scsi_Host *, struct scsi_device *);
int isp_thread_event(ispsoftc_t *, int, void *, int, const char *, const int line);
static inline uint64_t _isp_microtime_sub(struct timeval *, struct timeval *);
static inline void _isp_usec_delay(unsigned int);
static inline unsigned long _usec_to_jiffies(unsigned int);
static inline unsigned long _jiffies_to_usec(unsigned long);
static inline int isplinux_tagtype(Scsi_Cmnd *);
static inline void mbox_wait_complete(ispsoftc_t *, mbreg_t *);
static ISP_INLINE uint64_t _isp_microtime_sub(struct timeval *, struct timeval *);
static ISP_INLINE void _isp_usec_delay(unsigned int);
static ISP_INLINE unsigned long _usec_to_jiffies(unsigned int);
static ISP_INLINE unsigned long _jiffies_to_usec(unsigned long);
static ISP_INLINE int isplinux_tagtype(Scsi_Cmnd *);
static ISP_INLINE void mbox_wait_complete(ispsoftc_t *, mbreg_t *);
int isplinux_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
const char *isplinux_info(struct Scsi_Host *);
@@ -718,7 +720,7 @@ extern int api_channel;
#define _SBSWAP(a, b, c)
#endif
static inline uint64_t
static ISP_INLINE uint64_t
_isp_microtime_sub(struct timeval *b, struct timeval *a)
{
uint64_t elapsed;
@@ -741,7 +743,7 @@ _isp_microtime_sub(struct timeval *b, struct timeval *a)
return (elapsed * 1000);
}
static inline void
static ISP_INLINE void
_isp_usec_delay(unsigned int usecs)
{
while (usecs > 1000) {
@@ -752,7 +754,7 @@ _isp_usec_delay(unsigned int usecs)
udelay(usecs);
}
static inline unsigned long
static ISP_INLINE unsigned long
_usec_to_jiffies(unsigned int usecs)
{
struct timespec lt;
@@ -763,7 +765,7 @@ _usec_to_jiffies(unsigned int usecs)
return (timespec_to_jiffies(&lt));
}
static inline unsigned long
static ISP_INLINE unsigned long
_jiffies_to_usec(unsigned long jiffies)
{
unsigned long usecs;
@@ -785,7 +787,7 @@ _jiffies_to_usec(unsigned long jiffies)
#define MSG_ORDERED_TAG 0x22
#endif
static inline int
static ISP_INLINE int
isplinux_tagtype(Scsi_Cmnd *Cmnd)
{
switch (Cmnd->tag) {
@@ -800,7 +802,7 @@ isplinux_tagtype(Scsi_Cmnd *Cmnd)
}
}
static inline void
static ISP_INLINE void
mbox_wait_complete(ispsoftc_t *isp, mbreg_t *mbp)
{
uint32_t lim = mbp->timeout;
@@ -857,7 +859,7 @@ mbox_wait_complete(ispsoftc_t *isp, mbreg_t *mbp)
}
}
static inline int
static ISP_INLINE int
fc_scratch_acquire(ispsoftc_t *isp, int chan)
{
if (ISP_DATA(isp, chan)->scratch_busy) {
@@ -870,11 +872,11 @@ fc_scratch_acquire(ispsoftc_t *isp, int chan)
/*
* Note that these allocators aren't interrupt safe
*/
static inline void * isp_kalloc(size_t, int);
static inline void isp_kfree(void *, size_t);
static inline void * isp_kzalloc(size_t, int);
static ISP_INLINE void * isp_kalloc(size_t, int);
static ISP_INLINE void isp_kfree(void *, size_t);
static ISP_INLINE void * isp_kzalloc(size_t, int);
static inline void *
static ISP_INLINE void *
isp_kalloc(size_t size, int flags)
{
void *ptr;
@@ -886,7 +888,7 @@ isp_kalloc(size_t size, int flags)
return (ptr);
}
static inline void
static ISP_INLINE void
isp_kfree(void *ptr, size_t size)
{
if (size >= PAGE_SIZE) {
@@ -896,7 +898,7 @@ isp_kfree(void *ptr, size_t size)
}
}
static inline void *
static ISP_INLINE void *
isp_kzalloc(size_t size, int flags)
{
void *ptr = isp_kalloc(size, flags);
@@ -909,7 +911,7 @@ isp_kzalloc(size_t size, int flags)
#define COPYIN(uarg, karg, amt) copy_from_user(karg, uarg, amt)
#define COPYOUT(karg, uarg, amt) copy_to_user(uarg, karg, amt)
static __inline void
static ISP_INLINE void
isp_get_dma64_seg(ispds64_t *dsp, struct scatterlist *sg, uint32_t sgidx)
{
sg += sgidx;
@@ -918,7 +920,7 @@ isp_get_dma64_seg(ispds64_t *dsp, struct scatterlist *sg, uint32_t sgidx)
dsp->ds_count = sg_dma_len(sg);
}
static __inline void
static ISP_INLINE void
isp_get_dma_seg(ispds_t *dsp, struct scatterlist *sg, uint32_t sgidx)
{
sg += sgidx;

View File

@@ -1,4 +1,4 @@
/* $Id: isp_pci.c,v 1.179 2009/04/03 04:56:01 mjacob Exp $ */
/* $Id: isp_pci.c,v 1.181 2009/05/10 16:25:09 mjacob Exp $ */
/*
* Copyright (c) 1997-2009 by Matthew Jacob
* All rights reserved.
@@ -380,7 +380,7 @@ struct isp_pcisoftc {
/*
* Gratefully borrowed from Gerard Roudier's sym53c8xx driver
*/
static __inline void *
static ISP_INLINE void *
map_pci_mem(struct isp_pcisoftc *isp_pci, u_long size)
{
unsigned long page_base;
@@ -397,7 +397,7 @@ map_pci_mem(struct isp_pcisoftc *isp_pci, u_long size)
return (page_remapped);
}
static __inline
static ISP_INLINE
void unmap_pci_mem(struct isp_pcisoftc *isp_pci, unsigned long size)
{
if (isp_pci->vaddr) {
@@ -407,7 +407,7 @@ void unmap_pci_mem(struct isp_pcisoftc *isp_pci, unsigned long size)
}
}
static __inline int
static ISP_INLINE int
map_isp_mem(struct isp_pcisoftc *isp_pci, u_short cmd, vm_offset_t mem_base)
{
if (cmd & PCI_COMMAND_MEMORY) {
@@ -419,7 +419,7 @@ map_isp_mem(struct isp_pcisoftc *isp_pci, u_short cmd, vm_offset_t mem_base)
return (0);
}
static __inline int
static ISP_INLINE int
map_isp_io(struct isp_pcisoftc *isp_pci, u_short cmd, vm_offset_t io_base)
{
if ((cmd & PCI_COMMAND_IO) && (io_base & 3) == 1) {
@@ -643,8 +643,10 @@ isplinux_pci_init_one(struct Scsi_Host *host)
/* enable PCI-INTX */
pci_intx(pdev, 1);
/* enable MSI-X or MSI-X */
if (pci_enable_msix(pdev, isp_msix, 3) == 0) {
/*
* enable MSI-X or MSI-X, but not for the 2432
*/
if (pdev->device != PCI_DEVICE_ID_QLOGIC_ISP2432 && pci_enable_msix(pdev, isp_msix, 3) == 0) {
isp_pci->msix_enabled = 1;
isp_pci->msix_vector[0] = isp_msix[0].vector;
isp_pci->msix_vector[1] = isp_msix[1].vector;
@@ -989,7 +991,7 @@ bad:
return (1);
}
static __inline uint32_t
static ISP_INLINE uint32_t
ispregrd(struct isp_pcisoftc *pcs, vm_offset_t offset)
{
uint32_t rv;
@@ -1003,7 +1005,7 @@ ispregrd(struct isp_pcisoftc *pcs, vm_offset_t offset)
return (rv);
}
static __inline void
static ISP_INLINE void
ispregwr(struct isp_pcisoftc *pcs, vm_offset_t offset, uint32_t val)
{
if (pcs->vaddr) {
@@ -1015,7 +1017,7 @@ ispregwr(struct isp_pcisoftc *pcs, vm_offset_t offset, uint32_t val)
}
}
static __inline int
static ISP_INLINE int
isp_pci_rd_debounced(struct isp_pcisoftc *pcs, vm_offset_t off, uint16_t *rp)
{
uint16_t val0, val1;
@@ -1072,7 +1074,7 @@ isp_pci_rd_isr(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *mbp)
#endif
#if !(defined(ISP_DISABLE_2300_SUPPORT) && defined(ISP_DISABLE_2322_SUPPORT) && defined(ISP_DISABLE_2400_SUPPORT))
static __inline uint32_t
static ISP_INLINE uint32_t
ispregrd32(struct isp_pcisoftc *pcs, vm_offset_t offset)
{
uint32_t rv;
@@ -1150,7 +1152,7 @@ isp_pci_rd_isr_2300(ispsoftc_t *isp, uint32_t *isrp, uint16_t *semap, uint16_t *
#endif
#if !defined(ISP_DISABLE_2400_SUPPORT)
static __inline void
static ISP_INLINE void
ispregwr32(struct isp_pcisoftc *pcs, vm_offset_t offset, uint32_t val)
{
if (pcs->vaddr) {