isp.c (297854) | isp.c (297858) |
---|---|
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 297854 2016-04-12 11:48:50Z mav $"); | 50__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 297858 2016-04-12 14:19:19Z 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 --- 4603 unchanged lines hidden (view full) --- 4662 tmf->tmf_header.rqs_entry_count = 1; 4663 tmf->tmf_nphdl = lp->handle; 4664 tmf->tmf_delay = 2; 4665 tmf->tmf_timeout = 4; 4666 tmf->tmf_flags = ISP24XX_TMF_TARGET_RESET; 4667 tmf->tmf_tidlo = lp->portid; 4668 tmf->tmf_tidhi = lp->portid >> 16; 4669 tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan); | 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 --- 4603 unchanged lines hidden (view full) --- 4662 tmf->tmf_header.rqs_entry_count = 1; 4663 tmf->tmf_nphdl = lp->handle; 4664 tmf->tmf_delay = 2; 4665 tmf->tmf_timeout = 4; 4666 tmf->tmf_flags = ISP24XX_TMF_TARGET_RESET; 4667 tmf->tmf_tidlo = lp->portid; 4668 tmf->tmf_tidhi = lp->portid >> 16; 4669 tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan); |
4670 isp_put_24xx_tmf(isp, tmf, isp->isp_iocb); 4671 MEMORYBARRIER(isp, SYNC_IFORDEV, 0, QENTRY_LEN, chan); 4672 fcp->sendmarker = 1; 4673 |
|
4670 isp_prt(isp, ISP_LOGALL, "Chan %d Reset N-Port Handle 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid); 4671 MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 4672 MBCMD_DEFAULT_TIMEOUT + tmf->tmf_timeout * 1000000); 4673 mbs.param[1] = QENTRY_LEN; | 4674 isp_prt(isp, ISP_LOGALL, "Chan %d Reset N-Port Handle 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid); 4675 MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 4676 MBCMD_DEFAULT_TIMEOUT + tmf->tmf_timeout * 1000000); 4677 mbs.param[1] = QENTRY_LEN; |
4674 mbs.param[2] = DMA_WD1(fcp->isp_scdma); 4675 mbs.param[3] = DMA_WD0(fcp->isp_scdma); 4676 mbs.param[6] = DMA_WD3(fcp->isp_scdma); 4677 mbs.param[7] = DMA_WD2(fcp->isp_scdma); 4678 4679 if (FC_SCRATCH_ACQUIRE(isp, chan)) { 4680 isp_prt(isp, ISP_LOGERR, sacq); 4681 break; 4682 } 4683 isp_put_24xx_tmf(isp, tmf, fcp->isp_scratch); 4684 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN, chan); 4685 fcp->sendmarker = 1; | 4678 mbs.param[2] = DMA_WD1(isp->isp_iocb_dma); 4679 mbs.param[3] = DMA_WD0(isp->isp_iocb_dma); 4680 mbs.param[6] = DMA_WD3(isp->isp_iocb_dma); 4681 mbs.param[7] = DMA_WD2(isp->isp_iocb_dma); |
4686 isp_mboxcmd(isp, &mbs); | 4682 isp_mboxcmd(isp, &mbs); |
4687 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { 4688 FC_SCRATCH_RELEASE(isp, chan); | 4683 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) |
4689 break; | 4684 break; |
4690 } 4691 MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); | 4685 4686 MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan); |
4692 sp = (isp24xx_statusreq_t *) local; | 4687 sp = (isp24xx_statusreq_t *) local; |
4693 isp_get_24xx_response(isp, &((isp24xx_statusreq_t *)fcp->isp_scratch)[1], sp); 4694 FC_SCRATCH_RELEASE(isp, chan); | 4688 isp_get_24xx_response(isp, &((isp24xx_statusreq_t *)isp->isp_iocb)[1], sp); |
4695 if (sp->req_completion_status == 0) { 4696 return (0); 4697 } 4698 isp_prt(isp, ISP_LOGWARN, "Chan %d reset of target %d returned 0x%x", chan, tgt, sp->req_completion_status); 4699 break; 4700 } else if (IS_FC(isp)) { 4701 if (ISP_CAP_2KLOGIN(isp)) { 4702 mbs.param[1] = tgt; --- 23 unchanged lines hidden (view full) --- 4726 chan = XS_CHANNEL(xs); 4727 4728 handle = isp_find_handle(isp, xs); 4729 if (handle == 0) { 4730 isp_prt(isp, ISP_LOGWARN, "cannot find handle for command to abort"); 4731 break; 4732 } 4733 if (IS_24XX(isp)) { | 4689 if (sp->req_completion_status == 0) { 4690 return (0); 4691 } 4692 isp_prt(isp, ISP_LOGWARN, "Chan %d reset of target %d returned 0x%x", chan, tgt, sp->req_completion_status); 4693 break; 4694 } else if (IS_FC(isp)) { 4695 if (ISP_CAP_2KLOGIN(isp)) { 4696 mbs.param[1] = tgt; --- 23 unchanged lines hidden (view full) --- 4720 chan = XS_CHANNEL(xs); 4721 4722 handle = isp_find_handle(isp, xs); 4723 if (handle == 0) { 4724 isp_prt(isp, ISP_LOGWARN, "cannot find handle for command to abort"); 4725 break; 4726 } 4727 if (IS_24XX(isp)) { |
4734 isp24xx_abrt_t local, *ab = &local, *ab2; | 4728 isp24xx_abrt_t local, *ab = &local; |
4735 fcparam *fcp; 4736 fcportdb_t *lp; 4737 4738 fcp = FCPARAM(isp, chan); 4739 if (tgt < 0 || tgt >= MAX_FC_TARG) { 4740 isp_prt(isp, ISP_LOGWARN, "Chan %d trying to abort bad target %d", chan, tgt); 4741 break; 4742 } --- 7 unchanged lines hidden (view full) --- 4750 ISP_MEMZERO(ab, QENTRY_LEN); 4751 ab->abrt_header.rqs_entry_type = RQSTYPE_ABORT_IO; 4752 ab->abrt_header.rqs_entry_count = 1; 4753 ab->abrt_handle = lp->handle; 4754 ab->abrt_cmd_handle = handle; 4755 ab->abrt_tidlo = lp->portid; 4756 ab->abrt_tidhi = lp->portid >> 16; 4757 ab->abrt_vpidx = ISP_GET_VPIDX(isp, chan); | 4729 fcparam *fcp; 4730 fcportdb_t *lp; 4731 4732 fcp = FCPARAM(isp, chan); 4733 if (tgt < 0 || tgt >= MAX_FC_TARG) { 4734 isp_prt(isp, ISP_LOGWARN, "Chan %d trying to abort bad target %d", chan, tgt); 4735 break; 4736 } --- 7 unchanged lines hidden (view full) --- 4744 ISP_MEMZERO(ab, QENTRY_LEN); 4745 ab->abrt_header.rqs_entry_type = RQSTYPE_ABORT_IO; 4746 ab->abrt_header.rqs_entry_count = 1; 4747 ab->abrt_handle = lp->handle; 4748 ab->abrt_cmd_handle = handle; 4749 ab->abrt_tidlo = lp->portid; 4750 ab->abrt_tidhi = lp->portid >> 16; 4751 ab->abrt_vpidx = ISP_GET_VPIDX(isp, chan); |
4752 isp_put_24xx_abrt(isp, ab, isp->isp_iocb); 4753 MEMORYBARRIER(isp, SYNC_IFORDEV, 0, 2 * QENTRY_LEN, chan); |
|
4758 4759 ISP_MEMZERO(&mbs, sizeof (mbs)); 4760 MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 5000000); 4761 mbs.param[1] = QENTRY_LEN; | 4754 4755 ISP_MEMZERO(&mbs, sizeof (mbs)); 4756 MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 5000000); 4757 mbs.param[1] = QENTRY_LEN; |
4762 mbs.param[2] = DMA_WD1(fcp->isp_scdma); 4763 mbs.param[3] = DMA_WD0(fcp->isp_scdma); 4764 mbs.param[6] = DMA_WD3(fcp->isp_scdma); 4765 mbs.param[7] = DMA_WD2(fcp->isp_scdma); | 4758 mbs.param[2] = DMA_WD1(isp->isp_iocb_dma); 4759 mbs.param[3] = DMA_WD0(isp->isp_iocb_dma); 4760 mbs.param[6] = DMA_WD3(isp->isp_iocb_dma); 4761 mbs.param[7] = DMA_WD2(isp->isp_iocb_dma); |
4766 | 4762 |
4767 if (FC_SCRATCH_ACQUIRE(isp, chan)) { 4768 isp_prt(isp, ISP_LOGERR, sacq); 4769 break; 4770 } 4771 isp_put_24xx_abrt(isp, ab, fcp->isp_scratch); 4772 ab2 = (isp24xx_abrt_t *) &((uint8_t *)fcp->isp_scratch)[QENTRY_LEN]; 4773 ab2->abrt_nphdl = 0xdeaf; 4774 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN, chan); | |
4775 isp_mboxcmd(isp, &mbs); | 4763 isp_mboxcmd(isp, &mbs); |
4776 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { 4777 FC_SCRATCH_RELEASE(isp, chan); | 4764 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) |
4778 break; | 4765 break; |
4779 } 4780 MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); 4781 isp_get_24xx_abrt(isp, ab2, ab); 4782 FC_SCRATCH_RELEASE(isp, chan); | 4766 4767 MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan); 4768 isp_get_24xx_abrt(isp, &((isp24xx_abrt_t *)isp->isp_iocb)[1], ab); |
4783 if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) { 4784 return (0); 4785 } 4786 isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, tgt, ab->abrt_nphdl); 4787 break; 4788 } else if (IS_FC(isp)) { 4789 if (ISP_CAP_SCCFW(isp)) { 4790 if (ISP_CAP_2KLOGIN(isp)) { --- 3729 unchanged lines hidden --- | 4769 if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) { 4770 return (0); 4771 } 4772 isp_prt(isp, ISP_LOGWARN, "Chan %d handle %d abort returned 0x%x", chan, tgt, ab->abrt_nphdl); 4773 break; 4774 } else if (IS_FC(isp)) { 4775 if (ISP_CAP_SCCFW(isp)) { 4776 if (ISP_CAP_2KLOGIN(isp)) { --- 3729 unchanged lines hidden --- |