Deleted Added
full compact
isp.c (202418) isp.c (203444)
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: head/sys/dev/isp/isp.c 202418 2010-01-15 20:08:08Z mjacob $");
50__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 203444 2010-02-03 21:09:32Z mjacob $");
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

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

689 * Do some sanity checking by running a NOP command.
690 * If it succeeds, the ROM firmware is now running.
691 */
692 ISP_MEMZERO(&mbs, sizeof (mbs));
693 mbs.param[0] = MBOX_NO_OP;
694 mbs.logval = MBLOGALL;
695 isp_mboxcmd(isp, &mbs);
696 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
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

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

689 * Do some sanity checking by running a NOP command.
690 * If it succeeds, the ROM firmware is now running.
691 */
692 ISP_MEMZERO(&mbs, sizeof (mbs));
693 mbs.param[0] = MBOX_NO_OP;
694 mbs.logval = MBLOGALL;
695 isp_mboxcmd(isp, &mbs);
696 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
697 isp_prt(isp, ISP_LOGERR, "NOP ommand failed (%x)", mbs.param[0]);
697 isp_prt(isp, ISP_LOGERR, "NOP command failed (%x)", mbs.param[0]);
698 ISP_RESET0(isp);
699 return;
700 }
701
702 /*
703 * Do some operational tests
704 */
705

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

4412 *tptr = XS_TIME(xs) / 1000;
4413 if (*tptr == 0 && XS_TIME(xs)) {
4414 *tptr = 1;
4415 }
4416 if (IS_24XX(isp) && *tptr > 0x1999) {
4417 *tptr = 0x1999;
4418 }
4419
698 ISP_RESET0(isp);
699 return;
700 }
701
702 /*
703 * Do some operational tests
704 */
705

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

4412 *tptr = XS_TIME(xs) / 1000;
4413 if (*tptr == 0 && XS_TIME(xs)) {
4414 *tptr = 1;
4415 }
4416 if (IS_24XX(isp) && *tptr > 0x1999) {
4417 *tptr = 0x1999;
4418 }
4419
4420 if (isp_save_xs(isp, xs, &handle)) {
4420 if (isp_allocate_xs(isp, xs, &handle)) {
4421 isp_prt(isp, ISP_LOGDEBUG0, "out of xflist pointers");
4422 XS_SETERR(xs, HBA_BOTCH);
4423 return (CMD_EAGAIN);
4424 }
4425 /* Whew. Thankfully the same for type 7 requests */
4426 reqp->req_handle = handle;
4427
4428 /*

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

5158 }
5159 if (sp->req_header.rqs_flags & RQSFLAG_BADORDER) {
5160 isp_print_bytes(isp, "invalid IOCB ordering", QENTRY_LEN, sp);
5161 ISP_WRITE(isp, isp->isp_respoutrp, optr);
5162 continue;
5163 }
5164 }
5165
4421 isp_prt(isp, ISP_LOGDEBUG0, "out of xflist pointers");
4422 XS_SETERR(xs, HBA_BOTCH);
4423 return (CMD_EAGAIN);
4424 }
4425 /* Whew. Thankfully the same for type 7 requests */
4426 reqp->req_handle = handle;
4427
4428 /*

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

5158 }
5159 if (sp->req_header.rqs_flags & RQSFLAG_BADORDER) {
5160 isp_print_bytes(isp, "invalid IOCB ordering", QENTRY_LEN, sp);
5161 ISP_WRITE(isp, isp->isp_respoutrp, optr);
5162 continue;
5163 }
5164 }
5165
5166 if ((sp->req_handle != ISP_SPCL_HANDLE) && (sp->req_handle > isp->isp_maxcmds || sp->req_handle < 1)) {
5167 isp_prt(isp, ISP_LOGERR, "bad request handle %d (type 0x%x)", sp->req_handle, etype);
5166 if (!ISP_VALID_HANDLE(isp, sp->req_handle)) {
5167 isp_prt(isp, ISP_LOGERR, "bad request handle 0x%x (iocb type 0x%x)", sp->req_handle, etype);
5168 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5169 ISP_WRITE(isp, isp->isp_respoutrp, optr);
5170 continue;
5171 }
5172 xs = isp_find_xs(isp, sp->req_handle);
5173 if (xs == NULL) {
5174 uint8_t ts = completion_status & 0xff;
5175 /*
5176 * Only whine if this isn't the expected fallout of
5177 * aborting the command or resetting the target.
5178 */
5179 if (etype != RQSTYPE_RESPONSE) {
5180 isp_prt(isp, ISP_LOGERR, "cannot find handle 0x%x (type 0x%x)", sp->req_handle, etype);
5168 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5169 ISP_WRITE(isp, isp->isp_respoutrp, optr);
5170 continue;
5171 }
5172 xs = isp_find_xs(isp, sp->req_handle);
5173 if (xs == NULL) {
5174 uint8_t ts = completion_status & 0xff;
5175 /*
5176 * Only whine if this isn't the expected fallout of
5177 * aborting the command or resetting the target.
5178 */
5179 if (etype != RQSTYPE_RESPONSE) {
5180 isp_prt(isp, ISP_LOGERR, "cannot find handle 0x%x (type 0x%x)", sp->req_handle, etype);
5181 } else if (ts != RQCS_ABORTED && ts != RQCS_RESET_OCCURRED && sp->req_handle != ISP_SPCL_HANDLE) {
5181 } else if (ts != RQCS_ABORTED && ts != RQCS_RESET_OCCURRED) {
5182 isp_prt(isp, ISP_LOGERR, "cannot find handle 0x%x (status 0x%x)", sp->req_handle, ts);
5183 }
5184 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5185 ISP_WRITE(isp, isp->isp_respoutrp, optr);
5186 continue;
5187 }
5188 if (req_status_flags & RQSTF_BUS_RESET) {
5189 XS_SETERR(xs, HBA_BUSRESET);

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

5676 rval = -1;
5677 }
5678#endif
5679 /*
5680 * We've had problems with data corruption occuring on
5681 * commands that complete (with no apparent error) after
5682 * we receive a LIP. This has been observed mostly on
5683 * Local Loop topologies. To be safe, let's just mark
5182 isp_prt(isp, ISP_LOGERR, "cannot find handle 0x%x (status 0x%x)", sp->req_handle, ts);
5183 }
5184 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5185 ISP_WRITE(isp, isp->isp_respoutrp, optr);
5186 continue;
5187 }
5188 if (req_status_flags & RQSTF_BUS_RESET) {
5189 XS_SETERR(xs, HBA_BUSRESET);

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

5676 rval = -1;
5677 }
5678#endif
5679 /*
5680 * We've had problems with data corruption occuring on
5681 * commands that complete (with no apparent error) after
5682 * we receive a LIP. This has been observed mostly on
5683 * Local Loop topologies. To be safe, let's just mark
5684 * all active commands as dead.
5684 * all active initiator commands as dead.
5685 */
5686 if (topo == TOPO_NL_PORT || topo == TOPO_FL_PORT) {
5687 int i, j;
5688 for (i = j = 0; i < isp->isp_maxcmds; i++) {
5689 XS_T *xs;
5685 */
5686 if (topo == TOPO_NL_PORT || topo == TOPO_FL_PORT) {
5687 int i, j;
5688 for (i = j = 0; i < isp->isp_maxcmds; i++) {
5689 XS_T *xs;
5690 xs = isp->isp_xflist[i];
5691 if (xs == NULL) {
5690 isp_hdl_t *hdp;
5691
5692 hdp = &isp->isp_xflist[i];
5693 if (ISP_H2HT(hdp->handle) != ISP_HANDLE_INITIATOR) {
5692 continue;
5693 }
5694 continue;
5695 }
5696 xs = hdp->cmd;
5694 if (XS_CHANNEL(xs) != chan) {
5695 continue;
5696 }
5697 j++;
5698 XS_SETERR(xs, HBA_BUSRESET);
5699 }
5700 if (j) {
5701 isp_prt(isp, ISP_LOGERR, lipd, chan, j);

--- 2685 unchanged lines hidden ---
5697 if (XS_CHANNEL(xs) != chan) {
5698 continue;
5699 }
5700 j++;
5701 XS_SETERR(xs, HBA_BUSRESET);
5702 }
5703 if (j) {
5704 isp_prt(isp, ISP_LOGERR, lipd, chan, j);

--- 2685 unchanged lines hidden ---