1/*- 2 * Copyright (c) 1997-2006 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 --- 29 unchanged lines hidden (view full) --- 38/* 39 * Include header file appropriate for platform we're building on. 40 */ 41#ifdef __NetBSD__ 42#include <dev/ic/isp_netbsd.h> 43#endif 44#ifdef __FreeBSD__ 45#include <sys/cdefs.h> |
46__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 166929 2007-02-23 21:59:21Z mjacob $"); |
47#include <dev/isp/isp_freebsd.h> 48#endif 49#ifdef __OpenBSD__ 50#include <dev/ic/isp_openbsd.h> 51#endif 52#ifdef __linux__ 53#include "isp_linux.h" 54#endif --- 1495 unchanged lines hidden (view full) --- 1550 * Fibre Channel specific initialization. 1551 */ 1552static void 1553isp_fibre_init(ispsoftc_t *isp) 1554{ 1555 fcparam *fcp; 1556 isp_icb_t local, *icbp = &local; 1557 mbreg_t mbs; |
1558 int ownloopid; |
1559 uint64_t nwwn, pwwn; 1560 1561 fcp = isp->isp_param; 1562 1563 MEMZERO(icbp, sizeof (*icbp)); 1564 icbp->icb_version = ICB_VERSION1; 1565 icbp->icb_fwoptions = fcp->isp_fwoptions; 1566 --- 59 unchanged lines hidden (view full) --- 1626 isp_prt(isp, ISP_LOGERR, 1627 "bad execution throttle of %d- using 16", 1628 fcp->isp_execthrottle); 1629 icbp->icb_execthrottle = ICB_DFLT_THROTTLE; 1630 } 1631 icbp->icb_retry_delay = fcp->isp_retry_delay; 1632 icbp->icb_retry_count = fcp->isp_retry_count; 1633 icbp->icb_hardaddr = fcp->isp_loopid; |
1634 ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; |
1635 if (icbp->icb_hardaddr > 125) { |
1636 icbp->icb_hardaddr = 0; 1637 ownloopid = 0; |
1638 } 1639 1640 /* 1641 * Our life seems so much better with 2200s and later with 1642 * the latest f/w if we set Hard Address. 1643 */ |
1644 if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) { |
1645 icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; 1646 } 1647 1648 /* 1649 * Right now we just set extended options to prefer point-to-point 1650 * over loop based upon some soft config options. 1651 * 1652 * NB: for the 2300, ICBOPT_EXTENDED is required. --- 135 unchanged lines hidden (view full) --- 1788 mbs.timeout = 30 * 1000000; 1789 isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %p (%08x%08x)", 1790 fcp->isp_scratch, (uint32_t) ((uint64_t)fcp->isp_scdma >> 32), 1791 (uint32_t) fcp->isp_scdma); 1792 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp)); 1793 isp_mboxcmd(isp, &mbs); 1794 FC_SCRATCH_RELEASE(isp); 1795 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { |
1796 isp_print_bytes(isp, "isp_fibre_init", sizeof (*icbp), icbp); |
1797 return; 1798 } 1799 isp->isp_reqidx = 0; 1800 isp->isp_reqodx = 0; 1801 isp->isp_residx = 0; 1802 1803 /* 1804 * Whatever happens, we're now committed to being here. 1805 */ 1806 isp->isp_state = ISP_INITSTATE; 1807} 1808 1809static void 1810isp_fibre_init_2400(ispsoftc_t *isp) 1811{ 1812 fcparam *fcp; 1813 isp_icb_2400_t local, *icbp = &local; 1814 mbreg_t mbs; |
1815 int ownloopid; |
1816 uint64_t nwwn, pwwn; 1817 1818 fcp = isp->isp_param; 1819 1820 /* 1821 * Turn on LIP F8 async event (1) 1822 */ 1823 MEMZERO(&mbs, sizeof (mbs)); --- 52 unchanged lines hidden (view full) --- 1876 return; 1877 } 1878 icbp->icb_xchgcnt = mbs.param[3]; 1879 } 1880 1881 icbp->icb_fwoptions1 = fcp->isp_fwoptions; 1882 1883 icbp->icb_hardaddr = fcp->isp_loopid; |
1884 ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; |
1885 if (icbp->icb_hardaddr > 125) { |
1886 icbp->icb_hardaddr = 0; 1887 ownloopid = 0; |
1888 } |
1889 if (ownloopid) { |
1890 icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; 1891 } 1892 1893 icbp->icb_fwoptions2 = fcp->isp_xfwoptions; 1894 switch(isp->isp_confopts & ISP_CFG_PORT_PREF) { 1895 case ISP_CFG_NPORT: 1896 icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; 1897 icbp->icb_fwoptions2 |= ICB2400_OPT2_PTP_2_LOOP; --- 363 unchanged lines hidden (view full) --- 2261 isp_mboxcmd(isp, &mbs); 2262 2263 switch (mbs.param[0]) { 2264 case MBOX_PORT_ID_USED: 2265 isp_prt(isp, ISP_LOGDEBUG0, 2266 "isp_plogi_old: portid 0x%06x already logged in as %u", 2267 portid, mbs.param[1]); 2268 return (MBOX_PORT_ID_USED | (mbs.param[1] << 16)); |
2269 2270 case MBOX_LOOP_ID_USED: 2271 isp_prt(isp, ISP_LOGDEBUG0, 2272 "isp_plogi_old: handle %u in use for port id 0x%02xXXXX", 2273 handle, mbs.param[1] & 0xff); 2274 return (MBOX_LOOP_ID_USED); 2275 2276 case MBOX_COMMAND_COMPLETE: --- 666 unchanged lines hidden (view full) --- 2943 MAKE_WWN_FROM_NODE_NAME(tmp.port_wwn, pdb.portname); 2944 tmp.roles = (pdb.s3_role & SVC3_ROLE_MASK) >> SVC3_ROLE_SHIFT; 2945 tmp.portid = pdb.portid; 2946 tmp.handle = pdb.handle; 2947 2948 /* 2949 * Check to make sure it's still a valid entry. The 24XX seems 2950 * to return a portid but not a WWPN/WWNN or role for devices |
2951 * which shift on a loop. |
2952 */ 2953 if (tmp.node_wwn == 0 || tmp.port_wwn == 0 || tmp.portid == 0) { |
2954 int a, b, c; 2955 a = (tmp.node_wwn == 0); 2956 b = (tmp.port_wwn == 0); 2957 c = (tmp.portid == 0); 2958 isp_prt(isp, ISP_LOGWARN, 2959 "bad pdb (%1d%1d%1d) @ handle 0x%x", a, b, c, 2960 handle); 2961 isp_dump_portdb(isp); |
2962 continue; 2963 } 2964 2965 /* 2966 * Now search the entire port database 2967 * for the same Port and Node WWN. 2968 */ 2969 for (i = 0; i < MAX_FC_TARG; i++) { --- 1584 unchanged lines hidden (view full) --- 4554 "mailbox cmd (0x%x) with no waiters", mbox); 4555 } 4556 } else if (isp_parse_async(isp, mbox) < 0) { 4557 return; 4558 } 4559 if ((IS_FC(isp) && mbox != ASYNC_RIO_RESP) || 4560 isp->isp_state != ISP_RUNSTATE) { 4561 goto out; |
4562 } 4563 } 4564 4565 /* 4566 * We can't be getting this now. 4567 */ 4568 if (isp->isp_state != ISP_RUNSTATE) { 4569 isp_prt(isp, ISP_LOGINFO, --- 2930 unchanged lines hidden (view full) --- 7500 int loops = 0; 7501 const uint32_t base = 0x7ffe0000; 7502 uint32_t tmp; 7503 7504 ISP_WRITE(isp, BIU2400_FLASH_ADDR, base | addr); 7505 for (loops = 0; loops < 5000; loops++) { 7506 USEC_DELAY(10); 7507 tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); |
7508 if ((tmp & (1U << 31)) != 0) { |
7509 break; 7510 } 7511 } |
7512 if (tmp & (1U << 31)) { |
7513 tmp = ISP_READ(isp, BIU2400_FLASH_DATA); 7514 *rp = tmp; 7515 } else { 7516 *rp = 0xffffffff; 7517 } 7518} 7519 7520static void --- 794 unchanged lines hidden --- |