Deleted Added
full compact
isp_freebsd.c (208895) isp_freebsd.c (215034)
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 * 1. Redistributions of source code must retain the above copyright

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

23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27/*
28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
29 */
30#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 * 1. Redistributions of source code must retain the above copyright

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

23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27/*
28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
29 */
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 208895 2010-06-07 17:39:36Z mjacob $");
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 215034 2010-11-09 10:59:09Z brucec $");
32#include <dev/isp/isp_freebsd.h>
33#include <sys/unistd.h>
34#include <sys/kthread.h>
35#include <sys/conf.h>
36#include <sys/module.h>
37#include <sys/ioccom.h>
38#include <dev/isp/isp_ioctl.h>
39#include <sys/devicestat.h>

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

1785 int status, bus;
1786 struct ccb_accept_tio *atiop;
1787 atio_private_data_t *atp;
1788
1789 /*
1790 * The firmware status (except for the QLTM_SVALID bit)
1791 * indicates why this ATIO was sent to us.
1792 *
32#include <dev/isp/isp_freebsd.h>
33#include <sys/unistd.h>
34#include <sys/kthread.h>
35#include <sys/conf.h>
36#include <sys/module.h>
37#include <sys/ioccom.h>
38#include <dev/isp/isp_ioctl.h>
39#include <sys/devicestat.h>

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

1785 int status, bus;
1786 struct ccb_accept_tio *atiop;
1787 atio_private_data_t *atp;
1788
1789 /*
1790 * The firmware status (except for the QLTM_SVALID bit)
1791 * indicates why this ATIO was sent to us.
1792 *
1793 * If QLTM_SVALID is set, the firware has recommended Sense Data.
1793 * If QLTM_SVALID is set, the firmware has recommended Sense Data.
1794 *
1795 * If the DISCONNECTS DISABLED bit is set in the flags field,
1796 * we're still connected on the SCSI bus.
1797 */
1798 status = aep->at_status;
1799 if ((status & ~QLTM_SVALID) == AT_PHASE_ERROR) {
1800 /*
1801 * Bus Phase Sequence error. We should have sense data

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

1912 uint16_t nphdl;
1913 atio_private_data_t *atp;
1914 inot_private_data_t *ntp;
1915
1916 /*
1917 * The firmware status (except for the QLTM_SVALID bit)
1918 * indicates why this ATIO was sent to us.
1919 *
1794 *
1795 * If the DISCONNECTS DISABLED bit is set in the flags field,
1796 * we're still connected on the SCSI bus.
1797 */
1798 status = aep->at_status;
1799 if ((status & ~QLTM_SVALID) == AT_PHASE_ERROR) {
1800 /*
1801 * Bus Phase Sequence error. We should have sense data

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

1912 uint16_t nphdl;
1913 atio_private_data_t *atp;
1914 inot_private_data_t *ntp;
1915
1916 /*
1917 * The firmware status (except for the QLTM_SVALID bit)
1918 * indicates why this ATIO was sent to us.
1919 *
1920 * If QLTM_SVALID is set, the firware has recommended Sense Data.
1920 * If QLTM_SVALID is set, the firmware has recommended Sense Data.
1921 */
1922 if ((aep->at_status & ~QLTM_SVALID) != AT_CDB) {
1923 isp_prt(isp, ISP_LOGWARN, "bogus atio (0x%x) leaked to platform", aep->at_status);
1924 isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
1925 return;
1926 }
1927
1928 if (ISP_CAP_SCCFW(isp)) {

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

2576 switch (inot->in_status) {
2577 case IN24XX_ELS_RCVD:
2578 {
2579 char buf[16], *msg;
2580 int chan = ISP_GET_VPIDX(isp, inot->in_vpidx);
2581
2582 /*
2583 * Note that we're just getting notification that an ELS was received
1921 */
1922 if ((aep->at_status & ~QLTM_SVALID) != AT_CDB) {
1923 isp_prt(isp, ISP_LOGWARN, "bogus atio (0x%x) leaked to platform", aep->at_status);
1924 isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0);
1925 return;
1926 }
1927
1928 if (ISP_CAP_SCCFW(isp)) {

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

2576 switch (inot->in_status) {
2577 case IN24XX_ELS_RCVD:
2578 {
2579 char buf[16], *msg;
2580 int chan = ISP_GET_VPIDX(isp, inot->in_vpidx);
2581
2582 /*
2583 * Note that we're just getting notification that an ELS was received
2584 * (possibly with some associcated information sent upstream). This is
2584 * (possibly with some associated information sent upstream). This is
2585 * *not* the same as being given the ELS frame to accept or reject.
2586 */
2587 switch (inot->in_status_subcode) {
2588 case LOGO:
2589 msg = "LOGO";
2590 if (ISP_FW_NEWER_THAN(isp, 4, 0, 25)) {
2591 ptr = (uint8_t *)inot; /* point to unswizzled entry! */
2592 wwn = (((uint64_t) ptr[IN24XX_LOGO_WWPN_OFF]) << 56) |

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

2779 if (mp->nt_need_ack) {
2780 isp_prt(isp, ISP_LOGTINFO, "Notify Code 0x%x (qevalid=%d) being acked", mp->nt_ncode, mp->nt_lreserved != NULL);
2781 return (isp_notify_ack(isp, mp->nt_lreserved));
2782 }
2783 return (0);
2784}
2785
2786/*
2585 * *not* the same as being given the ELS frame to accept or reject.
2586 */
2587 switch (inot->in_status_subcode) {
2588 case LOGO:
2589 msg = "LOGO";
2590 if (ISP_FW_NEWER_THAN(isp, 4, 0, 25)) {
2591 ptr = (uint8_t *)inot; /* point to unswizzled entry! */
2592 wwn = (((uint64_t) ptr[IN24XX_LOGO_WWPN_OFF]) << 56) |

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

2779 if (mp->nt_need_ack) {
2780 isp_prt(isp, ISP_LOGTINFO, "Notify Code 0x%x (qevalid=%d) being acked", mp->nt_ncode, mp->nt_lreserved != NULL);
2781 return (isp_notify_ack(isp, mp->nt_lreserved));
2782 }
2783 return (0);
2784}
2785
2786/*
2787 * Handle task managment functions.
2787 * Handle task management functions.
2788 *
2789 * We show up here with a notify structure filled out.
2790 *
2791 * The nt_lreserved tag points to the original queue entry
2792 */
2793static void
2794isp_handle_platform_target_tmf(ispsoftc_t *isp, isp_notify_t *notify)
2795{

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

2889 (void) isp_acknak_abts(isp, notify->nt_lreserved, ENOMEM);
2890 } else {
2891 (void) isp_notify_ack(isp, notify->nt_lreserved);
2892 }
2893 }
2894}
2895
2896/*
2788 *
2789 * We show up here with a notify structure filled out.
2790 *
2791 * The nt_lreserved tag points to the original queue entry
2792 */
2793static void
2794isp_handle_platform_target_tmf(ispsoftc_t *isp, isp_notify_t *notify)
2795{

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

2889 (void) isp_acknak_abts(isp, notify->nt_lreserved, ENOMEM);
2890 } else {
2891 (void) isp_notify_ack(isp, notify->nt_lreserved);
2892 }
2893 }
2894}
2895
2896/*
2897 * Find the associated private data and makr it as dead so
2897 * Find the associated private data and mark it as dead so
2898 * we don't try to work on it any further.
2899 */
2900static void
2901isp_target_mark_aborted(ispsoftc_t *isp, union ccb *ccb)
2902{
2903 tstate_t *tptr;
2904 atio_private_data_t *atp;
2905

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

5363 }
5364 return (0x400000007F000009ull);
5365 } else {
5366 seed = iswwnn ? fc->def_wwnn : fc->def_wwpn;
5367 }
5368
5369
5370 /*
2898 * we don't try to work on it any further.
2899 */
2900static void
2901isp_target_mark_aborted(ispsoftc_t *isp, union ccb *ccb)
2902{
2903 tstate_t *tptr;
2904 atio_private_data_t *atp;
2905

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

5363 }
5364 return (0x400000007F000009ull);
5365 } else {
5366 seed = iswwnn ? fc->def_wwnn : fc->def_wwpn;
5367 }
5368
5369
5370 /*
5371 * For channel zero just return what we have. For either ACIIVE or
5371 * For channel zero just return what we have. For either ACTIVE or
5372 * DEFAULT cases, we depend on default override of NVRAM values for
5373 * channel zero.
5374 */
5375 if (chan == 0) {
5376 return (seed);
5377 }
5378
5379 /*

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

5399 * The type 2 NAA fields for QLogic cards appear be laid out
5400 * thusly:
5401 *
5402 * bits 63..60 NAA == 2 bits 59..57 unused/zero bit 56
5403 * port (1) or node (0) WWN distinguishor bit 48
5404 * physical port on dual-port chips (23XX/24XX)
5405 *
5406 * This is somewhat nutty, particularly since bit 48 is
5372 * DEFAULT cases, we depend on default override of NVRAM values for
5373 * channel zero.
5374 */
5375 if (chan == 0) {
5376 return (seed);
5377 }
5378
5379 /*

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

5399 * The type 2 NAA fields for QLogic cards appear be laid out
5400 * thusly:
5401 *
5402 * bits 63..60 NAA == 2 bits 59..57 unused/zero bit 56
5403 * port (1) or node (0) WWN distinguishor bit 48
5404 * physical port on dual-port chips (23XX/24XX)
5405 *
5406 * This is somewhat nutty, particularly since bit 48 is
5407 * irrelevant as they assign seperate serial numbers to
5407 * irrelevant as they assign separate serial numbers to
5408 * different physical ports anyway.
5409 *
5410 * We'll stick our channel number plus one first into bits
5411 * 57..59 and thence into bits 52..55 which allows for 8 bits
5412 * of channel which is comfortably more than our maximum
5413 * (126) now.
5414 */
5415 seed &= ~0x0FF0000000000000ULL;

--- 196 unchanged lines hidden ---
5408 * different physical ports anyway.
5409 *
5410 * We'll stick our channel number plus one first into bits
5411 * 57..59 and thence into bits 52..55 which allows for 8 bits
5412 * of channel which is comfortably more than our maximum
5413 * (126) now.
5414 */
5415 seed &= ~0x0FF0000000000000ULL;

--- 196 unchanged lines hidden ---