isp_pci.c (237537) | isp_pci.c (238869) |
---|---|
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 237537 2012-06-24 17:30:54Z mjacob $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 238869 2012-07-28 20:06:29Z 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> --- 543 unchanged lines hidden (view full) --- 583 isp->isp_confopts |= ISP_CFG_NPORT; 584 } else if (strcmp(sptr, "lport-only") == 0) { 585 isp->isp_confopts |= ISP_CFG_LPORT_ONLY; 586 } else if (strcmp(sptr, "nport-only") == 0) { 587 isp->isp_confopts |= ISP_CFG_NPORT_ONLY; 588 } 589 } 590 | 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> --- 543 unchanged lines hidden (view full) --- 583 isp->isp_confopts |= ISP_CFG_NPORT; 584 } else if (strcmp(sptr, "lport-only") == 0) { 585 isp->isp_confopts |= ISP_CFG_LPORT_ONLY; 586 } else if (strcmp(sptr, "nport-only") == 0) { 587 isp->isp_confopts |= ISP_CFG_NPORT_ONLY; 588 } 589 } 590 |
591 tval = 0; 592 (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "nofctape", &tval); 593 if (tval) { 594 isp->isp_confopts |= ISP_CFG_NOFCTAPE; 595 } 596 597 tval = 0; 598 (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "fctape", &tval); 599 if (tval) { 600 isp->isp_confopts &= ~ISP_CFG_NOFCTAPE; 601 isp->isp_confopts |= ISP_CFG_FCTAPE; 602 } 603 604 |
|
591 /* 592 * Because the resource_*_value functions can neither return 593 * 64 bit integer values, nor can they be directly coerced 594 * to interpret the right hand side of the assignment as 595 * you want them to interpret it, we have to force WWN 596 * hint replacement to specify WWN strings with a leading 597 * 'w' (e..g w50000000aaaa0001). Sigh. 598 */ --- 60 unchanged lines hidden (view full) --- 659 return (ENOMEM); 660 } 661 memset(pcs, 0, sizeof (*pcs)); 662 663 pcs->pci_dev = dev; 664 isp = &pcs->pci_isp; 665 isp->isp_dev = dev; 666 isp->isp_nchan = 1; | 605 /* 606 * Because the resource_*_value functions can neither return 607 * 64 bit integer values, nor can they be directly coerced 608 * to interpret the right hand side of the assignment as 609 * you want them to interpret it, we have to force WWN 610 * hint replacement to specify WWN strings with a leading 611 * 'w' (e..g w50000000aaaa0001). Sigh. 612 */ --- 60 unchanged lines hidden (view full) --- 673 return (ENOMEM); 674 } 675 memset(pcs, 0, sizeof (*pcs)); 676 677 pcs->pci_dev = dev; 678 isp = &pcs->pci_isp; 679 isp->isp_dev = dev; 680 isp->isp_nchan = 1; |
681 if (sizeof (bus_addr_t) > 4) 682 isp->isp_osinfo.sixtyfourbit = 1; |
|
667 668 /* 669 * Get Generic Options 670 */ 671 isp_nvports = 0; 672 isp_get_generic_options(dev, isp); 673 674 /* --- 348 unchanged lines hidden (view full) --- 1023 } 1024 ISP_UNLOCK(isp); 1025 mtx_destroy(&isp->isp_osinfo.lock); 1026 (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->iqd, pcs->irq); 1027 if (pcs->msicount) { 1028 pci_release_msi(dev); 1029 } 1030 (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); | 683 684 /* 685 * Get Generic Options 686 */ 687 isp_nvports = 0; 688 isp_get_generic_options(dev, isp); 689 690 /* --- 348 unchanged lines hidden (view full) --- 1039 } 1040 ISP_UNLOCK(isp); 1041 mtx_destroy(&isp->isp_osinfo.lock); 1042 (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->iqd, pcs->irq); 1043 if (pcs->msicount) { 1044 pci_release_msi(dev); 1045 } 1046 (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); |
1047 /* 1048 * XXX: THERE IS A LOT OF LEAKAGE HERE 1049 */ |
|
1031 if (pcs->pci_isp.isp_param) { 1032 free(pcs->pci_isp.isp_param, M_DEVBUF); 1033 pcs->pci_isp.isp_param = NULL; 1034 } 1035 if (pcs->pci_isp.isp_osinfo.pc.ptr) { 1036 free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); 1037 pcs->pci_isp.isp_osinfo.pc.ptr = NULL; 1038 } --- 397 unchanged lines hidden (view full) --- 1436 1437static void imc(void *, bus_dma_segment_t *, int, int); 1438static void imc1(void *, bus_dma_segment_t *, int, int); 1439 1440static void 1441imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) 1442{ 1443 struct imush *imushp = (struct imush *) arg; | 1050 if (pcs->pci_isp.isp_param) { 1051 free(pcs->pci_isp.isp_param, M_DEVBUF); 1052 pcs->pci_isp.isp_param = NULL; 1053 } 1054 if (pcs->pci_isp.isp_osinfo.pc.ptr) { 1055 free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); 1056 pcs->pci_isp.isp_osinfo.pc.ptr = NULL; 1057 } --- 397 unchanged lines hidden (view full) --- 1455 1456static void imc(void *, bus_dma_segment_t *, int, int); 1457static void imc1(void *, bus_dma_segment_t *, int, int); 1458 1459static void 1460imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) 1461{ 1462 struct imush *imushp = (struct imush *) arg; |
1463 isp_ecmd_t *ecmd; |
|
1444 1445 if (error) { 1446 imushp->error = error; 1447 return; 1448 } 1449 if (nseg != 1) { 1450 imushp->error = EINVAL; 1451 return; 1452 } 1453 isp_prt(imushp->isp, ISP_LOGDEBUG0, "request/result area @ 0x%jx/0x%jx", (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); | 1464 1465 if (error) { 1466 imushp->error = error; 1467 return; 1468 } 1469 if (nseg != 1) { 1470 imushp->error = EINVAL; 1471 return; 1472 } 1473 isp_prt(imushp->isp, ISP_LOGDEBUG0, "request/result area @ 0x%jx/0x%jx", (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); |
1474 |
|
1454 imushp->isp->isp_rquest = imushp->vbase; 1455 imushp->isp->isp_rquest_dma = segs->ds_addr; 1456 segs->ds_addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); 1457 imushp->vbase += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); | 1475 imushp->isp->isp_rquest = imushp->vbase; 1476 imushp->isp->isp_rquest_dma = segs->ds_addr; 1477 segs->ds_addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); 1478 imushp->vbase += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); |
1479 |
|
1458 imushp->isp->isp_result_dma = segs->ds_addr; 1459 imushp->isp->isp_result = imushp->vbase; | 1480 imushp->isp->isp_result_dma = segs->ds_addr; 1481 imushp->isp->isp_result = imushp->vbase; |
1482 segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); 1483 imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); |
|
1460 | 1484 |
1485 imushp->isp->isp_osinfo.ecmd_dma = segs->ds_addr; 1486 imushp->isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)imushp->vbase; 1487 imushp->isp->isp_osinfo.ecmd_base = imushp->isp->isp_osinfo.ecmd_free; 1488 for (ecmd = imushp->isp->isp_osinfo.ecmd_free; ecmd < &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) { 1489 if (ecmd == &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) { 1490 ecmd->next = NULL; 1491 } else { 1492 ecmd->next = ecmd + 1; 1493 } 1494 } |
|
1461#ifdef ISP_TARGET_MODE | 1495#ifdef ISP_TARGET_MODE |
1496 segs->ds_addr += (N_XCMDS * XCMD_SIZE); 1497 imushp->vbase += (N_XCMDS * XCMD_SIZE); |
|
1462 if (IS_24XX(imushp->isp)) { | 1498 if (IS_24XX(imushp->isp)) { |
1463 segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); 1464 imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); | |
1465 imushp->isp->isp_atioq_dma = segs->ds_addr; 1466 imushp->isp->isp_atioq = imushp->vbase; 1467 } 1468#endif 1469} 1470 1471static void 1472imc1(void *arg, bus_dma_segment_t *segs, int nseg, int error) --- 53 unchanged lines hidden (view full) --- 1526 len = isp->isp_maxcmds * sizeof (struct isp_pcmd); 1527 isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); 1528 if (isp->isp_osinfo.pcmd_pool == NULL) { 1529 isp_prt(isp, ISP_LOGERR, "cannot allocate pcmds"); 1530 ISP_LOCK(isp); 1531 return (1); 1532 } 1533 | 1499 imushp->isp->isp_atioq_dma = segs->ds_addr; 1500 imushp->isp->isp_atioq = imushp->vbase; 1501 } 1502#endif 1503} 1504 1505static void 1506imc1(void *arg, bus_dma_segment_t *segs, int nseg, int error) --- 53 unchanged lines hidden (view full) --- 1560 len = isp->isp_maxcmds * sizeof (struct isp_pcmd); 1561 isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); 1562 if (isp->isp_osinfo.pcmd_pool == NULL) { 1563 isp_prt(isp, ISP_LOGERR, "cannot allocate pcmds"); 1564 ISP_LOCK(isp); 1565 return (1); 1566 } 1567 |
1568#ifdef ISP_TARGET_MODE |
|
1534 /* 1535 * XXX: We don't really support 64 bit target mode for parallel scsi yet 1536 */ | 1569 /* 1570 * XXX: We don't really support 64 bit target mode for parallel scsi yet 1571 */ |
1537#ifdef ISP_TARGET_MODE 1538 if (IS_SCSI(isp) && sizeof (bus_addr_t) > 4) { | 1572 if (IS_SCSI(isp) && isp->isp_osinfo.sixtyfourbit) { |
1539 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1540 isp_prt(isp, ISP_LOGERR, "we cannot do DAC for SPI cards yet"); 1541 ISP_LOCK(isp); 1542 return (1); 1543 } 1544#endif 1545 1546 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)) { --- 28 unchanged lines hidden (view full) --- 1575 for (len = 0; len < isp->isp_maxcmds - 1; len++) { 1576 isp->isp_tgtlist[len].cmd = &isp->isp_tgtlist[len+1]; 1577 } 1578 isp->isp_tgtfree = isp->isp_tgtlist; 1579#endif 1580 1581 /* 1582 * Allocate and map the request and result queues (and ATIO queue | 1573 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1574 isp_prt(isp, ISP_LOGERR, "we cannot do DAC for SPI cards yet"); 1575 ISP_LOCK(isp); 1576 return (1); 1577 } 1578#endif 1579 1580 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)) { --- 28 unchanged lines hidden (view full) --- 1609 for (len = 0; len < isp->isp_maxcmds - 1; len++) { 1610 isp->isp_tgtlist[len].cmd = &isp->isp_tgtlist[len+1]; 1611 } 1612 isp->isp_tgtfree = isp->isp_tgtlist; 1613#endif 1614 1615 /* 1616 * Allocate and map the request and result queues (and ATIO queue |
1583 * if we're a 2400 supporting target mode). | 1617 * if we're a 2400 supporting target mode), and a region for 1618 * external dma addressable command/status structures (23XX and 1619 * later). |
1584 */ 1585 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1586 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1587#ifdef ISP_TARGET_MODE 1588 if (IS_24XX(isp)) { 1589 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1590 } 1591#endif | 1620 */ 1621 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1622 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1623#ifdef ISP_TARGET_MODE 1624 if (IS_24XX(isp)) { 1625 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1626 } 1627#endif |
1592 | 1628 if (isp->isp_type >= ISP_HA_FC_2300) { 1629 len += (N_XCMDS * XCMD_SIZE); 1630 } |
1593 ns = (len / PAGE_SIZE) + 1; 1594 1595 /* 1596 * Create a tag for the control spaces. We don't always need this 1597 * to be 32 bits, but we do this for simplicity and speed's sake. 1598 */ 1599 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, len, ns, slim, 0, &isp->isp_osinfo.cdmat)) { 1600 isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); --- 44 unchanged lines hidden (view full) --- 1645 im.vbase = base; 1646 im.error = 0; 1647 bus_dmamap_load(fc->tdmat, fc->tdmap, base, ISP_FC_SCRLEN, imc1, &im, 0); 1648 if (im.error) { 1649 bus_dmamem_free(fc->tdmat, base, fc->tdmap); 1650 bus_dma_tag_destroy(fc->tdmat); 1651 goto bad; 1652 } | 1631 ns = (len / PAGE_SIZE) + 1; 1632 1633 /* 1634 * Create a tag for the control spaces. We don't always need this 1635 * to be 32 bits, but we do this for simplicity and speed's sake. 1636 */ 1637 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, len, ns, slim, 0, &isp->isp_osinfo.cdmat)) { 1638 isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); --- 44 unchanged lines hidden (view full) --- 1683 im.vbase = base; 1684 im.error = 0; 1685 bus_dmamap_load(fc->tdmat, fc->tdmap, base, ISP_FC_SCRLEN, imc1, &im, 0); 1686 if (im.error) { 1687 bus_dmamem_free(fc->tdmat, base, fc->tdmap); 1688 bus_dma_tag_destroy(fc->tdmat); 1689 goto bad; 1690 } |
1691 for (i = 0; i < INITIAL_NEXUS_COUNT; i++) { 1692 struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO); 1693 if (n == NULL) { 1694 while (fc->nexus_free_list) { 1695 n = fc->nexus_free_list; 1696 fc->nexus_free_list = n->next; 1697 free(n, M_DEVBUF); 1698 } 1699 goto bad; 1700 } 1701 n->next = fc->nexus_free_list; 1702 fc->nexus_free_list = n; 1703 } |
|
1653 } 1654 } 1655 1656 for (i = 0; i < isp->isp_maxcmds; i++) { 1657 struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i]; 1658 error = bus_dmamap_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap); 1659 if (error) { 1660 isp_prt(isp, ISP_LOGERR, "error %d creating per-cmd DMA maps", error); --- 13 unchanged lines hidden (view full) --- 1674 ISP_LOCK(isp); 1675 return (0); 1676 1677bad: 1678 while (--cmap >= 0) { 1679 struct isp_fc *fc = ISP_FC_PC(isp, cmap); 1680 bus_dmamem_free(fc->tdmat, base, fc->tdmap); 1681 bus_dma_tag_destroy(fc->tdmat); | 1704 } 1705 } 1706 1707 for (i = 0; i < isp->isp_maxcmds; i++) { 1708 struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i]; 1709 error = bus_dmamap_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap); 1710 if (error) { 1711 isp_prt(isp, ISP_LOGERR, "error %d creating per-cmd DMA maps", error); --- 13 unchanged lines hidden (view full) --- 1725 ISP_LOCK(isp); 1726 return (0); 1727 1728bad: 1729 while (--cmap >= 0) { 1730 struct isp_fc *fc = ISP_FC_PC(isp, cmap); 1731 bus_dmamem_free(fc->tdmat, base, fc->tdmap); 1732 bus_dma_tag_destroy(fc->tdmat); |
1733 while (fc->nexus_free_list) { 1734 struct isp_nexus *n = fc->nexus_free_list; 1735 fc->nexus_free_list = n->next; 1736 free(n, M_DEVBUF); 1737 } |
|
1682 } 1683 bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); 1684 bus_dma_tag_destroy(isp->isp_osinfo.cdmat); 1685 free(isp->isp_xflist, M_DEVBUF); 1686#ifdef ISP_TARGET_MODE 1687 free(isp->isp_tgtlist, M_DEVBUF); 1688#endif 1689 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); --- 38 unchanged lines hidden (view full) --- 1728 if (error) { 1729 mp->error = error; 1730 return; 1731 } 1732 csio = mp->cmd_token; 1733 isp = mp->isp; 1734 rq = mp->rq; 1735 if (nseg) { | 1738 } 1739 bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); 1740 bus_dma_tag_destroy(isp->isp_osinfo.cdmat); 1741 free(isp->isp_xflist, M_DEVBUF); 1742#ifdef ISP_TARGET_MODE 1743 free(isp->isp_tgtlist, M_DEVBUF); 1744#endif 1745 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); --- 38 unchanged lines hidden (view full) --- 1784 if (error) { 1785 mp->error = error; 1786 return; 1787 } 1788 csio = mp->cmd_token; 1789 isp = mp->isp; 1790 rq = mp->rq; 1791 if (nseg) { |
1736 if (sizeof (bus_addr_t) > 4) { | 1792 if (isp->isp_osinfo.sixtyfourbit) { |
1737 if (nseg >= ISP_NSEG64_MAX) { 1738 isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); 1739 mp->error = EFAULT; 1740 return; 1741 } 1742 if (rq->req_header.rqs_entry_type == RQSTYPE_CTIO2) { 1743 rq->req_header.rqs_entry_type = RQSTYPE_CTIO3; 1744 } --- 16 unchanged lines hidden (view full) --- 1761 ddir = ISP_NOXFR; 1762 } 1763 } else { 1764 dm_segs = NULL; 1765 nseg = 0; 1766 ddir = ISP_NOXFR; 1767 } 1768 | 1793 if (nseg >= ISP_NSEG64_MAX) { 1794 isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); 1795 mp->error = EFAULT; 1796 return; 1797 } 1798 if (rq->req_header.rqs_entry_type == RQSTYPE_CTIO2) { 1799 rq->req_header.rqs_entry_type = RQSTYPE_CTIO3; 1800 } --- 16 unchanged lines hidden (view full) --- 1817 ddir = ISP_NOXFR; 1818 } 1819 } else { 1820 dm_segs = NULL; 1821 nseg = 0; 1822 ddir = ISP_NOXFR; 1823 } 1824 |
1769 if (isp_send_tgt_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, &csio->sense_data, csio->sense_len) != CMD_QUEUED) { | 1825 error = isp_send_tgt_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, &csio->sense_data, csio->sense_len); 1826 switch (error) { 1827 case CMD_EAGAIN: |
1770 mp->error = MUSHERR_NOQENTRIES; | 1828 mp->error = MUSHERR_NOQENTRIES; |
1829 case CMD_QUEUED: 1830 break; 1831 default: 1832 mp->error = EIO; |
|
1771 } 1772} 1773#endif 1774 1775static void dma2_2(void *, bus_dma_segment_t *, int, bus_size_t, int); 1776static void dma2(void *, bus_dma_segment_t *, int, int); 1777 1778static void --- 18 unchanged lines hidden (view full) --- 1797 if (error) { 1798 mp->error = error; 1799 return; 1800 } 1801 csio = mp->cmd_token; 1802 isp = mp->isp; 1803 rq = mp->rq; 1804 if (nseg) { | 1833 } 1834} 1835#endif 1836 1837static void dma2_2(void *, bus_dma_segment_t *, int, bus_size_t, int); 1838static void dma2(void *, bus_dma_segment_t *, int, int); 1839 1840static void --- 18 unchanged lines hidden (view full) --- 1859 if (error) { 1860 mp->error = error; 1861 return; 1862 } 1863 csio = mp->cmd_token; 1864 isp = mp->isp; 1865 rq = mp->rq; 1866 if (nseg) { |
1805 if (sizeof (bus_addr_t) > 4) { | 1867 if (isp->isp_osinfo.sixtyfourbit) { |
1806 if (nseg >= ISP_NSEG64_MAX) { 1807 isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); 1808 mp->error = EFAULT; 1809 return; 1810 } 1811 if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) { 1812 rq->req_header.rqs_entry_type = RQSTYPE_T3RQS; 1813 } else if (rq->req_header.rqs_entry_type == RQSTYPE_REQUEST) { --- 16 unchanged lines hidden (view full) --- 1830 ddir = ISP_NOXFR; 1831 } 1832 } else { 1833 dm_segs = NULL; 1834 nseg = 0; 1835 ddir = ISP_NOXFR; 1836 } 1837 | 1868 if (nseg >= ISP_NSEG64_MAX) { 1869 isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); 1870 mp->error = EFAULT; 1871 return; 1872 } 1873 if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) { 1874 rq->req_header.rqs_entry_type = RQSTYPE_T3RQS; 1875 } else if (rq->req_header.rqs_entry_type == RQSTYPE_REQUEST) { --- 16 unchanged lines hidden (view full) --- 1892 ddir = ISP_NOXFR; 1893 } 1894 } else { 1895 dm_segs = NULL; 1896 nseg = 0; 1897 ddir = ISP_NOXFR; 1898 } 1899 |
1838 if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir) != CMD_QUEUED) { | 1900 error = isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, (ispds64_t *)csio->req_map); 1901 switch (error) { 1902 case CMD_EAGAIN: |
1839 mp->error = MUSHERR_NOQENTRIES; | 1903 mp->error = MUSHERR_NOQENTRIES; |
1904 break; 1905 case CMD_QUEUED: 1906 break; 1907 default: 1908 mp->error = EIO; 1909 break; |
|
1840 } 1841} 1842 1843static int 1844isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) 1845{ 1846 mush_t mush, *mp; 1847 void (*eptr)(void *, bus_dma_segment_t *, int, int); --- 83 unchanged lines hidden (view full) --- 1931 (*eptr)(mp, segs, csio->sglist_cnt, 0); 1932 } 1933 } 1934 if (mp->error) { 1935 int retval = CMD_COMPLETE; 1936 if (mp->error == MUSHERR_NOQENTRIES) { 1937 retval = CMD_EAGAIN; 1938 } else if (mp->error == EFBIG) { | 1910 } 1911} 1912 1913static int 1914isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) 1915{ 1916 mush_t mush, *mp; 1917 void (*eptr)(void *, bus_dma_segment_t *, int, int); --- 83 unchanged lines hidden (view full) --- 2001 (*eptr)(mp, segs, csio->sglist_cnt, 0); 2002 } 2003 } 2004 if (mp->error) { 2005 int retval = CMD_COMPLETE; 2006 if (mp->error == MUSHERR_NOQENTRIES) { 2007 retval = CMD_EAGAIN; 2008 } else if (mp->error == EFBIG) { |
1939 XS_SETERR(csio, CAM_REQ_TOO_BIG); | 2009 csio->ccb_h.status = CAM_REQ_TOO_BIG; |
1940 } else if (mp->error == EINVAL) { | 2010 } else if (mp->error == EINVAL) { |
1941 XS_SETERR(csio, CAM_REQ_INVALID); | 2011 csio->ccb_h.status = CAM_REQ_INVALID; |
1942 } else { | 2012 } else { |
1943 XS_SETERR(csio, CAM_UNREC_HBA_ERROR); | 2013 csio->ccb_h.status = CAM_UNREC_HBA_ERROR; |
1944 } 1945 return (retval); 1946 } 1947 return (CMD_QUEUED); 1948} 1949 1950static void 1951isp_pci_reset0(ispsoftc_t *isp) --- 53 unchanged lines hidden --- | 2014 } 2015 return (retval); 2016 } 2017 return (CMD_QUEUED); 2018} 2019 2020static void 2021isp_pci_reset0(ispsoftc_t *isp) --- 53 unchanged lines hidden --- |