isp_pci.c (292249) | isp_pci.c (292725) |
---|---|
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 292249 2015-12-15 04:51:50Z mav $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 292725 2015-12-25 13:03:18Z 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; --- 75 unchanged lines hidden (view full) --- 1826 free(n, M_DEVBUF); 1827 } 1828 } 1829 if (isp->isp_rquest_dma != 0) 1830 bus_dmamap_unload(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap); 1831 bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); 1832 bus_dma_tag_destroy(isp->isp_osinfo.cdmat); 1833 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; --- 75 unchanged lines hidden (view full) --- 1805 free(n, M_DEVBUF); 1806 } 1807 } 1808 if (isp->isp_rquest_dma != 0) 1809 bus_dmamap_unload(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap); 1810 bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); 1811 bus_dma_tag_destroy(isp->isp_osinfo.cdmat); 1812 free(isp->isp_xflist, M_DEVBUF); |
1834#ifdef ISP_TARGET_MODE 1835 free(isp->isp_tgtlist, M_DEVBUF); 1836#endif | |
1837 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1838 isp->isp_rquest = NULL; 1839 ISP_LOCK(isp); 1840 return (1); 1841} 1842 1843typedef struct { 1844 ispsoftc_t *isp; --- 270 unchanged lines hidden --- | 1813 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1814 isp->isp_rquest = NULL; 1815 ISP_LOCK(isp); 1816 return (1); 1817} 1818 1819typedef struct { 1820 ispsoftc_t *isp; --- 270 unchanged lines hidden --- |