diff options
author | mjacob <mjacob@cvs.openbsd.org> | 2001-04-04 22:06:55 +0000 |
---|---|---|
committer | mjacob <mjacob@cvs.openbsd.org> | 2001-04-04 22:06:55 +0000 |
commit | bd4d73746acd6293ee009e2d0634a7e0bc8aa58c (patch) | |
tree | 51395b1c95203574a0514eeecba0984b3982fa99 /sys | |
parent | 0ecc7d573b791c047b7dc067ce77f555e57b5dee (diff) |
Ansify source. Say which channel the initiator ID is for. Rename
ICBOPT_PORTNAME to ICBOPT_BOTH_WWNS as being more descriptive.
Change handles to 16 bits. Add ISPCTL_RUN_MBOXCMD control function.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/isp.c | 359 |
1 files changed, 182 insertions, 177 deletions
diff --git a/sys/dev/ic/isp.c b/sys/dev/ic/isp.c index 09f16c08c01..0d49c028c1f 100644 --- a/sys/dev/ic/isp.c +++ b/sys/dev/ic/isp.c @@ -1,9 +1,9 @@ -/* $OpenBSD: isp.c,v 1.20 2001/02/12 23:44:59 mjacob Exp $ */ +/* $OpenBSD: isp.c,v 1.21 2001/04/04 22:06:54 mjacob Exp $ */ /* * Machine and OS Independent (well, as best as possible) * code for the Qlogic ISP SCSI adapters. * - * Copyright (c) 1997, 1998, 1999, 2000 by Matthew Jacob + * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob * Feral Software * All rights reserved. * @@ -108,7 +108,7 @@ static int isp_handle_other_response __P((struct ispsoftc *, ispstatusreq_t *, u_int16_t *)); static void isp_parse_status __P((struct ispsoftc *, ispstatusreq_t *, XS_T *)); -static void isp_fastpost_complete __P((struct ispsoftc *, u_int32_t)); +static void isp_fastpost_complete __P((struct ispsoftc *, u_int16_t)); static void isp_scsi_init __P((struct ispsoftc *)); static void isp_scsi_channel_init __P((struct ispsoftc *, int)); static void isp_fibre_init __P((struct ispsoftc *)); @@ -143,8 +143,7 @@ static void isp_parse_nvram_2100 __P((struct ispsoftc *, u_int8_t *)); * Locking done elsewhere. */ void -isp_reset(isp) - struct ispsoftc *isp; +isp_reset(struct ispsoftc *isp) { mbreg_t mbs; int loops, i, touched, dodnld = 1; @@ -649,6 +648,8 @@ again: dodnld? "loaded" : "resident", mbs.param[1], mbs.param[2], mbs.param[3]); if (IS_FC(isp)) { + isp_prt(isp, ISP_LOGCONFIG, "Firmware Attributes = 0x%x", + mbs.param[6]); if (ISP_READ(isp, BIU2100_CSR) & BIU2100_PCI64) { isp_prt(isp, ISP_LOGCONFIG, "Installed in 64-Bit PCI slot"); @@ -730,8 +731,7 @@ again: */ void -isp_init(isp) - struct ispsoftc *isp; +isp_init(struct ispsoftc *isp) { /* * Must do this first to get defaults established. @@ -748,8 +748,7 @@ isp_init(isp) } static void -isp_scsi_init(isp) - struct ispsoftc *isp; +isp_scsi_init(struct ispsoftc *isp) { sdparam *sdp_chan0, *sdp_chan1; mbreg_t mbs; @@ -913,9 +912,7 @@ isp_scsi_init(isp) } static void -isp_scsi_channel_init(isp, channel) - struct ispsoftc *isp; - int channel; +isp_scsi_channel_init(struct ispsoftc *isp, int channel) { sdparam *sdp; mbreg_t mbs; @@ -933,7 +930,8 @@ isp_scsi_channel_init(isp, channel) if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { return; } - isp_prt(isp, ISP_LOGINFO, "Initiator ID is %d", sdp->isp_initiator_id); + isp_prt(isp, ISP_LOGINFO, "Initiator ID is %d on Channel %d", + sdp->isp_initiator_id, channel); /* @@ -946,18 +944,34 @@ isp_scsi_channel_init(isp, channel) if (sdp->isp_devparam[tgt].dev_enable == 0) { continue; } - sdf = DPARM_SAFE_DFLT; +#ifndef ISP_TARGET_MODE + if (tgt == sdp->isp_initiator_id) { + sdf = DPARM_DEFAULT; + } else { + sdf = DPARM_SAFE_DFLT; + /* + * It is not quite clear when this changed over so that + * we could force narrow and async for 1000/1020 cards, + * but assume that this is only the case for loaded + * firmware. + */ + if (isp->isp_loaded_fw) { + sdf |= DPARM_NARROW | DPARM_ASYNC; + } + } +#else /* - * It is not quite clear when this changed over so that - * we could force narrow and async for 1000/1020 cards, - * but assume that this is only the case for loaded - * firmware. + * The !$*!)$!$)* f/w uses the same index into some + * internal table to decide how to respond to negotiations, + * so if we've said "let's be safe" for ID X, and ID X + * selects *us*, the negotiations will back to 'safe' + * (as in narrow/async). What the f/w *should* do is + * use the initiator id settings to decide how to respond. */ - if (isp->isp_loaded_fw) { - sdf |= DPARM_NARROW | DPARM_ASYNC; - } + sdf = DPARM_DEFAULT; +#endif mbs.param[0] = MBOX_SET_TARGET_PARAMS; - mbs.param[1] = (tgt << 8) | (channel << 15); + mbs.param[1] = (channel << 15) | (tgt << 8); mbs.param[2] = sdf; if ((sdf & DPARM_SYNC) == 0) { mbs.param[3] = 0; @@ -966,7 +980,11 @@ isp_scsi_channel_init(isp, channel) (sdp->isp_devparam[tgt].sync_offset << 8) | (sdp->isp_devparam[tgt].sync_period); } - isp_mboxcmd(isp, &mbs, MBLOGALL); + isp_prt(isp, ISP_LOGDEBUG0, + "bus %d set tgt %d flags 0x%x off 0x%x period 0x%x", + channel, tgt, mbs.param[2], mbs.param[3] >> 8, + mbs.param[3] & 0xff); + isp_mboxcmd(isp, &mbs, MBLOGNONE); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { sdf = DPARM_SAFE_DFLT; mbs.param[0] = MBOX_SET_TARGET_PARAMS; @@ -1017,8 +1035,7 @@ isp_scsi_channel_init(isp, channel) * Locks are held before coming here. */ static void -isp_fibre_init(isp) - struct ispsoftc *isp; +isp_fibre_init(struct ispsoftc *isp) { fcparam *fcp; isp_icb_t *icbp; @@ -1076,11 +1093,6 @@ isp_fibre_init(isp) */ fcp->isp_fwoptions |= ICBOPT_PDBCHANGE_AE; - /* - * We don't set ICBOPT_PORTNAME because we want our - * Node Name && Port Names to be distinct. - */ - /* * Make sure that target role reflects into fwoptions. @@ -1148,6 +1160,7 @@ isp_fibre_init(isp) nwwn = ISP_NODEWWN(isp); pwwn = ISP_PORTWWN(isp); if (nwwn && pwwn) { + icbp->icb_fwoptions |= ICBOPT_BOTH_WWNS; MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, nwwn); MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, pwwn); isp_prt(isp, ISP_LOGDEBUG1, @@ -1158,7 +1171,7 @@ isp_fibre_init(isp) ((u_int32_t) (pwwn & 0xffffffff))); } else { isp_prt(isp, ISP_LOGDEBUG1, "Not using any WWNs"); - fcp->isp_fwoptions &= ~(ICBOPT_USE_PORTNAME|ICBOPT_FULL_LOGIN); + icbp->icb_fwoptions &= ~(ICBOPT_BOTH_WWNS|ICBOPT_FULL_LOGIN); } icbp->icb_rqstqlen = RQUEST_QUEUE_LEN(isp); icbp->icb_rsltqlen = RESULT_QUEUE_LEN(isp); @@ -1204,9 +1217,7 @@ isp_fibre_init(isp) */ static int -isp_getmap(isp, map) - struct ispsoftc *isp; - fcpos_map_t *map; +isp_getmap(struct ispsoftc *isp, fcpos_map_t *map) { fcparam *fcp = (fcparam *) isp->isp_param; mbreg_t mbs; @@ -1234,8 +1245,7 @@ isp_getmap(isp, map) } static void -isp_mark_getpdb_all(isp) - struct ispsoftc *isp; +isp_mark_getpdb_all(struct ispsoftc *isp) { fcparam *fcp = (fcparam *) isp->isp_param; int i; @@ -1245,10 +1255,7 @@ isp_mark_getpdb_all(isp) } static int -isp_getpdb(isp, id, pdbp) - struct ispsoftc *isp; - int id; - isp_pdb_t *pdbp; +isp_getpdb(struct ispsoftc *isp, int id, isp_pdb_t *pdbp) { fcparam *fcp = (fcparam *) isp->isp_param; mbreg_t mbs; @@ -1275,10 +1282,7 @@ isp_getpdb(isp, id, pdbp) } static u_int64_t -isp_get_portname(isp, loopid, nodename) - struct ispsoftc *isp; - int loopid; - int nodename; +isp_get_portname(struct ispsoftc *isp, int loopid, int nodename) { u_int64_t wwn = 0; mbreg_t mbs; @@ -1307,9 +1311,7 @@ isp_get_portname(isp, loopid, nodename) */ static int -isp_fclink_test(isp, usdelay) - struct ispsoftc *isp; - int usdelay; +isp_fclink_test(struct ispsoftc *isp, int usdelay) { static char *toponames[] = { "Private Loop", @@ -1360,10 +1362,10 @@ isp_fclink_test(isp, usdelay) */ enano = NANOTIME_SUB(&hrb, &hra); - isp_prt(isp, ISP_LOGDEBUG3, "usec%d: 0x%lx->0x%lx enano %lu", + isp_prt(isp, ISP_LOGDEBUG1, + "usec%d: 0x%lx->0x%lx enano 0x%x%08x", count, (long) GET_NANOSEC(&hra), (long) GET_NANOSEC(&hrb), - (enano > ((u_int64_t)0xffffffff))? 0xffffffff : - (unsigned long) (enano & 0xffffffff)); + (u_int32_t)(enano >> 32), (u_int32_t)(enano & 0xffffffff)); /* * If the elapsed time is less than 1 millisecond, @@ -1382,7 +1384,8 @@ isp_fclink_test(isp, usdelay) enano -= (u_int64_t) 4000000000U; } wrk = enano; - USEC_SLEEP(isp, wrk/1000); + wrk /= 1000; + USEC_SLEEP(isp, wrk); } else { while (enano > (u_int64_t) 4000000000U) { count += 4000000; @@ -1531,8 +1534,7 @@ not_on_fabric: } static char * -isp2100_fw_statename(state) - int state; +isp2100_fw_statename(int state) { switch(state) { case FW_CONFIG_WAIT: return "Config Wait"; @@ -1553,8 +1555,7 @@ isp2100_fw_statename(state) */ static int -isp_pdb_sync(isp) - struct ispsoftc *isp; +isp_pdb_sync(struct ispsoftc *isp) { struct lportdb *lp; fcparam *fcp = isp->isp_param; @@ -1864,8 +1865,7 @@ dump_em: } static int -isp_scan_loop(isp) - struct ispsoftc *isp; +isp_scan_loop(struct ispsoftc *isp) { struct lportdb *lp; fcparam *fcp = isp->isp_param; @@ -2134,8 +2134,7 @@ isp_scan_loop(isp) } static int -isp_scan_fabric(isp) - struct ispsoftc *isp; +isp_scan_fabric(struct ispsoftc *isp) { fcparam *fcp = isp->isp_param; u_int32_t portid, first_portid; @@ -2245,11 +2244,10 @@ isp_register_fc4_type(struct ispsoftc *isp) */ int -isp_start(xs) - XS_T *xs; +isp_start(XS_T *xs) { struct ispsoftc *isp; - u_int16_t iptr, optr; + u_int16_t iptr, optr, handle; union { ispreq_t *_reqp; ispreqt2_t *_t2reqp; @@ -2304,6 +2302,39 @@ isp_start(xs) if (IS_FC(isp)) { fcparam *fcp = isp->isp_param; struct lportdb *lp; +#ifdef HANDLE_LOOPSTATE_IN_OUTER_LAYERS + if (fcp->isp_fwstate != FW_READY || + fcp->isp_loopstate != LOOP_READY) { + return (CMD_RQLATER); + } + + /* + * If we're not on a Fabric, we can't have a target + * above FL_PORT_ID-1. + * + * If we're on a fabric and *not* connected as an F-port, + * we can't have a target less than FC_SNS_ID+1. This + * keeps us from having to sort out the difference between + * local public loop devices and those which we might get + * from a switch's database. + */ + if (fcp->isp_onfabric == 0) { + if (target >= FL_PORT_ID) { + XS_SETERR(xs, HBA_SELTIMEOUT); + return (CMD_COMPLETE); + } + } else { + if (target >= FL_PORT_ID && target <= FC_SNS_ID) { + XS_SETERR(xs, HBA_SELTIMEOUT); + return (CMD_COMPLETE); + } + if (fcp->isp_topo != TOPO_F_PORT && + target < FL_PORT_ID) { + XS_SETERR(xs, HBA_SELTIMEOUT); + return (CMD_COMPLETE); + } + } +#else /* * Check for f/w being in ready state. If the f/w * isn't in ready state, then we don't know our @@ -2420,6 +2451,7 @@ isp_start(xs) * XXX: Here's were we would cancel any loop_dead flag * XXX: also cancel in dead_loop timeout that's running */ +#endif /* * Now check whether we should even think about pursuing this. @@ -2551,18 +2583,19 @@ isp_start(xs) if (isp->isp_sendmarker && reqp->req_time < 5) { reqp->req_time = 5; } - if (isp_save_xs(isp, xs, &reqp->req_handle)) { + if (isp_save_xs(isp, xs, &handle)) { isp_prt(isp, ISP_LOGDEBUG1, "out of xflist pointers"); XS_SETERR(xs, HBA_BOTCH); return (CMD_EAGAIN); } + reqp->req_handle = handle; /* * Set up DMA and/or do any bus swizzling of the request entry * so that the Qlogic F/W understands what is being asked of it. */ i = ISP_DMASETUP(isp, xs, reqp, &iptr, optr); if (i != CMD_QUEUED) { - isp_destroy_handle(isp, reqp->req_handle); + isp_destroy_handle(isp, handle); /* * dmasetup sets actual error in packet, and * return what we were given to return. @@ -2589,15 +2622,12 @@ isp_start(xs) */ int -isp_control(isp, ctl, arg) - struct ispsoftc *isp; - ispctl_t ctl; - void *arg; +isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg) { XS_T *xs; mbreg_t mbs; int bus, tgt; - u_int32_t handle; + u_int16_t handle; switch (ctl) { default: @@ -2670,8 +2700,8 @@ isp_control(isp, ctl, arg) mbs.param[1] = (bus << 15) | (XS_TGT(xs) << 8) | XS_LUN(xs); } - mbs.param[3] = handle >> 16; - mbs.param[2] = handle & 0xffff; + mbs.param[3] = 0; + mbs.param[2] = handle; isp_mboxcmd(isp, &mbs, MBLOGALL & ~MBOX_COMMAND_ERROR); if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { return (0); @@ -2734,18 +2764,24 @@ isp_control(isp, ctl, arg) } break; + case ISPCTL_RUN_MBOXCMD: + + isp_mboxcmd(isp, arg, MBLOGALL); + return(0); + #ifdef ISP_TARGET_MODE case ISPCTL_TOGGLE_TMODE: { - int ena = *(int *)arg; /* * We don't check/set against role here- that's the * responsibility for the outer layer to coordinate. */ if (IS_SCSI(isp)) { + int param = *(int *)arg; mbs.param[0] = MBOX_ENABLE_TARGET_MODE; - mbs.param[1] = (ena)? ENABLE_TARGET_FLAG : 0; + mbs.param[1] = param & 0xffff; + mbs.param[2] = param >> 16; isp_mboxcmd(isp, &mbs, MBLOGALL); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { break; @@ -2772,8 +2808,7 @@ isp_control(isp, ctl, arg) #define MAX_REQUESTQ_COMPLETIONS 32 int -isp_intr(arg) - void *arg; +isp_intr(void *arg) { struct ispsoftc *isp = arg; XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs; @@ -2849,10 +2884,10 @@ isp_intr(arg) mbox); } } else { - u_int32_t fhandle = isp_parse_async(isp, (int) mbox); + int fhandle = isp_parse_async(isp, (int) mbox); isp_prt(isp, ISP_LOGDEBUG2, "Async Mbox 0x%x", mbox); if (fhandle > 0) { - isp_fastpost_complete(isp, fhandle); + isp_fastpost_complete(isp, (u_int16_t) fhandle); } } if (IS_FC(isp) || isp->isp_state != ISP_RUNSTATE) { @@ -2990,7 +3025,9 @@ isp_intr(arg) if (sp->req_handle > isp->isp_maxcmds || sp->req_handle < 1) { MEMZERO(sp, sizeof (isphdr_t)); isp_prt(isp, ISP_LOGERR, - "bad request handle %d", sp->req_handle); + "bad request handle %d (type 0x%x, flags 0x%x)", + sp->req_handle, sp->req_header.rqs_entry_type, + sp->req_header.rqs_flags); ISP_WRITE(isp, INMAILBOX5, optr); continue; } @@ -3085,7 +3122,7 @@ isp_intr(arg) break; default: isp_prt(isp, ISP_LOGWARN, - "unhandled respose queue type 0x%x", + "unhandled response queue type 0x%x", sp->req_header.rqs_entry_type); if (XS_NOERR(xs)) { XS_SETERR(xs, HBA_BOTCH); @@ -3154,12 +3191,10 @@ isp_intr(arg) */ static int -isp_parse_async(isp, mbox) - struct ispsoftc *isp; - int mbox; +isp_parse_async(struct ispsoftc *isp, int mbox) { int bus; - u_int32_t fast_post_handle = 0; + u_int16_t fast_post_handle = 0; if (IS_DUALBUS(isp)) { bus = ISP_READ(isp, OUTMAILBOX6); @@ -3178,7 +3213,8 @@ isp_parse_async(isp, mbox) case ASYNC_SYSTEM_ERROR: mbox = ISP_READ(isp, OUTMAILBOX1); isp_prt(isp, ISP_LOGERR, - "Internal FW Error @ RISC Addr 0x%x", mbox); + "Internal Firmware Error @ RISC Addr 0x%x", mbox); + ISP_DUMPREGS(isp, "Firmware Error"); isp_reinit(isp); #ifdef ISP_TARGET_MODE isp_target_async(isp, bus, ASYNC_SYSTEM_ERROR); @@ -3205,7 +3241,7 @@ isp_parse_async(isp, mbox) case ASYNC_TIMEOUT_RESET: isp_prt(isp, ISP_LOGWARN, - "timeout initiated SCSI bus reset of bus %d\n", bus); + "timeout initiated SCSI bus reset of bus %d", bus); isp->isp_sendmarker |= (1 << bus); #ifdef ISP_TARGET_MODE isp_target_async(isp, bus, mbox); @@ -3274,8 +3310,7 @@ isp_parse_async(isp, mbox) break; case ASYNC_CMD_CMPLT: - fast_post_handle = (ISP_READ(isp, OUTMAILBOX2) << 16) | - ISP_READ(isp, OUTMAILBOX1); + fast_post_handle = ISP_READ(isp, OUTMAILBOX1); isp_prt(isp, ISP_LOGDEBUG3, "fast post completion of %u", fast_post_handle); break; @@ -3425,10 +3460,8 @@ isp_parse_async(isp, mbox) */ static int -isp_handle_other_response(isp, sp, optrp) - struct ispsoftc *isp; - ispstatusreq_t *sp; - u_int16_t *optrp; +isp_handle_other_response(struct ispsoftc *isp, + ispstatusreq_t *sp, u_int16_t *optrp) { switch (sp->req_header.rqs_entry_type) { case RQSTYPE_STATUS_CONT: @@ -3452,6 +3485,9 @@ isp_handle_other_response(isp, sp, optrp) #endif case RQSTYPE_REQUEST: default: + if (isp_async(isp, ISPASYNC_UNHANDLED_RESPONSE, sp)) { + return (0); + } isp_prt(isp, ISP_LOGWARN, "Unhandled Response Type 0x%x", sp->req_header.rqs_entry_type); return (-1); @@ -3459,10 +3495,7 @@ isp_handle_other_response(isp, sp, optrp) } static void -isp_parse_status(isp, sp, xs) - struct ispsoftc *isp; - ispstatusreq_t *sp; - XS_T *xs; +isp_parse_status(struct ispsoftc *isp, ispstatusreq_t *sp, XS_T *xs) { switch (sp->req_completion_status & 0xff) { case RQCS_COMPLETE: @@ -3794,13 +3827,11 @@ isp_parse_status(isp, sp, xs) } static void -isp_fastpost_complete(isp, fph) - struct ispsoftc *isp; - u_int32_t fph; +isp_fastpost_complete(struct ispsoftc *isp, u_int16_t fph) { XS_T *xs; - if (fph < 1) { + if (fph == 0) { return; } xs = isp_find_xs(isp, fph); @@ -3839,7 +3870,7 @@ static u_int16_t mbpscsi[] = { ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */ ISPOPMAP(0x3f, 0x3f), /* 0x06: MBOX_MAILBOX_REG_TEST */ ISPOPMAP(0x03, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */ - ISPOPMAP(0x01, 0x0f), /* 0x08: MBOX_ABOUT_FIRMWARE */ + ISPOPMAP(0x01, 0x4f), /* 0x08: MBOX_ABOUT_FIRMWARE */ ISPOPMAP(0x00, 0x00), /* 0x09: */ ISPOPMAP(0x00, 0x00), /* 0x0a: */ ISPOPMAP(0x00, 0x00), /* 0x0b: */ @@ -3916,8 +3947,8 @@ static u_int16_t mbpscsi[] = { ISPOPMAP(0xdf, 0xdf), /* 0x52: INITIALIZE REQUEST QUEUE A64 */ ISPOPMAP(0xff, 0xff), /* 0x53: INITIALIZE RESPONSE QUEUE A64 */ ISPOPMAP(0xcf, 0xff), /* 0x54: EXECUTE IOCB A64 */ - ISPOPMAP(0x03, 0x01), /* 0x55: ENABLE TARGET MODE */ - ISPOPMAP(0x00, 0x00), /* 0x56: */ + ISPOPMAP(0x07, 0x01), /* 0x55: ENABLE TARGET MODE */ + ISPOPMAP(0x03, 0x0f), /* 0x56: GET TARGET STATUS */ ISPOPMAP(0x00, 0x00), /* 0x57: */ ISPOPMAP(0x00, 0x00), /* 0x58: */ ISPOPMAP(0x00, 0x00), /* 0x59: */ @@ -3927,7 +3958,7 @@ static u_int16_t mbpscsi[] = { ISPOPMAP(0x01, 0x01) /* 0x5d: GET NOST DATA */ }; -#ifndef ISP_STRIPEED +#ifndef ISP_STRIPPED static char *scsi_mbcmd_names[] = { "NO-OP", "LOAD RAM", @@ -4015,7 +4046,7 @@ static char *scsi_mbcmd_names[] = { "INITIALIZE RESPONSE QUEUE A64", "EXECUTE IOCB A64", "ENABLE TARGET MODE", - NULL, + "GET TARGET MODE STATE", NULL, NULL, NULL, @@ -4030,7 +4061,7 @@ static u_int16_t mbpfc[] = { ISPOPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */ ISPOPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */ ISPOPMAP(0x03, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */ - ISPOPMAP(0x1f, 0x01), /* 0x03: MBOX_DUMP_RAM */ + ISPOPMAP(0xdf, 0x01), /* 0x03: MBOX_DUMP_RAM */ ISPOPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */ ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */ ISPOPMAP(0xff, 0xff), /* 0x06: MBOX_MAILBOX_REG_TEST */ @@ -4289,10 +4320,7 @@ static char *fc_mbcmd_names[] = { #endif static void -isp_mboxcmd(isp, mbp, logmask) - struct ispsoftc *isp; - mbreg_t *mbp; - int logmask; +isp_mboxcmd(struct ispsoftc *isp, mbreg_t *mbp, int logmask) { char *cname, *xname, tname[16], mname[16]; unsigned int lim, ibits, obits, box, opcode; @@ -4370,7 +4398,8 @@ isp_mboxcmd(isp, mbp, logmask) cname = (IS_FC(isp))? fc_mbcmd_names[opcode] : scsi_mbcmd_names[opcode]; #endif if (cname == NULL) { - SNPRINTF(cname, sizeof tname, "opcode %x", opcode); + cname = tname; + SNPRINTF(tname, sizeof tname, "opcode %x", opcode); } /* @@ -4426,8 +4455,7 @@ isp_mboxcmd(isp, mbp, logmask) } static void -isp_fw_state(isp) - struct ispsoftc *isp; +isp_fw_state(struct ispsoftc *isp) { if (IS_FC(isp)) { mbreg_t mbs; @@ -4442,8 +4470,7 @@ isp_fw_state(isp) } static void -isp_update(isp) - struct ispsoftc *isp; +isp_update(struct ispsoftc *isp) { int bus, upmask; @@ -4456,9 +4483,7 @@ isp_update(isp) } static void -isp_update_bus(isp, bus) - struct ispsoftc *isp; - int bus; +isp_update_bus(struct ispsoftc *isp, int bus) { int tgt; mbreg_t mbs; @@ -4481,7 +4506,7 @@ isp_update_bus(isp, bus) if (sdp->isp_devparam[tgt].dev_enable == 0) { sdp->isp_devparam[tgt].dev_update = 0; sdp->isp_devparam[tgt].dev_refresh = 0; - isp_prt(isp, ISP_LOGDEBUG1, + isp_prt(isp, ISP_LOGDEBUG0, "skipping target %d bus %d update", tgt, bus); continue; } @@ -4540,7 +4565,7 @@ isp_update_bus(isp, bus) sdp->isp_devparam[tgt].cur_dflags &= ~DPARM_TQING; sdp->isp_devparam[tgt].cur_dflags |= (sdp->isp_devparam[tgt].dev_flags & DPARM_TQING); - isp_prt(isp, ISP_LOGDEBUG2, + isp_prt(isp, ISP_LOGDEBUG0, "bus %d set tgt %d flags 0x%x off 0x%x period 0x%x", bus, tgt, mbs.param[2], mbs.param[3] >> 8, mbs.param[3] & 0xff); @@ -4550,7 +4575,7 @@ isp_update_bus(isp, bus) } else { continue; } - mbs.param[1] = (bus << 15) | (tgt << 8) ; + mbs.param[1] = (bus << 15) | (tgt << 8); isp_mboxcmd(isp, &mbs, MBLOGALL); if (get == 0) { isp->isp_sendmarker |= (1 << bus); @@ -4576,9 +4601,7 @@ isp_update_bus(isp, bus) } static void -isp_setdfltparm(isp, channel) - struct ispsoftc *isp; - int channel; +isp_setdfltparm(struct ispsoftc *isp, int channel) { int tgt; mbreg_t mbs; @@ -4668,6 +4691,30 @@ isp_setdfltparm(isp, channel) sdp->isp_gotdparms = 1; /* + * Establish some default parameters. + */ + sdp->isp_cmd_dma_burst_enable = 1; + sdp->isp_data_dma_burst_enabl = 1; + sdp->isp_fifo_threshold = 0; + sdp->isp_initiator_id = DEFAULT_IID(isp); + if (isp->isp_type >= ISP_HA_SCSI_1040) { + sdp->isp_async_data_setup = 9; + } else { + sdp->isp_async_data_setup = 6; + } + sdp->isp_selection_timeout = 250; + sdp->isp_max_queue_depth = MAXISPREQUEST(isp); + sdp->isp_tag_aging = 8; + sdp->isp_bus_reset_delay = 3; + sdp->isp_retry_count = 2; + sdp->isp_retry_delay = 2; + + for (tgt = 0; tgt < MAX_TARGETS; tgt++) { + sdp->isp_devparam[tgt].exc_throttle = ISP_EXEC_THROTTLE; + sdp->isp_devparam[tgt].dev_enable = 1; + } + + /* * If we've not been told to avoid reading NVRAM, try and read it. * If we're successful reading it, we can return since NVRAM will * tell us the right thing to do. Otherwise, establish some reasonable @@ -4684,7 +4731,7 @@ isp_setdfltparm(isp, channel) */ if ((isp->isp_confopts & ISP_CFG_NONVRAM) == 0) { mbs.param[0] = MBOX_GET_ACT_NEG_STATE; - isp_mboxcmd(isp, &mbs, MBLOGALL); + isp_mboxcmd(isp, &mbs, MBLOGNONE); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { sdp->isp_req_ack_active_neg = 1; sdp->isp_data_line_active_neg = 1; @@ -4694,15 +4741,12 @@ isp_setdfltparm(isp, channel) sdp->isp_data_line_active_neg = (mbs.param[1+channel] >> 5) & 0x1; } - } else { - sdp->isp_req_ack_active_neg = 1; - sdp->isp_data_line_active_neg = 1; } - isp_prt(isp, ISP_LOGDEBUG1, + isp_prt(isp, ISP_LOGDEBUG0, "defaulting bus %d REQ/ACK Active Negation is %d", channel, sdp->isp_req_ack_active_neg); - isp_prt(isp, ISP_LOGDEBUG1, + isp_prt(isp, ISP_LOGDEBUG0, "defaulting bus %d DATA Active Negation is %d", channel, sdp->isp_data_line_active_neg); @@ -4797,36 +4841,12 @@ isp_setdfltparm(isp, channel) ISP_10M_SYNCPARMS & 0xff; } } - isp_prt(isp, ISP_LOGDEBUG1, + isp_prt(isp, ISP_LOGDEBUG0, "Initial bus %d tgt %d flags %x offset %x period %x", channel, tgt, sdp->isp_devparam[tgt].dev_flags, sdp->isp_devparam[tgt].sync_offset, sdp->isp_devparam[tgt].sync_period); } - - /* - * Establish default some more default parameters. - */ - sdp->isp_cmd_dma_burst_enable = 1; - sdp->isp_data_dma_burst_enabl = 1; - sdp->isp_fifo_threshold = 0; - sdp->isp_initiator_id = DEFAULT_IID(isp); - if (isp->isp_type >= ISP_HA_SCSI_1040) { - sdp->isp_async_data_setup = 9; - } else { - sdp->isp_async_data_setup = 6; - } - sdp->isp_selection_timeout = 250; - sdp->isp_max_queue_depth = MAXISPREQUEST(isp); - sdp->isp_tag_aging = 8; - sdp->isp_bus_reset_delay = 3; - sdp->isp_retry_count = 2; - sdp->isp_retry_delay = 2; - - for (tgt = 0; tgt < MAX_TARGETS; tgt++) { - sdp->isp_devparam[tgt].exc_throttle = ISP_EXEC_THROTTLE; - sdp->isp_devparam[tgt].dev_enable = 1; - } } /* @@ -4838,11 +4858,10 @@ isp_setdfltparm(isp, channel) */ void -isp_reinit(isp) - struct ispsoftc *isp; +isp_reinit(struct ispsoftc *isp) { XS_T *xs; - u_int32_t handle; + u_int16_t handle; isp_reset(isp); if (isp->isp_state != ISP_RESETSTATE) { @@ -4883,8 +4902,7 @@ skip: * NVRAM Routines */ static int -isp_read_nvram(isp) - struct ispsoftc *isp; +isp_read_nvram(struct ispsoftc *isp) { int i, amt; u_int8_t csum, minversion; @@ -4957,10 +4975,7 @@ isp_read_nvram(isp) } static void -isp_rdnvram_word(isp, wo, rp) - struct ispsoftc *isp; - int wo; - u_int16_t *rp; +isp_rdnvram_word(struct ispsoftc *isp, int wo, u_int16_t *rp) { int i, cbits; u_int16_t bit, rqst; @@ -5023,9 +5038,7 @@ isp_rdnvram_word(isp, wo, rp) } static void -isp_parse_nvram_1020(isp, nvram_data) - struct ispsoftc *isp; - u_int8_t *nvram_data; +isp_parse_nvram_1020(struct ispsoftc *isp, u_int8_t *nvram_data) { int i; sdparam *sdp = (sdparam *) isp->isp_param; @@ -5126,10 +5139,7 @@ isp_parse_nvram_1020(isp, nvram_data) } static void -isp_parse_nvram_1080(isp, bus, nvram_data) - struct ispsoftc *isp; - int bus; - u_int8_t *nvram_data; +isp_parse_nvram_1080(struct ispsoftc *isp, int bus, u_int8_t *nvram_data) { int i; sdparam *sdp = (sdparam *) isp->isp_param; @@ -5202,10 +5212,7 @@ isp_parse_nvram_1080(isp, bus, nvram_data) } static void -isp_parse_nvram_12160(isp, bus, nvram_data) - struct ispsoftc *isp; - int bus; - u_int8_t *nvram_data; +isp_parse_nvram_12160(struct ispsoftc *isp, int bus, u_int8_t *nvram_data) { sdparam *sdp = (sdparam *) isp->isp_param; int i; @@ -5279,9 +5286,7 @@ isp_parse_nvram_12160(isp, bus, nvram_data) } static void -isp_parse_nvram_2100(isp, nvram_data) - struct ispsoftc *isp; - u_int8_t *nvram_data; +isp_parse_nvram_2100(struct ispsoftc *isp, u_int8_t *nvram_data) { fcparam *fcp = (fcparam *) isp->isp_param; u_int64_t wwn; |