Deleted Added
full compact
isp.c (291265) isp.c (291365)
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 291265 2015-11-24 19:20:49Z mav $");
50__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 291365 2015-11-26 13:04:58Z 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

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

2805 int i, r;
2806 uint16_t nphdl;
2807 fcparam *fcp;
2808 isp_pdb_t pdb;
2809 NANOTIME_T hra, hrb;
2810
2811 fcp = FCPARAM(isp, chan);
2812
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

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

2805 int i, r;
2806 uint16_t nphdl;
2807 fcparam *fcp;
2808 isp_pdb_t pdb;
2809 NANOTIME_T hra, hrb;
2810
2811 fcp = FCPARAM(isp, chan);
2812
2813 if (fcp->isp_loopstate < LOOP_HAVE_LINK)
2814 return (-1);
2813 if (fcp->isp_loopstate >= LOOP_LTEST_DONE)
2814 return (0);
2815
2816 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC link test", chan);
2817 fcp->isp_loopstate = LOOP_TESTING_LINK;
2818
2819 /*
2820 * Wait up to N microseconds for F/W to go to a ready state.
2821 */
2822 GET_NANOTIME(&hra);
2823 while (1) {
2824 isp_change_fw_state(isp, chan, isp_fw_state(isp, chan));
2825 if (fcp->isp_fwstate == FW_READY) {
2826 break;
2827 }
2815 if (fcp->isp_loopstate >= LOOP_LTEST_DONE)
2816 return (0);
2817
2818 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC link test", chan);
2819 fcp->isp_loopstate = LOOP_TESTING_LINK;
2820
2821 /*
2822 * Wait up to N microseconds for F/W to go to a ready state.
2823 */
2824 GET_NANOTIME(&hra);
2825 while (1) {
2826 isp_change_fw_state(isp, chan, isp_fw_state(isp, chan));
2827 if (fcp->isp_fwstate == FW_READY) {
2828 break;
2829 }
2830 if (fcp->isp_loopstate < LOOP_TESTING_LINK)
2831 goto abort;
2828 GET_NANOTIME(&hrb);
2829 if ((NANOTIME_SUB(&hrb, &hra) / 1000 + 1000 >= usdelay))
2830 break;
2831 ISP_SLEEP(isp, 1000);
2832 }
2832 GET_NANOTIME(&hrb);
2833 if ((NANOTIME_SUB(&hrb, &hra) / 1000 + 1000 >= usdelay))
2834 break;
2835 ISP_SLEEP(isp, 1000);
2836 }
2833
2834 /*
2835 * If we haven't gone to 'ready' state, return.
2836 */
2837 if (fcp->isp_fwstate != FW_READY) {
2838 isp_prt(isp, ISP_LOG_SANCFG,
2839 "Chan %d Firmware is not ready (%s)",
2840 chan, isp_fc_fw_statename(fcp->isp_fwstate));
2841 return (-1);
2842 }
2843
2844 /*

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

2933 fcp->isp_gbspeed = 4;
2934 else if (mbs.param[1] == MBGSD_2GB)
2935 fcp->isp_gbspeed = 2;
2936 else if (mbs.param[1] == MBGSD_1GB)
2937 fcp->isp_gbspeed = 1;
2938 }
2939 }
2940
2837 if (fcp->isp_fwstate != FW_READY) {
2838 isp_prt(isp, ISP_LOG_SANCFG,
2839 "Chan %d Firmware is not ready (%s)",
2840 chan, isp_fc_fw_statename(fcp->isp_fwstate));
2841 return (-1);
2842 }
2843
2844 /*

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

2933 fcp->isp_gbspeed = 4;
2934 else if (mbs.param[1] == MBGSD_2GB)
2935 fcp->isp_gbspeed = 2;
2936 else if (mbs.param[1] == MBGSD_1GB)
2937 fcp->isp_gbspeed = 1;
2938 }
2939 }
2940
2941 if (fcp->isp_loopstate < LOOP_TESTING_LINK) {
2942abort:
2943 isp_prt(isp, ISP_LOG_SANCFG,
2944 "Chan %d FC link test aborted", chan);
2945 return (1);
2946 }
2941 fcp->isp_loopstate = LOOP_LTEST_DONE;
2942 isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGCONFIG,
2943 "Chan %d WWPN %016jx WWNN %016jx",
2944 chan, (uintmax_t)fcp->isp_wwpn, (uintmax_t)fcp->isp_wwnn);
2945 isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGCONFIG,
2946 "Chan %d %dGb %s PortID 0x%06x LoopID 0x%02x",
2947 chan, fcp->isp_gbspeed, isp_fc_toponame(fcp), fcp->isp_portid,
2948 fcp->isp_loopid);

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

2963 */
2964static int
2965isp_pdb_sync(ispsoftc_t *isp, int chan)
2966{
2967 fcparam *fcp = FCPARAM(isp, chan);
2968 fcportdb_t *lp;
2969 uint16_t dbidx;
2970
2947 fcp->isp_loopstate = LOOP_LTEST_DONE;
2948 isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGCONFIG,
2949 "Chan %d WWPN %016jx WWNN %016jx",
2950 chan, (uintmax_t)fcp->isp_wwpn, (uintmax_t)fcp->isp_wwnn);
2951 isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGCONFIG,
2952 "Chan %d %dGb %s PortID 0x%06x LoopID 0x%02x",
2953 chan, fcp->isp_gbspeed, isp_fc_toponame(fcp), fcp->isp_portid,
2954 fcp->isp_loopid);

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

2969 */
2970static int
2971isp_pdb_sync(ispsoftc_t *isp, int chan)
2972{
2973 fcparam *fcp = FCPARAM(isp, chan);
2974 fcportdb_t *lp;
2975 uint16_t dbidx;
2976
2971 if (fcp->isp_loopstate < LOOP_FSCAN_DONE) {
2977 if (fcp->isp_loopstate < LOOP_FSCAN_DONE)
2972 return (-1);
2978 return (-1);
2973 }
2974 if (fcp->isp_loopstate > LOOP_SYNCING_PDB) {
2979 if (fcp->isp_loopstate >= LOOP_READY)
2975 return (0);
2980 return (0);
2976 }
2977
2978 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC PDB sync", chan);
2979
2980 fcp->isp_loopstate = LOOP_SYNCING_PDB;
2981
2982 for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) {
2983 lp = &fcp->portdb[dbidx];
2984

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

3020 default:
3021 isp_prt(isp, ISP_LOGWARN,
3022 "isp_pdb_sync: state %d for idx %d",
3023 lp->state, dbidx);
3024 isp_dump_portdb(isp, chan);
3025 }
3026 }
3027
2981
2982 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC PDB sync", chan);
2983
2984 fcp->isp_loopstate = LOOP_SYNCING_PDB;
2985
2986 for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) {
2987 lp = &fcp->portdb[dbidx];
2988

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

3024 default:
3025 isp_prt(isp, ISP_LOGWARN,
3026 "isp_pdb_sync: state %d for idx %d",
3027 lp->state, dbidx);
3028 isp_dump_portdb(isp, chan);
3029 }
3030 }
3031
3028 /*
3029 * If we get here, we've for sure seen not only a valid loop
3030 * but know what is or isn't on it, so mark this for usage
3031 * in isp_start.
3032 */
3033 fcp->loop_seen_once = 1;
3032 if (fcp->isp_loopstate < LOOP_SYNCING_PDB) {
3033 isp_prt(isp, ISP_LOG_SANCFG,
3034 "Chan %d FC PDB sync aborted", chan);
3035 return (1);
3036 }
3037
3034 fcp->isp_loopstate = LOOP_READY;
3035 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC PDB sync done", chan);
3036 return (0);
3037}
3038
3039static void
3040isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_t *pdb)
3041{

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

3149isp_scan_loop(ispsoftc_t *isp, int chan)
3150{
3151 fcparam *fcp = FCPARAM(isp, chan);
3152 int idx, lim, r;
3153 isp_pdb_t pdb;
3154 uint16_t handles[LOCAL_LOOP_LIM];
3155 uint16_t handle;
3156
3038 fcp->isp_loopstate = LOOP_READY;
3039 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC PDB sync done", chan);
3040 return (0);
3041}
3042
3043static void
3044isp_pdb_add_update(ispsoftc_t *isp, int chan, isp_pdb_t *pdb)
3045{

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

3153isp_scan_loop(ispsoftc_t *isp, int chan)
3154{
3155 fcparam *fcp = FCPARAM(isp, chan);
3156 int idx, lim, r;
3157 isp_pdb_t pdb;
3158 uint16_t handles[LOCAL_LOOP_LIM];
3159 uint16_t handle;
3160
3157 if (fcp->isp_loopstate < LOOP_LTEST_DONE) {
3161 if (fcp->isp_loopstate < LOOP_LTEST_DONE)
3158 return (-1);
3162 return (-1);
3159 }
3160 if (fcp->isp_loopstate > LOOP_SCANNING_LOOP) {
3163 if (fcp->isp_loopstate >= LOOP_LSCAN_DONE)
3161 return (0);
3164 return (0);
3162 }
3165
3163 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC loop scan", chan);
3164 fcp->isp_loopstate = LOOP_SCANNING_LOOP;
3165 if (TOPO_IS_FABRIC(fcp->isp_topo)) {
3166 if (!IS_24XX(isp)) {
3167 isp_fix_portids(isp, chan);
3168 if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
3169 goto abort;
3170 }

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

3209 * In older cards with older f/w GET_PORT_DATABASE has been
3210 * known to hang. This trick gets around that problem.
3211 */
3212 if (IS_2100(isp) || IS_2200(isp)) {
3213 uint64_t node_wwn = isp_get_wwn(isp, chan, handle, 1);
3214 if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) {
3215abort:
3216 isp_prt(isp, ISP_LOG_SANCFG,
3166 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC loop scan", chan);
3167 fcp->isp_loopstate = LOOP_SCANNING_LOOP;
3168 if (TOPO_IS_FABRIC(fcp->isp_topo)) {
3169 if (!IS_24XX(isp)) {
3170 isp_fix_portids(isp, chan);
3171 if (fcp->isp_loopstate < LOOP_SCANNING_LOOP)
3172 goto abort;
3173 }

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

3212 * In older cards with older f/w GET_PORT_DATABASE has been
3213 * known to hang. This trick gets around that problem.
3214 */
3215 if (IS_2100(isp) || IS_2200(isp)) {
3216 uint64_t node_wwn = isp_get_wwn(isp, chan, handle, 1);
3217 if (fcp->isp_loopstate < LOOP_SCANNING_LOOP) {
3218abort:
3219 isp_prt(isp, ISP_LOG_SANCFG,
3217 "Chan %d FC loop scan done (abort)", chan);
3218 return (-1);
3220 "Chan %d FC loop scan aborted", chan);
3221 return (1);
3219 }
3220 if (node_wwn == INI_NONE) {
3221 continue;
3222 }
3223 }
3224
3225 /*
3226 * Get the port database entity for this index.

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

3419 fcparam *fcp = FCPARAM(isp, chan);
3420 fcportdb_t *lp;
3421 uint32_t portid;
3422 uint16_t nphdl;
3423 isp_pdb_t pdb;
3424 int portidx, portlim, r;
3425 sns_gid_ft_rsp_t *rs0, *rs1;
3426
3222 }
3223 if (node_wwn == INI_NONE) {
3224 continue;
3225 }
3226 }
3227
3228 /*
3229 * Get the port database entity for this index.

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

3422 fcparam *fcp = FCPARAM(isp, chan);
3423 fcportdb_t *lp;
3424 uint32_t portid;
3425 uint16_t nphdl;
3426 isp_pdb_t pdb;
3427 int portidx, portlim, r;
3428 sns_gid_ft_rsp_t *rs0, *rs1;
3429
3427 if (fcp->isp_loopstate < LOOP_LSCAN_DONE) {
3430 if (fcp->isp_loopstate < LOOP_LSCAN_DONE)
3428 return (-1);
3431 return (-1);
3429 }
3430 if (fcp->isp_loopstate > LOOP_SCANNING_FABRIC) {
3432 if (fcp->isp_loopstate >= LOOP_FSCAN_DONE)
3431 return (0);
3433 return (0);
3432 }
3434
3433 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC fabric scan", chan);
3434 fcp->isp_loopstate = LOOP_SCANNING_FABRIC;
3435 if (!TOPO_IS_FABRIC(fcp->isp_topo)) {
3436 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3437 isp_prt(isp, ISP_LOG_SANCFG,
3438 "Chan %d FC fabric scan done (no fabric)", chan);
3439 return (0);
3440 }

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

3445 isp_prt(isp, ISP_LOG_SANCFG,
3446 "Chan %d FC fabric scan done (bad)", chan);
3447 return (-1);
3448 }
3449 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
3450abort:
3451 FC_SCRATCH_RELEASE(isp, chan);
3452 isp_prt(isp, ISP_LOG_SANCFG,
3435 isp_prt(isp, ISP_LOG_SANCFG, "Chan %d FC fabric scan", chan);
3436 fcp->isp_loopstate = LOOP_SCANNING_FABRIC;
3437 if (!TOPO_IS_FABRIC(fcp->isp_topo)) {
3438 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3439 isp_prt(isp, ISP_LOG_SANCFG,
3440 "Chan %d FC fabric scan done (no fabric)", chan);
3441 return (0);
3442 }

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

3447 isp_prt(isp, ISP_LOG_SANCFG,
3448 "Chan %d FC fabric scan done (bad)", chan);
3449 return (-1);
3450 }
3451 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC) {
3452abort:
3453 FC_SCRATCH_RELEASE(isp, chan);
3454 isp_prt(isp, ISP_LOG_SANCFG,
3453 "Chan %d FC fabric scan done (abort)", chan);
3454 return (-1);
3455 "Chan %d FC fabric scan aborted", chan);
3456 return (1);
3455 }
3456
3457 /*
3458 * Make sure we still are logged into the fabric controller.
3459 */
3460 nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID;
3461 r = isp_getpdb(isp, chan, nphdl, &pdb, 0);
3462 if ((r & 0xffff) == MBOX_NOT_LOGGED_IN) {

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

3473 r = isp_gid_ft_ct_passthru(isp, chan);
3474 else
3475 r = isp_gid_ft_sns(isp, chan);
3476 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3477 goto abort;
3478 if (r > 0) {
3479 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3480 FC_SCRATCH_RELEASE(isp, chan);
3457 }
3458
3459 /*
3460 * Make sure we still are logged into the fabric controller.
3461 */
3462 nphdl = IS_24XX(isp) ? NPH_FL_ID : FL_ID;
3463 r = isp_getpdb(isp, chan, nphdl, &pdb, 0);
3464 if ((r & 0xffff) == MBOX_NOT_LOGGED_IN) {

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

3475 r = isp_gid_ft_ct_passthru(isp, chan);
3476 else
3477 r = isp_gid_ft_sns(isp, chan);
3478 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3479 goto abort;
3480 if (r > 0) {
3481 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3482 FC_SCRATCH_RELEASE(isp, chan);
3481 return (0);
3483 return (-1);
3482 } else if (r < 0) {
3483 fcp->isp_loopstate = LOOP_LTEST_DONE; /* try again */
3484 FC_SCRATCH_RELEASE(isp, chan);
3484 } else if (r < 0) {
3485 fcp->isp_loopstate = LOOP_LTEST_DONE; /* try again */
3486 FC_SCRATCH_RELEASE(isp, chan);
3485 return (0);
3487 return (-1);
3486 }
3487
3488 MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN, chan);
3489 rs0 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+IGPOFF);
3490 rs1 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+OGPOFF);
3491 isp_get_gid_ft_response(isp, rs0, rs1, NGENT);
3492 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3493 goto abort;

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

3499 level = ISP_LOGWARN;
3500 }
3501 isp_prt(isp, level, "Chan %d Fabric Nameserver rejected GID_FT"
3502 " (Reason=0x%x Expl=0x%x)", chan,
3503 rs1->snscb_cthdr.ct_reason,
3504 rs1->snscb_cthdr.ct_explanation);
3505 FC_SCRATCH_RELEASE(isp, chan);
3506 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3488 }
3489
3490 MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN, chan);
3491 rs0 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+IGPOFF);
3492 rs1 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+OGPOFF);
3493 isp_get_gid_ft_response(isp, rs0, rs1, NGENT);
3494 if (fcp->isp_loopstate < LOOP_SCANNING_FABRIC)
3495 goto abort;

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

3501 level = ISP_LOGWARN;
3502 }
3503 isp_prt(isp, level, "Chan %d Fabric Nameserver rejected GID_FT"
3504 " (Reason=0x%x Expl=0x%x)", chan,
3505 rs1->snscb_cthdr.ct_reason,
3506 rs1->snscb_cthdr.ct_explanation);
3507 FC_SCRATCH_RELEASE(isp, chan);
3508 fcp->isp_loopstate = LOOP_FSCAN_DONE;
3507 return (0);
3509 return (-1);
3508 }
3509
3510 /* Check our buffer was big enough to get the full list. */
3511 for (portidx = 0; portidx < NGENT-1; portidx++) {
3512 if (rs1->snscb_ports[portidx].control & 0x80)
3513 break;
3514 }
3515 if ((rs1->snscb_ports[portidx].control & 0x80) == 0) {

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

5652 /*
5653 * These are broadcast events that have to be sent across
5654 * all active channels.
5655 */
5656 for (chan = 0; chan < isp->isp_nchan; chan++) {
5657 fcp = FCPARAM(isp, chan);
5658 int topo = fcp->isp_topo;
5659
3510 }
3511
3512 /* Check our buffer was big enough to get the full list. */
3513 for (portidx = 0; portidx < NGENT-1; portidx++) {
3514 if (rs1->snscb_ports[portidx].control & 0x80)
3515 break;
3516 }
3517 if ((rs1->snscb_ports[portidx].control & 0x80) == 0) {

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

5654 /*
5655 * These are broadcast events that have to be sent across
5656 * all active channels.
5657 */
5658 for (chan = 0; chan < isp->isp_nchan; chan++) {
5659 fcp = FCPARAM(isp, chan);
5660 int topo = fcp->isp_topo;
5661
5660 if (fcp->role == ISP_ROLE_NONE) {
5662 if (fcp->role == ISP_ROLE_NONE)
5661 continue;
5663 continue;
5662 }
5663
5664 fcp->isp_loopstate = LOOP_NIL;
5664 if (fcp->isp_loopstate > LOOP_HAVE_LINK)
5665 fcp->isp_loopstate = LOOP_HAVE_LINK;
5665 ISP_SET_SENDMARKER(isp, chan, 1);
5666 isp_async(isp, ISPASYNC_LIP, chan);
5667#ifdef ISP_TARGET_MODE
5668 if (isp_target_async(isp, chan, mbox)) {
5669 acked = 1;
5670 }
5671#endif
5672 /*

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

5709 /*
5710 * This is a broadcast event that has to be sent across
5711 * all active channels.
5712 */
5713 for (chan = 0; chan < isp->isp_nchan; chan++) {
5714 fcp = FCPARAM(isp, chan);
5715 if (fcp->role == ISP_ROLE_NONE)
5716 continue;
5666 ISP_SET_SENDMARKER(isp, chan, 1);
5667 isp_async(isp, ISPASYNC_LIP, chan);
5668#ifdef ISP_TARGET_MODE
5669 if (isp_target_async(isp, chan, mbox)) {
5670 acked = 1;
5671 }
5672#endif
5673 /*

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

5710 /*
5711 * This is a broadcast event that has to be sent across
5712 * all active channels.
5713 */
5714 for (chan = 0; chan < isp->isp_nchan; chan++) {
5715 fcp = FCPARAM(isp, chan);
5716 if (fcp->role == ISP_ROLE_NONE)
5717 continue;
5718 fcp->isp_linkstate = 1;
5719 if (fcp->isp_loopstate < LOOP_HAVE_LINK)
5720 fcp->isp_loopstate = LOOP_HAVE_LINK;
5717 ISP_SET_SENDMARKER(isp, chan, 1);
5718 isp_async(isp, ISPASYNC_LOOP_UP, chan);
5719#ifdef ISP_TARGET_MODE
5720 if (isp_target_async(isp, chan, mbox)) {
5721 acked = 1;
5722 }
5723#endif
5724 }

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

5729 * This is a broadcast event that has to be sent across
5730 * all active channels.
5731 */
5732 for (chan = 0; chan < isp->isp_nchan; chan++) {
5733 fcp = FCPARAM(isp, chan);
5734 if (fcp->role == ISP_ROLE_NONE)
5735 continue;
5736 ISP_SET_SENDMARKER(isp, chan, 1);
5721 ISP_SET_SENDMARKER(isp, chan, 1);
5722 isp_async(isp, ISPASYNC_LOOP_UP, chan);
5723#ifdef ISP_TARGET_MODE
5724 if (isp_target_async(isp, chan, mbox)) {
5725 acked = 1;
5726 }
5727#endif
5728 }

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

5733 * This is a broadcast event that has to be sent across
5734 * all active channels.
5735 */
5736 for (chan = 0; chan < isp->isp_nchan; chan++) {
5737 fcp = FCPARAM(isp, chan);
5738 if (fcp->role == ISP_ROLE_NONE)
5739 continue;
5740 ISP_SET_SENDMARKER(isp, chan, 1);
5741 fcp->isp_linkstate = 0;
5737 fcp->isp_loopstate = LOOP_NIL;
5738 isp_async(isp, ISPASYNC_LOOP_DOWN, chan);
5739#ifdef ISP_TARGET_MODE
5740 if (isp_target_async(isp, chan, mbox)) {
5741 acked = 1;
5742 }
5743#endif
5744 }

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

5749 * This is a broadcast event that has to be sent across
5750 * all active channels.
5751 */
5752 for (chan = 0; chan < isp->isp_nchan; chan++) {
5753 fcp = FCPARAM(isp, chan);
5754 if (fcp->role == ISP_ROLE_NONE)
5755 continue;
5756 ISP_SET_SENDMARKER(isp, chan, 1);
5742 fcp->isp_loopstate = LOOP_NIL;
5743 isp_async(isp, ISPASYNC_LOOP_DOWN, chan);
5744#ifdef ISP_TARGET_MODE
5745 if (isp_target_async(isp, chan, mbox)) {
5746 acked = 1;
5747 }
5748#endif
5749 }

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

5754 * This is a broadcast event that has to be sent across
5755 * all active channels.
5756 */
5757 for (chan = 0; chan < isp->isp_nchan; chan++) {
5758 fcp = FCPARAM(isp, chan);
5759 if (fcp->role == ISP_ROLE_NONE)
5760 continue;
5761 ISP_SET_SENDMARKER(isp, chan, 1);
5757 fcp->isp_loopstate = LOOP_NIL;
5762 if (fcp->isp_loopstate > LOOP_HAVE_LINK)
5763 fcp->isp_loopstate = LOOP_HAVE_LINK;
5758 isp_async(isp, ISPASYNC_LOOP_RESET, chan);
5759#ifdef ISP_TARGET_MODE
5760 if (isp_target_async(isp, chan, mbox)) {
5761 acked = 1;
5762 }
5763#endif
5764 }
5765 break;

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

5792 chan = echan = 0;
5793 }
5794 for (; chan <= echan; chan++) {
5795 fcp = FCPARAM(isp, chan);
5796 if (fcp->role == ISP_ROLE_NONE)
5797 continue;
5798 if (fcp->isp_loopstate > LOOP_LTEST_DONE)
5799 fcp->isp_loopstate = LOOP_LTEST_DONE;
5764 isp_async(isp, ISPASYNC_LOOP_RESET, chan);
5765#ifdef ISP_TARGET_MODE
5766 if (isp_target_async(isp, chan, mbox)) {
5767 acked = 1;
5768 }
5769#endif
5770 }
5771 break;

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

5798 chan = echan = 0;
5799 }
5800 for (; chan <= echan; chan++) {
5801 fcp = FCPARAM(isp, chan);
5802 if (fcp->role == ISP_ROLE_NONE)
5803 continue;
5804 if (fcp->isp_loopstate > LOOP_LTEST_DONE)
5805 fcp->isp_loopstate = LOOP_LTEST_DONE;
5806 else if (fcp->isp_loopstate < LOOP_HAVE_LINK)
5807 fcp->isp_loopstate = LOOP_HAVE_LINK;
5800 isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan,
5801 ISPASYNC_CHANGE_PDB, nphdl, nlstate, reason);
5802 }
5803 break;
5804 }
5805 case ASYNC_CHANGE_NOTIFY:
5806 {
5807 int portid;

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

5815 } else {
5816 chan = 0;
5817 }
5818 fcp = FCPARAM(isp, chan);
5819 if (fcp->role == ISP_ROLE_NONE)
5820 break;
5821 if (fcp->isp_loopstate > LOOP_LTEST_DONE)
5822 fcp->isp_loopstate = LOOP_LTEST_DONE;
5808 isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan,
5809 ISPASYNC_CHANGE_PDB, nphdl, nlstate, reason);
5810 }
5811 break;
5812 }
5813 case ASYNC_CHANGE_NOTIFY:
5814 {
5815 int portid;

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

5823 } else {
5824 chan = 0;
5825 }
5826 fcp = FCPARAM(isp, chan);
5827 if (fcp->role == ISP_ROLE_NONE)
5828 break;
5829 if (fcp->isp_loopstate > LOOP_LTEST_DONE)
5830 fcp->isp_loopstate = LOOP_LTEST_DONE;
5831 else if (fcp->isp_loopstate < LOOP_HAVE_LINK)
5832 fcp->isp_loopstate = LOOP_HAVE_LINK;
5823 isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan,
5824 ISPASYNC_CHANGE_SNS, portid);
5825 break;
5826 }
5827 case ASYNC_ERR_LOGGING_DISABLED:
5828 isp_prt(isp, ISP_LOGWARN, "Error logging disabled (reason 0x%x)",
5829 ISP_READ(isp, OUTMAILBOX1));
5830 break;

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

5862 "Looped Back in Point-to-Point mode");
5863 break;
5864 default:
5865 isp_prt(isp, ISP_LOGWARN,
5866 "Unknown connection mode (0x%x)", mbox);
5867 break;
5868 }
5869 ISP_SET_SENDMARKER(isp, chan, 1);
5833 isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan,
5834 ISPASYNC_CHANGE_SNS, portid);
5835 break;
5836 }
5837 case ASYNC_ERR_LOGGING_DISABLED:
5838 isp_prt(isp, ISP_LOGWARN, "Error logging disabled (reason 0x%x)",
5839 ISP_READ(isp, OUTMAILBOX1));
5840 break;

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

5872 "Looped Back in Point-to-Point mode");
5873 break;
5874 default:
5875 isp_prt(isp, ISP_LOGWARN,
5876 "Unknown connection mode (0x%x)", mbox);
5877 break;
5878 }
5879 ISP_SET_SENDMARKER(isp, chan, 1);
5870 FCPARAM(isp, chan)->isp_loopstate = LOOP_NIL;
5880 FCPARAM(isp, chan)->isp_loopstate = LOOP_HAVE_LINK;
5871 isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan, ISPASYNC_CHANGE_OTHER);
5872 break;
5873 case ASYNC_P2P_INIT_ERR:
5874 isp_prt(isp, ISP_LOGWARN, "P2P init error (reason 0x%x)",
5875 ISP_READ(isp, OUTMAILBOX1));
5876 break;
5877 case ASYNC_RCV_ERR:
5878 if (IS_24XX(isp)) {

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

5934 case RQSTYPE_RPT_ID_ACQ:
5935 isp_get_ridacq(isp, (isp_ridacq_t *)hp, &rid);
5936 if (rid.ridacq_format == 0) {
5937 for (chan = 0; chan < isp->isp_nchan; chan++) {
5938 fcparam *fcp = FCPARAM(isp, chan);
5939 if (fcp->role == ISP_ROLE_NONE)
5940 continue;
5941 c = (chan == 0) ? 127 : (chan - 1);
5881 isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan, ISPASYNC_CHANGE_OTHER);
5882 break;
5883 case ASYNC_P2P_INIT_ERR:
5884 isp_prt(isp, ISP_LOGWARN, "P2P init error (reason 0x%x)",
5885 ISP_READ(isp, OUTMAILBOX1));
5886 break;
5887 case ASYNC_RCV_ERR:
5888 if (IS_24XX(isp)) {

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

5944 case RQSTYPE_RPT_ID_ACQ:
5945 isp_get_ridacq(isp, (isp_ridacq_t *)hp, &rid);
5946 if (rid.ridacq_format == 0) {
5947 for (chan = 0; chan < isp->isp_nchan; chan++) {
5948 fcparam *fcp = FCPARAM(isp, chan);
5949 if (fcp->role == ISP_ROLE_NONE)
5950 continue;
5951 c = (chan == 0) ? 127 : (chan - 1);
5942 if (rid.ridacq_map[c / 16] & (1 << (c % 16))) {
5943 fcp->isp_loopstate = LOOP_NIL;
5952 if (rid.ridacq_map[c / 16] & (1 << (c % 16)) ||
5953 chan == 0) {
5954 fcp->isp_loopstate = LOOP_HAVE_LINK;
5944 isp_async(isp, ISPASYNC_CHANGE_NOTIFY,
5945 chan, ISPASYNC_CHANGE_OTHER);
5955 isp_async(isp, ISPASYNC_CHANGE_NOTIFY,
5956 chan, ISPASYNC_CHANGE_OTHER);
5957 } else {
5958 fcp->isp_loopstate = LOOP_NIL;
5959 isp_async(isp, ISPASYNC_LOOP_DOWN,
5960 chan);
5946 }
5947 }
5948 } else {
5961 }
5962 }
5963 } else {
5949 FCPARAM(isp, rid.ridacq_vp_index)->isp_loopstate = LOOP_NIL;
5950 isp_async(isp, ISPASYNC_CHANGE_NOTIFY,
5951 rid.ridacq_vp_index, ISPASYNC_CHANGE_OTHER);
5964 fcparam *fcp = FCPARAM(isp, rid.ridacq_vp_index);
5965 if (rid.ridacq_vp_status == RIDACQ_STS_COMPLETE ||
5966 rid.ridacq_vp_status == RIDACQ_STS_CHANGED) {
5967 fcp->isp_loopstate = LOOP_HAVE_LINK;
5968 isp_async(isp, ISPASYNC_CHANGE_NOTIFY,
5969 rid.ridacq_vp_index, ISPASYNC_CHANGE_OTHER);
5970 } else {
5971 fcp->isp_loopstate = LOOP_NIL;
5972 isp_async(isp, ISPASYNC_LOOP_DOWN,
5973 rid.ridacq_vp_index);
5974 }
5952 }
5953 return (1);
5954 case RQSTYPE_ATIO:
5955 case RQSTYPE_CTIO:
5956 case RQSTYPE_ENABLE_LUN:
5957 case RQSTYPE_MODIFY_LUN:
5958 case RQSTYPE_NOTIFY:
5959 case RQSTYPE_NOTIFY_ACK:

--- 2333 unchanged lines hidden ---
5975 }
5976 return (1);
5977 case RQSTYPE_ATIO:
5978 case RQSTYPE_CTIO:
5979 case RQSTYPE_ENABLE_LUN:
5980 case RQSTYPE_MODIFY_LUN:
5981 case RQSTYPE_NOTIFY:
5982 case RQSTYPE_NOTIFY_ACK:

--- 2333 unchanged lines hidden ---