From owner-p4-projects@FreeBSD.ORG Fri Oct 13 15:09:01 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DD02816A47B; Fri, 13 Oct 2006 15:09:00 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9186816A417 for ; Fri, 13 Oct 2006 15:09:00 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41F5B43D7B for ; Fri, 13 Oct 2006 15:08:41 +0000 (GMT) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9DF8fC3040446 for ; Fri, 13 Oct 2006 15:08:41 GMT (envelope-from mjacob@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9DF8fJU040443 for perforce@freebsd.org; Fri, 13 Oct 2006 15:08:41 GMT (envelope-from mjacob@freebsd.org) Date: Fri, 13 Oct 2006 15:08:41 GMT Message-Id: <200610131508.k9DF8fJU040443@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mjacob@freebsd.org using -f From: Matt Jacob To: Perforce Change Reviews Cc: Subject: PERFORCE change 107827 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2006 15:09:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=107827 Change 107827 by mjacob@newisp on 2006/10/13 15:08:04 Sync with Mendocino tree. 24XX target mode working on linux- pull common code changes here. Affected files ... .. //depot/projects/newisp/dev/isp/isp.c#16 edit .. //depot/projects/newisp/dev/isp/isp_library.c#9 edit .. //depot/projects/newisp/dev/isp/isp_library.h#8 edit .. //depot/projects/newisp/dev/isp/isp_pci.c#13 edit .. //depot/projects/newisp/dev/isp/isp_stds.h#5 edit .. //depot/projects/newisp/dev/isp/isp_target.c#7 edit .. //depot/projects/newisp/dev/isp/isp_target.h#9 edit .. //depot/projects/newisp/dev/isp/isp_tpublic.h#4 edit .. //depot/projects/newisp/dev/isp/ispmbox.h#8 edit .. //depot/projects/newisp/dev/isp/ispvar.h#6 edit Differences ... ==== //depot/projects/newisp/dev/isp/isp.c#16 (text+ko) ==== @@ -256,6 +256,8 @@ isp->isp_rqstoutrp = BIU2400_REQOUTP; isp->isp_respinrp = BIU2400_RSPINP; isp->isp_respoutrp = BIU2400_RSPOUTP; + isp->isp_atioinrp = BIU2400_ATIO_RSPINP; + isp->isp_atiooutrp = BIU2400_ATIO_REQINP; } else if (IS_23XX(isp)) { isp->isp_rqstinrp = BIU_REQINP; isp->isp_rqstoutrp = BIU_REQOUTP; @@ -1141,13 +1143,6 @@ isp_setdfltparm(isp, 1); } - /* - * If we have neither Target nor Initiator role, leave now. - */ - if (isp->isp_role == ISP_ROLE_NONE) { - return; - } - if (IS_FC(isp)) { /* * Do this *before* initializing the firmware. @@ -1509,6 +1504,7 @@ MEMZERO(icbp, sizeof (*icbp)); icbp->icb_version = ICB_VERSION1; + icbp->icb_fwoptions = fcp->isp_fwoptions; /* * Firmware Options are either retrieved from NVRAM or @@ -1520,11 +1516,8 @@ /* * If this is a 2100 < revision 5, we have to turn off FAIRNESS. */ - if ((isp->isp_type == ISP_HA_FC_2100) && isp->isp_revision < 5) { - /* - * XXX: This should be applied to icb- not fwoptions - */ - fcp->isp_fwoptions &= ~ICBOPT_FAIRNESS; + if (IS_2100(isp) && isp->isp_revision < 5) { + icbp->icb_fwoptions &= ~ICBOPT_FAIRNESS; } /* @@ -1533,54 +1526,29 @@ * a LIP- this is a known f/w bug for 2100 f/w less than 1.17.0. */ if (!ISP_FW_NEWER_THAN(isp, 1, 17, 0)) { - /* - * XXX: This should be applied to icb- not fwoptions - */ - /* - * XXX: This should be applied to icb- not fwoptions - */ - fcp->isp_fwoptions |= ICBOPT_FULL_LOGIN; + icbp->icb_fwoptions |= ICBOPT_FULL_LOGIN; } /* * Insist on Port Database Update Async notifications */ - /* - * XXX: This should be applied to icb- not fwoptions - */ - fcp->isp_fwoptions |= ICBOPT_PDBCHANGE_AE; + icbp->icb_fwoptions |= ICBOPT_PDBCHANGE_AE; /* * Make sure that target role reflects into fwoptions. */ if (isp->isp_role & ISP_ROLE_TARGET) { - /* - * XXX: This should be applied to icb- not fwoptions - */ - fcp->isp_fwoptions |= ICBOPT_TGT_ENABLE; + icbp->icb_fwoptions |= ICBOPT_TGT_ENABLE; } else { - /* - * XXX: This should be applied to icb- not fwoptions - */ - fcp->isp_fwoptions &= ~ICBOPT_TGT_ENABLE; + icbp->icb_fwoptions &= ~ICBOPT_TGT_ENABLE; } if (isp->isp_role & ISP_ROLE_INITIATOR) { - /* - * XXX: This should be applied to icb- not fwoptions - */ - fcp->isp_fwoptions &= ~ICBOPT_INI_DISABLE; + icbp->icb_fwoptions &= ~ICBOPT_INI_DISABLE; } else { - /* - * XXX: This should be applied to icb- not fwoptions - */ - fcp->isp_fwoptions |= ICBOPT_INI_DISABLE; + icbp->icb_fwoptions |= ICBOPT_INI_DISABLE; } - /* - * Propagate all of this into the ICB structure. - */ - icbp->icb_fwoptions = fcp->isp_fwoptions; icbp->icb_maxfrmlen = fcp->isp_maxfrmlen; if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN || icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) { @@ -2823,16 +2791,16 @@ } /* - * Scan loop for devices. + * Scan local loop for devices. */ static int isp_scan_loop(ispsoftc_t *isp) { fcportdb_t *lp, tmp; fcparam *fcp = isp->isp_param; - int i, idx; + int i; isp_pdb_t pdb; - uint16_t dbidx, lim; + uint16_t dbidx, lim = 0; if (fcp->isp_fwstate < FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) { @@ -2850,6 +2818,9 @@ * The firmware has (typically) peformed a PLOGI for us. * * If we're a N-port connection, we treat this is a short loop (0..1). + * + * If we're in target mode, we can all possible handles to see who + * might have logged into us. */ switch (fcp->isp_topo) { case TOPO_NL_PORT: @@ -2870,8 +2841,7 @@ /* - * Run through the local loop ports and get - * port database info for each one. + * Run through the list and get the port database info for each one. */ for (dbidx = 0; dbidx < lim; dbidx++) { /* @@ -2947,29 +2917,17 @@ /* * Now search the entire port database - * for the same Port and Node WWN. Start - * from where we currently are at and - * search forward. + * for the same Port and Node WWN. */ - idx = dbidx; for (i = 0; i < MAX_FC_TARG; i++) { - lp = &fcp->portdb[idx]; + lp = &fcp->portdb[i]; if (lp->state == FC_PORTDB_STATE_NIL) { - if (++idx >= MAX_FC_TARG) { - idx = 0; - } continue; } if (lp->node_wwn != tmp.node_wwn) { - if (++idx >= MAX_FC_TARG) { - idx = 0; - } continue; } if (lp->port_wwn != tmp.port_wwn) { - if (++idx >= MAX_FC_TARG) { - idx = 0; - } continue; } @@ -2980,7 +2938,7 @@ if (lp->state != FC_PORTDB_STATE_PROBATIONAL) { isp_prt(isp, ISP_LOGERR, "portdb entry %d not probational (0x%x)", - idx, lp->state); + i, lp->state); isp_dump_portdb(isp); isp_mark_portdb(isp, 1); return (-1); @@ -3017,7 +2975,6 @@ break; } - /* * Did we find and update an old entry? */ @@ -3029,23 +2986,18 @@ * Ah. A new device entry. Find an empty slot * for it and save info for later disposition. */ - idx = dbidx; for (i = 0; i < MAX_FC_TARG; i++) { - if (fcp->portdb[idx].state == FC_PORTDB_STATE_NIL) { + if (fcp->portdb[i].state == FC_PORTDB_STATE_NIL) { break; } - if (++idx >= MAX_FC_TARG) { - idx = 0; - } } if (i == MAX_FC_TARG) { isp_prt(isp, ISP_LOGERR, "could not find slot for new entry"); continue; } + lp = &fcp->portdb[i]; - lp = &fcp->portdb[idx]; - lp->autologin = 1; lp->state = FC_PORTDB_STATE_NEW; lp->portid = 0; @@ -3576,7 +3528,8 @@ } /* - * Try to log into this device. + * Try to see if we are logged into this device, + * and maybe log into it. * * isp_login_device will check for handle and * portid consistency after login. @@ -3651,17 +3604,17 @@ static int isp_login_device(ispsoftc_t *isp, uint32_t portid, isp_pdb_t *p, uint16_t *ohp) { - int lim, r, logval; + int lim, i, r, logval; uint16_t handle; if (IS_24XX(isp)) { - lim = 0xffff; + lim = NPH_MAX_24XX; } else { - lim = MAX_FC_TARG; + lim = NPH_MAX; } handle = isp_nxt_handle(isp, *ohp); - for (r = 0; r < lim; r++) { + for (i = 0; i < lim; i++) { /* * See if we're still logged into something with * this handle and that something agrees with this @@ -3702,7 +3655,7 @@ handle = logval >> 16; break; } else if (logval != MBOX_LOOP_ID_USED) { - r = lim; + i = lim; break; } else { *ohp = handle; @@ -3710,7 +3663,7 @@ } } - if (r == lim) { + if (i == lim) { isp_prt(isp, ISP_LOGERR, "PLOGI 0x%06x failed", portid); return (-1); } @@ -4388,7 +4341,7 @@ * of completions on a request queue at any one time. */ #ifndef MAX_REQUESTQ_COMPLETIONS -#define MAX_REQUESTQ_COMPLETIONS 64 +#define MAX_REQUESTQ_COMPLETIONS 32 #endif void @@ -4399,6 +4352,7 @@ int i, nlooked = 0, ndone = 0; again: + optr = isp->isp_residx; /* * Is this a mailbox related interrupt? * The mailbox semaphore will be nonzero if so. @@ -4432,13 +4386,7 @@ } if ((IS_FC(isp) && mbox != ASYNC_RIO_RESP) || isp->isp_state != ISP_RUNSTATE) { - if (IS_24XX(isp)) { - ISP_WRITE(isp, BIU2400_HCCR, - HCCR_2400_CMD_CLEAR_RISC_INT); - } else { - ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT); - ISP_WRITE(isp, BIU_SEMA, 0); - } + goto out; return; } } @@ -4452,47 +4400,44 @@ /* * Thank you very much! *Burrrp*! */ - WRITE_RESPONSE_QUEUE_OUT_POINTER(isp, - READ_RESPONSE_QUEUE_IN_POINTER(isp)); - - if (IS_24XX(isp)) { - ISP_WRITE(isp, BIU2400_HCCR, - HCCR_2400_CMD_CLEAR_RISC_INT); - ISP_DISABLE_INTS(isp); - } else { - ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT); - ISP_WRITE(isp, BIU_SEMA, 0); - } - return; + ISP_WRITE(isp, isp->isp_respoutrp, + ISP_READ(isp, isp->isp_respinrp)); + ISP_DISABLE_INTS(isp); + goto out; } #ifdef ISP_TARGET_MODE /* * Check for ATIO Queue entries. */ - if ((isp->isp_role & ISP_ROLE_TARGET) && IS_24XX(isp)) { + if (isp->isp_rspbsy == 0 && (isp->isp_role & ISP_ROLE_TARGET) && + IS_24XX(isp)) { iptr = ISP_READ(isp, isp->isp_atioinrp); optr = ISP_READ(isp, isp->isp_atiooutrp); isp->isp_rspbsy = 1; - i = 0; while (optr != iptr) { uint8_t qe[QENTRY_LEN]; - uint16_t oop; isphdr_t *hp; + uint32_t oop; void *addr; oop = optr; - optr = ISP_NXT_QENTRY(optr, RESULT_QUEUE_LEN(isp)); MEMORYBARRIER(isp, SYNC_ATIOQ, oop, QENTRY_LEN); - addr = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_atioq, optr); + addr = ISP_QUEUE_ENTRY(isp->isp_atioq, oop); isp_get_hdr(isp, addr, (isphdr_t *)qe); hp = (isphdr_t *)qe; - isp_prt(isp, ISP_LOGALL, "ATIOQ: got 0x%x", hp->rqs_entry_type); - isp_print_bytes(isp, "ATIOQU", QENTRY_LEN, addr); - i++; - } - if (i) { + switch (hp->rqs_entry_type) { + case RQSTYPE_NOTIFY: + case RQSTYPE_ATIO: + (void) isp_target_notify(isp, addr, &oop); + break; + default: + isp_print_qentry(isp, "?ATIOQ entry?", + oop, addr); + break; + } + optr = ISP_NXT_QENTRY(oop, RESULT_QUEUE_LEN(isp)); ISP_WRITE(isp, isp->isp_atiooutrp, optr); } isp->isp_rspbsy = 0; @@ -4513,6 +4458,7 @@ isp_prt(isp, ISP_LOGINFO, "isp_intr: hard optr=%x, soft optr %x", optr, isp->isp_residx); + isp->isp_residx = optr; } } else { optr = isp->isp_residx; @@ -4527,24 +4473,18 @@ if (IS_2100(isp) || (IS_2300(isp) && isp->isp_revision < 2)) { i = 0; do { - iptr = READ_RESPONSE_QUEUE_IN_POINTER(isp); - junk = READ_RESPONSE_QUEUE_IN_POINTER(isp); + iptr = ISP_READ(isp, isp->isp_respinrp); + junk = ISP_READ(isp, isp->isp_respinrp); } while (junk != iptr && ++i < 1000); if (iptr != junk) { - if (IS_24XX(isp)) { - ISP_WRITE(isp, BIU2400_HCCR, - HCCR_2400_CMD_CLEAR_RISC_INT); - } else { - ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT); - } isp_prt(isp, ISP_LOGWARN, "Response Queue Out Pointer Unstable (%x, %x)", iptr, junk); - return; + goto out; } } else { - iptr = READ_RESPONSE_QUEUE_IN_POINTER(isp); + iptr = ISP_READ(isp, isp->isp_respinrp); } isp->isp_resodx = iptr; @@ -4562,7 +4502,7 @@ junk = 0; } else if (IS_23XX(isp)) { USEC_DELAY(100); - iptr = READ_RESPONSE_QUEUE_IN_POINTER(isp); + iptr = ISP_READ(isp, isp->isp_respinrp); junk = ISP_READ(isp, BIU_R2HSTSLO); } else { junk = ISP_READ(isp, BIU_ISR); @@ -4585,11 +4525,11 @@ } isp->isp_resodx = iptr; + if (isp->isp_rspbsy) { - return; + goto out; } isp->isp_rspbsy = 1; - while (optr != iptr) { uint8_t qe[QENTRY_LEN]; ispstatusreq_t *sp = (ispstatusreq_t *) qe; @@ -4701,7 +4641,7 @@ if (sp->req_header.rqs_flags & RQSFLAG_CONTINUATION) { isp_prt(isp, ISP_LOGWARN, "continuation segment"); - WRITE_RESPONSE_QUEUE_OUT_POINTER(isp, optr); + ISP_WRITE(isp, isp->isp_respoutrp, optr); continue; } if (sp->req_header.rqs_flags & RQSFLAG_FULL) { @@ -4728,7 +4668,7 @@ "bad request handle %d (type 0x%x)", sp->req_handle, etype); MEMZERO(hp, QENTRY_LEN); /* PERF */ - WRITE_RESPONSE_QUEUE_OUT_POINTER(isp, optr); + ISP_WRITE(isp, isp->isp_respoutrp, optr); continue; } xs = isp_find_xs(isp, sp->req_handle); @@ -4748,7 +4688,7 @@ sp->req_handle, ts); } MEMZERO(hp, QENTRY_LEN); /* PERF */ - WRITE_RESPONSE_QUEUE_OUT_POINTER(isp, optr); + ISP_WRITE(isp, isp->isp_respoutrp, optr); continue; } isp_destroy_handle(isp, sp->req_handle); @@ -4902,15 +4842,18 @@ * ISP's notion of what we've seen so far. */ if (nlooked) { - WRITE_RESPONSE_QUEUE_OUT_POINTER(isp, optr); + ISP_WRITE(isp, isp->isp_respoutrp, optr); /* * While we're at it, read the requst queue out pointer. */ - isp->isp_reqodx = READ_REQUEST_QUEUE_OUT_POINTER(isp); - if (isp->isp_rscchiwater < ndone) + isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); + if (isp->isp_rscchiwater < ndone) { isp->isp_rscchiwater = ndone; + } } +out: + if (IS_24XX(isp)) { ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RISC_INT); } else { @@ -5002,7 +4945,7 @@ * We don't need to be chatty about this- just unlatch things * and move on. */ - mbox = READ_REQUEST_QUEUE_OUT_POINTER(isp); + mbox = ISP_READ(isp, isp->isp_rqstoutrp); break; case ASYNC_TIMEOUT_RESET: @@ -5274,6 +5217,15 @@ FCPARAM(isp)->isp_loopstate = LOOP_LIP_RCVD; break; + case ASYNC_RJT_SENT: /* same as ASYNC_QFULL_SENT */ + if (IS_24XX(isp)) { + isp_prt(isp, ISP_LOGTDEBUG0, "LS_RJT sent"); + break; + } else if (IS_2200(isp)) { + isp_prt(isp, ISP_LOGTDEBUG0, "QFULL sent"); + break; + } + /* FALLTHROUGH */ default: isp_prt(isp, ISP_LOGWARN, "Unknown Async Code 0x%x", mbox); break; @@ -6292,7 +6244,7 @@ ISPOPMAP(0x03, 0x01), /* 0x40: MBOX_LOOP_PORT_BYPASS */ ISPOPMAP(0x03, 0x01), /* 0x41: MBOX_LOOP_PORT_ENABLE */ ISPOPMAP(0x03, 0x07), /* 0x42: MBOX_GET_RESOURCE_COUNT */ - ISPOPMAP(0x01, 0x01), /* 0x43: MBOX_REQUEST_NON_PARTICIPATING_MODE */ + ISPOPMAP(0x01, 0x01), /* 0x43: MBOX_REQUEST_OFFLINE_MODE */ ISPOPMAP(0x00, 0x00), /* 0x44: */ ISPOPMAP(0x00, 0x00), /* 0x45: */ ISPOPMAP(0x00, 0x00), /* 0x46: */ ==== //depot/projects/newisp/dev/isp/isp_library.c#9 (text) ==== @@ -114,7 +114,7 @@ { volatile uint32_t iptr, optr; - optr = isp->isp_reqodx = READ_REQUEST_QUEUE_OUT_POINTER(isp); + optr = isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); iptr = isp->isp_reqidx; *resultp = ISP_QUEUE_ENTRY(isp->isp_rquest, iptr); iptr = ISP_NXT_QENTRY(iptr, RQUEST_QUEUE_LEN(isp)); @@ -208,12 +208,9 @@ return (-1); } } - if ((isp->isp_role & ISP_ROLE_INITIATOR) == 0) { - fcp->isp_loopstate = LOOP_READY; - return (0); - } if (isp_control(isp, ISPCTL_SCAN_LOOP, NULL) != 0) { - isp_prt(isp, ISP_LOGINFO, "isp_fc_runstate: scan loop fails"); + isp_prt(isp, ISP_LOGINFO, + "isp_fc_runstate: scan loop fails"); return (LOOP_PDB_RCVD); } if (isp_control(isp, ISPCTL_SCAN_FABRIC, NULL) != 0) { @@ -233,6 +230,37 @@ return (0); } +void +isp_shutdown(ispsoftc_t *isp) +{ + if (IS_FC(isp)) { + if (isp->isp_role != ISP_ROLE_NONE) { + mbreg_t mbs; + MEMZERO(&mbs, sizeof (mbs)); + mbs.param[0] = MBOX_REQUEST_OFFLINE_MODE; + (void) isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); + if (mbs.param[0] == MBOX_COMMAND_COMPLETE) { + return; + } + } + if (IS_24XX(isp)) { + ISP_WRITE(isp, BIU2400_ICR, 0); + ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_PAUSE); + } else { + ISP_WRITE(isp, BIU_ICR, 0); + ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE); + ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS); + ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET); + ISP_WRITE(isp, BIU2100_CSR, BIU2100_FB_REGS); + ISP_WRITE(isp, FBM_CMD, FBMCMD_FIFO_RESET_ALL); + ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS); + } + } else { + ISP_WRITE(isp, BIU_ICR, 0); + ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE); + } +} + /* * Functions to move stuff to a form that the QLogic RISC engine understands * and functions to move stuff back to a form the processor understands. @@ -1130,6 +1158,71 @@ } } +void +isp_get_els(ispsoftc_t *isp, els_t *src, els_t *dst) +{ + int i; + + isp_get_hdr(isp, &src->els_hdr, &dst->els_hdr); + ISP_IOXGET_32(isp, &src->els_handle, dst->els_handle); + ISP_IOXGET_16(isp, &src->els_status, dst->els_status); + ISP_IOXGET_16(isp, &src->els_nphdl, dst->els_nphdl); + ISP_IOXGET_16(isp, &src->els_xmit_dsd_count, dst->els_xmit_dsd_count); + ISP_IOXGET_8(isp, &src->els_vphdl, dst->els_vphdl); + ISP_IOXGET_8(isp, &src->els_sof, dst->els_sof); + ISP_IOXGET_32(isp, &src->els_rxid, dst->els_rxid); + ISP_IOXGET_16(isp, &src->els_recv_dsd_count, dst->els_recv_dsd_count); + ISP_IOXGET_8(isp, &src->els_opcode, dst->els_opcode); + ISP_IOXGET_8(isp, &src->els_reserved2, dst->els_reserved1); + ISP_IOXGET_8(isp, &src->els_did_lo, dst->els_did_lo); + ISP_IOXGET_8(isp, &src->els_did_mid, dst->els_did_mid); + ISP_IOXGET_8(isp, &src->els_did_hi, dst->els_did_hi); + ISP_IOXGET_8(isp, &src->els_reserved2, dst->els_reserved2); + ISP_IOXGET_16(isp, &src->els_reserved3, dst->els_reserved3); + ISP_IOXGET_16(isp, &src->els_ctl_flags, dst->els_ctl_flags); + ISP_IOXGET_32(isp, &src->els_bytecnt, dst->els_bytecnt); + ISP_IOXGET_32(isp, &src->els_subcode1, dst->els_subcode1); + ISP_IOXGET_32(isp, &src->els_subcode2, dst->els_subcode2); + for (i = 0; i < 20; i++) { + ISP_IOXGET_8(isp, &src->els_reserved4[i], + dst->els_reserved4[i]); + } +} + +void +isp_put_els(ispsoftc_t *isp, els_t *src, els_t *dst) +{ + isp_put_hdr(isp, &src->els_hdr, &dst->els_hdr); + ISP_IOXPUT_32(isp, src->els_handle, &dst->els_handle); + ISP_IOXPUT_16(isp, src->els_status, &dst->els_status); + ISP_IOXPUT_16(isp, src->els_nphdl, &dst->els_nphdl); + ISP_IOXPUT_16(isp, src->els_xmit_dsd_count, &dst->els_xmit_dsd_count); + ISP_IOXPUT_8(isp, src->els_vphdl, &dst->els_vphdl); + ISP_IOXPUT_8(isp, src->els_sof, &dst->els_sof); + ISP_IOXPUT_32(isp, src->els_rxid, &dst->els_rxid); + ISP_IOXPUT_16(isp, src->els_recv_dsd_count, &dst->els_recv_dsd_count); + ISP_IOXPUT_8(isp, src->els_opcode, &dst->els_opcode); + ISP_IOXPUT_8(isp, src->els_reserved2, &dst->els_reserved1); + ISP_IOXPUT_8(isp, src->els_did_lo, &dst->els_did_lo); + ISP_IOXPUT_8(isp, src->els_did_mid, &dst->els_did_mid); + ISP_IOXPUT_8(isp, src->els_did_hi, &dst->els_did_hi); + ISP_IOXPUT_8(isp, src->els_reserved2, &dst->els_reserved2); + ISP_IOXPUT_16(isp, src->els_reserved3, &dst->els_reserved3); + ISP_IOXPUT_16(isp, src->els_ctl_flags, &dst->els_ctl_flags); + ISP_IOXPUT_32(isp, src->els_recv_bytecnt, &dst->els_recv_bytecnt); + ISP_IOXPUT_32(isp, src->els_xmit_bytecnt, &dst->els_xmit_bytecnt); + ISP_IOXPUT_32(isp, src->els_xmit_dsd_length, &dst->els_xmit_dsd_length); + ISP_IOXPUT_16(isp, src->els_xmit_dsd_a1500, &dst->els_xmit_dsd_a1500); + ISP_IOXPUT_16(isp, src->els_xmit_dsd_a3116, &dst->els_xmit_dsd_a3116); + ISP_IOXPUT_16(isp, src->els_xmit_dsd_a4732, &dst->els_xmit_dsd_a4732); + ISP_IOXPUT_16(isp, src->els_xmit_dsd_a6348, &dst->els_xmit_dsd_a6348); + ISP_IOXPUT_32(isp, src->els_recv_dsd_length, &dst->els_recv_dsd_length); + ISP_IOXPUT_16(isp, src->els_recv_dsd_a1500, &dst->els_recv_dsd_a1500); + ISP_IOXPUT_16(isp, src->els_recv_dsd_a3116, &dst->els_recv_dsd_a3116); + ISP_IOXPUT_16(isp, src->els_recv_dsd_a4732, &dst->els_recv_dsd_a4732); + ISP_IOXPUT_16(isp, src->els_recv_dsd_a6348, &dst->els_recv_dsd_a6348); +} + /* * FC Structure Canonicalization */ @@ -1137,43 +1230,52 @@ void isp_get_fc_hdr(ispsoftc_t *isp, fc_hdr_t *src, fc_hdr_t *dst) { - int i, amt; - uint32_t *a, *b; - - a = (uint32_t *) src; - b = (uint32_t *) dst; - amt = (sizeof (fc_hdr_t)) >> 2; - for (i = 0; i < amt; i++) { - ISP_IOZGET_32(isp, a++, *b++); - } + ISP_IOZGET_8(isp, &src->r_ctl, dst->r_ctl); + ISP_IOZGET_8(isp, &src->d_id[0], dst->d_id[0]); + ISP_IOZGET_8(isp, &src->d_id[1], dst->d_id[1]); + ISP_IOZGET_8(isp, &src->d_id[2], dst->d_id[2]); + ISP_IOZGET_8(isp, &src->cs_ctl, dst->cs_ctl); + ISP_IOZGET_8(isp, &src->s_id[0], dst->s_id[0]); + ISP_IOZGET_8(isp, &src->s_id[1], dst->s_id[1]); + ISP_IOZGET_8(isp, &src->s_id[2], dst->s_id[2]); + ISP_IOZGET_8(isp, &src->type, dst->type); + ISP_IOZGET_8(isp, &src->f_ctl, dst->f_ctl); + ISP_IOZGET_8(isp, &src->seq_id, dst->seq_id); + ISP_IOZGET_8(isp, &src->df_ctl, dst->df_ctl); + ISP_IOZGET_16(isp, &src->seq_cnt, dst->seq_cnt); + /* XXX SOMETHING WAS AND STILL CONTINUES WRONG HERE XXX */ +#if 0 + ISP_IOZGET_16(isp, &src->ox_id, dst->ox_id); + ISP_IOZGET_16(isp, &src->rx_id, dst->rx_id); +#else + ISP_IOZGET_32(isp, &src->ox_id, dst->parameter); + dst->ox_id = dst->parameter; + dst->rx_id = dst->parameter >> 16; +#endif + ISP_IOZGET_32(isp, &src->parameter, dst->parameter); } void isp_get_fcp_cmnd_iu(ispsoftc_t *isp, fcp_cmnd_iu_t *src, fcp_cmnd_iu_t *dst) { - int i, amt; - uint32_t *a, *b; + int i; - a = (uint32_t *) src; - b = (uint32_t *) dst; - amt = (sizeof (fcp_cmnd_iu_t)) >> 2; - for (i = 0; i < amt; i++) { - ISP_IOZGET_32(isp, a++, *b++); + for (i = 0; i < 8; i++) { + ISP_IOZGET_8(isp, &src->fcp_cmnd_lun[i], dst->fcp_cmnd_lun[i]); } -} - -void -isp_put_fcp_cmnd_iu(ispsoftc_t *isp, fcp_cmnd_iu_t *src, fcp_cmnd_iu_t *dst) -{ - int i, amt; - uint32_t *a, *b; - - a = (uint32_t *) src; - b = (uint32_t *) dst; - amt = (sizeof (fcp_cmnd_iu_t)) >> 2; - for (i = 0; i < amt; i++) { - ISP_IOZPUT_32(isp, *a++, b++); + ISP_IOZGET_8(isp, &src->fcp_cmnd_crn, dst->fcp_cmnd_crn); + ISP_IOZGET_8(isp, &src->fcp_cmnd_task_attribute, + dst->fcp_cmnd_task_attribute); + ISP_IOZGET_8(isp, &src->fcp_cmnd_task_management, + dst->fcp_cmnd_task_management); + ISP_IOZGET_8(isp, &src->fcp_cmnd_alen_datadir, + dst->fcp_cmnd_alen_datadir); + for (i = 0; i < 16; i++) { + ISP_IOZGET_8(isp, &src->cdb_dl.sf.fcp_cmnd_cdb[i], + dst->cdb_dl.sf.fcp_cmnd_cdb[i]); } + ISP_IOZGET_32(isp, &src->cdb_dl.sf.fcp_cmnd_dl, + dst->cdb_dl.sf.fcp_cmnd_dl); } void @@ -1595,31 +1697,31 @@ if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { for (i = 0; i < ISP_RQDSEG_T2; i++) { ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg[i].ds_base, - &dst->rsp.m0.ct_dataseg[i].ds_base); + src->rsp.m0.u.ct_dataseg[i].ds_base, + &dst->rsp.m0.u.ct_dataseg[i].ds_base); ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg[i].ds_count, - &dst->rsp.m0.ct_dataseg[i].ds_count); + src->rsp.m0.u.ct_dataseg[i].ds_count, + &dst->rsp.m0.u.ct_dataseg[i].ds_count); } } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { for (i = 0; i < ISP_RQDSEG_T3; i++) { ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg64[i].ds_base, - &dst->rsp.m0.ct_dataseg64[i].ds_base); + src->rsp.m0.u.ct_dataseg64[i].ds_base, + &dst->rsp.m0.u.ct_dataseg64[i].ds_base); ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg64[i].ds_basehi, - &dst->rsp.m0.ct_dataseg64[i].ds_basehi); + src->rsp.m0.u.ct_dataseg64[i].ds_basehi, + &dst->rsp.m0.u.ct_dataseg64[i].ds_basehi); ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg64[i].ds_count, - &dst->rsp.m0.ct_dataseg64[i].ds_count); + src->rsp.m0.u.ct_dataseg64[i].ds_count, + &dst->rsp.m0.u.ct_dataseg64[i].ds_count); } } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO4) { - ISP_IOXPUT_16(isp, src->rsp.m0.ct_dslist.ds_type, - &dst->rsp.m0.ct_dslist.ds_type); - ISP_IOXPUT_32(isp, src->rsp.m0.ct_dslist.ds_segment, - &dst->rsp.m0.ct_dslist.ds_segment); - ISP_IOXPUT_32(isp, src->rsp.m0.ct_dslist.ds_base, - &dst->rsp.m0.ct_dslist.ds_base); + ISP_IOXPUT_16(isp, src->rsp.m0.u.ct_dslist.ds_type, + &dst->rsp.m0.u.ct_dslist.ds_type); + ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_segment, + &dst->rsp.m0.u.ct_dslist.ds_segment); + ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_base, + &dst->rsp.m0.u.ct_dslist.ds_base); } } else if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) { ISP_IOXPUT_16(isp, src->rsp.m1._reserved, @@ -1677,31 +1779,31 @@ if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { for (i = 0; i < ISP_RQDSEG_T2; i++) { ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg[i].ds_base, - &dst->rsp.m0.ct_dataseg[i].ds_base); + src->rsp.m0.u.ct_dataseg[i].ds_base, + &dst->rsp.m0.u.ct_dataseg[i].ds_base); ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg[i].ds_count, - &dst->rsp.m0.ct_dataseg[i].ds_count); + src->rsp.m0.u.ct_dataseg[i].ds_count, + &dst->rsp.m0.u.ct_dataseg[i].ds_count); } } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { for (i = 0; i < ISP_RQDSEG_T3; i++) { ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg64[i].ds_base, - &dst->rsp.m0.ct_dataseg64[i].ds_base); + src->rsp.m0.u.ct_dataseg64[i].ds_base, + &dst->rsp.m0.u.ct_dataseg64[i].ds_base); ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg64[i].ds_basehi, - &dst->rsp.m0.ct_dataseg64[i].ds_basehi); + src->rsp.m0.u.ct_dataseg64[i].ds_basehi, + &dst->rsp.m0.u.ct_dataseg64[i].ds_basehi); ISP_IOXPUT_32(isp, - src->rsp.m0.ct_dataseg64[i].ds_count, - &dst->rsp.m0.ct_dataseg64[i].ds_count); + src->rsp.m0.u.ct_dataseg64[i].ds_count, + &dst->rsp.m0.u.ct_dataseg64[i].ds_count); } } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO4) { - ISP_IOXPUT_16(isp, src->rsp.m0.ct_dslist.ds_type, - &dst->rsp.m0.ct_dslist.ds_type); - ISP_IOXPUT_32(isp, src->rsp.m0.ct_dslist.ds_segment, - &dst->rsp.m0.ct_dslist.ds_segment); - ISP_IOXPUT_32(isp, src->rsp.m0.ct_dslist.ds_base, - &dst->rsp.m0.ct_dslist.ds_base); + ISP_IOXPUT_16(isp, src->rsp.m0.u.ct_dslist.ds_type, + &dst->rsp.m0.u.ct_dslist.ds_type); + ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_segment, + &dst->rsp.m0.u.ct_dslist.ds_segment); + ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_base, + &dst->rsp.m0.u.ct_dslist.ds_base); } } else if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) { ISP_IOXPUT_16(isp, src->rsp.m1._reserved, @@ -1763,12 +1865,12 @@ &dst->rsp.m0.ct_xfrlen); ISP_IOXPUT_32(isp, src->rsp.m0.reserved1, &dst->rsp.m0.reserved1); - ISP_IOXPUT_32(isp, src->rsp.m0.ct.ds_base, - &dst->rsp.m0.ct.ds_base); - ISP_IOXPUT_32(isp, src->rsp.m0.ct.ds_basehi, - &dst->rsp.m0.ct.ds_basehi); - ISP_IOXPUT_32(isp, src->rsp.m0.ct.ds_count, - &dst->rsp.m0.ct.ds_count); + ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_base, + &dst->rsp.m0.ds.ds_base); + ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_basehi, + &dst->rsp.m0.ds.ds_basehi); + ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_count, + &dst->rsp.m0.ds.ds_count); } else if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE1) { ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen); @@ -1822,31 +1924,31 @@ if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { for (i = 0; i < ISP_RQDSEG_T2; i++) { ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg[i].ds_base, - dst->rsp.m0.ct_dataseg[i].ds_base); + &src->rsp.m0.u.ct_dataseg[i].ds_base, + dst->rsp.m0.u.ct_dataseg[i].ds_base); ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg[i].ds_count, - dst->rsp.m0.ct_dataseg[i].ds_count); + &src->rsp.m0.u.ct_dataseg[i].ds_count, + dst->rsp.m0.u.ct_dataseg[i].ds_count); } } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { for (i = 0; i < ISP_RQDSEG_T3; i++) { ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg64[i].ds_base, - dst->rsp.m0.ct_dataseg64[i].ds_base); + &src->rsp.m0.u.ct_dataseg64[i].ds_base, + dst->rsp.m0.u.ct_dataseg64[i].ds_base); ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg64[i].ds_basehi, - dst->rsp.m0.ct_dataseg64[i].ds_basehi); + &src->rsp.m0.u.ct_dataseg64[i].ds_basehi, + dst->rsp.m0.u.ct_dataseg64[i].ds_basehi); ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg64[i].ds_count, - dst->rsp.m0.ct_dataseg64[i].ds_count); + &src->rsp.m0.u.ct_dataseg64[i].ds_count, + dst->rsp.m0.u.ct_dataseg64[i].ds_count); } } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO4) { - ISP_IOXGET_16(isp, &src->rsp.m0.ct_dslist.ds_type, - dst->rsp.m0.ct_dslist.ds_type); - ISP_IOXGET_32(isp, &src->rsp.m0.ct_dslist.ds_segment, - dst->rsp.m0.ct_dslist.ds_segment); - ISP_IOXGET_32(isp, &src->rsp.m0.ct_dslist.ds_base, - dst->rsp.m0.ct_dslist.ds_base); + ISP_IOXGET_16(isp, &src->rsp.m0.u.ct_dslist.ds_type, + dst->rsp.m0.u.ct_dslist.ds_type); + ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_segment, + dst->rsp.m0.u.ct_dslist.ds_segment); + ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_base, + dst->rsp.m0.u.ct_dslist.ds_base); } } else if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) { ISP_IOXGET_16(isp, &src->rsp.m1._reserved, @@ -1906,31 +2008,31 @@ if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { for (i = 0; i < ISP_RQDSEG_T2; i++) { ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg[i].ds_base, - dst->rsp.m0.ct_dataseg[i].ds_base); + &src->rsp.m0.u.ct_dataseg[i].ds_base, + dst->rsp.m0.u.ct_dataseg[i].ds_base); ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg[i].ds_count, - dst->rsp.m0.ct_dataseg[i].ds_count); + &src->rsp.m0.u.ct_dataseg[i].ds_count, + dst->rsp.m0.u.ct_dataseg[i].ds_count); } } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { for (i = 0; i < ISP_RQDSEG_T3; i++) { ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg64[i].ds_base, - dst->rsp.m0.ct_dataseg64[i].ds_base); + &src->rsp.m0.u.ct_dataseg64[i].ds_base, + dst->rsp.m0.u.ct_dataseg64[i].ds_base); ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg64[i].ds_basehi, - dst->rsp.m0.ct_dataseg64[i].ds_basehi); + &src->rsp.m0.u.ct_dataseg64[i].ds_basehi, + dst->rsp.m0.u.ct_dataseg64[i].ds_basehi); ISP_IOXGET_32(isp, - &src->rsp.m0.ct_dataseg64[i].ds_count, - dst->rsp.m0.ct_dataseg64[i].ds_count); + &src->rsp.m0.u.ct_dataseg64[i].ds_count, + dst->rsp.m0.u.ct_dataseg64[i].ds_count); } } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO4) { - ISP_IOXGET_16(isp, &src->rsp.m0.ct_dslist.ds_type, - dst->rsp.m0.ct_dslist.ds_type); - ISP_IOXGET_32(isp, &src->rsp.m0.ct_dslist.ds_segment, - dst->rsp.m0.ct_dslist.ds_segment); - ISP_IOXGET_32(isp, &src->rsp.m0.ct_dslist.ds_base, - dst->rsp.m0.ct_dslist.ds_base); + ISP_IOXGET_16(isp, &src->rsp.m0.u.ct_dslist.ds_type, + dst->rsp.m0.u.ct_dslist.ds_type); + ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_segment, + dst->rsp.m0.u.ct_dslist.ds_segment); + ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_base, + dst->rsp.m0.u.ct_dslist.ds_base); } } else if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) { ISP_IOXGET_16(isp, &src->rsp.m1._reserved, @@ -1992,12 +2094,12 @@ dst->rsp.m0.ct_xfrlen); ISP_IOXGET_32(isp, &src->rsp.m0.reserved1, dst->rsp.m0.reserved1); - ISP_IOXGET_32(isp, &src->rsp.m0.ct.ds_base, - dst->rsp.m0.ct.ds_base); - ISP_IOXGET_32(isp, &src->rsp.m0.ct.ds_basehi, - dst->rsp.m0.ct.ds_basehi); - ISP_IOXGET_32(isp, &src->rsp.m0.ct.ds_count, - dst->rsp.m0.ct.ds_count); + ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_base, + dst->rsp.m0.ds.ds_base); + ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_basehi, + dst->rsp.m0.ds.ds_basehi); + ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_count, + dst->rsp.m0.ds.ds_count); } else if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE1) { ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen); @@ -2558,8 +2660,8 @@ ISP_IOXPUT_16(isp, src->abts_rsp_sid_lo, &dst->abts_rsp_sid_lo); ISP_IOXPUT_8(isp, src->abts_rsp_sid_hi, &dst->abts_rsp_sid_hi); ISP_IOXPUT_8(isp, src->abts_rsp_cs_ctl, &dst->abts_rsp_cs_ctl); - ISP_IOXPUT_16(isp, src->abts_rsp_fs_ctl, &dst->abts_rsp_fs_ctl); - ISP_IOXPUT_8(isp, src->abts_rsp_f_ctl, &dst->abts_rsp_f_ctl); + ISP_IOXPUT_16(isp, src->abts_rsp_f_ctl_lo, &dst->abts_rsp_f_ctl_lo); + ISP_IOXPUT_8(isp, src->abts_rsp_f_ctl_hi, &dst->abts_rsp_f_ctl_hi); ISP_IOXPUT_8(isp, src->abts_rsp_type, &dst->abts_rsp_type); ISP_IOXPUT_16(isp, src->abts_rsp_seq_cnt, &dst->abts_rsp_seq_cnt); ISP_IOXPUT_8(isp, src->abts_rsp_df_ctl, &dst->abts_rsp_df_ctl); @@ -2567,12 +2669,46 @@ ISP_IOXPUT_16(isp, src->abts_rsp_rx_id, &dst->abts_rsp_rx_id); ISP_IOXPUT_16(isp, src->abts_rsp_ox_id, &dst->abts_rsp_ox_id); ISP_IOXPUT_32(isp, src->abts_rsp_param, &dst->abts_rsp_param); - for (i = 0; i < 12; i++) { >>> TRUNCATED FOR MAIL (1000 lines) <<<