isp_pci.c (196008) | isp_pci.c (203444) |
---|---|
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 196008 2009-08-01 01:04:26Z mjacob $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 203444 2010-02-03 21:09:32Z mjacob $"); |
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> --- 1471 unchanged lines hidden (view full) --- 1511 1512 if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, &isp->isp_osinfo.dmat)) { 1513 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1514 ISP_LOCK(isp); 1515 isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); 1516 return (1); 1517 } 1518 | 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> --- 1471 unchanged lines hidden (view full) --- 1511 1512 if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, &isp->isp_osinfo.dmat)) { 1513 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1514 ISP_LOCK(isp); 1515 isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); 1516 return (1); 1517 } 1518 |
1519 len = sizeof (XS_T **) * isp->isp_maxcmds; 1520 isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); | 1519 len = sizeof (isp_hdl_t) * isp->isp_maxcmds; 1520 isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); |
1521 if (isp->isp_xflist == NULL) { 1522 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1523 ISP_LOCK(isp); 1524 isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); 1525 return (1); 1526 } | 1521 if (isp->isp_xflist == NULL) { 1522 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1523 ISP_LOCK(isp); 1524 isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); 1525 return (1); 1526 } |
1527 for (len = 0; len < isp->isp_maxcmds - 1; len++) { 1528 isp->isp_xflist[len].cmd = &isp->isp_xflist[len+1]; 1529 } 1530 isp->isp_xffree = isp->isp_xflist; |
|
1527#ifdef ISP_TARGET_MODE | 1531#ifdef ISP_TARGET_MODE |
1528 len = sizeof (void **) * isp->isp_maxcmds; 1529 isp->isp_tgtlist = (void **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); | 1532 len = sizeof (isp_hdl_t *) * isp->isp_maxcmds; 1533 isp->isp_tgtlist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); |
1530 if (isp->isp_tgtlist == NULL) { 1531 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1532 free(isp->isp_xflist, M_DEVBUF); 1533 ISP_LOCK(isp); 1534 isp_prt(isp, ISP_LOGERR, "cannot alloc tgtlist array"); 1535 return (1); 1536 } | 1534 if (isp->isp_tgtlist == NULL) { 1535 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1536 free(isp->isp_xflist, M_DEVBUF); 1537 ISP_LOCK(isp); 1538 isp_prt(isp, ISP_LOGERR, "cannot alloc tgtlist array"); 1539 return (1); 1540 } |
1541 for (len = 0; len < isp->isp_maxcmds - 1; len++) { 1542 isp->isp_tgtlist[len].cmd = &isp->isp_tgtlist[len+1]; 1543 } 1544 isp->isp_tgtfree = isp->isp_tgtlist; |
|
1537#endif 1538 1539 /* 1540 * Allocate and map the request and result queues (and ATIO queue 1541 * if we're a 2400 supporting target mode). 1542 */ 1543 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1544 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); --- 416 unchanged lines hidden --- | 1545#endif 1546 1547 /* 1548 * Allocate and map the request and result queues (and ATIO queue 1549 * if we're a 2400 supporting target mode). 1550 */ 1551 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1552 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); --- 416 unchanged lines hidden --- |