Deleted Added
sdiff udiff text old ( 166894 ) new ( 166929 )
full compact
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 166894 2007-02-23 05:39:58Z 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 uint64_t nwwn, pwwn;
1559
1560 fcp = isp->isp_param;
1561
1562 MEMZERO(icbp, sizeof (*icbp));
1563 icbp->icb_version = ICB_VERSION1;
1564 icbp->icb_fwoptions = fcp->isp_fwoptions;
1565

--- 59 unchanged lines hidden (view full) ---

1625 isp_prt(isp, ISP_LOGERR,
1626 "bad execution throttle of %d- using 16",
1627 fcp->isp_execthrottle);
1628 icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
1629 }
1630 icbp->icb_retry_delay = fcp->isp_retry_delay;
1631 icbp->icb_retry_count = fcp->isp_retry_count;
1632 icbp->icb_hardaddr = fcp->isp_loopid;
1633 if (icbp->icb_hardaddr > 125) {
1634 /*
1635 * We end up with these Loop IDs for F-Port topologies
1636 */
1637 if (icbp->icb_hardaddr != 0xff &&
1638 icbp->icb_hardaddr != 0x800 &&
1639 icbp->icb_hardaddr != 0xffff) {
1640 isp_prt(isp, ISP_LOGERR,
1641 "bad hard address %u- resetting to zero",
1642 icbp->icb_hardaddr);
1643 icbp->icb_hardaddr = 0;
1644 }
1645 }
1646
1647 /*
1648 * Our life seems so much better with 2200s and later with
1649 * the latest f/w if we set Hard Address.
1650 */
1651 if (ISP_FW_NEWER_THAN(isp, 2, 2, 5)) {
1652 icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
1653 }
1654
1655 /*
1656 * Right now we just set extended options to prefer point-to-point
1657 * over loop based upon some soft config options.
1658 *
1659 * NB: for the 2300, ICBOPT_EXTENDED is required.

--- 135 unchanged lines hidden (view full) ---

1795 mbs.timeout = 30 * 1000000;
1796 isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %p (%08x%08x)",
1797 fcp->isp_scratch, (uint32_t) ((uint64_t)fcp->isp_scdma >> 32),
1798 (uint32_t) fcp->isp_scdma);
1799 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp));
1800 isp_mboxcmd(isp, &mbs);
1801 FC_SCRATCH_RELEASE(isp);
1802 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
1803 return;
1804 }
1805 isp->isp_reqidx = 0;
1806 isp->isp_reqodx = 0;
1807 isp->isp_residx = 0;
1808
1809 /*
1810 * Whatever happens, we're now committed to being here.
1811 */
1812 isp->isp_state = ISP_INITSTATE;
1813}
1814
1815static void
1816isp_fibre_init_2400(ispsoftc_t *isp)
1817{
1818 fcparam *fcp;
1819 isp_icb_2400_t local, *icbp = &local;
1820 mbreg_t mbs;
1821 uint64_t nwwn, pwwn;
1822
1823 fcp = isp->isp_param;
1824
1825 /*
1826 * Turn on LIP F8 async event (1)
1827 */
1828 MEMZERO(&mbs, sizeof (mbs));

--- 52 unchanged lines hidden (view full) ---

1881 return;
1882 }
1883 icbp->icb_xchgcnt = mbs.param[3];
1884 }
1885
1886 icbp->icb_fwoptions1 = fcp->isp_fwoptions;
1887
1888 icbp->icb_hardaddr = fcp->isp_loopid;
1889 if (icbp->icb_hardaddr > 125) {
1890 /*
1891 * We end up with these Loop IDs for F-Port topologies
1892 */
1893 if (icbp->icb_hardaddr != 0xff &&
1894 icbp->icb_hardaddr != 0x800 &&
1895 icbp->icb_hardaddr != 0xffff) {
1896 isp_prt(isp, ISP_LOGERR,
1897 "bad hard address %u- resetting to zero",
1898 icbp->icb_hardaddr);
1899 icbp->icb_hardaddr = 0;
1900 }
1901 }
1902
1903 if (isp->isp_confopts & ISP_CFG_OWNLOOPID) {
1904 icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
1905 }
1906
1907 icbp->icb_fwoptions2 = fcp->isp_xfwoptions;
1908 switch(isp->isp_confopts & ISP_CFG_PORT_PREF) {
1909 case ISP_CFG_NPORT:
1910 icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK;
1911 icbp->icb_fwoptions2 |= ICB2400_OPT2_PTP_2_LOOP;

--- 363 unchanged lines hidden (view full) ---

2275 isp_mboxcmd(isp, &mbs);
2276
2277 switch (mbs.param[0]) {
2278 case MBOX_PORT_ID_USED:
2279 isp_prt(isp, ISP_LOGDEBUG0,
2280 "isp_plogi_old: portid 0x%06x already logged in as %u",
2281 portid, mbs.param[1]);
2282 return (MBOX_PORT_ID_USED | (mbs.param[1] << 16));
2283 break;
2284
2285 case MBOX_LOOP_ID_USED:
2286 isp_prt(isp, ISP_LOGDEBUG0,
2287 "isp_plogi_old: handle %u in use for port id 0x%02xXXXX",
2288 handle, mbs.param[1] & 0xff);
2289 return (MBOX_LOOP_ID_USED);
2290
2291 case MBOX_COMMAND_COMPLETE:

--- 666 unchanged lines hidden (view full) ---

2958 MAKE_WWN_FROM_NODE_NAME(tmp.port_wwn, pdb.portname);
2959 tmp.roles = (pdb.s3_role & SVC3_ROLE_MASK) >> SVC3_ROLE_SHIFT;
2960 tmp.portid = pdb.portid;
2961 tmp.handle = pdb.handle;
2962
2963 /*
2964 * Check to make sure it's still a valid entry. The 24XX seems
2965 * to return a portid but not a WWPN/WWNN or role for devices
2966 * which shift on a loop, or have a WWPN/WWNN but no portid.
2967 */
2968 if (tmp.node_wwn == 0 || tmp.port_wwn == 0 || tmp.portid == 0) {
2969 if (isp->isp_dblev & ISP_LOGSANCFG) {
2970 int a, b, c;
2971 a = !(tmp.node_wwn == 0);
2972 b = !(tmp.port_wwn == 0);
2973 c = !(tmp.portid == 0);
2974 isp_prt(isp, ISP_LOGALL,
2975 "bad pdb (%1d%1d%1d) @ handle 0x%x",
2976 a, b, c, handle);
2977 isp_dump_portdb(isp);
2978 }
2979 continue;
2980 }
2981
2982 /*
2983 * Now search the entire port database
2984 * for the same Port and Node WWN.
2985 */
2986 for (i = 0; i < MAX_FC_TARG; i++) {

--- 1584 unchanged lines hidden (view full) ---

4571 "mailbox cmd (0x%x) with no waiters", mbox);
4572 }
4573 } else if (isp_parse_async(isp, mbox) < 0) {
4574 return;
4575 }
4576 if ((IS_FC(isp) && mbox != ASYNC_RIO_RESP) ||
4577 isp->isp_state != ISP_RUNSTATE) {
4578 goto out;
4579 return;
4580 }
4581 }
4582
4583 /*
4584 * We can't be getting this now.
4585 */
4586 if (isp->isp_state != ISP_RUNSTATE) {
4587 isp_prt(isp, ISP_LOGINFO,

--- 2930 unchanged lines hidden (view full) ---

7518 int loops = 0;
7519 const uint32_t base = 0x7ffe0000;
7520 uint32_t tmp;
7521
7522 ISP_WRITE(isp, BIU2400_FLASH_ADDR, base | addr);
7523 for (loops = 0; loops < 5000; loops++) {
7524 USEC_DELAY(10);
7525 tmp = ISP_READ(isp, BIU2400_FLASH_ADDR);
7526 if ((tmp & (1 << 31)) != 0) {
7527 break;
7528 }
7529 }
7530 if (tmp & (1 << 31)) {
7531 tmp = ISP_READ(isp, BIU2400_FLASH_DATA);
7532 *rp = tmp;
7533 } else {
7534 *rp = 0xffffffff;
7535 }
7536}
7537
7538static void

--- 794 unchanged lines hidden ---