isp_pci.c (292764) | isp_pci.c (297858) |
---|---|
1/*- 2 * Copyright (c) 1997-2008 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 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 28 * FreeBSD Version. 29 */ 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997-2008 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 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 28 * FreeBSD Version. 29 */ 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 292764 2015-12-27 06:16:02Z mav $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 297858 2016-04-12 14:19:19Z mav $"); |
32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/module.h> 37#include <sys/linker.h> 38#include <sys/firmware.h> 39#include <sys/bus.h> --- 1685 unchanged lines hidden (view full) --- 1725 (uintmax_t)im.maddr, (uintmax_t)len); 1726 isp->isp_atioq_dma = im.maddr; 1727 } 1728#endif 1729 1730 if (IS_FC(isp)) { 1731 if (isp_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, 1732 BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, | 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/module.h> 37#include <sys/linker.h> 38#include <sys/firmware.h> 39#include <sys/bus.h> --- 1685 unchanged lines hidden (view full) --- 1725 (uintmax_t)im.maddr, (uintmax_t)len); 1726 isp->isp_atioq_dma = im.maddr; 1727 } 1728#endif 1729 1730 if (IS_FC(isp)) { 1731 if (isp_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, 1732 BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, |
1733 ISP_FC_SCRLEN, 1, ISP_FC_SCRLEN, 0, &isp->isp_osinfo.scdmat)) { | 1733 2*QENTRY_LEN, 1, 2*QENTRY_LEN, 0, &isp->isp_osinfo.iocbdmat)) { |
1734 goto bad; 1735 } | 1734 goto bad; 1735 } |
1736 if (bus_dmamem_alloc(isp->isp_osinfo.iocbdmat, 1737 (void **)&base, BUS_DMA_COHERENT, &isp->isp_osinfo.iocbmap) != 0) 1738 goto bad; 1739 isp->isp_iocb = base; 1740 im.error = 0; 1741 if (bus_dmamap_load(isp->isp_osinfo.iocbdmat, isp->isp_osinfo.iocbmap, 1742 base, 2*QENTRY_LEN, imc, &im, 0) || im.error) 1743 goto bad; 1744 isp->isp_iocb_dma = im.maddr; 1745 1746 if (isp_dma_tag_create(isp->isp_osinfo.dmat, 64, slim, 1747 BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, 1748 ISP_FC_SCRLEN, 1, ISP_FC_SCRLEN, 0, &isp->isp_osinfo.scdmat)) 1749 goto bad; |
|
1736 for (cmap = 0; cmap < isp->isp_nchan; cmap++) { 1737 struct isp_fc *fc = ISP_FC_PC(isp, cmap); 1738 if (bus_dmamem_alloc(isp->isp_osinfo.scdmat, 1739 (void **)&base, BUS_DMA_COHERENT, &fc->scmap) != 0) 1740 goto bad; 1741 FCPARAM(isp, cmap)->isp_scratch = base; 1742 im.error = 0; 1743 if (bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, --- 42 unchanged lines hidden (view full) --- 1786 ISP_LOCK(isp); 1787 return (0); 1788 1789bad: 1790 if (IS_FC(isp)) { 1791 while (--cmap >= 0) { 1792 struct isp_fc *fc = ISP_FC_PC(isp, cmap); 1793 bus_dmamap_unload(isp->isp_osinfo.scdmat, fc->scmap); | 1750 for (cmap = 0; cmap < isp->isp_nchan; cmap++) { 1751 struct isp_fc *fc = ISP_FC_PC(isp, cmap); 1752 if (bus_dmamem_alloc(isp->isp_osinfo.scdmat, 1753 (void **)&base, BUS_DMA_COHERENT, &fc->scmap) != 0) 1754 goto bad; 1755 FCPARAM(isp, cmap)->isp_scratch = base; 1756 im.error = 0; 1757 if (bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, --- 42 unchanged lines hidden (view full) --- 1800 ISP_LOCK(isp); 1801 return (0); 1802 1803bad: 1804 if (IS_FC(isp)) { 1805 while (--cmap >= 0) { 1806 struct isp_fc *fc = ISP_FC_PC(isp, cmap); 1807 bus_dmamap_unload(isp->isp_osinfo.scdmat, fc->scmap); |
1794 bus_dmamem_free(isp->isp_osinfo.scdmat, base, fc->scmap); | 1808 bus_dmamem_free(isp->isp_osinfo.scdmat, 1809 FCPARAM(isp, cmap)->isp_scratch, fc->scmap); |
1795 while (fc->nexus_free_list) { 1796 struct isp_nexus *n = fc->nexus_free_list; 1797 fc->nexus_free_list = n->next; 1798 free(n, M_DEVBUF); 1799 } 1800 } 1801 bus_dma_tag_destroy(isp->isp_osinfo.scdmat); | 1810 while (fc->nexus_free_list) { 1811 struct isp_nexus *n = fc->nexus_free_list; 1812 fc->nexus_free_list = n->next; 1813 free(n, M_DEVBUF); 1814 } 1815 } 1816 bus_dma_tag_destroy(isp->isp_osinfo.scdmat); |
1817 bus_dmamap_unload(isp->isp_osinfo.iocbdmat, isp->isp_osinfo.iocbmap); 1818 bus_dmamem_free(isp->isp_osinfo.iocbdmat, isp->isp_iocb, 1819 isp->isp_osinfo.iocbmap); 1820 bus_dma_tag_destroy(isp->isp_osinfo.iocbdmat); |
|
1802 } 1803bad1: 1804 if (isp->isp_rquest_dma != 0) { 1805 bus_dmamap_unload(isp->isp_osinfo.reqdmat, 1806 isp->isp_osinfo.reqmap); 1807 } 1808 if (isp->isp_rquest != NULL) { 1809 bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, --- 304 unchanged lines hidden --- | 1821 } 1822bad1: 1823 if (isp->isp_rquest_dma != 0) { 1824 bus_dmamap_unload(isp->isp_osinfo.reqdmat, 1825 isp->isp_osinfo.reqmap); 1826 } 1827 if (isp->isp_rquest != NULL) { 1828 bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, --- 304 unchanged lines hidden --- |