Deleted Added
full compact
isp_library.c (290980) isp_library.c (290993)
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 *

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

30 */
31#ifdef __NetBSD__
32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD$");
34#include <dev/ic/isp_netbsd.h>
35#endif
36#ifdef __FreeBSD__
37#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 *

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

30 */
31#ifdef __NetBSD__
32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD$");
34#include <dev/ic/isp_netbsd.h>
35#endif
36#ifdef __FreeBSD__
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/dev/isp/isp_library.c 290980 2015-11-17 14:13:55Z mav $");
38__FBSDID("$FreeBSD: head/sys/dev/isp/isp_library.c 290993 2015-11-17 16:33:46Z mav $");
39#include <dev/isp/isp_freebsd.h>
40#endif
41#ifdef __OpenBSD__
42#include <dev/ic/isp_openbsd.h>
43#endif
44#ifdef __linux__
45#include "isp_linux.h"
46#endif

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

395isp_fc_runstate(ispsoftc_t *isp, int chan, int tval)
396{
397 fcparam *fcp;
398
399 fcp = FCPARAM(isp, chan);
400 if (fcp->role == ISP_ROLE_NONE) {
401 return (0);
402 }
39#include <dev/isp/isp_freebsd.h>
40#endif
41#ifdef __OpenBSD__
42#include <dev/ic/isp_openbsd.h>
43#endif
44#ifdef __linux__
45#include "isp_linux.h"
46#endif

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

395isp_fc_runstate(ispsoftc_t *isp, int chan, int tval)
396{
397 fcparam *fcp;
398
399 fcp = FCPARAM(isp, chan);
400 if (fcp->role == ISP_ROLE_NONE) {
401 return (0);
402 }
403 if (fcp->isp_fwstate < FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) {
404 if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) {
405 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: linktest failed for channel %d", chan);
406 return (-1);
407 }
408 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) {
409 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: f/w not ready for channel %d", chan);
410 return (-1);
411 }
403 if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) {
404 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: linktest failed for channel %d", chan);
405 return (-1);
412 }
406 }
413
414 if (isp_control(isp, ISPCTL_SCAN_LOOP, chan) != 0) {
407 if (isp_control(isp, ISPCTL_SCAN_LOOP, chan) != 0) {
415 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan loop fails on channel %d", chan);
416 return (LOOP_PDB_RCVD);
408 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan loop failed on channel %d", chan);
409 return (LOOP_LTEST_DONE);
417 }
418 if (isp_control(isp, ISPCTL_SCAN_FABRIC, chan) != 0) {
410 }
411 if (isp_control(isp, ISPCTL_SCAN_FABRIC, chan) != 0) {
419 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan fabric fails on channel %d", chan);
412 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan fabric failed on channel %d", chan);
420 return (LOOP_LSCAN_DONE);
421 }
422 if (isp_control(isp, ISPCTL_PDB_SYNC, chan) != 0) {
413 return (LOOP_LSCAN_DONE);
414 }
415 if (isp_control(isp, ISPCTL_PDB_SYNC, chan) != 0) {
423 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: pdb_sync fails on channel %d", chan);
416 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: pdb_sync failed on channel %d", chan);
424 return (LOOP_FSCAN_DONE);
425 }
417 return (LOOP_FSCAN_DONE);
418 }
426 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate != LOOP_READY) {
427 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: f/w not ready again on channel %d", chan);
419 if (fcp->isp_loopstate != LOOP_READY) {
420 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: not ready again on channel %d", chan);
428 return (-1);
429 }
430 return (0);
431}
432
433/*
434 * Fibre Channel Support routines
435 */

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

531 strlcat(buf, ")", len);
532}
533
534const char *
535isp_fc_fw_statename(int state)
536{
537 switch (state) {
538 case FW_CONFIG_WAIT: return "Config Wait";
421 return (-1);
422 }
423 return (0);
424}
425
426/*
427 * Fibre Channel Support routines
428 */

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

524 strlcat(buf, ")", len);
525}
526
527const char *
528isp_fc_fw_statename(int state)
529{
530 switch (state) {
531 case FW_CONFIG_WAIT: return "Config Wait";
539 case FW_WAIT_AL_PA: return "Waiting for AL_PA";
532 case FW_WAIT_LINK: return "Wait Link";
540 case FW_WAIT_LOGIN: return "Wait Login";
541 case FW_READY: return "Ready";
542 case FW_LOSS_OF_SYNC: return "Loss Of Sync";
543 case FW_ERROR: return "Error";
544 case FW_REINIT: return "Re-Init";
545 case FW_NON_PART: return "Nonparticipating";
546 default: return "?????";
547 }
548}
549
550const char *
551isp_fc_loop_statename(int state)
552{
553 switch (state) {
554 case LOOP_NIL: return "NIL";
533 case FW_WAIT_LOGIN: return "Wait Login";
534 case FW_READY: return "Ready";
535 case FW_LOSS_OF_SYNC: return "Loss Of Sync";
536 case FW_ERROR: return "Error";
537 case FW_REINIT: return "Re-Init";
538 case FW_NON_PART: return "Nonparticipating";
539 default: return "?????";
540 }
541}
542
543const char *
544isp_fc_loop_statename(int state)
545{
546 switch (state) {
547 case LOOP_NIL: return "NIL";
555 case LOOP_LIP_RCVD: return "LIP Received";
556 case LOOP_PDB_RCVD: return "PDB Received";
557 case LOOP_SCANNING_LOOP: return "Scanning";
548 case LOOP_TESTING_LINK: return "Testing Link";
549 case LOOP_LTEST_DONE: return "Link Test Done";
550 case LOOP_SCANNING_LOOP: return "Scanning Loop";
558 case LOOP_LSCAN_DONE: return "Loop Scan Done";
559 case LOOP_SCANNING_FABRIC: return "Scanning Fabric";
560 case LOOP_FSCAN_DONE: return "Fabric Scan Done";
561 case LOOP_SYNCING_PDB: return "Syncing PDB";
562 case LOOP_READY: return "Ready";
563 default: return "?????";
564 }
565}
566
567const char *
568isp_fc_toponame(fcparam *fcp)
569{
570
551 case LOOP_LSCAN_DONE: return "Loop Scan Done";
552 case LOOP_SCANNING_FABRIC: return "Scanning Fabric";
553 case LOOP_FSCAN_DONE: return "Fabric Scan Done";
554 case LOOP_SYNCING_PDB: return "Syncing PDB";
555 case LOOP_READY: return "Ready";
556 default: return "?????";
557 }
558}
559
560const char *
561isp_fc_toponame(fcparam *fcp)
562{
563
571 if (fcp->isp_fwstate != FW_READY) {
564 if (fcp->isp_loopstate < LOOP_LTEST_DONE) {
572 return "Unavailable";
573 }
574 switch (fcp->isp_topo) {
575 case TOPO_NL_PORT: return "Private Loop";
576 case TOPO_FL_PORT: return "FL Port";
577 case TOPO_N_PORT: return "N-Port to N-Port";
578 case TOPO_F_PORT: return "F Port";
579 case TOPO_PTP_STUB: return "F Port (no FLOGI_ACC response)";

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

2522void
2523isp_find_chan_by_did(ispsoftc_t *isp, uint32_t did, uint16_t *cp)
2524{
2525 uint16_t chan;
2526
2527 *cp = ISP_NOCHAN;
2528 for (chan = 0; chan < isp->isp_nchan; chan++) {
2529 fcparam *fcp = FCPARAM(isp, chan);
565 return "Unavailable";
566 }
567 switch (fcp->isp_topo) {
568 case TOPO_NL_PORT: return "Private Loop";
569 case TOPO_FL_PORT: return "FL Port";
570 case TOPO_N_PORT: return "N-Port to N-Port";
571 case TOPO_F_PORT: return "F Port";
572 case TOPO_PTP_STUB: return "F Port (no FLOGI_ACC response)";

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

2515void
2516isp_find_chan_by_did(ispsoftc_t *isp, uint32_t did, uint16_t *cp)
2517{
2518 uint16_t chan;
2519
2520 *cp = ISP_NOCHAN;
2521 for (chan = 0; chan < isp->isp_nchan; chan++) {
2522 fcparam *fcp = FCPARAM(isp, chan);
2530 if ((fcp->role & ISP_ROLE_TARGET) == 0 || fcp->isp_fwstate != FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) {
2523 if ((fcp->role & ISP_ROLE_TARGET) == 0 ||
2524 fcp->isp_loopstate < LOOP_LTEST_DONE) {
2531 continue;
2532 }
2533 if (fcp->isp_portid == did) {
2534 *cp = chan;
2535 break;
2536 }
2537 }
2538}

--- 1472 unchanged lines hidden ---
2525 continue;
2526 }
2527 if (fcp->isp_portid == did) {
2528 *cp = chan;
2529 break;
2530 }
2531 }
2532}

--- 1472 unchanged lines hidden ---