Deleted Added
full compact
isp.c (316092) isp.c (316145)
1/*-
2 * Copyright (c) 1997-2009 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 33 unchanged lines hidden (view full) ---

42 */
43#ifdef __NetBSD__
44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD$");
46#include <dev/ic/isp_netbsd.h>
47#endif
48#ifdef __FreeBSD__
49#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997-2009 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 33 unchanged lines hidden (view full) ---

42 */
43#ifdef __NetBSD__
44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD$");
46#include <dev/ic/isp_netbsd.h>
47#endif
48#ifdef __FreeBSD__
49#include <sys/cdefs.h>
50__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp.c 316092 2017-03-28 10:25:56Z mav $");
50__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp.c 316145 2017-03-29 15:42:35Z mav $");
51#include <dev/isp/isp_freebsd.h>
52#endif
53#ifdef __OpenBSD__
54#include <dev/ic/isp_openbsd.h>
55#endif
56#ifdef __linux__
57#include "isp_linux.h"
58#endif

--- 352 unchanged lines hidden (view full) ---

411 if (isp->isp_mdvec->dv_clock) {
412 if (isp->isp_mdvec->dv_clock < isp->isp_clock) {
413 isp->isp_clock = isp->isp_mdvec->dv_clock;
414 }
415 }
416 }
417
418 /*
51#include <dev/isp/isp_freebsd.h>
52#endif
53#ifdef __OpenBSD__
54#include <dev/ic/isp_openbsd.h>
55#endif
56#ifdef __linux__
57#include "isp_linux.h"
58#endif

--- 352 unchanged lines hidden (view full) ---

411 if (isp->isp_mdvec->dv_clock) {
412 if (isp->isp_mdvec->dv_clock < isp->isp_clock) {
413 isp->isp_clock = isp->isp_mdvec->dv_clock;
414 }
415 }
416 }
417
418 /*
419 * Clear instrumentation
420 */
421 isp->isp_intcnt = isp->isp_intbogus = 0;
422
423 /*
424 * Hit the chip over the head with hammer,
425 * and give it a chance to recover.
426 */
427
428 if (IS_SCSI(isp)) {
429 ISP_WRITE(isp, BIU_ICR, BIU_ICR_SOFT_RESET);
430 /*
431 * A slight delay...

--- 3967 unchanged lines hidden (view full) ---

4399 } else if (ttype == REQFLAG_HTAG) {
4400 ttype = FCP_CMND_TASK_ATTR_HEAD;
4401 } else {
4402 ttype = FCP_CMND_TASK_ATTR_SIMPLE;
4403 }
4404 ((ispreqt7_t *)reqp)->req_task_attribute = ttype;
4405 } else if (IS_FC(isp)) {
4406 /*
419 * Hit the chip over the head with hammer,
420 * and give it a chance to recover.
421 */
422
423 if (IS_SCSI(isp)) {
424 ISP_WRITE(isp, BIU_ICR, BIU_ICR_SOFT_RESET);
425 /*
426 * A slight delay...

--- 3967 unchanged lines hidden (view full) ---

4394 } else if (ttype == REQFLAG_HTAG) {
4395 ttype = FCP_CMND_TASK_ATTR_HEAD;
4396 } else {
4397 ttype = FCP_CMND_TASK_ATTR_SIMPLE;
4398 }
4399 ((ispreqt7_t *)reqp)->req_task_attribute = ttype;
4400 } else if (IS_FC(isp)) {
4401 /*
4407 * See comment in isp_intr
4402 * See comment in isp_intr_respq
4408 */
4409 /* XS_SET_RESID(xs, 0); */
4410
4411 /*
4412 * Fibre Channel always requires some kind of tag.
4413 * The Qlogic drivers seem be happy not to use a tag,
4414 * but this breaks for some devices (IBM drives).
4415 */

--- 490 unchanged lines hidden (view full) ---

4906
4907/*
4908 * Interrupt Service Routine(s).
4909 *
4910 * External (OS) framework has done the appropriate locking,
4911 * and the locking will be held throughout this function.
4912 */
4913
4403 */
4404 /* XS_SET_RESID(xs, 0); */
4405
4406 /*
4407 * Fibre Channel always requires some kind of tag.
4408 * The Qlogic drivers seem be happy not to use a tag,
4409 * but this breaks for some devices (IBM drives).
4410 */

--- 490 unchanged lines hidden (view full) ---

4901
4902/*
4903 * Interrupt Service Routine(s).
4904 *
4905 * External (OS) framework has done the appropriate locking,
4906 * and the locking will be held throughout this function.
4907 */
4908
4909#ifdef ISP_TARGET_MODE
4910void
4911isp_intr_atioq(ispsoftc_t *isp)
4912{
4913 uint8_t qe[QENTRY_LEN];
4914 isphdr_t *hp;
4915 void *addr;
4916 uint32_t iptr, optr, oop;
4917
4918 iptr = ISP_READ(isp, BIU2400_ATIO_RSPINP);
4919 optr = isp->isp_atioodx;
4920 while (optr != iptr) {
4921 oop = optr;
4922 MEMORYBARRIER(isp, SYNC_ATIOQ, oop, QENTRY_LEN, -1);
4923 addr = ISP_QUEUE_ENTRY(isp->isp_atioq, oop);
4924 isp_get_hdr(isp, addr, (isphdr_t *)qe);
4925 hp = (isphdr_t *)qe;
4926 switch (hp->rqs_entry_type) {
4927 case RQSTYPE_NOTIFY:
4928 case RQSTYPE_ATIO:
4929 (void) isp_target_notify(isp, addr, &oop);
4930 break;
4931 default:
4932 isp_print_qentry(isp, "?ATIOQ entry?", oop, addr);
4933 break;
4934 }
4935 optr = ISP_NXT_QENTRY(oop, RESULT_QUEUE_LEN(isp));
4936 }
4937 if (isp->isp_atioodx != optr) {
4938 ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, optr);
4939 isp->isp_atioodx = optr;
4940 }
4941}
4942#endif
4943
4944void
4945isp_intr_async(ispsoftc_t *isp, uint16_t event)
4946{
4947
4948 if (IS_FC(isp))
4949 isp_parse_async_fc(isp, event);
4950 else
4951 isp_parse_async(isp, event);
4952}
4953
4954void
4955isp_intr_mbox(ispsoftc_t *isp, uint16_t mbox0)
4956{
4957 int i, obits;
4958
4959 if (!isp->isp_mboxbsy) {
4960 isp_prt(isp, ISP_LOGWARN, "mailbox 0x%x with no waiters", mbox0);
4961 return;
4962 }
4963 obits = isp->isp_obits;
4964 isp->isp_mboxtmp[0] = mbox0;
4965 for (i = 1; i < ISP_NMBOX(isp); i++) {
4966 if ((obits & (1 << i)) == 0)
4967 continue;
4968 isp->isp_mboxtmp[i] = ISP_READ(isp, MBOX_OFF(i));
4969 }
4970 MBOX_NOTIFY_COMPLETE(isp);
4971}
4972
4914/*
4915 * Limit our stack depth by sticking with the max likely number
4916 * of completions on a request queue at any one time.
4917 */
4918#ifndef MAX_REQUESTQ_COMPLETIONS
4919#define MAX_REQUESTQ_COMPLETIONS 32
4920#endif
4921
4922void
4973/*
4974 * Limit our stack depth by sticking with the max likely number
4975 * of completions on a request queue at any one time.
4976 */
4977#ifndef MAX_REQUESTQ_COMPLETIONS
4978#define MAX_REQUESTQ_COMPLETIONS 32
4979#endif
4980
4981void
4923isp_intr(ispsoftc_t *isp, uint16_t isr, uint16_t sema, uint16_t info)
4982isp_intr_respq(ispsoftc_t *isp)
4924{
4925 XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs;
4926 uint32_t iptr, optr, junk;
4927 int i, nlooked = 0, ndone = 0, continuations_expected = 0;
4928 int etype, last_etype = 0;
4929
4983{
4984 XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs;
4985 uint32_t iptr, optr, junk;
4986 int i, nlooked = 0, ndone = 0, continuations_expected = 0;
4987 int etype, last_etype = 0;
4988
4930again:
4931 /*
4989 /*
4932 * Is this a mailbox related interrupt?
4933 * The mailbox semaphore will be nonzero if so.
4934 */
4935 if (sema) {
4936 fmbox:
4937 if (info & MBOX_COMMAND_COMPLETE) {
4938 isp->isp_intmboxc++;
4939 if (isp->isp_mboxbsy) {
4940 int obits = isp->isp_obits;
4941 isp->isp_mboxtmp[0] = info;
4942 for (i = 1; i < ISP_NMBOX(isp); i++) {
4943 if ((obits & (1 << i)) == 0) {
4944 continue;
4945 }
4946 isp->isp_mboxtmp[i] = ISP_READ(isp, MBOX_OFF(i));
4947 }
4948 MBOX_NOTIFY_COMPLETE(isp);
4949 } else {
4950 isp_prt(isp, ISP_LOGWARN, "mailbox cmd (0x%x) with no waiters", info);
4951 }
4952 } else {
4953 if (IS_FC(isp))
4954 isp_parse_async_fc(isp, info);
4955 else
4956 isp_parse_async(isp, info);
4957 }
4958 if ((IS_FC(isp) && info != ASYNC_RIOZIO_STALL) || isp->isp_state != ISP_RUNSTATE) {
4959 goto out;
4960 }
4961 }
4962
4963 /*
4964 * We can't be getting this now.
4965 */
4966 if (isp->isp_state != ISP_RUNSTATE) {
4990 * We can't be getting this now.
4991 */
4992 if (isp->isp_state != ISP_RUNSTATE) {
4967 /*
4968 * This seems to happen to 23XX and 24XX cards- don't know why.
4969 */
4970 if (isp->isp_mboxbsy && isp->isp_lastmbxcmd == MBOX_ABOUT_FIRMWARE) {
4971 goto fmbox;
4972 }
4973 isp_prt(isp, ISP_LOGINFO, "interrupt (ISR=%x SEMA=%x INFO=%x) "
4974 "when not ready", isr, sema, info);
4975 /*
4976 * Thank you very much! *Burrrp*!
4977 */
4978 isp->isp_residx = ISP_READ(isp, isp->isp_respinrp);
4979 isp->isp_resodx = isp->isp_residx;
4980 ISP_WRITE(isp, isp->isp_respoutrp, isp->isp_resodx);
4981 if (IS_24XX(isp)) {
4982 ISP_DISABLE_INTS(isp);
4983 }
4984 goto out;
4993 isp_prt(isp, ISP_LOGINFO, "respq interrupt when not ready");
4994 return;
4985 }
4986
4995 }
4996
4987#ifdef ISP_TARGET_MODE
4988 /*
4989 * Check for ATIO Queue entries.
4990 */
4991 if (IS_24XX(isp) &&
4992 (isr == ISPR2HST_ATIO_UPDATE || isr == ISPR2HST_ATIO_RSPQ_UPDATE ||
4993 isr == ISPR2HST_ATIO_UPDATE2)) {
4994 iptr = ISP_READ(isp, BIU2400_ATIO_RSPINP);
4995 optr = isp->isp_atioodx;
4996
4997 while (optr != iptr) {
4998 uint8_t qe[QENTRY_LEN];
4999 isphdr_t *hp;
5000 uint32_t oop;
5001 void *addr;
5002
5003 oop = optr;
5004 MEMORYBARRIER(isp, SYNC_ATIOQ, oop, QENTRY_LEN, -1);
5005 addr = ISP_QUEUE_ENTRY(isp->isp_atioq, oop);
5006 isp_get_hdr(isp, addr, (isphdr_t *)qe);
5007 hp = (isphdr_t *)qe;
5008 switch (hp->rqs_entry_type) {
5009 case RQSTYPE_NOTIFY:
5010 case RQSTYPE_ATIO:
5011 (void) isp_target_notify(isp, addr, &oop);
5012 break;
5013 default:
5014 isp_print_qentry(isp, "?ATIOQ entry?", oop, addr);
5015 break;
5016 }
5017 optr = ISP_NXT_QENTRY(oop, RESULT_QUEUE_LEN(isp));
5018 }
5019 if (isp->isp_atioodx != optr) {
5020 ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, optr);
5021 isp->isp_atioodx = optr;
5022 }
5023 }
5024#endif
5025
5026 /*
5027 * You *must* read the Response Queue In Pointer
5028 * prior to clearing the RISC interrupt.
5029 *
5030 * Debounce the 2300 if revision less than 2.
5031 */
4997 iptr = ISP_READ(isp, isp->isp_respinrp);
4998 /* Debounce the 2300 if revision less than 2. */
5032 if (IS_2100(isp) || (IS_2300(isp) && isp->isp_revision < 2)) {
4999 if (IS_2100(isp) || (IS_2300(isp) && isp->isp_revision < 2)) {
5033 i = 0;
5034 do {
5000 do {
5001 junk = iptr;
5035 iptr = ISP_READ(isp, isp->isp_respinrp);
5002 iptr = ISP_READ(isp, isp->isp_respinrp);
5036 junk = ISP_READ(isp, isp->isp_respinrp);
5037 } while (junk != iptr && ++i < 1000);
5038
5039 if (iptr != junk) {
5040 isp_prt(isp, ISP_LOGWARN, "Response Queue Out Pointer Unstable (%x, %x)", iptr, junk);
5041 goto out;
5042 }
5043 } else {
5044 iptr = ISP_READ(isp, isp->isp_respinrp);
5003 } while (junk != iptr);
5045 }
5004 }
5046
5047 optr = isp->isp_resodx;
5048 if (optr == iptr && sema == 0) {
5049 /*
5050 * There are a lot of these- reasons unknown- mostly on
5051 * faster Alpha machines.
5052 *
5053 * I tried delaying after writing HCCR_CMD_CLEAR_RISC_INT to
5054 * make sure the old interrupt went away (to avoid 'ringing'
5055 * effects), but that didn't stop this from occurring.
5056 */
5057 if (IS_24XX(isp)) {
5058 junk = 0;
5059 } else if (IS_23XX(isp)) {
5060 ISP_DELAY(100);
5061 iptr = ISP_READ(isp, isp->isp_respinrp);
5062 junk = ISP_READ(isp, BIU_R2HSTSLO);
5063 } else {
5064 junk = ISP_READ(isp, BIU_ISR);
5065 }
5066 if (optr == iptr) {
5067 if (IS_23XX(isp) || IS_24XX(isp)) {
5068 ;
5069 } else {
5070 sema = ISP_READ(isp, BIU_SEMA);
5071 info = ISP_READ(isp, OUTMAILBOX0);
5072 if ((sema & 0x3) && (info & 0x8000)) {
5073 goto again;
5074 }
5075 }
5076 isp->isp_intbogus++;
5077 isp_prt(isp, ISP_LOGDEBUG1, "bogus intr- isr %x (%x) iptr %x optr %x", isr, junk, iptr, optr);
5078 }
5079 }
5080 isp->isp_residx = iptr;
5081
5005 isp->isp_residx = iptr;
5006
5007 optr = isp->isp_resodx;
5082 while (optr != iptr) {
5083 uint8_t qe[QENTRY_LEN];
5084 ispstatusreq_t *sp = (ispstatusreq_t *) qe;
5085 isphdr_t *hp;
5086 int buddaboom, scsi_status, completion_status;
5087 int req_status_flags, req_state_flags;
5088 uint8_t *snsp, *resp;
5089 uint32_t rlen, slen, totslen;

--- 35 unchanged lines hidden (view full) ---

5125 req_state_flags = sp->req_state_flags;
5126 resid = sp->req_resid;
5127 } else if (etype == RQSTYPE_RIO1) {
5128 isp_rio1_t *rio = (isp_rio1_t *) qe;
5129 isp_get_rio1(isp, (isp_rio1_t *) hp, rio);
5130 for (i = 0; i < rio->req_header.rqs_seqno; i++) {
5131 isp_fastpost_complete(isp, rio->req_handles[i]);
5132 }
5008 while (optr != iptr) {
5009 uint8_t qe[QENTRY_LEN];
5010 ispstatusreq_t *sp = (ispstatusreq_t *) qe;
5011 isphdr_t *hp;
5012 int buddaboom, scsi_status, completion_status;
5013 int req_status_flags, req_state_flags;
5014 uint8_t *snsp, *resp;
5015 uint32_t rlen, slen, totslen;

--- 35 unchanged lines hidden (view full) ---

5051 req_state_flags = sp->req_state_flags;
5052 resid = sp->req_resid;
5053 } else if (etype == RQSTYPE_RIO1) {
5054 isp_rio1_t *rio = (isp_rio1_t *) qe;
5055 isp_get_rio1(isp, (isp_rio1_t *) hp, rio);
5056 for (i = 0; i < rio->req_header.rqs_seqno; i++) {
5057 isp_fastpost_complete(isp, rio->req_handles[i]);
5058 }
5133 if (isp->isp_fpcchiwater < rio->req_header.rqs_seqno) {
5134 isp->isp_fpcchiwater = rio->req_header.rqs_seqno;
5135 }
5136 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5137 last_etype = etype;
5138 continue;
5139 } else if (etype == RQSTYPE_RIO2) {
5140 isp_prt(isp, ISP_LOGERR, "dropping RIO2 response");
5141 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5142 last_etype = etype;
5143 continue;

--- 228 unchanged lines hidden (view full) ---

5372 }
5373 }
5374 if (snsp && slen) {
5375 if (totslen > slen) {
5376 continuations_expected += ((totslen - slen + QENTRY_LEN - 5) / (QENTRY_LEN - 4));
5377 if (ndone > (MAX_REQUESTQ_COMPLETIONS - continuations_expected - 1)) {
5378 /* we'll lose some stats, but that's a small price to pay */
5379 for (i = 0; i < ndone; i++) {
5059 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5060 last_etype = etype;
5061 continue;
5062 } else if (etype == RQSTYPE_RIO2) {
5063 isp_prt(isp, ISP_LOGERR, "dropping RIO2 response");
5064 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5065 last_etype = etype;
5066 continue;

--- 228 unchanged lines hidden (view full) ---

5295 }
5296 }
5297 if (snsp && slen) {
5298 if (totslen > slen) {
5299 continuations_expected += ((totslen - slen + QENTRY_LEN - 5) / (QENTRY_LEN - 4));
5300 if (ndone > (MAX_REQUESTQ_COMPLETIONS - continuations_expected - 1)) {
5301 /* we'll lose some stats, but that's a small price to pay */
5302 for (i = 0; i < ndone; i++) {
5380 if (complist[i]) {
5381 isp->isp_rsltccmplt++;
5303 if (complist[i])
5382 isp_done(complist[i]);
5304 isp_done(complist[i]);
5383 }
5384 }
5385 ndone = 0;
5386 }
5387 isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, "Expecting %d more Status Continuations for total sense length of %u",
5388 continuations_expected, totslen);
5389 }
5390 XS_SAVE_SENSE(xs, snsp, totslen, slen);
5391 } else if ((req_status_flags & RQSF_GOT_STATUS) && (scsi_status & 0xff) == SCSI_CHECK && IS_FC(isp)) {

--- 56 unchanged lines hidden (view full) ---

5448 /*
5449 * If we looked at any commands, then it's valid to find out
5450 * what the outpointer is. It also is a trigger to update the
5451 * ISP's notion of what we've seen so far.
5452 */
5453 if (nlooked) {
5454 ISP_WRITE(isp, isp->isp_respoutrp, optr);
5455 isp->isp_resodx = optr;
5305 }
5306 ndone = 0;
5307 }
5308 isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, "Expecting %d more Status Continuations for total sense length of %u",
5309 continuations_expected, totslen);
5310 }
5311 XS_SAVE_SENSE(xs, snsp, totslen, slen);
5312 } else if ((req_status_flags & RQSF_GOT_STATUS) && (scsi_status & 0xff) == SCSI_CHECK && IS_FC(isp)) {

--- 56 unchanged lines hidden (view full) ---

5369 /*
5370 * If we looked at any commands, then it's valid to find out
5371 * what the outpointer is. It also is a trigger to update the
5372 * ISP's notion of what we've seen so far.
5373 */
5374 if (nlooked) {
5375 ISP_WRITE(isp, isp->isp_respoutrp, optr);
5376 isp->isp_resodx = optr;
5456 if (isp->isp_rscchiwater < ndone)
5457 isp->isp_rscchiwater = ndone;
5458 }
5459
5377 }
5378
5460out:
5461
5462 if (IS_24XX(isp)) {
5463 ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_CLEAR_RISC_INT);
5464 } else {
5465 ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
5466 ISP_WRITE(isp, BIU_SEMA, 0);
5467 }
5468
5469 for (i = 0; i < ndone; i++) {
5470 xs = complist[i];
5471 if (xs) {
5472 if (((isp->isp_dblev & (ISP_LOGDEBUG1|ISP_LOGDEBUG2|ISP_LOGDEBUG3))) ||
5473 ((isp->isp_dblev & (ISP_LOGDEBUG0|ISP_LOG_CWARN) && ((!XS_NOERR(xs)) || (*XS_STSP(xs) != SCSI_GOOD))))) {
5474 isp_prt_endcmd(isp, xs);
5475 }
5379 for (i = 0; i < ndone; i++) {
5380 xs = complist[i];
5381 if (xs) {
5382 if (((isp->isp_dblev & (ISP_LOGDEBUG1|ISP_LOGDEBUG2|ISP_LOGDEBUG3))) ||
5383 ((isp->isp_dblev & (ISP_LOGDEBUG0|ISP_LOG_CWARN) && ((!XS_NOERR(xs)) || (*XS_STSP(xs) != SCSI_GOOD))))) {
5384 isp_prt_endcmd(isp, xs);
5385 }
5476 isp->isp_rsltccmplt++;
5477 isp_done(xs);
5478 }
5479 }
5480}
5481
5482/*
5483 * Support routines.
5484 */

--- 176 unchanged lines hidden (view full) ---

5661 }
5662
5663 if (h1 || h2) {
5664 isp_prt(isp, ISP_LOGDEBUG3, "fast post/rio completion of 0x%08x", h1);
5665 isp_fastpost_complete(isp, h1);
5666 if (h2) {
5667 isp_prt(isp, ISP_LOGDEBUG3, "fast post/rio completion of 0x%08x", h2);
5668 isp_fastpost_complete(isp, h2);
5386 isp_done(xs);
5387 }
5388 }
5389}
5390
5391/*
5392 * Support routines.
5393 */

--- 176 unchanged lines hidden (view full) ---

5570 }
5571
5572 if (h1 || h2) {
5573 isp_prt(isp, ISP_LOGDEBUG3, "fast post/rio completion of 0x%08x", h1);
5574 isp_fastpost_complete(isp, h1);
5575 if (h2) {
5576 isp_prt(isp, ISP_LOGDEBUG3, "fast post/rio completion of 0x%08x", h2);
5577 isp_fastpost_complete(isp, h2);
5669 if (isp->isp_fpcchiwater < 2) {
5670 isp->isp_fpcchiwater = 2;
5671 }
5672 } else {
5673 if (isp->isp_fpcchiwater < 1) {
5674 isp->isp_fpcchiwater = 1;
5675 }
5676 }
5578 }
5677 } else {
5678 isp->isp_intoasync++;
5679 }
5680}
5681
5682static void
5683isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
5684{
5685 fcparam *fcp;
5686 uint16_t chan;

--- 41 unchanged lines hidden (view full) ---

5728 break;
5729 }
5730#endif
5731 isp_prt(isp, ISP_LOGERR, "%s: unexpected ASYNC_QWAKEUP code", __func__);
5732 break;
5733
5734 case ASYNC_CMD_CMPLT:
5735 isp_fastpost_complete(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) | ISP_READ(isp, OUTMAILBOX1));
5579 }
5580}
5581
5582static void
5583isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
5584{
5585 fcparam *fcp;
5586 uint16_t chan;

--- 41 unchanged lines hidden (view full) ---

5628 break;
5629 }
5630#endif
5631 isp_prt(isp, ISP_LOGERR, "%s: unexpected ASYNC_QWAKEUP code", __func__);
5632 break;
5633
5634 case ASYNC_CMD_CMPLT:
5635 isp_fastpost_complete(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) | ISP_READ(isp, OUTMAILBOX1));
5736 if (isp->isp_fpcchiwater < 1) {
5737 isp->isp_fpcchiwater = 1;
5738 }
5739 break;
5740
5741 case ASYNC_RIOZIO_STALL:
5636 break;
5637
5638 case ASYNC_RIOZIO_STALL:
5639 isp_intr_respq(isp);
5742 break;
5743
5744 case ASYNC_CTIO_DONE:
5745#ifdef ISP_TARGET_MODE
5746 isp_target_async(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) |
5747 ISP_READ(isp, OUTMAILBOX1), mbox);
5640 break;
5641
5642 case ASYNC_CTIO_DONE:
5643#ifdef ISP_TARGET_MODE
5644 isp_target_async(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) |
5645 ISP_READ(isp, OUTMAILBOX1), mbox);
5748 isp->isp_fphccmplt++;
5749#else
5750 isp_prt(isp, ISP_LOGWARN, "unexpected ASYNC CTIO done");
5751#endif
5752 break;
5753 case ASYNC_LIP_ERROR:
5754 case ASYNC_LIP_NOS_OLS_RECV:
5755 case ASYNC_LIP_OCCURRED:
5756 case ASYNC_PTPMODE:

--- 255 unchanged lines hidden (view full) ---

6012 break;
6013 case ASYNC_AUTOLOAD_FW_FAILURE:
6014 isp_prt(isp, ISP_LOGERR, "Autoload FW init failure");
6015 break;
6016 default:
6017 isp_prt(isp, ISP_LOGWARN, "Unknown Async Code 0x%x", mbox);
6018 break;
6019 }
5646#else
5647 isp_prt(isp, ISP_LOGWARN, "unexpected ASYNC CTIO done");
5648#endif
5649 break;
5650 case ASYNC_LIP_ERROR:
5651 case ASYNC_LIP_NOS_OLS_RECV:
5652 case ASYNC_LIP_OCCURRED:
5653 case ASYNC_PTPMODE:

--- 255 unchanged lines hidden (view full) ---

5909 break;
5910 case ASYNC_AUTOLOAD_FW_FAILURE:
5911 isp_prt(isp, ISP_LOGERR, "Autoload FW init failure");
5912 break;
5913 default:
5914 isp_prt(isp, ISP_LOGWARN, "Unknown Async Code 0x%x", mbox);
5915 break;
5916 }
6020 if (mbox != ASYNC_CTIO_DONE && mbox != ASYNC_CMD_CMPLT) {
6021 isp->isp_intoasync++;
6022 }
6023}
6024
6025/*
6026 * Handle other response entries. A pointer to the request queue output
6027 * index is here in case we want to eat several entries at once, although
6028 * this is not used currently.
6029 */
6030

--- 70 unchanged lines hidden (view full) ---

6101 case RQSTYPE_NOTIFY_ACK:
6102 case RQSTYPE_CTIO1:
6103 case RQSTYPE_ATIO2:
6104 case RQSTYPE_CTIO2:
6105 case RQSTYPE_CTIO3:
6106 case RQSTYPE_CTIO7:
6107 case RQSTYPE_ABTS_RCVD:
6108 case RQSTYPE_ABTS_RSP:
5917}
5918
5919/*
5920 * Handle other response entries. A pointer to the request queue output
5921 * index is here in case we want to eat several entries at once, although
5922 * this is not used currently.
5923 */
5924

--- 70 unchanged lines hidden (view full) ---

5995 case RQSTYPE_NOTIFY_ACK:
5996 case RQSTYPE_CTIO1:
5997 case RQSTYPE_ATIO2:
5998 case RQSTYPE_CTIO2:
5999 case RQSTYPE_CTIO3:
6000 case RQSTYPE_CTIO7:
6001 case RQSTYPE_ABTS_RCVD:
6002 case RQSTYPE_ABTS_RSP:
6109 isp->isp_rsltccmplt++; /* count as a response completion */
6110#ifdef ISP_TARGET_MODE
6003#ifdef ISP_TARGET_MODE
6111 if (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)) {
6004 if (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp))
6112 return (1);
6005 return (1);
6113 }
6114#endif
6115 /* FALLTHROUGH */
6116 case RQSTYPE_REQUEST:
6117 default:
6118 ISP_DELAY(100);
6119 if (type != isp_get_response_type(isp, hp)) {
6120 /*
6121 * This is questionable- we're just papering over

--- 522 unchanged lines hidden (view full) ---

6644 XS_SET_RESID(xs, 0);
6645 *XS_STSP(xs) = SCSI_GOOD;
6646 if (XS_XFRLEN(xs)) {
6647 ISP_DMAFREE(isp, xs, fph);
6648 }
6649 if (isp->isp_nactive) {
6650 isp->isp_nactive--;
6651 }
6006#endif
6007 /* FALLTHROUGH */
6008 case RQSTYPE_REQUEST:
6009 default:
6010 ISP_DELAY(100);
6011 if (type != isp_get_response_type(isp, hp)) {
6012 /*
6013 * This is questionable- we're just papering over

--- 522 unchanged lines hidden (view full) ---

6536 XS_SET_RESID(xs, 0);
6537 *XS_STSP(xs) = SCSI_GOOD;
6538 if (XS_XFRLEN(xs)) {
6539 ISP_DMAFREE(isp, xs, fph);
6540 }
6541 if (isp->isp_nactive) {
6542 isp->isp_nactive--;
6543 }
6652 isp->isp_fphccmplt++;
6653 isp_done(xs);
6654}
6655
6656#define ISP_SCSI_IBITS(op) (mbpscsi[((op)<<1)])
6657#define ISP_SCSI_OBITS(op) (mbpscsi[((op)<<1) + 1])
6658#define ISP_SCSI_OPMAP(in, out) in, out
6659static const uint8_t mbpscsi[] = {
6660 ISP_SCSI_OPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */

--- 1650 unchanged lines hidden ---
6544 isp_done(xs);
6545}
6546
6547#define ISP_SCSI_IBITS(op) (mbpscsi[((op)<<1)])
6548#define ISP_SCSI_OBITS(op) (mbpscsi[((op)<<1) + 1])
6549#define ISP_SCSI_OPMAP(in, out) in, out
6550static const uint8_t mbpscsi[] = {
6551 ISP_SCSI_OPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */

--- 1650 unchanged lines hidden ---