mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-19 05:36:22 +00:00
synchronize with feral cvs repository
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@206 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+433
-425
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_library.c,v 1.38 2007/05/31 18:35:28 mjacob Exp $ */
|
||||
/* $Id: isp_library.c,v 1.44 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -215,17 +214,19 @@ isp_print_bytes(ispsoftc_t *isp, const char *msg, int amt, void *arg)
|
||||
*/
|
||||
|
||||
int
|
||||
isp_fc_runstate(ispsoftc_t *isp, int chan, int tval)
|
||||
isp_fc_runstate(ispsoftc_t *isp, int tval)
|
||||
{
|
||||
fcparam *fcp;
|
||||
int *tptr;
|
||||
|
||||
if (isp->isp_role == ISP_ROLE_NONE) {
|
||||
return (0);
|
||||
}
|
||||
fcp = FCPARAM(isp, 0);
|
||||
fcp = FCPARAM(isp);
|
||||
tptr = &tval;
|
||||
if (fcp->isp_fwstate < FW_READY ||
|
||||
fcp->isp_loopstate < LOOP_PDB_RCVD) {
|
||||
if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) {
|
||||
if (isp_control(isp, ISPCTL_FCLINK_TEST, tptr) != 0) {
|
||||
isp_prt(isp, ISP_LOGSANCFG,
|
||||
"isp_fc_runstate: linktest failed");
|
||||
return (-1);
|
||||
@@ -240,17 +241,17 @@ isp_fc_runstate(ispsoftc_t *isp, int chan, int tval)
|
||||
if ((isp->isp_role & ISP_ROLE_INITIATOR) == 0) {
|
||||
return (0);
|
||||
}
|
||||
if (isp_control(isp, ISPCTL_SCAN_LOOP, chan) != 0) {
|
||||
if (isp_control(isp, ISPCTL_SCAN_LOOP, NULL) != 0) {
|
||||
isp_prt(isp, ISP_LOGSANCFG,
|
||||
"isp_fc_runstate: scan loop fails");
|
||||
return (LOOP_PDB_RCVD);
|
||||
}
|
||||
if (isp_control(isp, ISPCTL_SCAN_FABRIC, chan) != 0) {
|
||||
if (isp_control(isp, ISPCTL_SCAN_FABRIC, NULL) != 0) {
|
||||
isp_prt(isp, ISP_LOGSANCFG,
|
||||
"isp_fc_runstate: scan fabric fails");
|
||||
return (LOOP_LSCAN_DONE);
|
||||
}
|
||||
if (isp_control(isp, ISPCTL_PDB_SYNC, chan) != 0) {
|
||||
if (isp_control(isp, ISPCTL_PDB_SYNC, NULL) != 0) {
|
||||
isp_prt(isp, ISP_LOGSANCFG, "isp_fc_runstate: pdb_sync fails");
|
||||
return (LOOP_FSCAN_DONE);
|
||||
}
|
||||
@@ -266,9 +267,9 @@ isp_fc_runstate(ispsoftc_t *isp, int chan, int tval)
|
||||
* Fibre Channel Support- get the port database for the id.
|
||||
*/
|
||||
void
|
||||
isp_dump_portdb(ispsoftc_t *isp, int chan)
|
||||
isp_dump_portdb(ispsoftc_t *isp)
|
||||
{
|
||||
fcparam *fcp = FCPARAM(isp, chan);
|
||||
fcparam *fcp = (fcparam *) isp->isp_param;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_FC_TARG; i++) {
|
||||
@@ -620,7 +621,7 @@ isp_put_request_t7(ispsoftc_t *isp, ispreqt7_t *src, ispreqt7_t *dst)
|
||||
a = (uint32_t *) src->req_lun;
|
||||
b = (uint32_t *) dst->req_lun;
|
||||
for (i = 0; i < (ASIZE(src->req_lun) >> 2); i++ ) {
|
||||
ISP_IOZPUT_32(isp, *a++, b++);
|
||||
*b++ = ISP_SWAP32(isp, *a++);
|
||||
}
|
||||
ISP_IOXPUT_8(isp, src->req_alen_datadir, &dst->req_alen_datadir);
|
||||
ISP_IOXPUT_8(isp, src->req_task_management, &dst->req_task_management);
|
||||
@@ -628,8 +629,8 @@ isp_put_request_t7(ispsoftc_t *isp, ispreqt7_t *src, ispreqt7_t *dst)
|
||||
ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
|
||||
a = (uint32_t *) src->req_cdb;
|
||||
b = (uint32_t *) dst->req_cdb;
|
||||
for (i = 0; i < (ASIZE(src->req_cdb) >> 2); i++ ) {
|
||||
ISP_IOZPUT_32(isp, *a++, b++);
|
||||
for (i = 0; i < (ASIZE(src->req_cdb) >> 2); i++) {
|
||||
*b++ = ISP_SWAP32(isp, *a++);
|
||||
}
|
||||
ISP_IOXPUT_32(isp, src->req_dl, &dst->req_dl);
|
||||
ISP_IOXPUT_16(isp, src->req_tidlo, &dst->req_tidlo);
|
||||
@@ -722,6 +723,8 @@ isp_get_24xx_response(ispsoftc_t *isp, isp24xx_statusreq_t *src,
|
||||
isp24xx_statusreq_t *dst)
|
||||
{
|
||||
int i;
|
||||
uint32_t *s, *d;
|
||||
|
||||
isp_get_hdr(isp, &src->req_header, &dst->req_header);
|
||||
ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle);
|
||||
ISP_IOXGET_16(isp, &src->req_completion_status,
|
||||
@@ -735,9 +738,10 @@ isp_get_24xx_response(ispsoftc_t *isp, isp24xx_statusreq_t *src,
|
||||
ISP_IOXGET_32(isp, &src->req_fcp_residual, dst->req_fcp_residual);
|
||||
ISP_IOXGET_32(isp, &src->req_sense_len, dst->req_sense_len);
|
||||
ISP_IOXGET_32(isp, &src->req_response_len, dst->req_response_len);
|
||||
for (i = 0; i < 28; i++) {
|
||||
ISP_IOXGET_8(isp, &src->req_rsp_sense[i],
|
||||
dst->req_rsp_sense[i]);
|
||||
s = (uint32_t *)src->req_rsp_sense;
|
||||
d = (uint32_t *)dst->req_rsp_sense;
|
||||
for (i = 0; i < (ASIZE(src->req_rsp_sense) >> 2); i++) {
|
||||
d[i] = ISP_SWAP32(isp, s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,14 +754,14 @@ isp_get_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst)
|
||||
ISP_IOXGET_16(isp, &src->abrt_nphdl, dst->abrt_nphdl);
|
||||
ISP_IOXGET_16(isp, &src->abrt_options, dst->abrt_options);
|
||||
ISP_IOXGET_32(isp, &src->abrt_cmd_handle, dst->abrt_cmd_handle);
|
||||
for (i = 0; i < ASIZE(&src->abrt_reserved); i++) {
|
||||
for (i = 0; i < ASIZE(src->abrt_reserved); i++) {
|
||||
ISP_IOXGET_8(isp, &src->abrt_reserved[i],
|
||||
dst->abrt_reserved[i]);
|
||||
}
|
||||
ISP_IOXGET_16(isp, &src->abrt_tidlo, dst->abrt_tidlo);
|
||||
ISP_IOXGET_8(isp, &src->abrt_tidhi, dst->abrt_tidhi);
|
||||
ISP_IOXGET_8(isp, &src->abrt_vpidx, dst->abrt_vpidx);
|
||||
for (i = 0; i < ASIZE(&src->abrt_reserved1); i++) {
|
||||
for (i = 0; i < ASIZE(src->abrt_reserved1); i++) {
|
||||
ISP_IOXGET_8(isp, &src->abrt_reserved1[i],
|
||||
dst->abrt_reserved1[i]);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_library.h,v 1.22 2007/05/31 18:35:28 mjacob Exp $ */
|
||||
/* $Id: isp_library.h,v 1.25 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -64,8 +63,8 @@ extern void isp_destroy_handle(ispsoftc_t *, uint32_t);
|
||||
extern int isp_getrqentry(ispsoftc_t *, uint32_t *, uint32_t *, void **);
|
||||
extern void isp_print_qentry (ispsoftc_t *, char *, int, void *);
|
||||
extern void isp_print_bytes(ispsoftc_t *, const char *, int, void *);
|
||||
extern int isp_fc_runstate(ispsoftc_t *, int, int);
|
||||
extern void isp_dump_portdb(ispsoftc_t *, int);
|
||||
extern int isp_fc_runstate(ispsoftc_t *, int);
|
||||
extern void isp_dump_portdb(ispsoftc_t *);
|
||||
extern void isp_shutdown(ispsoftc_t *);
|
||||
extern void isp_put_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
|
||||
extern void isp_get_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_stds.h,v 1.10 2007/03/10 01:56:34 mjacob Exp $ */
|
||||
/* $Id: isp_stds.h,v 1.11 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
||||
+43
-43
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_target.c,v 1.67 2007/06/01 17:19:31 mjacob Exp $ */
|
||||
/* $Id: isp_target.c,v 1.70 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -232,7 +231,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
/*
|
||||
* Just go straight to outer layer for this one.
|
||||
*/
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, local);
|
||||
(void) 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);
|
||||
@@ -245,7 +244,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
break;
|
||||
|
||||
case RQSTYPE_ATIO2:
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
isp_get_atio2e(isp, at2eiop, (at2e_entry_t *) local);
|
||||
} else {
|
||||
isp_get_atio2(isp, at2iop, (at2_entry_t *) local);
|
||||
@@ -255,7 +254,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
|
||||
case RQSTYPE_CTIO3:
|
||||
case RQSTYPE_CTIO2:
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
isp_get_ctio2e(isp, ct2eiop, (ct2e_entry_t *) local);
|
||||
} else {
|
||||
isp_get_ctio2(isp, ct2iop, (ct2_entry_t *) local);
|
||||
@@ -271,7 +270,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
case RQSTYPE_ENABLE_LUN:
|
||||
case RQSTYPE_MODIFY_LUN:
|
||||
isp_get_enable_lun(isp, lunenp, (lun_entry_t *) local);
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, local);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, local);
|
||||
break;
|
||||
|
||||
case RQSTYPE_NOTIFY:
|
||||
@@ -300,7 +299,8 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
case IN24XX_LINK_FAILED:
|
||||
case IN24XX_SRR_RCVD:
|
||||
case IN24XX_ELS_RCVD:
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, &local);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION,
|
||||
&local);
|
||||
break;
|
||||
default:
|
||||
isp_prt(isp, ISP_LOGINFO,
|
||||
@@ -311,7 +311,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
}
|
||||
break;
|
||||
} else if (IS_FC(isp)) {
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
isp_get_notify_fc_e(isp, inote_fcp,
|
||||
(in_fcentry_e_t *)local);
|
||||
} else {
|
||||
@@ -365,14 +365,14 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
notify.nt_tagval = TAG_ANY;
|
||||
notify.nt_ncode = NT_BUS_RESET;
|
||||
notify.nt_need_ack = 1;
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
break;
|
||||
}
|
||||
case IN_PORT_LOGOUT:
|
||||
case IN_ABORT_TASK:
|
||||
case IN_PORT_CHANGED:
|
||||
case IN_GLOBAL_LOGO:
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, &local);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, &local);
|
||||
break;
|
||||
default:
|
||||
isp_prt(isp, ISP_LOGINFO,
|
||||
@@ -402,7 +402,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
nack_24xx->na_status, nack_24xx->na_status_subcode,
|
||||
nack_24xx->na_rxid);
|
||||
} else if (IS_FC(isp)) {
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
isp_get_notify_ack_fc_e(isp, nacke_fcp,
|
||||
(na_fcentry_e_t *)local);
|
||||
} else {
|
||||
@@ -434,7 +434,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
|
||||
case RQSTYPE_ABTS_RCVD:
|
||||
isp_get_abts(isp, abts, (abts_t *)local);
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, &local);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, &local);
|
||||
break;
|
||||
case RQSTYPE_ABTS_RSP:
|
||||
isp_get_abts_rsp(isp, abts_rsp, (abts_rsp_t *)local);
|
||||
@@ -492,7 +492,7 @@ isp_target_notify(ispsoftc_t *isp, void *vptr, uint32_t *optrp)
|
||||
*/
|
||||
int
|
||||
isp_lun_cmd(ispsoftc_t *isp, int cmd, int bus, int tgt, int lun,
|
||||
int cmd_cnt, int inot_cnt)
|
||||
int cmd_cnt, int inot_cnt, uint32_t opaque)
|
||||
{
|
||||
lun_entry_t el;
|
||||
uint32_t nxti, optr;
|
||||
@@ -523,10 +523,11 @@ isp_lun_cmd(ispsoftc_t *isp, int cmd, int bus, int tgt, int lun,
|
||||
}
|
||||
el.le_header.rqs_entry_type = cmd;
|
||||
el.le_header.rqs_entry_count = 1;
|
||||
el.le_reserved = opaque;
|
||||
if (IS_SCSI(isp)) {
|
||||
el.le_tgt = tgt;
|
||||
el.le_lun = lun;
|
||||
} else if (ISP_CAP_SCCFW(isp) == 0) {
|
||||
} else if (FCPARAM(isp)->isp_sccfw == 0) {
|
||||
el.le_lun = lun;
|
||||
}
|
||||
el.le_timeout = 30;
|
||||
@@ -560,7 +561,7 @@ isp_target_put_entry(ispsoftc_t *isp, void *ap)
|
||||
isp_put_atio(isp, (at_entry_t *) ap, (at_entry_t *) outp);
|
||||
break;
|
||||
case RQSTYPE_ATIO2:
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
isp_put_atio2e(isp, (at2e_entry_t *) ap,
|
||||
(at2e_entry_t *) outp);
|
||||
} else {
|
||||
@@ -572,7 +573,7 @@ isp_target_put_entry(ispsoftc_t *isp, void *ap)
|
||||
isp_put_ctio(isp, (ct_entry_t *) ap, (ct_entry_t *) outp);
|
||||
break;
|
||||
case RQSTYPE_CTIO2:
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
isp_put_ctio2e(isp, (ct2e_entry_t *) ap,
|
||||
(ct2e_entry_t *) outp);
|
||||
} else {
|
||||
@@ -607,12 +608,12 @@ isp_target_put_atio(ispsoftc_t *isp, void *arg)
|
||||
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)) {
|
||||
if (FCPARAM(isp)->isp_sccfw) {
|
||||
atun._atio2.at_scclun = aep->at_scclun;
|
||||
} else {
|
||||
atun._atio2.at_lun = (uint8_t) aep->at_lun;
|
||||
}
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
atun._atio2e.at_iid = ((at2e_entry_t *)aep)->at_iid;
|
||||
} else {
|
||||
atun._atio2.at_iid = aep->at_iid;
|
||||
@@ -700,10 +701,10 @@ isp_endcmd(ispsoftc_t *isp, void *arg, uint32_t code, uint32_t hdl)
|
||||
|
||||
cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
|
||||
cto->ct_header.rqs_entry_count = 1;
|
||||
if (ISP_CAP_SCCFW(isp) == 0) {
|
||||
if (FCPARAM(isp)->isp_sccfw == 0) {
|
||||
cto->ct_lun = aep->at_lun;
|
||||
}
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
un._ctio2e.ct_iid = ((at2e_entry_t *)aep)->at_iid;
|
||||
} else {
|
||||
cto->ct_iid = aep->at_iid;
|
||||
@@ -766,7 +767,6 @@ isp_target_async(ispsoftc_t *isp, int bus, int event)
|
||||
notify.nt_iid = INI_ANY;
|
||||
/* nt_tgt set in outer layers */
|
||||
notify.nt_lun = LUN_ANY;
|
||||
notify.nt_channel = bus;
|
||||
notify.nt_tagval = TAG_ANY;
|
||||
|
||||
if (IS_SCSI(isp)) {
|
||||
@@ -777,27 +777,27 @@ isp_target_async(ispsoftc_t *isp, int bus, int event)
|
||||
case ASYNC_LOOP_UP:
|
||||
case ASYNC_PTPMODE:
|
||||
notify.nt_ncode = NT_LINK_UP;
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
break;
|
||||
case ASYNC_LOOP_DOWN:
|
||||
notify.nt_ncode = NT_LINK_DOWN;
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
break;
|
||||
case ASYNC_LIP_ERROR:
|
||||
case ASYNC_LIP_F8:
|
||||
case ASYNC_LIP_OCCURRED:
|
||||
case ASYNC_LOOP_RESET:
|
||||
notify.nt_ncode = NT_LIP_RESET;
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
break;
|
||||
case ASYNC_BUS_RESET:
|
||||
case ASYNC_TIMEOUT_RESET: /* XXX: where does this come from ? */
|
||||
notify.nt_ncode = NT_BUS_RESET;
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
break;
|
||||
case ASYNC_DEVICE_RESET:
|
||||
notify.nt_ncode = NT_TARGET_RESET;
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
|
||||
break;
|
||||
case ASYNC_CTIO_DONE:
|
||||
{
|
||||
@@ -823,7 +823,7 @@ isp_target_async(ispsoftc_t *isp, int bus, int event)
|
||||
ct->ct_fwhandle = bus;
|
||||
ct->ct_flags = CT_SENDSTATUS;
|
||||
}
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, storage);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, storage);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -889,7 +889,7 @@ isp_got_msg(ispsoftc_t *isp, in_entry_t *inp)
|
||||
isp_notify_ack(isp, inp);
|
||||
return;
|
||||
}
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt);
|
||||
} else {
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"unknown immediate notify status 0x%x", inp->in_status);
|
||||
@@ -911,7 +911,7 @@ isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp)
|
||||
|
||||
MEMZERO(&nt, sizeof (tmd_notify_t));
|
||||
nt.nt_hba = isp;
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
nt.nt_iid = ((in_fcentry_e_t *)inp)->in_iid;
|
||||
loopid = ((in_fcentry_e_t *)inp)->in_iid;
|
||||
seqid = ((in_fcentry_e_t *)inp)->in_seqid;
|
||||
@@ -921,7 +921,7 @@ isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp)
|
||||
seqid = inp->in_seqid;
|
||||
}
|
||||
/* nt_tgt set in outer layers */
|
||||
if (ISP_CAP_SCCFW(isp)) {
|
||||
if (FCPARAM(isp)->isp_sccfw) {
|
||||
nt.nt_lun = inp->in_scclun;
|
||||
} else {
|
||||
nt.nt_lun = inp->in_lun;
|
||||
@@ -964,7 +964,7 @@ isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp)
|
||||
isp_notify_ack(isp, inp);
|
||||
return;
|
||||
}
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt);
|
||||
}
|
||||
|
||||
#define HILO(x) (uint32_t) (x >> 32), (uint32_t) x
|
||||
@@ -1027,7 +1027,7 @@ isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
|
||||
isp_endcmd(isp, aep, 0, 0);
|
||||
return;
|
||||
}
|
||||
isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1087,7 +1087,7 @@ isp_notify_ack(ispsoftc_t *isp, void *arg)
|
||||
if (arg) {
|
||||
in_fcentry_t *inp = arg;
|
||||
MEMCPY(storage, arg, sizeof (isphdr_t));
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
((na_fcentry_e_t *)na)->na_iid =
|
||||
((in_fcentry_e_t *)inp)->in_iid;
|
||||
iid = ((na_fcentry_e_t *)na)->na_iid;
|
||||
@@ -1112,7 +1112,7 @@ isp_notify_ack(ispsoftc_t *isp, void *arg)
|
||||
}
|
||||
na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK;
|
||||
na->na_header.rqs_entry_count = 1;
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
isp_put_notify_ack_fc_e(isp, (na_fcentry_e_t *) na,
|
||||
(na_fcentry_e_t *)outp);
|
||||
} else {
|
||||
@@ -1202,7 +1202,7 @@ isp_handle_atio(ispsoftc_t *isp, at_entry_t *aep)
|
||||
/*
|
||||
* Punt to platform specific layer.
|
||||
*/
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, aep);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, aep);
|
||||
break;
|
||||
|
||||
case AT_RESET:
|
||||
@@ -1233,13 +1233,13 @@ isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep)
|
||||
{
|
||||
int lun, iid;
|
||||
|
||||
if (ISP_CAP_SCCFW(isp)) {
|
||||
if (FCPARAM(isp)->isp_sccfw) {
|
||||
lun = aep->at_scclun;
|
||||
} else {
|
||||
lun = aep->at_lun;
|
||||
}
|
||||
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
iid = ((at2e_entry_t *)aep)->at_iid;
|
||||
} else {
|
||||
iid = aep->at_iid;
|
||||
@@ -1292,7 +1292,7 @@ isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep)
|
||||
/*
|
||||
* Punt to platform specific layer.
|
||||
*/
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, aep);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, aep);
|
||||
break;
|
||||
|
||||
case AT_RESET:
|
||||
@@ -1474,7 +1474,7 @@ isp_handle_ctio(ispsoftc_t *isp, ct_entry_t *ct)
|
||||
/*
|
||||
* The platform layer will destroy the handle if appropriate.
|
||||
*/
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1633,7 +1633,7 @@ isp_handle_ctio2(ispsoftc_t *isp, ct2_entry_t *ct)
|
||||
*/
|
||||
isp_prt(isp, pl, "data CTIO complete");
|
||||
}
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
|
||||
/*
|
||||
* The platform layer will destroy the handle if appropriate.
|
||||
*/
|
||||
@@ -1786,7 +1786,7 @@ isp_handle_ctio7(ispsoftc_t *isp, ct7_entry_t *ct)
|
||||
*/
|
||||
isp_prt(isp, pl, "data CTIO complete");
|
||||
}
|
||||
isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
|
||||
(void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
|
||||
/*
|
||||
* The platform layer will destroy the handle if appropriate.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_target.h,v 1.50 2007/06/01 17:19:31 mjacob Exp $ */
|
||||
/* $Id: isp_target.h,v 1.53 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -937,11 +936,11 @@ void isp_notify_ack(ispsoftc_t *, void *);
|
||||
|
||||
/*
|
||||
* Enable/Disable/Modify a logical unit.
|
||||
* (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt)
|
||||
* (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
|
||||
*/
|
||||
#define DFLT_CMND_CNT 0xfe /* unmonitored */
|
||||
#define DFLT_INOT_CNT 0xfe /* unmonitored */
|
||||
int isp_lun_cmd(ispsoftc_t *, int, int, int, int, int, int);
|
||||
int isp_lun_cmd(ispsoftc_t *, int, int, int, int, int, int, uint32_t);
|
||||
|
||||
/*
|
||||
* General request queue 'put' routine for target mode entries.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_tpublic.h,v 1.31 2007/04/30 18:47:23 mjacob Exp $ */
|
||||
/* $Id: isp_tpublic.h,v 1.34 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
||||
+20
-31
@@ -1,4 +1,4 @@
|
||||
/* $Id: ispmbox.h,v 1.63 2007/06/01 01:15:02 mjacob Exp $ */
|
||||
/* $Id: ispmbox.h,v 1.66 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -794,31 +793,24 @@ typedef struct {
|
||||
* About Firmware returns an 'attribute' word in mailbox 6.
|
||||
* These attributes are for 2200 and 2300.
|
||||
*/
|
||||
#define ISP_FW_ATTR_TMODE 0x0001
|
||||
#define ISP_FW_ATTR_SCCLUN 0x0002
|
||||
#define ISP_FW_ATTR_FABRIC 0x0004
|
||||
#define ISP_FW_ATTR_CLASS2 0x0008
|
||||
#define ISP_FW_ATTR_FCTAPE 0x0010
|
||||
#define ISP_FW_ATTR_IP 0x0020
|
||||
#define ISP_FW_ATTR_VI 0x0040
|
||||
#define ISP_FW_ATTR_VI_SOLARIS 0x0080
|
||||
#define ISP_FW_ATTR_2KLOGINS 0x0100 /* just a guess... */
|
||||
#define ISP_FW_ATTR_TMODE 0x01
|
||||
#define ISP_FW_ATTR_SCCLUN 0x02
|
||||
#define ISP_FW_ATTR_FABRIC 0x04
|
||||
#define ISP_FW_ATTR_CLASS2 0x08
|
||||
#define ISP_FW_ATTR_FCTAPE 0x10
|
||||
#define ISP_FW_ATTR_IP 0x20
|
||||
#define ISP_FW_ATTR_VI 0x40
|
||||
#define ISP_FW_ATTR_VI_SOLARIS 0x80
|
||||
#define ISP_FW_ATTR_2KLOGINS 0x100 /* XXX: just a guess */
|
||||
|
||||
/* and these are for the 2400 */
|
||||
#define ISP2400_FW_ATTR_CLASS2 0x0001
|
||||
#define ISP2400_FW_ATTR_IP 0x0002
|
||||
#define ISP2400_FW_ATTR_MULTIID 0x0004
|
||||
#define ISP2400_FW_ATTR_SB2 0x0008
|
||||
#define ISP2400_FW_ATTR_T10CRC 0x0010
|
||||
#define ISP2400_FW_ATTR_VI 0x0020
|
||||
#define ISP2400_FW_ATTR_EXPFW 0x2000
|
||||
|
||||
#define ISP_CAP_TMODE(isp) \
|
||||
(IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_TMODE))
|
||||
#define ISP_CAP_SCCFW(isp) \
|
||||
(IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_SCCLUN))
|
||||
#define ISP_CAP_2KLOGIN(isp) \
|
||||
(IS_24XX(isp)? 1 : (isp->isp_fwattr & ISP_FW_ATTR_2KLOGINS))
|
||||
#define ISP2400_FW_ATTR_CLASS2 (1 << 0)
|
||||
#define ISP2400_FW_ATTR_IP (1 << 1)
|
||||
#define ISP2400_FW_ATTR_MULTIID (1 << 2)
|
||||
#define ISP2400_FW_ATTR_SB2 (1 << 3)
|
||||
#define ISP2400_FW_ATTR_T10CRC (1 << 4)
|
||||
#define ISP2400_FW_ATTR_VI (1 << 5)
|
||||
#define ISP2400_FW_ATTR_EXPFW (1 << 13)
|
||||
|
||||
/*
|
||||
* Reduced Interrupt Operation Response Queue Entreis
|
||||
@@ -1172,7 +1164,6 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t handle;
|
||||
uint16_t channel;
|
||||
uint32_t
|
||||
flags : 8,
|
||||
portid : 24;
|
||||
@@ -1426,9 +1417,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint16_t handle;
|
||||
uint16_t lun;
|
||||
uint32_t
|
||||
channel : 8,
|
||||
portid : 24;
|
||||
uint32_t portid;
|
||||
uint32_t timeout;
|
||||
union {
|
||||
struct {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: ispreg.h,v 1.25 2007/03/10 01:56:34 mjacob Exp $ */
|
||||
/* $Id: ispreg.h,v 1.26 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
||||
+67
-72
@@ -1,4 +1,4 @@
|
||||
/* $Id: ispvar.h,v 1.76 2007/06/01 17:19:31 mjacob Exp $ */
|
||||
/* $Id: ispvar.h,v 1.84 2007/10/11 22:08:38 mjacob Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -190,7 +189,9 @@ struct ispmdvec {
|
||||
* SCSI Specific Host Adapter Parameters- per bus, per target
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t : 12,
|
||||
uint32_t : 10,
|
||||
isp_bad_nvram : 1,
|
||||
isp_gotdparms : 1,
|
||||
isp_req_ack_active_neg : 1,
|
||||
isp_data_line_active_neg: 1,
|
||||
isp_cmd_dma_burst_enable: 1,
|
||||
@@ -344,7 +345,6 @@ typedef struct {
|
||||
* the 'loopid'.
|
||||
*/
|
||||
uint16_t handle;
|
||||
|
||||
/*
|
||||
* The ini_map_idx, if nonzero, is the system virtual target ID (+1)
|
||||
* as a cross-reference with the isp_ini_map.
|
||||
@@ -386,14 +386,14 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t : 10,
|
||||
: 1,
|
||||
: 1,
|
||||
: 1,
|
||||
isp_tmode : 1,
|
||||
isp_2klogin : 1,
|
||||
isp_sccfw : 1,
|
||||
isp_gbspeed : 3,
|
||||
: 1,
|
||||
: 1,
|
||||
: 1,
|
||||
: 1,
|
||||
isp_gotdparms : 1,
|
||||
isp_bad_nvram : 1,
|
||||
isp_loopstate : 4, /* Current Loop State */
|
||||
isp_fwstate : 4, /* ISP F/W state */
|
||||
isp_topo : 3,
|
||||
@@ -404,6 +404,7 @@ typedef struct {
|
||||
uint16_t isp_xfwoptions;
|
||||
uint16_t isp_zfwoptions;
|
||||
uint16_t isp_loopid; /* hard loop id */
|
||||
uint16_t isp_fwattr; /* firmware attributes */
|
||||
uint16_t isp_execthrottle;
|
||||
uint8_t isp_retry_delay;
|
||||
uint8_t isp_retry_count;
|
||||
@@ -482,29 +483,22 @@ struct ispsoftc {
|
||||
*/
|
||||
|
||||
void * isp_param; /* type specific */
|
||||
uint16_t isp_fwrev[3]; /* Loaded F/W revision */
|
||||
uint16_t isp_romfw_rev[3]; /* PROM F/W revision */
|
||||
uint16_t isp_fwrev[3]; /* runnng F/W revision */
|
||||
uint16_t isp_maxcmds; /* max possible I/O cmds */
|
||||
uint8_t isp_type; /* HBA Chip Type */
|
||||
uint8_t isp_revision; /* HBA Chip H/W Revision */
|
||||
uint32_t isp_maxluns; /* maximum luns supported */
|
||||
|
||||
uint32_t isp_clock : 8, /* input clock */
|
||||
: 2,
|
||||
isp_gotdparms : 1,
|
||||
: 1,
|
||||
: 5,
|
||||
isp_port : 1, /* 23XX/24XX only */
|
||||
: 1,
|
||||
isp_failed : 1, /* board failed */
|
||||
isp_open : 1, /* opened (ioctl) */
|
||||
isp_touched : 1, /* board ever seen? */
|
||||
isp_bustype : 1, /* SBus or PCI */
|
||||
isp_loaded_fw : 1, /* loaded firmware */
|
||||
isp_role : 2, /* roles supported */
|
||||
isp_dblev : 12; /* debug log mask */
|
||||
|
||||
uint16_t isp_fwattr; /* firmware attributes */
|
||||
uint16_t isp_nchan; /* number of channels */
|
||||
|
||||
uint32_t isp_confopts; /* config options */
|
||||
|
||||
uint32_t isp_rqstinrp; /* register for REQINP */
|
||||
@@ -577,8 +571,8 @@ struct ispsoftc {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define SDPARAM(isp, chan) (&((sdparam *)(isp)->isp_param)[(chan)])
|
||||
#define FCPARAM(isp, chan) (&((fcparam *)(isp)->isp_param)[(chan)])
|
||||
#define SDPARAM(isp) ((sdparam *) (isp)->isp_param)
|
||||
#define FCPARAM(isp) ((fcparam *) (isp)->isp_param)
|
||||
|
||||
/*
|
||||
* ISP Driver Run States
|
||||
@@ -788,34 +782,27 @@ void isp_done(XS_T *);
|
||||
* Platform Dependent to External to Internal Control Function
|
||||
*
|
||||
* Assumes locks are held on entry. You should note that with many of
|
||||
* these commands locks may be released while this function is called.
|
||||
* these commands and locks may be released while this is occurring.
|
||||
*
|
||||
* ... ISPCTL_RESET_BUS, int channel);
|
||||
* Reset BUS on this channel
|
||||
* ... ISPCTL_RESET_DEV, int channel, int target);
|
||||
* Reset Device on this channel at this target.
|
||||
* ... ISPCTL_ABORT_CMD, XS_T *xs);
|
||||
* Abort active transaction described by xs.
|
||||
* ... IPCTL_UPDATE_PARAMS);
|
||||
* Update any operating parameters (speed, etc.)
|
||||
* ... ISPCTL_FCLINK_TEST, int channel);
|
||||
* Test FC link status on this channel
|
||||
* ... ISPCTL_SCAN_FABRIC, int channel);
|
||||
* Scan fabric on this channel
|
||||
* ... ISPCTL_SCAN_LOOP, int channel);
|
||||
* Scan local loop on this channel
|
||||
* ... ISPCTL_PDB_SYNC, int channel);
|
||||
* Synchronize port database on this channel
|
||||
* ... ISPCTL_SEND_LIP, int channel);
|
||||
* Send a LIP on this channel
|
||||
* ... ISPCTL_GET_PORTNAME, int channel, int nphandle, uint64_t *wwpn)
|
||||
* Get a WWPN for this N-port handle on this channel
|
||||
* ... ISPCTL_RUN_MBOXCMD, mbreg_t *mbp)
|
||||
* Run this mailbox command
|
||||
* ... ISPCTL_GET_PDB, int channel, int nphandle, isp_pdb_t *pdb)
|
||||
* Get PDB on this channel for this N-port handle
|
||||
* ... ISPCTL_PLOGX, isp_plcmd_t *)
|
||||
* Performa a port login/logout
|
||||
* A few notes about some of these functions:
|
||||
*
|
||||
* ISPCTL_FCLINK_TEST tests to make sure we have good fibre channel link.
|
||||
* The argument is a pointer to an integer which is the time, in microseconds,
|
||||
* we should wait to see whether we have good link. This test, if successful,
|
||||
* lets us know our connection topology and our Loop ID/AL_PA and so on.
|
||||
* You can't get anywhere without this.
|
||||
*
|
||||
* ISPCTL_SCAN_FABRIC queries the name server (if we're on a fabric) for
|
||||
* all entities using the FC Generic Services subcommand GET ALL NEXT.
|
||||
* For each found entity, an ISPASYNC_FABRICDEV event is generated (see
|
||||
* below).
|
||||
*
|
||||
* ISPCTL_SCAN_LOOP does a local loop scan. This is only done if the connection
|
||||
* topology is NL or FL port (private or public loop). Since the Qlogic f/w
|
||||
* 'automatically' manages local loop connections, this function essentially
|
||||
* notes the arrival, departure, and possible shuffling around of local loop
|
||||
* entities. Thus for each arrival and departure this generates an isp_async
|
||||
* event of ISPASYNC_PROMENADE (see below).
|
||||
*
|
||||
* ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in
|
||||
* order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_FABRIC, and ISPCTL_SCAN_LOOP.
|
||||
@@ -826,21 +813,24 @@ void isp_done(XS_T *);
|
||||
* part of this function. It's now been separated to allow for finer control.
|
||||
*/
|
||||
typedef enum {
|
||||
ISPCTL_RESET_BUS,
|
||||
ISPCTL_RESET_DEV,
|
||||
ISPCTL_ABORT_CMD,
|
||||
ISPCTL_UPDATE_PARAMS,
|
||||
ISPCTL_FCLINK_TEST,
|
||||
ISPCTL_SCAN_FABRIC,
|
||||
ISPCTL_SCAN_LOOP,
|
||||
ISPCTL_PDB_SYNC,
|
||||
ISPCTL_SEND_LIP,
|
||||
ISPCTL_GET_PORTNAME,
|
||||
ISPCTL_RUN_MBOXCMD,
|
||||
ISPCTL_GET_PDB,
|
||||
ISPCTL_PLOGX
|
||||
ISPCTL_RESET_BUS, /* Reset Bus */
|
||||
ISPCTL_RESET_DEV, /* Reset Device */
|
||||
ISPCTL_ABORT_CMD, /* Abort Command */
|
||||
ISPCTL_UPDATE_PARAMS, /* Update Operating Parameters (SCSI) */
|
||||
ISPCTL_FCLINK_TEST, /* Test FC Link Status */
|
||||
ISPCTL_SCAN_FABRIC, /* (Re)scan Fabric Name Server */
|
||||
ISPCTL_SCAN_LOOP, /* (Re)scan Local Loop */
|
||||
ISPCTL_PDB_SYNC, /* Synchronize Port Database */
|
||||
ISPCTL_SEND_LIP, /* Send a LIP */
|
||||
ISPCTL_GET_PORTNAME, /* get portname from an N-port handle */
|
||||
ISPCTL_GET_NODENAME, /* get nodename from an N-port handle */
|
||||
ISPCTL_RUN_MBOXCMD, /* run a mailbox command */
|
||||
ISPCTL_TOGGLE_TMODE, /* toggle target mode */
|
||||
ISPCTL_GET_PDB, /* get a single port database entry */
|
||||
ISPCTL_PLOGX /* do a port login/logout */
|
||||
} ispctl_t;
|
||||
int isp_control(ispsoftc_t *, ispctl_t, ...);
|
||||
int isp_control(ispsoftc_t *, ispctl_t, void *);
|
||||
|
||||
|
||||
/*
|
||||
* Platform Dependent to Internal to External Control Function
|
||||
@@ -852,7 +842,7 @@ int isp_control(ispsoftc_t *, ispctl_t, ...);
|
||||
*
|
||||
* ISPASYNC_CHANGE_NOTIFY notifies the outer layer that a change has
|
||||
* occurred that invalidates the list of fabric devices known and/or
|
||||
* the list of known loop devices. The argument passed is an integer
|
||||
* the list of known loop devices. The argument passed is a pointer
|
||||
* whose values are defined below (local loop change, name server
|
||||
* change, other). 'Other' may simply be a LIP, or a change in
|
||||
* connection topology.
|
||||
@@ -896,15 +886,17 @@ typedef enum {
|
||||
ISPASYNC_DEV_GONE, /* FC Device Depart */
|
||||
ISPASYNC_TARGET_NOTIFY, /* target asynchronous notification event */
|
||||
ISPASYNC_TARGET_ACTION, /* target action requested */
|
||||
ISPASYNC_CONF_CHANGE, /* Platform Configuration Change */
|
||||
ISPASYNC_UNHANDLED_RESPONSE, /* Unhandled Response Entry */
|
||||
ISPASYNC_FW_CRASH, /* Firmware has crashed */
|
||||
ISPASYNC_FW_DUMPED, /* Firmware crashdump taken */
|
||||
ISPASYNC_FW_RESTARTED /* Firmware has been restarted */
|
||||
} ispasync_t;
|
||||
void isp_async(ispsoftc_t *, ispasync_t, ...);
|
||||
int isp_async(ispsoftc_t *, ispasync_t, void *);
|
||||
|
||||
#define ISPASYNC_CHANGE_PDB 0
|
||||
#define ISPASYNC_CHANGE_SNS 1
|
||||
#define ISPASYNC_CHANGE_OTHER 2
|
||||
#define ISPASYNC_CHANGE_PDB ((void *) 0)
|
||||
#define ISPASYNC_CHANGE_SNS ((void *) 1)
|
||||
#define ISPASYNC_CHANGE_OTHER ((void *) 2)
|
||||
|
||||
/*
|
||||
* Platform Dependent Error and Debug Printout
|
||||
@@ -938,7 +930,7 @@ void isp_async(ispsoftc_t *, ispasync_t, ...);
|
||||
* Each platform must also provide the following macros/defines:
|
||||
*
|
||||
*
|
||||
* ISP_FC_SCRLEN FC scratch area DMA length
|
||||
* ISP2100_SCRLEN - length for the Fibre Channel scratch DMA area
|
||||
*
|
||||
* MEMZERO(dst, src) platform zeroing function
|
||||
* MEMCPY(dst, src, count) platform copying function
|
||||
@@ -970,8 +962,8 @@ void isp_async(ispsoftc_t *, ispasync_t, ...);
|
||||
* MBOX_NOTIFY_COMPLETE(ispsoftc_t *) notification of mbox cmd donee
|
||||
* MBOX_RELEASE(ispsoftc_t *) release lock on mailbox regs
|
||||
*
|
||||
* FC_SCRATCH_ACQUIRE(ispsoftc_t *, chan) acquire lock on FC scratch area
|
||||
* FC_SCRATCH_RELEASE(ispsoftc_t *, chan) acquire lock on FC scratch area
|
||||
* FC_SCRATCH_ACQUIRE(ispsoftc_t *) acquire lock on FC scratch area
|
||||
* FC_SCRATCH_RELEASE(ispsoftc_t *) acquire lock on FC scratch area
|
||||
*
|
||||
* SCSI_GOOD SCSI 'Good' Status
|
||||
* SCSI_CHECK SCSI 'Check Condition' Status
|
||||
@@ -1049,6 +1041,9 @@ void isp_async(ispsoftc_t *, ispasync_t, ...);
|
||||
* ISP_IOXGET_32(ispsoftc_t *, uint32_t *srcptr, uint32_t dstrval)
|
||||
*
|
||||
* ISP_SWIZZLE_NVRAM_WORD(ispsoftc_t *, uint16_t *)
|
||||
* ISP_SWIZZLE_NVRAM_LONG(ispsoftc_t *, uint32_t *)
|
||||
* ISP_SWAP16(ispsoftc_t *, uint16_t srcval)
|
||||
* ISP_SWAP32(ispsoftc_t *, uint32_t srcval)
|
||||
*/
|
||||
|
||||
#endif /* _ISPVAR_H */
|
||||
|
||||
+11140
-24835
File diff suppressed because it is too large
Load Diff
+99
-169
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_cb_ops.c,v 1.63 2007/06/01 01:15:02 mjacob Exp $ */
|
||||
/* $Id: isp_cb_ops.c,v 1.77 2007/08/29 20:37:08 mjacob Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -126,15 +125,8 @@ copy_info(struct info_str *info, const char *fmt, ...)
|
||||
}
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
||||
int
|
||||
isplinux_proc_info_26(struct Scsi_Host *shp, char *buf, char **st, off_t off, int len, int io)
|
||||
{
|
||||
return (isplinux_proc_info(buf, st, off, len, shp->host_no, io));
|
||||
}
|
||||
#endif
|
||||
int
|
||||
isplinux_proc_info(char *buf, char **st, off_t off, int len, int host, int io)
|
||||
isplinux_proc_info(struct Scsi_Host *shp, char *buf, char **st, off_t off, int len, int io)
|
||||
{
|
||||
int i;
|
||||
struct info_str info;
|
||||
@@ -146,7 +138,7 @@ isplinux_proc_info(char *buf, char **st, off_t off, int len, int host, int io)
|
||||
if (isp == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (isp->isp_host->host_no == host) {
|
||||
if (isp->isp_host->host_no == shp->host_no) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -172,9 +164,7 @@ isplinux_proc_info(char *buf, char **st, off_t off, int len, int host, int io)
|
||||
io = len;
|
||||
} else if (strncmp(buf, "rescan", 6) == 0) {
|
||||
if (IS_FC(isp)) {
|
||||
for (io = 0; io < isp->isp_nchan; io++) {
|
||||
SEND_THREAD_EVENT(isp, ISP_THREAD_FC_RESCAN, FCPARAM(isp, io), 1, __FUNCTION__, __LINE__);
|
||||
}
|
||||
SEND_THREAD_EVENT(isp, ISP_THREAD_FC_RESCAN, NULL, 1, __FUNCTION__, __LINE__);
|
||||
io = len;
|
||||
}
|
||||
} else if (strncmp(buf, "lip", 3) == 0) {
|
||||
@@ -192,7 +182,7 @@ isplinux_proc_info(char *buf, char **st, off_t off, int len, int host, int io)
|
||||
return (-EINVAL);
|
||||
}
|
||||
ISP_LOCKU_SOFTC(isp);
|
||||
(void) isp_control(isp, ISPCTL_RESET_BUS, bus);
|
||||
(void) isp_control(isp, ISPCTL_RESET_BUS, &bus);
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
io = len;
|
||||
} else if (strncmp(buf, "devreset=", 9) == 0) {
|
||||
@@ -204,7 +194,7 @@ isplinux_proc_info(char *buf, char **st, off_t off, int len, int host, int io)
|
||||
}
|
||||
/* always bus 0 */
|
||||
ISP_LOCKU_SOFTC(isp);
|
||||
(void) isp_control(isp, ISPCTL_RESET_DEV, 0, dev);
|
||||
(void) isp_control(isp, ISPCTL_RESET_DEV, &dev);
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
io = len;
|
||||
} else if (strncmp(buf, "reset", 5) == 0) {
|
||||
@@ -323,7 +313,7 @@ isplinux_proc_info(char *buf, char **st, off_t off, int len, int host, int io)
|
||||
#endif
|
||||
|
||||
if (IS_FC(isp)) {
|
||||
fcparam *fcp = FCPARAM(isp, 0);
|
||||
fcparam *fcp = FCPARAM(isp);
|
||||
copy_info(&info,
|
||||
"Self:\nHandle ID 0x%x PortID 0x%06x FW State 0x%x Loop State 0x%x\n",
|
||||
fcp->isp_loopid, fcp->isp_portid, fcp->isp_fwstate, fcp->isp_loopstate);
|
||||
@@ -372,91 +362,38 @@ static int isp_close(struct inode *, struct file *);
|
||||
static int isp_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
|
||||
static int isp_qlogic_ext_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
|
||||
|
||||
struct file_operations isp_procfs_operations = {
|
||||
dev_t isp_dev;
|
||||
struct cdev isp_cdev = {
|
||||
.kobj = { .name = ISP_NAME, } ,
|
||||
.owner = THIS_MODULE
|
||||
};
|
||||
ISP_CLASS *isp_class;
|
||||
|
||||
struct file_operations isp_ioctl_operations = {
|
||||
owner: THIS_MODULE,
|
||||
open: isp_open,
|
||||
release: isp_close,
|
||||
ioctl: isp_ioctl,
|
||||
};
|
||||
|
||||
struct file_operations hba_api_procfs_operations = {
|
||||
struct file_operations hba_api_ioctl_operations = {
|
||||
owner: THIS_MODULE,
|
||||
ioctl: isp_qlogic_ext_ioctl,
|
||||
};
|
||||
|
||||
static struct proc_dir_entry *isp_root = 0;
|
||||
static struct proc_dir_entry *hba_api_node = 0;
|
||||
|
||||
void
|
||||
isplinux_init_proc(ispsoftc_t *isp)
|
||||
{
|
||||
char tbuf[32];
|
||||
|
||||
SNPRINTF(tbuf, sizeof(tbuf), "isp%d@0x%x", isp->isp_unit, isp->isp_osinfo.device_id);
|
||||
if (isp_root == NULL) {
|
||||
isp_root = proc_mkdir("isp", 0);
|
||||
}
|
||||
if (isp_root != NULL && isp->isp_osinfo.pdp == NULL) {
|
||||
isp->isp_osinfo.pdp = create_proc_entry(tbuf, S_IFREG|S_IRUGO|S_IWUSR, isp_root);
|
||||
if (isp->isp_osinfo.pdp) {
|
||||
isp->isp_osinfo.pdp->proc_fops = &isp_procfs_operations;
|
||||
}
|
||||
}
|
||||
if (hba_api_node == NULL && isp->isp_osinfo.host && isp->isp_osinfo.host->hostt && isp->isp_osinfo.host->hostt->proc_dir) {
|
||||
hba_api_node = create_proc_entry("HbaApiNode", S_IFREG|S_IRUGO|S_IWUSR, isp->isp_osinfo.host->hostt->proc_dir);
|
||||
if (hba_api_node) {
|
||||
hba_api_node->proc_fops = &hba_api_procfs_operations;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
isplinux_undo_proc(ispsoftc_t *isp)
|
||||
{
|
||||
char tbuf[64];
|
||||
int i;
|
||||
|
||||
SNPRINTF(tbuf, sizeof(tbuf), "isp/isp%d@0x%x", isp->isp_unit, isp->isp_osinfo.device_id);
|
||||
remove_proc_entry(tbuf, 0);
|
||||
for (i = 0; i < MAX_ISP; i++) {
|
||||
if (isplist[i]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == MAX_ISP) {
|
||||
remove_proc_entry("isp", 0);
|
||||
if (hba_api_node && isp->isp_osinfo.host && isp->isp_osinfo.host->hostt && isp->isp_osinfo.host->hostt->proc_dir) {
|
||||
SNPRINTF(tbuf, sizeof(tbuf), "scsi/isp/HbaApiNode");
|
||||
remove_proc_entry("HbaApiNode", isp->isp_osinfo.host->hostt->proc_dir);
|
||||
hba_api_node = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ispsoftc_t *
|
||||
get_isp_from_procname(const unsigned char *name)
|
||||
{
|
||||
ispsoftc_t *isp;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_ISP; i++) {
|
||||
char tbuf[32];
|
||||
isp = isplist[i];
|
||||
if (isp == NULL) {
|
||||
continue;
|
||||
}
|
||||
SNPRINTF(tbuf, sizeof(tbuf), "isp%d@0x%x", isp->isp_unit, isp->isp_osinfo.device_id);
|
||||
if (strcmp(name, tbuf) == 0) {
|
||||
return (isp);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
isp_open(struct inode *ip, struct file *fp)
|
||||
{
|
||||
ispsoftc_t *isp = get_isp_from_procname(fp->f_dentry->d_name.name);
|
||||
const int minor = iminor(ip);
|
||||
int i;
|
||||
ispsoftc_t *isp = NULL;
|
||||
|
||||
for (i = 0; i < MAX_ISP; i++) {
|
||||
if (isplist[i] && isplist[i]->isp_unit == minor) {
|
||||
isp = isplist[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isp == NULL) {
|
||||
return (-ENXIO);
|
||||
}
|
||||
@@ -480,7 +417,7 @@ static int
|
||||
isp_ioctl(struct inode *ip, struct file *fp, unsigned int c, unsigned long arg)
|
||||
{
|
||||
ispsoftc_t *isp = fp->private_data;
|
||||
int i, rv, inarg, outarg;
|
||||
int rv, inarg, outarg;
|
||||
fcparam *fcp;
|
||||
uint16_t loopid;
|
||||
mbreg_t mbs;
|
||||
@@ -594,9 +531,7 @@ isp_ioctl(struct inode *ip, struct file *fp, unsigned int c, unsigned long arg)
|
||||
case ISP_RESCAN:
|
||||
if (IS_FC(isp)) {
|
||||
ISP_LOCKU_SOFTC(isp);
|
||||
for (i = 0; i < isp->isp_nchan; i++) {
|
||||
SEND_THREAD_EVENT(isp, ISP_THREAD_FC_RESCAN, FCPARAM(isp, i), 1, __FUNCTION__, __LINE__);
|
||||
}
|
||||
SEND_THREAD_EVENT(isp, ISP_THREAD_FC_RESCAN, NULL, 0, __FUNCTION__, __LINE__)
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
}
|
||||
break;
|
||||
@@ -651,7 +586,7 @@ isp_ioctl(struct inode *ip, struct file *fp, unsigned int c, unsigned long arg)
|
||||
}
|
||||
case ISP_FC_LIP:
|
||||
ISP_LOCK_SOFTC(isp);
|
||||
if (isp_control(isp, ISPCTL_SEND_LIP, 0)) {
|
||||
if (isp_control(isp, ISPCTL_SEND_LIP, NULL)) {
|
||||
rv = -EIO;
|
||||
}
|
||||
ISP_UNLK_SOFTC(isp);
|
||||
@@ -674,7 +609,7 @@ isp_ioctl(struct inode *ip, struct file *fp, unsigned int c, unsigned long arg)
|
||||
break;
|
||||
}
|
||||
ISP_LOCK_SOFTC(isp);
|
||||
lp = &FCPARAM(isp, 0)->portdb[ifc->loopid];
|
||||
lp = &FCPARAM(isp)->portdb[ifc->loopid];
|
||||
if (lp->state == FC_PORTDB_STATE_VALID) {
|
||||
ifc->role = lp->roles;
|
||||
ifc->loopid = lp->handle;
|
||||
@@ -701,12 +636,12 @@ isp_ioctl(struct inode *ip, struct file *fp, unsigned int c, unsigned long arg)
|
||||
hba->fc_fw_major = ISP_FW_MAJORX(isp->isp_fwrev);
|
||||
hba->fc_fw_minor = ISP_FW_MINORX(isp->isp_fwrev);
|
||||
hba->fc_fw_micro = ISP_FW_MICROX(isp->isp_fwrev);
|
||||
hba->fc_speed = FCPARAM(isp, 0)->isp_gbspeed;
|
||||
hba->fc_speed = FCPARAM(isp)->isp_gbspeed;
|
||||
hba->fc_scsi_supported = 1;
|
||||
hba->fc_topology = FCPARAM(isp, 0)->isp_topo + 1;
|
||||
hba->fc_loopid = FCPARAM(isp, 0)->isp_loopid;
|
||||
hba->nvram_node_wwn = FCPARAM(isp, 0)->isp_wwnn_nvram;
|
||||
hba->nvram_port_wwn = FCPARAM(isp, 0)->isp_wwpn_nvram;
|
||||
hba->fc_topology = FCPARAM(isp)->isp_topo + 1;
|
||||
hba->fc_loopid = FCPARAM(isp)->isp_loopid;
|
||||
hba->nvram_node_wwn = FCPARAM(isp)->isp_wwnn_nvram;
|
||||
hba->nvram_port_wwn = FCPARAM(isp)->isp_wwpn_nvram;
|
||||
hba->active_node_wwn = ISP_NODEWWN(isp);
|
||||
hba->active_port_wwn = ISP_PORTWWN(isp);
|
||||
ISP_UNLK_SOFTC(isp);
|
||||
@@ -734,7 +669,7 @@ isp_ioctl(struct inode *ip, struct file *fp, unsigned int c, unsigned long arg)
|
||||
MEMZERO(&mbs, sizeof (mbs));
|
||||
needmarker = rv = 0;
|
||||
loopid = fct->loopid;
|
||||
if (ISP_CAP_2KLOGIN(isp) == 0) {
|
||||
if (FCPARAM(isp)->isp_2klogin == 0) {
|
||||
loopid <<= 8;
|
||||
}
|
||||
switch (fct->action) {
|
||||
@@ -787,49 +722,59 @@ isp_ioctl(struct inode *ip, struct file *fp, unsigned int c, unsigned long arg)
|
||||
}
|
||||
case ISP_FC_GETDLIST:
|
||||
{
|
||||
isp_dlist_t local, *ua;
|
||||
int rv, nph, nphe, lim, chan;
|
||||
uint64_t wwpn, *uptr;
|
||||
isp_dlist_t *ua;
|
||||
uint16_t nph, nphs, nphe, lim, count;
|
||||
struct wwnpair pair, *uptr;
|
||||
|
||||
if (IS_SCSI(isp)) {
|
||||
rv = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (COPYIN((void *)arg, &local, sizeof (local))) {
|
||||
ua = (isp_dlist_t *)arg;
|
||||
uptr = &ua->wwns[0];
|
||||
|
||||
if (COPYIN((void *)&ua->count, &lim, sizeof (lim))) {
|
||||
rv = EFAULT;
|
||||
break;
|
||||
}
|
||||
ua = (isp_dlist_t *)arg;
|
||||
uptr = &ua->wwpns[0];
|
||||
lim = local.count;
|
||||
chan = local.channel;
|
||||
local.count = 0;
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
nphe = NPH_MAX_2K;
|
||||
} else {
|
||||
nphe = NPH_MAX;
|
||||
}
|
||||
|
||||
for (rv = 0, nph = 1; local.count < lim && nph != nphe; nph++) {
|
||||
if (FCPARAM(isp)->isp_2klogin == 0) {
|
||||
nphe = NPH_MAX;
|
||||
} else {
|
||||
nphe = NPH_MAX_2K;
|
||||
}
|
||||
if (IS_24XX(isp)) {
|
||||
nphs = 1;
|
||||
} else {
|
||||
nphs = 0;
|
||||
}
|
||||
for (count = 0, nph = nphs; count < lim && nph != nphe; nph++) {
|
||||
ISP_LOCKU_SOFTC(isp);
|
||||
rv = isp_control(isp, ISPCTL_GET_PORTNAME, chan, nph, &wwpn);
|
||||
pair.wwnn = nph;
|
||||
if (isp_control(isp, ISPCTL_GET_NODENAME, &pair.wwnn)) {
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
continue;
|
||||
}
|
||||
pair.wwpn = nph;
|
||||
if (isp_control(isp, ISPCTL_GET_PORTNAME, &pair.wwpn)) {
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
continue;
|
||||
}
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
if (rv == 0 && wwpn != (uint64_t) 0) {
|
||||
local.count++;
|
||||
if (COPYOUT(&wwpn, (void *)uptr++, sizeof (uint64_t))) {
|
||||
rv = EFAULT;
|
||||
break;
|
||||
}
|
||||
if (pair.wwnn == 0 || pair.wwpn == 0) {
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
if (COPYOUT(&pair, (void *)uptr++, sizeof (pair))) {
|
||||
rv = EFAULT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (local.count) {
|
||||
if (COPYOUT(&local.count, (void *)&ua->count, sizeof (local.count))) {
|
||||
rv = EFAULT;
|
||||
} else {
|
||||
rv = 0;
|
||||
}
|
||||
if (rv == 0) {
|
||||
if (COPYOUT(&count, (void *)&ua->count, sizeof (count))) {
|
||||
rv = EFAULT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -847,7 +792,7 @@ isp_ioctl(struct inode *ip, struct file *fp, unsigned int c, unsigned long arg)
|
||||
static int isp_exti_query(EXT_IOCTL *);
|
||||
static int isp_exti_setinstance(EXT_IOCTL *);
|
||||
static int isp_exti_fcct_passthru(EXT_IOCTL *);
|
||||
static int isp_exti_discover_luns(ispsoftc_t *, int, UINT64, UINT64, UINT16 *);
|
||||
static int isp_exti_discover_luns(ispsoftc_t *, UINT64, UINT64, UINT16 *);
|
||||
static void *isp_exti_usrptr(UINT64, UINT16);
|
||||
static int isp_exti_passthru(EXT_IOCTL *);
|
||||
static int isp_run_cmd(ispsoftc_t *, isp_xcmd_t *);
|
||||
@@ -969,7 +914,6 @@ isp_exti_setinstance(EXT_IOCTL *ext)
|
||||
}
|
||||
api_isp = isplist[index];
|
||||
ext->HbaSelect = api_isp->isp_unit;
|
||||
api_channel = 0; /* XXXXXXXXXXXXXXXXXXXXXXX */
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -988,9 +932,9 @@ isp_exti_query(EXT_IOCTL *pext)
|
||||
return (0);
|
||||
}
|
||||
ISP_LOCKU_SOFTC(isp);
|
||||
fcp = FCPARAM(isp, api_channel);
|
||||
fcp = FCPARAM(isp);
|
||||
if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate < LOOP_LSCAN_DONE) {
|
||||
if (isp_fc_runstate(isp, api_channel, 1000000) < 0) {
|
||||
if (isp_fc_runstate(isp, 1000000) < 0) {
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
pext->Status = EXT_STATUS_PENDING;
|
||||
return (0);
|
||||
@@ -1071,9 +1015,9 @@ isp_exti_query(EXT_IOCTL *pext)
|
||||
hbp.PortActiveFC4Types = EXT_DEF_FC4_TYPE_SCSI;
|
||||
hbp.PortSupportedSpeed = EXT_DEF_PORTSPEED_1GBIT;
|
||||
if (IS_23XX(isp)) {
|
||||
hbp.PortSupportedSpeed |= EXT_DEF_PORTSPEED_2GBIT;
|
||||
hbp.PortSupportedSpeed = EXT_DEF_PORTSPEED_2GBIT;
|
||||
} else if (IS_24XX(isp)) {
|
||||
hbp.PortSupportedSpeed |= EXT_DEF_PORTSPEED_2GBIT|EXT_DEF_PORTSPEED_4GBIT;
|
||||
hbp.PortSupportedSpeed = EXT_DEF_PORTSPEED_4GBIT;
|
||||
}
|
||||
cl = min(pext->ResponseLen, sizeof (hbp));
|
||||
if (COPYOUT(&hbp, outaddr, cl)) {
|
||||
@@ -1197,7 +1141,7 @@ isp_exti_query(EXT_IOCTL *pext)
|
||||
wwpn = rlp->port_wwn;
|
||||
wwnn = rlp->node_wwn;
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
rval = isp_exti_discover_luns(isp, api_channel, wwpn, wwnn, &tgt.LunCount);
|
||||
rval = isp_exti_discover_luns(isp, wwpn, wwnn, &tgt.LunCount);
|
||||
if (rval) {
|
||||
break;
|
||||
}
|
||||
@@ -1221,9 +1165,7 @@ isp_exti_query(EXT_IOCTL *pext)
|
||||
xc.PciBusNumber = pdev->bus->number;
|
||||
xc.PciDevFunc = pdev->devfn;
|
||||
xc.PciSlotNumber = PCI_SLOT(pdev->devfn);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
||||
xc.DomainNr = pci_domain_nr(pdev->bus);
|
||||
#endif
|
||||
xc.InterruptLevel = pdev->irq;
|
||||
cl = min(pext->ResponseLen, sizeof (xc));
|
||||
if (COPYOUT(&xc, outaddr, cl)) {
|
||||
@@ -1243,16 +1185,16 @@ isp_exti_query(EXT_IOCTL *pext)
|
||||
|
||||
|
||||
#define IGPOFF 0 /* place CT Request itself is put */
|
||||
#define OGPOFF (ISP_FC_SCRLEN >> 1) /* place CT Response itself is put */
|
||||
#define ZTXOFF (ISP_FC_SCRLEN - (1 * QENTRY_LEN)) /* place where status entry for CT passthru request ends up */
|
||||
#define CTXOFF (ISP_FC_SCRLEN - (2 * QENTRY_LEN)) /* place where CT passthru request is put */
|
||||
#define OGPOFF (ISP2100_SCRLEN >> 1) /* place CT Response itself is put */
|
||||
#define ZTXOFF (ISP2100_SCRLEN - (1 * QENTRY_LEN)) /* place where status entry for CT passthru request ends up */
|
||||
#define CTXOFF (ISP2100_SCRLEN - (2 * QENTRY_LEN)) /* place where CT passthru request is put */
|
||||
|
||||
static int
|
||||
isp_exti_fcct_passthru(EXT_IOCTL *pext)
|
||||
{
|
||||
ispsoftc_t *isp = api_isp;
|
||||
isp_plcmd_t p;
|
||||
fcparam *fcp = FCPARAM(isp, 0);
|
||||
fcparam *fcp = FCPARAM(isp);
|
||||
mbreg_t mbs;
|
||||
uint8_t qe[QENTRY_LEN], *scp;
|
||||
uint16_t handle;
|
||||
@@ -1267,11 +1209,11 @@ isp_exti_fcct_passthru(EXT_IOCTL *pext)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (pext->RequestLen > (ISP_FC_SCRLEN >> 1)) {
|
||||
if (pext->RequestLen > (ISP2100_SCRLEN >> 1)) {
|
||||
pext->Status = EXT_STATUS_NO_MEMORY;
|
||||
return (0);
|
||||
}
|
||||
if (pext->ResponseLen > ((ISP_FC_SCRLEN >> 1) - (2 * QENTRY_LEN))) {
|
||||
if (pext->ResponseLen > ((ISP2100_SCRLEN >> 1) - (2 * QENTRY_LEN))) {
|
||||
pext->Status = EXT_STATUS_NO_MEMORY;
|
||||
return (0);
|
||||
}
|
||||
@@ -1305,7 +1247,6 @@ isp_exti_fcct_passthru(EXT_IOCTL *pext)
|
||||
/*
|
||||
* Login into the Management Server
|
||||
*/
|
||||
p.channel = api_channel;
|
||||
p.handle = NIL_HANDLE;
|
||||
p.portid = MANAGEMENT_PORT_ID;
|
||||
p.flags = PLOGX_FLG_CMD_PLOGI;
|
||||
@@ -1322,7 +1263,7 @@ isp_exti_fcct_passthru(EXT_IOCTL *pext)
|
||||
* Acquire Scratch
|
||||
*/
|
||||
MEMZERO(qe, QENTRY_LEN);
|
||||
FC_SCRATCH_ACQUIRE(isp, 0);
|
||||
FC_SCRATCH_ACQUIRE(isp);
|
||||
scp = fcp->isp_scratch;
|
||||
|
||||
MEMCPY(&scp[IGPOFF], localmem, pext->RequestLen);
|
||||
@@ -1387,7 +1328,7 @@ isp_exti_fcct_passthru(EXT_IOCTL *pext)
|
||||
ms->ms_header.rqs_entry_count = 1;
|
||||
ms->ms_header.rqs_entry_type = RQSTYPE_MS_PASSTHRU;
|
||||
ms->ms_handle = 0xffffffff;
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
ms->ms_nphdl = handle;
|
||||
} else {
|
||||
ms->ms_nphdl = handle << 8;
|
||||
@@ -1435,12 +1376,11 @@ out1:
|
||||
/*
|
||||
* Release Scratch
|
||||
*/
|
||||
FC_SCRATCH_RELEASE(isp, 0);
|
||||
FC_SCRATCH_RELEASE(isp);
|
||||
|
||||
/*
|
||||
* Log out of the Management Server
|
||||
*/
|
||||
p.channel = api_channel;
|
||||
p.handle = handle;
|
||||
p.portid = MANAGEMENT_PORT_ID;
|
||||
p.flags = PLOGX_FLG_CMD_LOGO|PLOGX_FLG_EXPLICIT_LOGO;
|
||||
@@ -1561,7 +1501,7 @@ isp_exti_passthru(EXT_IOCTL *pext)
|
||||
* so we know how to send the command.
|
||||
*/
|
||||
ISP_LOCKU_SOFTC(isp);
|
||||
for (lp = &FCPARAM(isp, 0)->portdb[0]; lp < &FCPARAM(isp, 0)->portdb[MAX_FC_TARG]; lp++) {
|
||||
for (lp = &FCPARAM(isp)->portdb[0]; lp < &FCPARAM(isp)->portdb[MAX_FC_TARG]; lp++) {
|
||||
if (lp->state != FC_PORTDB_STATE_VALID) {
|
||||
continue;
|
||||
}
|
||||
@@ -1579,7 +1519,7 @@ isp_exti_passthru(EXT_IOCTL *pext)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lp == &FCPARAM(isp, 0)->portdb[MAX_FC_TARG]) {
|
||||
if (lp == &FCPARAM(isp)->portdb[MAX_FC_TARG]) {
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
pext->Status = EXT_STATUS_DEV_NOT_FOUND;
|
||||
if (bufp) {
|
||||
@@ -1591,7 +1531,6 @@ isp_exti_passthru(EXT_IOCTL *pext)
|
||||
wwpn = lp->port_wwn;
|
||||
cmd.handle = lp->handle;
|
||||
cmd.portid = lp->portid;
|
||||
cmd.channel = api_channel;
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
|
||||
MEMCPY(cmd.fcd.beg.cdb, fcx.Cdb, min(EXT_DEF_SCSI_PASSTHRU_CDB_LENGTH, sizeof (cmd.fcd.beg.cdb)));
|
||||
@@ -1633,18 +1572,17 @@ isp_exti_passthru(EXT_IOCTL *pext)
|
||||
#define RPT_LUN_SIZE 1024
|
||||
|
||||
static int
|
||||
isp_exti_discover_luns(ispsoftc_t *isp, int chan, UINT64 wwpn, UINT64 wwnn, UINT16 *nluns)
|
||||
isp_exti_discover_luns(ispsoftc_t *isp, UINT64 wwpn, UINT64 wwnn, UINT16 *nluns)
|
||||
{
|
||||
isp_xcmd_t cmd;
|
||||
int status, nent, i, hilun;
|
||||
unsigned long flags;
|
||||
fcparam *fcp = FCPARAM(isp, chan);
|
||||
fcportdb_t *lp;
|
||||
uint8_t *bufp;
|
||||
|
||||
MEMZERO(&cmd, sizeof (isp_xcmd_t));
|
||||
ISP_LOCKU_SOFTC(isp);
|
||||
for (lp = &fcp->portdb[0]; lp < &fcp->portdb[MAX_FC_TARG]; lp++) {
|
||||
for (lp = &FCPARAM(isp)->portdb[0]; lp < &FCPARAM(isp)->portdb[MAX_FC_TARG]; lp++) {
|
||||
if (lp->state != FC_PORTDB_STATE_VALID) {
|
||||
continue;
|
||||
}
|
||||
@@ -1652,7 +1590,7 @@ isp_exti_discover_luns(ispsoftc_t *isp, int chan, UINT64 wwpn, UINT64 wwnn, UINT
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lp == &fcp->portdb[MAX_FC_TARG]) {
|
||||
if (lp == &FCPARAM(isp)->portdb[MAX_FC_TARG]) {
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
return (-ENODEV);
|
||||
}
|
||||
@@ -1716,9 +1654,7 @@ isp_run_cmd_done(struct scsi_cmnd *Cmnd)
|
||||
static int
|
||||
isp_run_cmd(ispsoftc_t *isp, isp_xcmd_t *cmd)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
||||
struct scsi_device *dev = NULL;
|
||||
#endif
|
||||
Scsi_Cmnd *Cmnd = NULL;
|
||||
struct Scsi_Host *host = NULL;
|
||||
uint32_t nxti, optr, handle;
|
||||
@@ -1742,7 +1678,6 @@ isp_run_cmd(ispsoftc_t *isp, isp_xcmd_t *cmd)
|
||||
goto out;
|
||||
}
|
||||
host = isp->isp_osinfo.host;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
||||
dev = isp_kzalloc(sizeof (struct scsi_device), GFP_KERNEL);
|
||||
if (dev == NULL) {
|
||||
result = -ENOMEM;
|
||||
@@ -1750,9 +1685,6 @@ isp_run_cmd(ispsoftc_t *isp, isp_xcmd_t *cmd)
|
||||
}
|
||||
Cmnd->device = dev;
|
||||
dev->host = host;
|
||||
#else
|
||||
Cmnd->host = host;
|
||||
#endif
|
||||
Cmnd->scsi_done = isp_run_cmd_done;
|
||||
Cmnd->request_buffer = &rsem;
|
||||
|
||||
@@ -1799,10 +1731,10 @@ isp_run_cmd(ispsoftc_t *isp, isp_xcmd_t *cmd)
|
||||
reqp->req_header.rqs_entry_type = RQSTYPE_T2RQS;
|
||||
t2->req_flags = REQFLAG_STAG;
|
||||
|
||||
if (ISP_CAP_2KLOGIN(isp)) {
|
||||
if (FCPARAM(isp)->isp_2klogin) {
|
||||
((ispreqt2e_t *)reqp)->req_target = cmd->handle;
|
||||
((ispreqt2e_t *)reqp)->req_scclun = cmd->lun;
|
||||
} else if (ISP_CAP_SCCFW(isp)) {
|
||||
} else if (FCPARAM(isp)->isp_sccfw) {
|
||||
t2->req_target = cmd->handle;
|
||||
t2->req_scclun = cmd->lun;
|
||||
} else {
|
||||
@@ -1869,11 +1801,9 @@ isp_run_cmd(ispsoftc_t *isp, isp_xcmd_t *cmd)
|
||||
isp_destroy_handle(isp, handle);
|
||||
ISP_UNLKU_SOFTC(isp);
|
||||
out:
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
||||
if (dev) {
|
||||
isp_kfree(dev, sizeof (struct scsi_device));
|
||||
}
|
||||
#endif
|
||||
isp_kfree(Cmnd, sizeof (Scsi_Cmnd));
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_ioctl.h,v 1.18 2007/05/31 18:35:28 mjacob Exp $ */
|
||||
/* $Id: isp_ioctl.h,v 1.23 2007/07/19 01:58:40 mjacob Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -171,7 +170,7 @@ struct isp_hba_device {
|
||||
uint8_t fc_fw_major;
|
||||
uint8_t fc_fw_minor;
|
||||
uint8_t fc_fw_micro;
|
||||
uint8_t fc_nchannels;
|
||||
uint8_t reserved;
|
||||
uint64_t nvram_node_wwn;
|
||||
uint64_t nvram_port_wwn;
|
||||
uint64_t active_node_wwn;
|
||||
@@ -216,13 +215,16 @@ struct isp_fc_tsk_mgmt {
|
||||
/*
|
||||
* Just gimme a list of WWPNs that are logged into us.
|
||||
*/
|
||||
#define ISP_DL_MAX 256
|
||||
typedef struct {
|
||||
uint16_t count;
|
||||
uint16_t channel;
|
||||
uint64_t wwpns[1];
|
||||
uint16_t reserved;
|
||||
struct wwnpair {
|
||||
uint64_t wwnn;
|
||||
uint64_t wwpn;
|
||||
} wwns[1];
|
||||
} isp_dlist_t;
|
||||
#define ISP_FC_GETDLIST (ISP_IOC | 22)
|
||||
/* don't recycle 22 */
|
||||
#define ISP_FC_GETDLIST (ISP_IOC | 23)
|
||||
/*
|
||||
* vim:ts=4:sw=4:expandtab
|
||||
*/
|
||||
|
||||
+342
-692
File diff suppressed because it is too large
Load Diff
+70
-93
@@ -1,4 +1,4 @@
|
||||
/* $Id: isp_linux.h,v 1.124 2007/06/01 17:19:34 mjacob Exp $ */
|
||||
/* $Id: isp_linux.h,v 1.138 2007/10/11 22:08:07 mjacob Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -72,11 +71,8 @@
|
||||
#define KERNEL_VERSION(v,p,s) (((v)<<16)+(p<<8)+s)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
|
||||
#error "Only Linux 2.4 and 2.6 kernels are supported with this driver"
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
|
||||
#error "Only Linux 2.4 and 2.6 kernels are supported with this driver"
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
|
||||
#error "Only Linux 2.6 kernels are supported with this driver"
|
||||
#endif
|
||||
|
||||
#ifndef UNUSED_PARAMETER
|
||||
@@ -92,9 +88,6 @@
|
||||
#include <linux/autoconf.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
#include <linux/blk.h>
|
||||
#endif
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/ioport.h>
|
||||
@@ -112,20 +105,36 @@
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/interrupt.h>
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
#include "scsi.h"
|
||||
#include "hosts.h"
|
||||
#else
|
||||
#include <scsi/scsi.h>
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
#include <scsi/scsi_host.h>
|
||||
#include <scsi/scsi_tcq.h>
|
||||
#include <scsi/scsi_device.h>
|
||||
|
||||
#include <linux/cdev.h>
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
|
||||
#include <linux/devfs_fs_kernel.h>
|
||||
#define ISP_CLASS struct class_simple
|
||||
#define CREATE_ISP_CLASS class_simple_create
|
||||
#define DESTROY_ISP_CLASS class_simple_destroy
|
||||
#define CREATE_ISP_DEV(isp) \
|
||||
class_simple_device_add(isp_class, MKDEV(MAJOR(isp_dev), isp->isp_unit), NULL, "%s%d", ISP_NAME, isp->isp_unit), \
|
||||
devfs_mk_cdev(MKDEV(MAJOR(isp_dev), isp->isp_unit), S_IFCHR | S_IRUGO | S_IWUGO, "%s%d", ISP_NAME, isp->isp_unit)
|
||||
#define DESTROY_ISP_DEV(isp) \
|
||||
devfs_remove("%s%d", ISP_NAME, isp->isp_unit), class_simple_device_remove(MKDEV(MAJOR(isp_dev), isp->isp_unit))
|
||||
#else
|
||||
#define ISP_CLASS struct class
|
||||
#define CREATE_ISP_CLASS class_create
|
||||
#define DESTROY_ISP_CLASS class_destroy
|
||||
#define CREATE_ISP_DEV(isp) \
|
||||
class_device_create(isp_class, NULL, MKDEV(MAJOR(isp_dev), isp->isp_unit), NULL, "%s%d", ISP_NAME, isp->isp_unit)
|
||||
#define DESTROY_ISP_DEV(isp) \
|
||||
class_device_destroy(isp_class, MKDEV(MAJOR(isp_dev), (isp)->isp_unit));
|
||||
#endif
|
||||
|
||||
typedef struct scsi_cmnd Scsi_Cmnd;
|
||||
typedef struct scsi_request Scsi_Request;
|
||||
typedef struct scsi_host_template Scsi_Host_Template;
|
||||
#endif
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#include <linux/proc_fs.h>
|
||||
#endif
|
||||
@@ -153,6 +162,10 @@ typedef struct scsi_host_template Scsi_Host_Template;
|
||||
#define ISP_SBUS_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
#ifndef ISP_NAME
|
||||
#define ISP_NAME "isp"
|
||||
#endif
|
||||
|
||||
#define ISP_PLATFORM_VERSION_MAJOR 5
|
||||
#define ISP_PLATFORM_VERSION_MINOR 0
|
||||
|
||||
@@ -174,13 +187,8 @@ typedef struct scsi_host_template Scsi_Host_Template;
|
||||
#define __WORDSIZE BITS_PER_LONG
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,16)
|
||||
#define DMA_HTYPE_T char *
|
||||
#define QLA_HANDLE(cmd) (cmd)->SCp.ptr
|
||||
#else
|
||||
#define DMA_HTYPE_T dma_addr_t
|
||||
#define QLA_HANDLE(cmd) (cmd)->SCp.dma_handle
|
||||
#endif
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
@@ -208,15 +216,6 @@ typedef struct scsi_host_template Scsi_Host_Template;
|
||||
#define u_char unsigned char
|
||||
typedef u_long vm_offset_t;
|
||||
|
||||
/* bit map using 8 bit arrays */
|
||||
typedef uint8_t isp_bmap_t;
|
||||
#define _ISP_WIX(isp, ix) (ix >> 3)
|
||||
#define _ISP_BIX(isp, ix) (1 << (ix & 0x7))
|
||||
#define ISP_NBPIDX(x) ((x) >> 8) /* number of bits per index */
|
||||
#define ISP_BTST(map, ix) (((map)[_ISP_WIX(isp, ix)] & _ISP_BIX(isp, ix)) != 0)
|
||||
#define ISP_BSET(map, ix) (map)[_ISP_WIX(isp, ix)] |= _ISP_BIX(isp, ix)
|
||||
#define ISP_BCLR(map, ix) (map)[_ISP_WIX(isp, ix)] &= ~_ISP_BIX(isp, ix)
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
|
||||
#ifndef DEFAULT_DEVICE_TYPE
|
||||
@@ -226,6 +225,12 @@ typedef uint8_t isp_bmap_t;
|
||||
#define N_NOTIFIES 256
|
||||
#define DEFAULT_INQSIZE 32
|
||||
|
||||
#define _WIX(isp, b, ix) (((b << 6)) | (ix >> 5))
|
||||
#define _BIX(isp, ix) (1 << (ix & 0x1f))
|
||||
|
||||
#define LUN_BTST(isp, b, ix) (((isp)->isp_osinfo.lunbmap[_WIX(isp, b, ix)] & _BIX(isp, ix)) != 0)
|
||||
#define LUN_BSET(isp, b, ix) isp->isp_osinfo.lunbmap[_WIX(isp, b, ix)] |= _BIX(isp, ix)
|
||||
#define LUN_BCLR(isp, b, ix) isp->isp_osinfo.lunbmap[_WIX(isp, b, ix)] &= ~_BIX(isp, ix)
|
||||
|
||||
typedef struct isp_notify isp_notify_t;
|
||||
|
||||
@@ -274,7 +279,6 @@ struct isposinfo {
|
||||
#endif
|
||||
char hbaname[16];
|
||||
long bins[8];
|
||||
u16 instance;
|
||||
u16 wqcnt;
|
||||
u16 wqhiwater;
|
||||
u16 hiwater;
|
||||
@@ -293,14 +297,13 @@ struct isposinfo {
|
||||
_deadloop : 1,
|
||||
_draining : 1,
|
||||
_blocked : 1,
|
||||
: 1,
|
||||
_fcrswdog : 1,
|
||||
_fcrspend : 1,
|
||||
_dogactive : 1,
|
||||
_mboxcmd_done : 1,
|
||||
_mbox_waiting : 1,
|
||||
_mbintsok : 1,
|
||||
_intsok : 1;
|
||||
isp_bmap_t _fcrswdog[ISP_NBPIDX(256)];
|
||||
void * misc[8]; /* private platform variant usage */
|
||||
struct task_struct * task_thread;
|
||||
struct semaphore * task_request;
|
||||
@@ -313,20 +316,28 @@ struct isposinfo {
|
||||
#define TM_WANTED 0x08
|
||||
#define TM_BUSY 0x04
|
||||
#define TM_TMODE_ENABLED 0x03
|
||||
uint32_t : 16,
|
||||
uint32_t rollinfo : 16,
|
||||
rstatus : 8,
|
||||
: 1,
|
||||
isget : 1,
|
||||
: 1,
|
||||
wildcarded : 1,
|
||||
hcb : 1,
|
||||
tmflags : 4;
|
||||
struct semaphore tgt_inisem;
|
||||
struct semaphore * rsemap;
|
||||
#define TM_MAX_BUS_FC 256
|
||||
#define TM_MAX_BUS_SPI 2
|
||||
#define TM_MAX_LUN_SPI 8
|
||||
isp_bmap_t benabled[ISP_NBPIDX(TM_MAX_BUS_FC)];
|
||||
isp_bmap_t spi_lun_enabled[TM_MAX_BUS_SPI][ISP_NBPIDX(TM_MAX_LUN_SPI)];
|
||||
/*
|
||||
* This is very inefficient, but is in fact big enough
|
||||
* to cover a complete bitmap for Fibre Channel, as well
|
||||
* as the dual bus SCSI cards. This works out without
|
||||
* overflow easily because the most you can enable
|
||||
* for the SCSI cards is 64 luns (x 2 busses).
|
||||
*
|
||||
* For Fibre Channel, we can run the max luns up to 16384
|
||||
* but we'll default to the minimum we can support here.
|
||||
*/
|
||||
#define TM_MAX_LUN_FC 64
|
||||
#define TM_MAX_LUN_SCSI 64
|
||||
uint32_t lunbmap[TM_MAX_LUN_FC >> 5];
|
||||
struct tmd_cmd * pending_t; /* pending list of commands going upstream */
|
||||
struct tmd_cmd * tfreelist; /* freelist head */
|
||||
struct tmd_cmd * bfreelist; /* freelist tail */
|
||||
@@ -418,23 +429,12 @@ if (isp->isp_osinfo.task_request) { \
|
||||
#define ISP_LOCKU_SOFTC ISP_ILOCK_SOFTC
|
||||
#define ISP_UNLKU_SOFTC ISP_IUNLK_SOFTC
|
||||
#define ISP_TLOCK_INIT(isp) spin_lock_init(&isp->isp_osinfo.tlock)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
#define ISP_DRIVER_ENTRY_LOCK(isp) spin_unlock_irq(&io_request_lock)
|
||||
#define ISP_DRIVER_EXIT_LOCK(isp) spin_lock_irq(&io_request_lock)
|
||||
#define ISP_DRIVER_CTL_ENTRY_LOCK ISP_DRIVER_ENTRY_LOCK
|
||||
#define ISP_DRIVER_CTL_EXIT_LOCK ISP_DRIVER_EXIT_LOCK
|
||||
#else
|
||||
#define ISP_DRIVER_ENTRY_LOCK(isp) spin_unlock_irq(isp->isp_osinfo.host->host_lock)
|
||||
#define ISP_DRIVER_EXIT_LOCK(isp) spin_lock_irq(isp->isp_osinfo.host->host_lock)
|
||||
#define ISP_DRIVER_CTL_ENTRY_LOCK(isp) do { } while (0)
|
||||
#define ISP_DRIVER_CTL_EXIT_LOCK(isp) do { } while (0)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
#define ISP_ATOMIC in_interrupt
|
||||
#else
|
||||
#define ISP_ATOMIC in_atomic
|
||||
#endif
|
||||
|
||||
#define ISP_MUST_POLL(isp) (ISP_ATOMIC() || isp->mbintsok == 0)
|
||||
|
||||
@@ -442,13 +442,11 @@ if (isp->isp_osinfo.task_request) { \
|
||||
* Required Macros/Defines
|
||||
*/
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,18)
|
||||
#if defined(CONFIG_HIGHMEM64G) || defined(CONFIG_X86_64)
|
||||
#define ISP_DAC_SUPPORTED 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ISP_FC_SCRLEN 0x1000
|
||||
#define ISP2100_SCRLEN 0x1000
|
||||
|
||||
#define MEMZERO(b, a) memset(b, 0, a)
|
||||
#define MEMCPY memcpy
|
||||
@@ -462,11 +460,7 @@ if (isp->isp_osinfo.task_request) { \
|
||||
|
||||
#define NANOTIME_T struct timeval
|
||||
/* for prior to 2.2.19, use do_gettimeofday, and, well, it'll be inaccurate */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
|
||||
#define GET_NANOTIME(ptr) (ptr)->tv_sec = 0, (ptr)->tv_usec = 0, get_fast_time(ptr)
|
||||
#else
|
||||
#define GET_NANOTIME(ptr) (ptr)->tv_sec = 0, (ptr)->tv_usec = 0, do_gettimeofday(ptr)
|
||||
#endif
|
||||
#define GET_NANOSEC(x) ((uint64_t) ((((uint64_t)(x)->tv_sec) * 1000000 + (x)->tv_usec)))
|
||||
#define NANOTIME_SUB _isp_microtime_sub
|
||||
|
||||
@@ -492,7 +486,7 @@ if (isp->isp_osinfo.task_request) { \
|
||||
isp->mboxcmd_done = 1
|
||||
#define MBOX_RELEASE(isp) up(&isp->mbox_sem)
|
||||
|
||||
#define FC_SCRATCH_ACQUIRE(isp, chan) \
|
||||
#define FC_SCRATCH_ACQUIRE(isp) \
|
||||
/* \
|
||||
* Try and acquire semaphore the easy way first- \
|
||||
* with our lock already held. \
|
||||
@@ -509,7 +503,7 @@ if (isp->isp_osinfo.task_request) { \
|
||||
ISP_IGET_LK_SOFTC(isp); \
|
||||
}
|
||||
|
||||
#define FC_SCRATCH_RELEASE(isp, chan) up(&isp->fcs_sem)
|
||||
#define FC_SCRATCH_RELEASE(isp) up(&isp->fcs_sem)
|
||||
|
||||
|
||||
#ifndef SCSI_GOOD
|
||||
@@ -532,12 +526,6 @@ if (isp->isp_osinfo.task_request) { \
|
||||
#define XS_T Scsi_Cmnd
|
||||
#define XS_DMA_ADDR_T dma_addr_t
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
#define XS_HOST(Cmnd) Cmnd->host
|
||||
#define XS_CHANNEL(Cmnd) (Cmnd)->channel
|
||||
#define XS_TGT(Cmnd) (Cmnd)->target
|
||||
#define XS_LUN(Cmnd) (Cmnd)->lun
|
||||
#else
|
||||
#define XS_HOST(Cmnd) Cmnd->device->host
|
||||
#define XS_CHANNEL(Cmnd) (Cmnd)->device->channel
|
||||
#define XS_TGT(Cmnd) (Cmnd)->device->id
|
||||
@@ -548,7 +536,6 @@ if (isp->isp_osinfo.task_request) { \
|
||||
#define SCSI_DATA_WRITE DMA_TO_DEVICE
|
||||
#define scsi_to_pci_dma_dir(x) x
|
||||
|
||||
#endif
|
||||
#define XS_ISP(Cmnd) ((ispsoftc_t *)XS_HOST(Cmnd)->hostdata)
|
||||
#define XS_CDBP(Cmnd) (Cmnd)->cmnd
|
||||
#define XS_CDBLEN(Cmnd) (Cmnd)->cmd_len
|
||||
@@ -607,7 +594,7 @@ if (isp->isp_osinfo.task_request) { \
|
||||
#define ISP_IOXGET_16(isp, s, d) d = le16_to_cpu(*((uint16_t *)s))
|
||||
#define ISP_IOXGET_32(isp, s, d) d = le32_to_cpu(*((uint32_t *)s))
|
||||
|
||||
#if BYTE_ORDER ==BIG_ENDIAN
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define ISP_IOX_8X2(isp, sptr, dptr, tag1, tag2) \
|
||||
dptr ## -> ## tag1 = sptr ## -> ## tag2; \
|
||||
dptr ## -> ## tag2 = sptr ## -> ## tag1
|
||||
@@ -631,6 +618,10 @@ if (isp->isp_osinfo.task_request) { \
|
||||
#define ISP_IOZGET_32(isp, s, d) d = be32_to_cpu(*((uint32_t *)s))
|
||||
|
||||
#define ISP_SWIZZLE_NVRAM_WORD(isp, rp) *rp = le16_to_cpu(*rp)
|
||||
#define ISP_SWIZZLE_NVRAM_LONG(isp, rp) *rp = le32_to_cpu(*rp)
|
||||
|
||||
#define ISP_SWAP16(isp, x) swab16(x)
|
||||
#define ISP_SWAP32(isp, x) swab32(x)
|
||||
|
||||
|
||||
/*
|
||||
@@ -672,7 +663,7 @@ union pstore {
|
||||
};
|
||||
#define isp_name isp_osinfo.hbaname
|
||||
#define isp_host isp_osinfo.host
|
||||
#define isp_unit isp_osinfo.instance
|
||||
#define isp_unit isp_osinfo.host->unique_id
|
||||
#define isp_psco isp_osinfo.storep->parallel_scsi.psc_opts
|
||||
#define isp_dutydone isp_osinfo.storep->parallel_scsi.dutydone
|
||||
#define isp_defwwnn isp_osinfo.storep->fibre_scsi.def_wwnn
|
||||
@@ -685,9 +676,7 @@ union pstore {
|
||||
*/
|
||||
void isplinux_timer(unsigned long);
|
||||
void isplinux_mbtimer(unsigned long);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
void isplinux_intr(int, void *, struct pt_regs *);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
|
||||
irqreturn_t isplinux_intr(int, void *, struct pt_regs *);
|
||||
#else
|
||||
irqreturn_t isplinux_intr(int, void *);
|
||||
@@ -711,29 +700,12 @@ static __inline int isplinux_tagtype(Scsi_Cmnd *);
|
||||
static __inline int mbox_acquire(ispsoftc_t *);
|
||||
static __inline void mbox_wait_complete(ispsoftc_t *, mbreg_t *);
|
||||
|
||||
|
||||
|
||||
int isplinux_proc_info(char *, char **, off_t, int, int, int);
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
||||
int isplinux_proc_info_26(struct Scsi_Host *, char *, char **, off_t, int, int);
|
||||
#endif
|
||||
int isplinux_detect(Scsi_Host_Template *);
|
||||
#ifdef MODULE
|
||||
int isplinux_release(struct Scsi_Host *);
|
||||
#define ISPLINUX_RELEASE isplinux_release
|
||||
#else
|
||||
#define ISPLINUX_RELEASE NULL
|
||||
#endif
|
||||
int isplinux_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
|
||||
const char *isplinux_info(struct Scsi_Host *);
|
||||
int isplinux_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
int isplinux_biosparam(Disk *, kdev_t, int[]);
|
||||
#else
|
||||
int isplinux_biosparam(struct scsi_device *, struct block_device *, sector_t, int[]);
|
||||
#endif
|
||||
int isplinux_default_id(ispsoftc_t *);
|
||||
|
||||
|
||||
/*
|
||||
* Driver wide data...
|
||||
*/
|
||||
@@ -743,7 +715,13 @@ extern int isp_disable;
|
||||
extern int isp_nofwreload;
|
||||
extern int isp_nonvram;
|
||||
extern int isp_fcduplex;
|
||||
extern int isp_maxsectors;
|
||||
extern struct scsi_host_template *isp_template;
|
||||
extern const char *class3_roles[4];
|
||||
extern dev_t isp_dev;
|
||||
extern struct cdev isp_cdev;
|
||||
extern struct file_operations isp_ioctl_operations;
|
||||
extern ISP_CLASS *isp_class;
|
||||
|
||||
/*
|
||||
* This used to be considered bad form, but locking crasp made it more attractive.
|
||||
@@ -751,7 +729,6 @@ extern const char *class3_roles[4];
|
||||
#define MAX_ISP 32
|
||||
extern ispsoftc_t *isplist[MAX_ISP];
|
||||
extern ispsoftc_t *api_isp;
|
||||
extern int api_channel;
|
||||
|
||||
/*
|
||||
* Platform private flags
|
||||
@@ -1007,7 +984,7 @@ isp_kzalloc(size_t size, int flags)
|
||||
|
||||
int isp_init_target(ispsoftc_t *);
|
||||
void isp_attach_target(ispsoftc_t *);
|
||||
void isp_deini_target(ispsoftc_t *);
|
||||
void isp_deinit_target(ispsoftc_t *);
|
||||
void isp_detach_target(ispsoftc_t *);
|
||||
int isp_target_async(ispsoftc_t *, int, int);
|
||||
int isp_target_notify(ispsoftc_t *, void *, uint32_t *);
|
||||
|
||||
+333
-576
File diff suppressed because it is too large
Load Diff
@@ -867,7 +867,7 @@ scsi_target_notify(tmd_notify_t *np)
|
||||
}
|
||||
ini = ini_from_notify(bp, np);
|
||||
spin_unlock_irqrestore(&scsi_target_lock, flags);
|
||||
SDprintk("scsi_target: MGT code %x from %s%d\n", np->nt_ncode, bp->h.r_name, bp->h.r_inst);
|
||||
SDprintk("scsi_target: MGT code %x from %s%d iid 0x%016llx\n", np->nt_ncode, bp->h.r_name, bp->h.r_inst, np->nt_iid);
|
||||
|
||||
switch (np->nt_ncode) {
|
||||
case NT_ABORT_TASK:
|
||||
|
||||
+12
-133
@@ -1,4 +1,4 @@
|
||||
/* $Id: scsi_target.c,v 1.62 2007/06/12 22:05:59 mjacob Exp $ */
|
||||
/* $Id: scsi_target.c,v 1.67 2007/08/27 07:25:52 mjacob Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -76,9 +75,6 @@
|
||||
#include <linux/autoconf.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
#include <linux/blk.h>
|
||||
#endif
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/ioport.h>
|
||||
@@ -111,7 +107,7 @@
|
||||
|
||||
#define DEFAULT_DEVICE_TYPE 0 /* DISK */
|
||||
#define MAX_BUS 8
|
||||
#define MAX_LUN 512
|
||||
#define MAX_LUN 64
|
||||
#define N_SENSE_BUFS 256
|
||||
|
||||
#define cd_dp cd_hreserved[0].ptrs[0]
|
||||
@@ -153,9 +149,6 @@
|
||||
#ifndef WRITE_16
|
||||
#define WRITE_16 0x8a
|
||||
#endif
|
||||
#ifndef REPORT_LUNS
|
||||
#define REPORT_LUNS 0xa0
|
||||
#endif
|
||||
|
||||
#define MODE_ALL_PAGES 0x3f
|
||||
#define MODE_VU_PAGE 0x00
|
||||
@@ -185,7 +178,7 @@
|
||||
/*
|
||||
* Size to allocate both a scatterlist + payload for small allocations
|
||||
*/
|
||||
#define SGS_SIZE 1024
|
||||
#define SGS_SIZE 512
|
||||
#define SGS0 (roundup(sizeof (struct scatterlist), sizeof (void *)))
|
||||
#define SGS_PAYLOAD_SIZE (SGS_SIZE - SGS0)
|
||||
#define SGS_SGP(x) ((struct scatterlist *)&((u8 *)(x))[SGS_PAYLOAD_SIZE])
|
||||
@@ -238,12 +231,8 @@ init_sg_elem(struct scatterlist *sgp, struct page *p, int offset, void *addr, si
|
||||
sgp->page = p;
|
||||
sgp->offset = offset;
|
||||
} else {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
sgp->address = addr;
|
||||
#else
|
||||
sgp->page = virt_to_page(addr);
|
||||
sgp->offset = offset_in_page(addr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,13 +288,8 @@ static struct scatterlist *sg_cache = NULL;
|
||||
* An overcommit disk is a cache of a fixed size.
|
||||
*/
|
||||
#define OC_SIZE (64 << 20)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
#define NextPage(pp) (pp)->next_hash
|
||||
#define NextPageType struct page *
|
||||
#else
|
||||
#define NextPage(pp) pp->private
|
||||
#define NextPageType unsigned long
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
struct page *** pagelists;
|
||||
@@ -407,10 +391,7 @@ static uint8_t ua[TMD_SENSELEN] = {
|
||||
0xf0, 0, 0x6, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0x29, 0x1
|
||||
};
|
||||
static uint8_t nosense[TMD_SENSELEN] = {
|
||||
0xf0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
static uint8_t invchg[TMD_SENSELEN] = {
|
||||
0xf0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3f, 0x0e
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static bus_t busses[MAX_BUS];
|
||||
@@ -888,8 +869,11 @@ scsi_target_start_cmd(tmd_cmd_t *tmd, int from_intr)
|
||||
} else {
|
||||
dp = SGS_SGP(addr);
|
||||
init_sg_elem(dp, NULL, 0, addr, min(TMD_SENSELEN, tmd->cd_totlen));
|
||||
if (ini->ini_sdata == NULL) {
|
||||
add_sdata(ini, nosense);
|
||||
}
|
||||
tmd->cd_xfrlen = dp->length;
|
||||
memcpy(addr, nosense, TMD_SENSELEN);
|
||||
memcpy(addr, ini->ini_sdata->sdata, TMD_SENSELEN);
|
||||
tmd->cd_data = dp;
|
||||
tmd->cd_hflags |= CDFH_DATA_IN|CDFH_PRIVATE_0;
|
||||
SDprintk2("sense data in scsi_target for %s%d: %p (%p) len %d, key/asc/ascq 0x%x/0x%x/0x%x\n",
|
||||
@@ -901,63 +885,6 @@ scsi_target_start_cmd(tmd_cmd_t *tmd, int from_intr)
|
||||
goto doit;
|
||||
}
|
||||
|
||||
if (tmd->cd_cdb[0] == REPORT_LUNS) {
|
||||
struct scatterlist *dp = NULL;
|
||||
if (tmd->cd_totlen != 0) {
|
||||
if (from_intr) {
|
||||
scsi_cmd_sched_restart(tmd, "REPORT_LUNS");
|
||||
return;
|
||||
}
|
||||
addr = scsi_target_kzalloc(SGS_SIZE, GFP_KERNEL|GFP_ATOMIC);
|
||||
if (addr == NULL) {
|
||||
printk("scsi_target_alloc: out of memory for report luns\n");
|
||||
add_sdata(ini, ifailure);
|
||||
tmd->cd_hflags |= CDFH_SNSVALID;
|
||||
} else {
|
||||
int i;
|
||||
uint32_t lim, nluns;
|
||||
uint8_t *rpa = addr;
|
||||
|
||||
lim = (tmd->cd_cdb[6] << 24) | (tmd->cd_cdb[7] << 16) | (tmd->cd_cdb[8] << 8) | tmd->cd_cdb[9];
|
||||
|
||||
spin_lock_irqsave(&scsi_target_lock, flags);
|
||||
for (nluns = i = 0; i < MAX_LUN; i++) {
|
||||
lun_t *lp = &bp->luns[i];
|
||||
if (lp->enabled) {
|
||||
uint8_t *ptr = &rpa[8 + (nluns << 3)];
|
||||
if (i >= 256) {
|
||||
ptr[0] = 0x40 | ((i >> 8) & 0x3f);
|
||||
}
|
||||
ptr[1] = i;
|
||||
nluns++;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&scsi_target_lock, flags);
|
||||
|
||||
/*
|
||||
* Make sure we always have *one* (lun 0) enabled
|
||||
*/
|
||||
if (nluns == 0) {
|
||||
nluns = 1;
|
||||
}
|
||||
rpa[0] = (nluns << 3) >> 24;
|
||||
rpa[1] = (nluns << 3) >> 16;
|
||||
rpa[2] = (nluns << 3) >> 8;
|
||||
rpa[3] = (nluns << 3);
|
||||
|
||||
dp = SGS_SGP(addr);
|
||||
lim = min(lim, tmd->cd_totlen);
|
||||
lim = min(lim, (nluns << 3) + 8);
|
||||
init_sg_elem(dp, NULL, 0, addr, lim);
|
||||
tmd->cd_xfrlen = dp->length;
|
||||
tmd->cd_data = dp;
|
||||
tmd->cd_hflags |= CDFH_DATA_IN|CDFH_PRIVATE_0;
|
||||
}
|
||||
}
|
||||
tmd->cd_hflags |= CDFH_STSVALID;
|
||||
goto doit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we have a legal and open lun
|
||||
*/
|
||||
@@ -1633,11 +1560,7 @@ scsi_target_ldfree(bus_t *bp, tmd_cmd_t *tmd, int from_intr)
|
||||
}
|
||||
SDprintk("scsi_target: LDFREE[%llx] %p tmd->cd_data %p\n", tmd->cd_tagval, tmd, dp);
|
||||
if (dp) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
scsi_target_kfree(dp->address, SGS_SIZE);
|
||||
#else
|
||||
scsi_target_kfree(page_address(dp->page) + dp->offset, SGS_SIZE);
|
||||
#endif
|
||||
} else {
|
||||
printk(KERN_ERR "scsi_target: LDFREE[%llx] null dp @ line %d\n", tmd->cd_tagval, __LINE__);
|
||||
return (0);
|
||||
@@ -1902,7 +1825,6 @@ scsi_target_handler(qact_e action, void *arg)
|
||||
case QOUT_HBA_UNREG:
|
||||
{
|
||||
hba_register_t *hp = arg;
|
||||
bus_t tmp;
|
||||
int j;
|
||||
|
||||
spin_lock_irqsave(&scsi_target_lock, flags);
|
||||
@@ -1919,10 +1841,7 @@ scsi_target_handler(qact_e action, void *arg)
|
||||
printk(KERN_WARNING "%s: HBA_UNREG cannot find busp)\n", __FUNCTION__);
|
||||
break;
|
||||
}
|
||||
tmp = *bp;
|
||||
memset(bp, 0, sizeof (*bp));
|
||||
spin_unlock_irqrestore(&scsi_target_lock, flags);
|
||||
bp = &tmp;
|
||||
for (j = 0; j < HASH_WIDTH; j++) {
|
||||
ini_t *nptr = bp->list[j];
|
||||
while (nptr) {
|
||||
@@ -1955,12 +1874,7 @@ scsi_target_thread(void *arg)
|
||||
|
||||
siginitsetinv(¤t->blocked, 0);
|
||||
lock_kernel();
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
daemonize();
|
||||
snprintf(current->comm, sizeof (current->comm), "scsi_target_thread");
|
||||
#else
|
||||
daemonize("scsi_target_thread");
|
||||
#endif
|
||||
unlock_kernel();
|
||||
up(&scsi_thread_entry_exit_semaphore);
|
||||
SDprintk("scsi_target_thread starting\n");
|
||||
@@ -2045,9 +1959,6 @@ scsi_alloc_disk(bus_t *bp, int lun, int overcommit, uint64_t nbytes)
|
||||
printk(KERN_ERR "%s: unable to allocate memory pages\n", __FUNCTION__);
|
||||
goto fail;
|
||||
}
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
LockPage(pp);
|
||||
#endif
|
||||
NextPage(pp) = (NextPageType) lp->pagelists;
|
||||
lp->pagelists = (struct page ***) pp;
|
||||
lp->npglists += 1;
|
||||
@@ -2077,9 +1988,6 @@ scsi_alloc_disk(bus_t *bp, int lun, int overcommit, uint64_t nbytes)
|
||||
printk(KERN_ERR "%s: unable to allocate memory pages\n", __FUNCTION__);
|
||||
goto fail;
|
||||
}
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
LockPage(pptr[j]);
|
||||
#endif
|
||||
if (--npgs == 0) {
|
||||
break;
|
||||
}
|
||||
@@ -2105,9 +2013,6 @@ scsi_free_disk(bus_t *bp, int lun)
|
||||
while (lp->pagelists) {
|
||||
struct page *pp = (struct page *) lp->pagelists;
|
||||
lp->pagelists = (struct page ***) NextPage(pp);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
UnlockPage(pp);
|
||||
#endif
|
||||
__free_page(pp);
|
||||
}
|
||||
lp->npglists = 0;
|
||||
@@ -2122,9 +2027,6 @@ scsi_free_disk(bus_t *bp, int lun)
|
||||
}
|
||||
for (j = 0; j < PG_PER_LIST; j++) {
|
||||
if (pptr[j] != NULL) {
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
UnlockPage(pptr[j]);
|
||||
#endif
|
||||
__free_page(pptr[j]);
|
||||
pptr[j] = NULL;
|
||||
}
|
||||
@@ -2323,11 +2225,10 @@ static int
|
||||
scsi_target_endis(char *hba_name_unit, uint64_t nbytes, int lun, int en)
|
||||
{
|
||||
DECLARE_MUTEX_LOCKED(rsem);
|
||||
unsigned long flags;
|
||||
enadis_t ec;
|
||||
lun_t *lp;
|
||||
bus_t *bp;
|
||||
int rv, i;
|
||||
int rv;
|
||||
|
||||
/*
|
||||
* XXX: yes, there is a race condition here where the bus can
|
||||
@@ -2363,11 +2264,7 @@ scsi_target_endis(char *hba_name_unit, uint64_t nbytes, int lun, int en)
|
||||
memset(&ec, 0, sizeof (ec));
|
||||
ec.en_hba = bp->h.r_identity;
|
||||
ec.en_tgt = TGT_ANY;
|
||||
if (bp->h.r_type == R_FC) {
|
||||
ec.en_lun = LUN_ANY;
|
||||
} else {
|
||||
ec.en_lun = lun;
|
||||
}
|
||||
ec.en_lun = lun;
|
||||
ec.en_private = &rsem;
|
||||
|
||||
(*bp->h.r_action)(en? QIN_ENABLE : QIN_DISABLE, &ec);
|
||||
@@ -2378,19 +2275,6 @@ scsi_target_endis(char *hba_name_unit, uint64_t nbytes, int lun, int en)
|
||||
scsi_free_disk(bp, lun);
|
||||
return (ec.en_error);
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&scsi_target_lock, flags);
|
||||
for (i = 0; i < HASH_WIDTH; i++) {
|
||||
ini_t *ini = bp->list[i];
|
||||
while (ini) {
|
||||
spin_unlock_irqrestore(&scsi_target_lock, flags);
|
||||
add_sdata(ini, invchg);
|
||||
spin_lock_irqsave(&scsi_target_lock, flags);
|
||||
ini = ini->ini_next;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&scsi_target_lock, flags);
|
||||
|
||||
if (en == 0) {
|
||||
scsi_free_disk(bp, lun);
|
||||
} else {
|
||||
@@ -2402,13 +2286,8 @@ scsi_target_endis(char *hba_name_unit, uint64_t nbytes, int lun, int en)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
|
||||
EXPORT_SYMBOL_NOVERS(scsi_target_handler);
|
||||
MODULE_PARM(scsi_tdebug, "i");
|
||||
#else
|
||||
EXPORT_SYMBOL(scsi_target_handler);
|
||||
module_param(scsi_tdebug, int, 0);
|
||||
#endif
|
||||
#ifdef MODULE_LICENSE
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: scsi_target.h,v 1.26 2007/03/10 01:56:34 mjacob Exp $ */
|
||||
/* $Id: scsi_target.h,v 1.27 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: scsi_target_ctl.c,v 1.18 2007/03/10 01:56:34 mjacob Exp $ */
|
||||
/* $Id: scsi_target_ctl.c,v 1.19 2007/07/07 23:20:56 mjacob Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
@@ -31,9 +31,8 @@
|
||||
* is the GNU Public License:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of The Version 2 GNU General Public License as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
||||
Reference in New Issue
Block a user