isp_pci.c (292598) | isp_pci.c (292921) |
---|---|
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: stable/10/sys/dev/isp/isp_pci.c 292598 2015-12-22 13:19:29Z mav $"); | 31__FBSDID("$FreeBSD: stable/10/sys/dev/isp/isp_pci.c 292921 2015-12-30 11:49:48Z 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> --- 1639 unchanged lines hidden (view full) --- 1679 ISP_LOCK(isp); 1680 isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); 1681 return (1); 1682 } 1683 for (len = 0; len < isp->isp_maxcmds - 1; len++) { 1684 isp->isp_xflist[len].cmd = &isp->isp_xflist[len+1]; 1685 } 1686 isp->isp_xffree = isp->isp_xflist; | 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> --- 1639 unchanged lines hidden (view full) --- 1679 ISP_LOCK(isp); 1680 isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); 1681 return (1); 1682 } 1683 for (len = 0; len < isp->isp_maxcmds - 1; len++) { 1684 isp->isp_xflist[len].cmd = &isp->isp_xflist[len+1]; 1685 } 1686 isp->isp_xffree = isp->isp_xflist; |
1687#ifdef ISP_TARGET_MODE 1688 len = sizeof (isp_hdl_t) * isp->isp_maxcmds; 1689 isp->isp_tgtlist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); 1690 if (isp->isp_tgtlist == NULL) { 1691 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1692 free(isp->isp_xflist, M_DEVBUF); 1693 ISP_LOCK(isp); 1694 isp_prt(isp, ISP_LOGERR, "cannot alloc tgtlist array"); 1695 return (1); 1696 } 1697 for (len = 0; len < isp->isp_maxcmds - 1; len++) { 1698 isp->isp_tgtlist[len].cmd = &isp->isp_tgtlist[len+1]; 1699 } 1700 isp->isp_tgtfree = isp->isp_tgtlist; 1701#endif | |
1702 1703 /* 1704 * Allocate and map the request and result queues (and ATIO queue 1705 * if we're a 2400 supporting target mode), and a region for 1706 * external dma addressable command/status structures (23XX and 1707 * later). 1708 */ 1709 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); --- 10 unchanged lines hidden (view full) --- 1720 /* 1721 * Create a tag for the control spaces. We don't always need this 1722 * to be 32 bits, but we do this for simplicity and speed's sake. 1723 */ 1724 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, len, 1, slim, 0, &isp->isp_osinfo.cdmat)) { 1725 isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); 1726 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1727 free(isp->isp_xflist, M_DEVBUF); | 1687 1688 /* 1689 * Allocate and map the request and result queues (and ATIO queue 1690 * if we're a 2400 supporting target mode), and a region for 1691 * external dma addressable command/status structures (23XX and 1692 * later). 1693 */ 1694 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); --- 10 unchanged lines hidden (view full) --- 1705 /* 1706 * Create a tag for the control spaces. We don't always need this 1707 * to be 32 bits, but we do this for simplicity and speed's sake. 1708 */ 1709 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, len, 1, slim, 0, &isp->isp_osinfo.cdmat)) { 1710 isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); 1711 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1712 free(isp->isp_xflist, M_DEVBUF); |
1728#ifdef ISP_TARGET_MODE 1729 free(isp->isp_tgtlist, M_DEVBUF); 1730#endif | |
1731 ISP_LOCK(isp); 1732 return (1); 1733 } 1734 1735 if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &isp->isp_osinfo.cdmap) != 0) { 1736 isp_prt(isp, ISP_LOGERR, "cannot allocate %d bytes of CCB memory", len); 1737 bus_dma_tag_destroy(isp->isp_osinfo.cdmat); 1738 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1739 free(isp->isp_xflist, M_DEVBUF); | 1713 ISP_LOCK(isp); 1714 return (1); 1715 } 1716 1717 if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &isp->isp_osinfo.cdmap) != 0) { 1718 isp_prt(isp, ISP_LOGERR, "cannot allocate %d bytes of CCB memory", len); 1719 bus_dma_tag_destroy(isp->isp_osinfo.cdmat); 1720 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1721 free(isp->isp_xflist, M_DEVBUF); |
1740#ifdef ISP_TARGET_MODE 1741 free(isp->isp_tgtlist, M_DEVBUF); 1742#endif | |
1743 ISP_LOCK(isp); 1744 return (1); 1745 } 1746 1747 im.isp = isp; 1748 im.chan = 0; 1749 im.vbase = base; 1750 im.error = 0; --- 72 unchanged lines hidden (view full) --- 1823 struct isp_nexus *n = fc->nexus_free_list; 1824 fc->nexus_free_list = n->next; 1825 free(n, M_DEVBUF); 1826 } 1827 } 1828 bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); 1829 bus_dma_tag_destroy(isp->isp_osinfo.cdmat); 1830 free(isp->isp_xflist, M_DEVBUF); | 1722 ISP_LOCK(isp); 1723 return (1); 1724 } 1725 1726 im.isp = isp; 1727 im.chan = 0; 1728 im.vbase = base; 1729 im.error = 0; --- 72 unchanged lines hidden (view full) --- 1802 struct isp_nexus *n = fc->nexus_free_list; 1803 fc->nexus_free_list = n->next; 1804 free(n, M_DEVBUF); 1805 } 1806 } 1807 bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); 1808 bus_dma_tag_destroy(isp->isp_osinfo.cdmat); 1809 free(isp->isp_xflist, M_DEVBUF); |
1831#ifdef ISP_TARGET_MODE 1832 free(isp->isp_tgtlist, M_DEVBUF); 1833#endif | |
1834 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1835 isp->isp_rquest = NULL; 1836 ISP_LOCK(isp); 1837 return (1); 1838} 1839 1840typedef struct { 1841 ispsoftc_t *isp; --- 270 unchanged lines hidden --- | 1810 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1811 isp->isp_rquest = NULL; 1812 ISP_LOCK(isp); 1813 return (1); 1814} 1815 1816typedef struct { 1817 ispsoftc_t *isp; --- 270 unchanged lines hidden --- |