isp_library.c (284681) | isp_library.c (285146) |
---|---|
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 284681 2015-06-21 14:18:54Z mav $"); | 38__FBSDID("$FreeBSD: head/sys/dev/isp/isp_library.c 285146 2015-07-04 18:38: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 --- 551 unchanged lines hidden (view full) --- 598{ 599 fcparam *fcp = FCPARAM(isp, chan); 600 601 if (chan >= isp->isp_nchan) { 602 isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan); 603 return (ENXIO); 604 } 605 if (chan == 0) { | 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 --- 551 unchanged lines hidden (view full) --- 598{ 599 fcparam *fcp = FCPARAM(isp, chan); 600 601 if (chan >= isp->isp_nchan) { 602 isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan); 603 return (ENXIO); 604 } 605 if (chan == 0) { |
606#ifdef ISP_TARGET_MODE 607 isp_del_all_wwn_entries(isp, chan); 608#endif | |
609 isp_clear_commands(isp); 610 isp_reset(isp, 0); 611 if (isp->isp_state != ISP_RESETSTATE) { 612 isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__); 613 return (EIO); 614 } 615 fcp->role = new_role; 616 isp_init(isp); --- 4 unchanged lines hidden (view full) --- 621 isp->isp_state = ISP_RUNSTATE; 622 return (0); 623 } else if (ISP_CAP_MULTI_ID(isp)) { 624 mbreg_t mbs; 625 vp_modify_t *vp; 626 uint8_t qe[QENTRY_LEN], *scp; 627 628 ISP_MEMZERO(qe, QENTRY_LEN); | 606 isp_clear_commands(isp); 607 isp_reset(isp, 0); 608 if (isp->isp_state != ISP_RESETSTATE) { 609 isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__); 610 return (EIO); 611 } 612 fcp->role = new_role; 613 isp_init(isp); --- 4 unchanged lines hidden (view full) --- 618 isp->isp_state = ISP_RUNSTATE; 619 return (0); 620 } else if (ISP_CAP_MULTI_ID(isp)) { 621 mbreg_t mbs; 622 vp_modify_t *vp; 623 uint8_t qe[QENTRY_LEN], *scp; 624 625 ISP_MEMZERO(qe, QENTRY_LEN); |
629 /* Acquire Scratch */ 630 | |
631 if (FC_SCRATCH_ACQUIRE(isp, chan)) { 632 return (EBUSY); 633 } 634 scp = fcp->isp_scratch; 635 636 /* 637 * Build a VP MODIFY command in memory 638 */ --- 27 unchanged lines hidden (view full) --- 666 isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); 667 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { 668 FC_SCRATCH_RELEASE(isp, chan); 669 return (EIO); 670 } 671 MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); 672 isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp); 673 | 626 if (FC_SCRATCH_ACQUIRE(isp, chan)) { 627 return (EBUSY); 628 } 629 scp = fcp->isp_scratch; 630 631 /* 632 * Build a VP MODIFY command in memory 633 */ --- 27 unchanged lines hidden (view full) --- 661 isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); 662 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { 663 FC_SCRATCH_RELEASE(isp, chan); 664 return (EIO); 665 } 666 MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); 667 isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp); 668 |
674#ifdef ISP_TARGET_MODE 675 isp_del_all_wwn_entries(isp, chan); 676#endif 677 /* 678 * Release Scratch 679 */ | |
680 FC_SCRATCH_RELEASE(isp, chan); 681 682 if (vp->vp_mod_status != VP_STS_OK) { 683 isp_prt(isp, ISP_LOGERR, "%s: VP_MODIFY of Chan %d failed with status %d", __func__, chan, vp->vp_mod_status); 684 return (EIO); 685 } 686 fcp->role = new_role; 687 return (0); --- 3252 unchanged lines hidden --- | 669 FC_SCRATCH_RELEASE(isp, chan); 670 671 if (vp->vp_mod_status != VP_STS_OK) { 672 isp_prt(isp, ISP_LOGERR, "%s: VP_MODIFY of Chan %d failed with status %d", __func__, chan, vp->vp_mod_status); 673 return (EIO); 674 } 675 fcp->role = new_role; 676 return (0); --- 3252 unchanged lines hidden --- |