The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/pci/if_pnreg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1997, 1998
    3  *      Bill Paul <wpaul@ctr.columbia.edu>.  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
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. All advertising materials mentioning features or use of this software
   14  *    must display the following acknowledgement:
   15  *      This product includes software developed by Bill Paul.
   16  * 4. Neither the name of the author nor the names of any co-contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   30  * THE POSSIBILITY OF SUCH DAMAGE.
   31  *
   32  * $FreeBSD$
   33  */
   34 
   35 /*
   36  * PNIC register definitions.
   37  */
   38 
   39 #define PN_BUSCTL               0x00    /* bus control */
   40 #define PN_TXSTART              0x08    /* tx start demand */
   41 #define PN_RXSTART              0x10    /* rx start demand */
   42 #define PN_RXADDR               0x18    /* rx descriptor list start addr */
   43 #define PN_TXADDR               0x20    /* tx descriptor list start addr */
   44 #define PN_ISR                  0x28    /* interrupt status register */
   45 #define PN_NETCFG               0x30    /* network config register */
   46 #define PN_IMR                  0x38    /* interrupt mask */
   47 #define PN_FRAMESDISCARDED      0x40    /* # of discarded frames */
   48 #define PN_SIO                  0x48    /* MII and ROM/EEPROM access */
   49 #define PN_GEN                  0x60    /* general purpose register */
   50 #define PN_ENDEC                0x78    /* ENDEC general register */
   51 #define PN_SIOPWR               0x90    /* serial eeprom power up */
   52 #define PN_SIOCTL               0x98    /* EEPROM control register */
   53 #define PN_MII                  0xA0    /* MII access register */
   54 #define PN_NWAY                 0xB8    /* Internal NWAY register */
   55 
   56 /*
   57  * Bus control bits.
   58  */
   59 #define PN_BUSCTL_RESET         0x00000001
   60 #define PN_BUSCTL_ARBITRATION   0x00000002
   61 #define PN_BUSCTL_SKIPLEN       0x0000007C
   62 #define PN_BUSCTL_BUF_BIGENDIAN 0x00000080
   63 #define PN_BUSCTL_BURSTLEN      0x00003F00
   64 #define PN_BUSCTL_CACHEALIGN    0x0000C000
   65 #define PN_BUSCTL_TXPOLL        0x000E0000
   66 #define PN_BUSCTL_MUSTBEONE     0x04000000
   67 
   68 #define PN_SKIPLEN_1LONG        0x00000004
   69 #define PN_SKIPLEN_2LONG        0x00000008
   70 #define PN_SKIPLEN_3LONG        0x00000010
   71 #define PN_SKIPLEN_4LONG        0x00000020
   72 #define PN_SKIPLEN_5LONG        0x00000040
   73 
   74 #define PN_CACHEALIGN_NONE      0x00000000
   75 #define PN_CACHEALIGN_8LONG     0x00004000
   76 #define PN_CACHEALIGN_16LONG    0x00008000
   77 #define PN_CACHEALIGN_32LONG    0x0000C000
   78 
   79 #define PN_BURSTLEN_USECA       0x00000000
   80 #define PN_BURSTLEN_1LONG       0x00000100
   81 #define PN_BURSTLEN_2LONG       0x00000200
   82 #define PN_BURSTLEN_4LONG       0x00000400
   83 #define PN_BURSTLEN_8LONG       0x00000800
   84 #define PN_BURSTLEN_16LONG      0x00001000
   85 #define PN_BURSTLEN_32LONG      0x00002000
   86 
   87 #define PN_TXPOLL_OFF           0x00000000
   88 #define PN_TXPOLL_200U          0x00020000
   89 #define PN_TXPOLL_800U          0x00040000
   90 #define PN_TXPOLL_1600U         0x00060000
   91 #define PN_TXPOLL_12_8M         0x00080000
   92 #define PN_TXPOLL_25_6M         0x000A0000
   93 #define PN_TXPOLL_51_2M         0x000C0000
   94 #define PN_TXPOLL_102_4M        0x000E0000
   95 
   96 #define PN_BUSCTL_CONFIG        \
   97         (PN_CACHEALIGN_8LONG|PN_BURSTLEN_8LONG)
   98 
   99 /*
  100  * Interrupt status bits.
  101  */
  102 #define PN_ISR_TX_OK            0x00000001      /* packet tx ok */
  103 #define PN_ISR_TX_IDLE          0x00000002      /* tx stopped */
  104 #define PN_ISR_TX_NOBUF         0x00000004      /* no tx buffer available */
  105 #define PN_ISR_TX_JABTIMEO      0x00000008      /* jabber timeout */
  106 #define PN_ISR_LINKPASS         0x00000010      /* link test pass */
  107 #define PN_ISR_TX_UNDERRUN      0x00000020      /* transmit underrun */
  108 #define PN_ISR_RX_OK            0x00000040      /* packet rx ok */
  109 #define PN_ISR_RX_NOBUF         0x00000080      /* rx buffer unavailable */
  110 #define PN_ISR_RX_IDLE          0x00000100      /* rx stopped */
  111 #define PN_ISR_RX_WATCHDOG      0x00000200      /* rx watchdog timeo */
  112 #define PN_ISR_TX_EARLY         0x00000400      /* rx watchdog timeo */
  113 #define PN_ISR_LINKFAIL         0x00001000
  114 #define PN_ISR_BUS_ERR          0x00002000
  115 #define PN_ISR_ABNORMAL         0x00008000
  116 #define PN_ISR_NORMAL           0x00010000
  117 #define PN_ISR_RX_STATE         0x000E0000
  118 #define PN_ISR_TX_STATE         0x00700000
  119 #define PN_ISR_BUSERRTYPE       0x03800000
  120 #define PN_ISR_TXABORT          0x04000000      /* tx abort */
  121 
  122 #define PN_RXSTATE_STOPPED      0x00000000      /* 000 - Stopped */
  123 #define PN_RXSTATE_FETCH        0x00020000      /* 001 - Fetching descriptor */
  124 #define PN_RXSTATE_ENDCHECK     0x00040000      /* 010 - check for rx end */
  125 #define PN_RXSTATE_WAIT         0x00060000      /* 011 - waiting for packet */
  126 #define PN_RXSTATE_SUSPEND      0x00080000      /* 100 - suspend rx */
  127 #define PN_RXSTATE_CLOSE        0x000A0000      /* 101 - close rx desc */
  128 #define PN_RXSTATE_FLUSH        0x000C0000      /* 110 - flush from FIFO */
  129 #define PN_RXSTATE_DEQUEUE      0x000E0000      /* 111 - dequeue from FIFO */
  130 
  131 #define PN_TXSTATE_RESET        0x00000000      /* 000 - reset */
  132 #define PN_TXSTATE_FETCH        0x00100000      /* 001 - fetching descriptor */
  133 #define PN_TXSTATE_WAITEND      0x00200000      /* 010 - wait for tx end */
  134 #define PN_TXSTATE_READING      0x00300000      /* 011 - read and enqueue */
  135 #define PN_TXSTATE_RSVD         0x00400000      /* 100 - reserved */
  136 #define PN_TXSTATE_SETUP        0x00500000      /* 101 - setup packet */
  137 #define PN_TXSTATE_SUSPEND      0x00600000      /* 110 - suspend tx */
  138 #define PN_TXSTATE_CLOSE        0x00700000      /* 111 - close tx desc */
  139 
  140 #define PN_BUSERR_PARITY        0x00000000
  141 #define PN_BUSERR_MASTABRT      0x00800000
  142 #define PN_BUSERR_TGTABRT       0x01000000
  143 #define PN_BUSERR_RSVD1         0x01800000
  144 #define PN_BUSERR_RSVD2         0x02000000
  145 
  146 /*
  147  * Network config bits.
  148  */
  149 #define PN_NETCFG_HASHPERF      0x00000001      /* 0 == perf, 1 == hash */
  150 #define PN_NETCFG_RX_ON         0x00000002
  151 #define PN_NETCFG_HASHONLY      0x00000004      /* 1 == allhash */
  152 #define PN_NETCFG_RX_PASSERR    0x00000008
  153 #define PN_NETCFG_INVERSFILT    0x00000010
  154 #define PN_NETCFG_BACKOFF       0x00000020
  155 #define PN_NETCFG_RX_PROMISC    0x00000040
  156 #define PN_NETCFG_RX_ALLMULTI   0x00000080
  157 #define PN_NETCFG_FLAKYOSC      0x00000100
  158 #define PN_NETCFG_FULLDUPLEX    0x00000200
  159 #define PN_NETCFG_OPERMODE      0x00000C00
  160 #define PN_NETCFG_FORCECOLL     0x00001000
  161 #define PN_NETCFG_TX_ON         0x00002000
  162 #define PN_NETCFG_TX_THRESH     0x0000C000
  163 #define PN_NETCFG_TX_BACKOFF    0x00020000
  164 #define PN_NETCFG_MIIENB        0x00040000      /* 1 == MII, 0 == internal */
  165 #define PN_NETCFG_HEARTBEAT     0x00080000      /* 1 == disabled */
  166 #define PN_NETCFG_TX_IMMEDIATE  0x00100000
  167 #define PN_NETCFG_STORENFWD     0x00200000
  168 #define PN_NETCFG_SPEEDSEL      0x00400000      /* 1 == 10Mbps 0 == 100Mbps */
  169 #define PN_NETCFG_PCS           0x00800000      /* 1 == 100baseTX */
  170 #define PN_NETCFG_SCRAMBLER     0x01000000
  171 #define PN_NETCFG_NO_RXCRC      0x20000000
  172 #define PN_NETCFG_EXT_ENDEC     0x40000000      /* 1 == ext, 0 == int PHY */
  173 
  174 #define PN_OPMODE_NORM          0x00000000
  175 #define PN_OPMODE_INTLOOP       0x00000400
  176 #define PN_OPMODE_EXTLOOP       0x00000800
  177 
  178 #define PN_TXTHRESH_72BYTES     0x00000000
  179 #define PN_TXTHRESH_96BYTES     0x00004000
  180 #define PN_TXTHRESH_128BYTES    0x00008000
  181 #define PN_TXTHRESH_160BYTES    0x0000C000
  182 
  183 /*
  184  * Interrupt mask bits.
  185  */
  186 #define PN_IMR_TX_OK            0x00000001      /* packet tx ok */
  187 #define PN_IMR_TX_IDLE          0x00000002      /* tx stopped */
  188 #define PN_IMR_TX_NOBUF         0x00000004      /* no tx buffer available */
  189 #define PN_IMR_TX_JABTIMEO      0x00000008      /* jabber timeout */
  190 #define PN_IMR_LINKPASS         0x00000010      /* link test pass */
  191 #define PN_IMR_TX_UNDERRUN      0x00000020      /* transmit underrun */
  192 #define PN_IMR_RX_OK            0x00000040      /* packet rx ok */
  193 #define PN_IMR_RX_NOBUF         0x00000080      /* rx buffer unavailable */
  194 #define PN_IMR_RX_IDLE          0x00000100      /* rx stopped */
  195 #define PN_IMR_RX_WATCHDOG      0x00000200      /* rx watchdog timeo */
  196 #define PN_IMR_TX_EARLY         0x00000400      /* rx watchdog timeo */
  197 #define PN_IMR_BUS_ERR          0x00002000
  198 #define PN_IMR_ABNORMAL         0x00008000
  199 #define PN_IMR_NORMAL           0x00010000
  200 #define PN_ISR_TXABORT          0x04000000      /* tx abort */
  201 
  202 #define PN_INTRS                                                        \
  203         (PN_IMR_RX_OK|PN_IMR_TX_OK|PN_IMR_RX_NOBUF|                     \
  204         PN_IMR_TX_NOBUF|PN_IMR_TX_UNDERRUN|PN_IMR_BUS_ERR|              \
  205         PN_IMR_ABNORMAL|PN_IMR_NORMAL)
  206 
  207 /*
  208  * Serial I/O (EEPROM/ROM) bits.
  209  */
  210 #define PN_SIO_DATA             0x0000003F
  211 #define PN_SIO_OPCODE           0x00000300
  212 #define PN_SIO_BUSY             0x80000000
  213 
  214 /*
  215  * SIOCTL/EEPROM bits
  216  */
  217 #define PN_EE_READ              0x600
  218 
  219 /*
  220  * General purpose register bits.
  221  */
  222 #define PN_GEN_CTL              0x000000F0
  223 #define PN_GEN_100TX_LINK       0x00000008
  224 #define PN_GEN_BNC_ENB          0x00000004
  225 #define PN_GEN_100TX_LOOP       0x00000002      /* 1 == normal, 0 == loop */
  226 #define PN_GEN_SPEEDSEL         0x00000001      /* 1 == 100Mbps, 0 == 10Mbps */
  227 #define PN_GEN_MUSTBEONE        0x00000030
  228 
  229 /*
  230  * General ENDEC bits.
  231  */
  232 #define PN_ENDEC_JABBERDIS      0x000000001     /* 1 == disable, 0 == enable */
  233 
  234 /*
  235  * MII bits.
  236  */
  237 #define PN_MII_DATA             0x0000FFFF
  238 #define PN_MII_REGADDR          0x007C0000
  239 #define PN_MII_PHYADDR          0x0F800000
  240 #define PN_MII_OPCODE           0x30000000
  241 #define PN_MII_RESERVED         0x00020000
  242 #define PN_MII_BUSY             0x80000000
  243 
  244 #define PN_MII_READ             0x60020000 /* read PHY command */
  245 #define PN_MII_WRITE            0x50020000 /* write PHY command */
  246 
  247 /*
  248  * Internal PHY NWAY register bits.
  249  */
  250 #define PN_NWAY_RESET           0x00000001      /* reset */
  251 #define PN_NWAY_PDOWN           0x00000002      /* power down */
  252 #define PN_NWAY_BYPASS          0x00000004      /* bypass */
  253 #define PN_NWAY_AUILOWCUR       0x00000008      /* AUI low current */
  254 #define PN_NWAY_TPEXTEND        0x00000010      /* low squelch voltage */
  255 #define PN_NWAY_POLARITY        0x00000020      /* 0 == on, 1 == off */
  256 #define PN_NWAY_TP              0x00000040      /* 1 == tp, 0 == AUI */
  257 #define PN_NWAY_AUIVOLT         0x00000080      /* 1 == full, 0 == half */
  258 #define PN_NWAY_DUPLEX          0x00000100      /* 1 == full, 0 == half */
  259 #define PN_NWAY_LINKTEST        0x00000200      /* 0 == on, 1 == off */
  260 #define PN_NWAY_AUTODETECT      0x00000400      /* 1 == off, 0 == on */
  261 #define PN_NWAY_SPEEDSEL        0x00000800      /* 0 == 10, 1 == 100 */
  262 #define PN_NWAY_NWAY_ENB        0x00001000      /* 0 == off, 1 == on */
  263 #define PN_NWAY_CAP10HALF       0x00002000
  264 #define PN_NWAY_CAP10FULL       0x00004000
  265 #define PN_NWAY_CAP100FULL      0x00008000
  266 #define PN_NWAY_CAP100HALF      0x00010000
  267 #define PN_NWAY_CAP100T4        0x00020000
  268 #define PN_NWAY_AUTONEGRSTR     0x02000000
  269 #define PN_NWAY_REMFAULT        0x04000000
  270 #define PN_NWAY_LPAR10HALF      0x08000000
  271 #define PN_NWAY_LPAR10FULL      0x10000000
  272 #define PN_NWAY_LPAR100FULL     0x20000000
  273 #define PN_NWAY_LPAR100HALF     0x40000000
  274 #define PN_NWAY_LPAR100T4       0x80000000
  275 
  276 /*
  277  * Nway register bits that must be set to turn on to initiate
  278  * an autoneg session with all modes advertized and AUI disabled.
  279  */
  280 #define PN_NWAY_AUTOENB                                                 \
  281         (PN_NWAY_AUILOWCUR|PN_NWAY_TPEXTEND|PN_NWAY_POLARITY|PN_NWAY_TP \
  282          |PN_NWAY_NWAY_ENB|PN_NWAY_CAP10HALF|PN_NWAY_CAP10FULL|         \
  283          PN_NWAY_CAP100FULL|PN_NWAY_CAP100HALF|PN_NWAY_CAP100T4|        \
  284          PN_NWAY_AUTONEGRSTR)
  285 
  286 #define PN_NWAY_MODE_10HD                                               \
  287         (PN_NWAY_CAP10HALF|PN_NWAY_CAP10FULL|           \
  288          PN_NWAY_CAP100FULL|PN_NWAY_CAP100HALF|PN_NWAY_CAP100T4|        \
  289          PN_NWAY_AUILOWCUR|PN_NWAY_TPEXTEND|PN_NWAY_POLARITY|           \
  290          PN_NWAY_TP)
  291 
  292 #define PN_NWAY_MODE_10FD                                               \
  293         (PN_NWAY_CAP10HALF|PN_NWAY_CAP10FULL|           \
  294          PN_NWAY_CAP100FULL|PN_NWAY_CAP100HALF|PN_NWAY_CAP100T4|        \
  295          PN_NWAY_AUILOWCUR|PN_NWAY_TPEXTEND|PN_NWAY_POLARITY|           \
  296          PN_NWAY_TP|PN_NWAY_DUPLEX)
  297 
  298 #define PN_NWAY_MODE_100HD                                              \
  299         (PN_NWAY_CAP10HALF|PN_NWAY_CAP10FULL|           \
  300          PN_NWAY_CAP100FULL|PN_NWAY_CAP100HALF|PN_NWAY_CAP100T4|        \
  301          PN_NWAY_AUILOWCUR|PN_NWAY_TPEXTEND|PN_NWAY_POLARITY|           \
  302          PN_NWAY_TP|PN_NWAY_SPEEDSEL)
  303 
  304 #define PN_NWAY_MODE_100FD                                              \
  305         (PN_NWAY_CAP10HALF|PN_NWAY_CAP10FULL|           \
  306          PN_NWAY_CAP100FULL|PN_NWAY_CAP100HALF|PN_NWAY_CAP100T4|        \
  307          PN_NWAY_AUILOWCUR|PN_NWAY_TPEXTEND|PN_NWAY_POLARITY|           \
  308          PN_NWAY_TP|PN_NWAY_SPEEDSEL|PN_NWAY_DUPLEX)
  309 
  310 #define PN_NWAY_MODE_100T4 PN_NWAY_MODE_100HD
  311 
  312 #define PN_NWAY_LPAR                                                    \
  313         (PN_NWAY_LPAR10HALF|PN_NWAY_LPAR10FULL|PN_NWAY_LPAR100HALF|     \
  314          PN_NWAY_LPAR100FULL|PN_NWAY_LPAR100T4)
  315 
  316 /*
  317  * Size of a setup frame.
  318  */
  319 #define PN_SFRAME_LEN           192
  320 
  321 /*
  322  * PNIC TX/RX list structure.
  323  */
  324 
  325 struct pn_desc {
  326         u_int32_t               pn_status;
  327         u_int32_t               pn_ctl;
  328         u_int32_t               pn_ptr1;
  329         u_int32_t               pn_ptr2;
  330 };
  331 
  332 #define pn_data         pn_ptr1
  333 #define pn_next         pn_ptr2
  334 
  335 
  336 #define RX_RXSTAT_FIFOOFLOW     0x00000001
  337 #define PN_RXSTAT_CRCERR        0x00000002
  338 #define PN_RXSTAT_DRIBBLE       0x00000004
  339 #define PN_RXSTAT_WATCHDOG      0x00000010
  340 #define PN_RXSTAT_FRAMETYPE     0x00000020      /* 0 == IEEE 802.3 */
  341 #define PN_RXSTAT_COLLSEEN      0x00000040
  342 #define PN_RXSTAT_GIANT         0x00000080
  343 #define PN_RXSTAT_LASTFRAG      0x00000100
  344 #define PN_RXSTAT_FIRSTFRAG     0x00000200
  345 #define PN_RXSTAT_MULTICAST     0x00000400
  346 #define PN_RXSTAT_RUNT          0x00000800
  347 #define PN_RXSTAT_RXTYPE        0x00003000
  348 #define PN_RXSTAT_RXERR         0x00008000
  349 #define PN_RXSTAT_RXLEN         0x7FFF0000
  350 #define PN_RXSTAT_OWN           0x80000000
  351 
  352 #define PN_RXBYTES(x)           ((x & PN_RXSTAT_RXLEN) >> 16)
  353 #define PN_RXSTAT (PN_RXSTAT_FIRSTFRAG|PN_RXSTAT_LASTFRAG|PN_RXSTAT_OWN)
  354 
  355 #define PN_RXCTL_BUFLEN1        0x00000FFF
  356 #define PN_RXCTL_BUFLEN2        0x00FFF000
  357 #define PN_RXCTL_RLINK          0x01000000
  358 #define PN_RXCTL_RLAST          0x02000000
  359 
  360 #define PN_TXSTAT_DEFER         0x00000001
  361 #define PN_TXSTAT_UNDERRUN      0x00000002
  362 #define PN_TXSTAT_LINKFAIL      0x00000003
  363 #define PN_TXSTAT_COLLCNT       0x00000078
  364 #define PN_TXSTAT_SQE           0x00000080
  365 #define PN_TXSTAT_EXCESSCOLL    0x00000100
  366 #define PN_TXSTAT_LATECOLL      0x00000200
  367 #define PN_TXSTAT_NOCARRIER     0x00000400
  368 #define PN_TXSTAT_CARRLOST      0x00000800
  369 #define PN_TXSTAT_JABTIMEO      0x00004000
  370 #define PN_TXSTAT_ERRSUM        0x00008000
  371 #define PN_TXSTAT_OWN           0x80000000
  372 
  373 #define PN_TXCTL_BUFLEN1        0x000007FF
  374 #define PN_TXCTL_BUFLEN2        0x003FF800
  375 #define PN_TXCTL_FILTTYPE0      0x00400000
  376 #define PN_TXCTL_PAD            0x00800000
  377 #define PN_TXCTL_TLINK          0x01000000
  378 #define PN_TXCTL_TLAST          0x02000000
  379 #define PN_TXCTL_NOCRC          0x04000000
  380 #define PN_TXCTL_SETUP          0x08000000
  381 #define PN_TXCTL_FILTTYPE1      0x10000000
  382 #define PN_TXCTL_FIRSTFRAG      0x20000000
  383 #define PN_TXCTL_LASTFRAG       0x40000000
  384 #define PN_TXCTL_FINT           0x80000000
  385 
  386 #define PN_FILTER_PERFECT       0x00000000
  387 #define PN_FILTER_HASHPERF      0x00400000
  388 #define PN_FILTER_INVERSE       0x10000000
  389 #define PN_FILTER_HASHONLY      0x10400000
  390 
  391 #define PN_MAXFRAGS             16
  392 #define PN_RX_LIST_CNT          64
  393 #define PN_TX_LIST_CNT          128
  394 #define PN_MIN_FRAMELEN         60
  395 #define PN_FRAMELEN             1536
  396 #define PN_RXLEN                1536
  397 
  398 /*
  399  * A tx 'super descriptor' is actually 16 regular descriptors
  400  * back to back.
  401  */
  402 struct pn_txdesc {
  403         struct pn_desc          pn_frag[PN_MAXFRAGS];
  404 };
  405 
  406 #define PN_TXNEXT(x)    x->pn_ptr->pn_frag[x->pn_lastdesc].pn_next
  407 #define PN_TXSTATUS(x)  x->pn_ptr->pn_frag[x->pn_lastdesc].pn_status
  408 #define PN_TXCTL(x)     x->pn_ptr->pn_frag[x->pn_lastdesc].pn_ctl
  409 #define PN_TXDATA(x)    x->pn_ptr->pn_frag[x->pn_lastdesc].pn_data
  410 
  411 #define PN_TXOWN(x)     x->pn_ptr->pn_frag[0].pn_status
  412 
  413 struct pn_list_data {
  414         struct pn_desc          pn_rx_list[PN_RX_LIST_CNT];
  415         struct pn_txdesc        pn_tx_list[PN_TX_LIST_CNT];
  416 };
  417 
  418 struct pn_chain {
  419         struct pn_txdesc        *pn_ptr;
  420         struct mbuf             *pn_mbuf;
  421         struct pn_chain         *pn_nextdesc;
  422         u_int8_t                pn_lastdesc;
  423 };
  424 
  425 struct pn_chain_onefrag {
  426         struct pn_desc          *pn_ptr;
  427         struct mbuf             *pn_mbuf;
  428         struct pn_chain_onefrag *pn_nextdesc;
  429 };
  430 
  431 struct pn_chain_data {
  432         struct pn_desc          pn_sframe;
  433         u_int32_t               pn_sbuf[PN_SFRAME_LEN/sizeof(u_int32_t)];
  434         struct pn_chain_onefrag pn_rx_chain[PN_RX_LIST_CNT];
  435         struct pn_chain         pn_tx_chain[PN_TX_LIST_CNT];
  436 
  437         struct pn_chain_onefrag *pn_rx_head;
  438 
  439         struct pn_chain         *pn_tx_head;
  440         struct pn_chain         *pn_tx_tail;
  441         struct pn_chain         *pn_tx_free;
  442 };
  443 
  444 struct pn_type {
  445         u_int16_t               pn_vid;
  446         u_int16_t               pn_did;
  447         char                    *pn_name;
  448 };
  449 
  450 struct pn_mii_frame {
  451         u_int8_t                mii_stdelim;
  452         u_int8_t                mii_opcode;
  453         u_int8_t                mii_phyaddr;
  454         u_int8_t                mii_regaddr;
  455         u_int8_t                mii_turnaround;
  456         u_int16_t               mii_data;
  457 };
  458 
  459 /*
  460  * MII constants
  461  */
  462 #define PN_MII_STARTDELIM       0x01
  463 #define PN_MII_READOP           0x02
  464 #define PN_MII_WRITEOP          0x01
  465 #define PN_MII_TURNAROUND       0x02
  466 
  467 #define PN_FLAG_FORCEDELAY      1
  468 #define PN_FLAG_SCHEDDELAY      2
  469 #define PN_FLAG_DELAYTIMEO      3       
  470 
  471 struct pn_softc {
  472         struct arpcom           arpcom;         /* interface info */
  473         struct ifmedia          ifmedia;        /* media info */
  474         bus_space_handle_t      pn_bhandle;     /* bus space handle */
  475         bus_space_tag_t         pn_btag;        /* bus space tag */
  476         struct pn_type          *pn_info;       /* PNIC adapter info */
  477         struct pn_type          *pn_pinfo;      /* phy info */
  478         u_int8_t                pn_unit;        /* interface number */
  479         u_int8_t                pn_type;
  480         u_int8_t                pn_phy_addr;    /* PHY address */
  481         u_int8_t                pn_tx_pend;     /* TX pending */
  482         u_int8_t                pn_want_auto;
  483         u_int8_t                pn_autoneg;
  484         caddr_t                 pn_ldata_ptr;
  485 #ifdef PN_RX_BUG_WAR
  486 #define PN_168_REV      16
  487 #define PN_169_REV      32
  488 #define PN_169B_REV     33
  489         u_int8_t                pn_rx_war;
  490         u_int8_t                pn_cachesize;
  491         struct pn_chain_onefrag *pn_rx_bug_save;
  492         unsigned char           *pn_rx_buf;
  493 #endif
  494         struct pn_list_data     *pn_ldata;
  495         struct pn_chain_data    pn_cdata;
  496 };
  497 
  498 /*
  499  * register space access macros
  500  */
  501 #define CSR_WRITE_4(sc, reg, val)       \
  502         bus_space_write_4(sc->pn_btag, sc->pn_bhandle, reg, val)
  503 #define CSR_WRITE_2(sc, reg, val)       \
  504         bus_space_write_2(sc->pn_btag, sc->pn_bhandle, reg, val)
  505 #define CSR_WRITE_1(sc, reg, val)       \
  506         bus_space_write_1(sc->pn_btag, sc->pn_bhandle, reg, val)
  507 
  508 #define CSR_READ_4(sc, reg)             \
  509         bus_space_read_4(sc->pn_btag, sc->pn_bhandle, reg)
  510 #define CSR_READ_2(sc, reg)             \
  511         bus_space_read_2(sc->pn_btag, sc->pn_bhandle, reg)
  512 #define CSR_READ_1(sc, reg)             \
  513         bus_space_read_1(sc->pn_btag, sc->pn_bhandle, reg)
  514 
  515 #define PN_TIMEOUT              1000
  516 
  517 /*
  518  * General constants that are fun to know.
  519  *
  520  * Lite-On PNIC PCI vendor ID
  521  */
  522 #define PN_VENDORID             0x11AD
  523 
  524 /*
  525  * Lite-On PNIC PCI device ID.
  526  */
  527 #define PN_DEVICEID_PNIC        0x0002
  528 
  529 /*
  530  * The 82c168 chip has the same PCI vendor/device ID as the
  531  * 82c169, but a different revision. Assume that any revision
  532  * between 0x10 an 0x1F is an 82c168.
  533  */
  534 #define PN_REVMASK              0xF0
  535 #define PN_REVID_82C168         0x10
  536 #define PN_REVID_82C169         0x20
  537 
  538 /*
  539  * Texas Instruments PHY identifiers
  540  */
  541 #define TI_PHY_VENDORID         0x4000
  542 #define TI_PHY_10BT             0x501F
  543 #define TI_PHY_100VGPMI         0x502F
  544 
  545 /*
  546  * These ID values are for the NS DP83840A 10/100 PHY
  547  */
  548 #define NS_PHY_VENDORID         0x2000
  549 #define NS_PHY_83840A           0x5C0F
  550 
  551 /*
  552  * Level 1 10/100 PHY
  553  */
  554 #define LEVEL1_PHY_VENDORID     0x7810
  555 #define LEVEL1_PHY_LXT970       0x000F
  556 
  557 /*
  558  * Intel 82555 10/100 PHY
  559  */
  560 #define INTEL_PHY_VENDORID      0x0A28
  561 #define INTEL_PHY_82555         0x015F
  562 
  563 /*
  564  * SEEQ 80220 10/100 PHY
  565  */
  566 #define SEEQ_PHY_VENDORID       0x0016
  567 #define SEEQ_PHY_80220          0xF83F
  568 
  569 
  570 /*
  571  * PCI low memory base and low I/O base register, and
  572  * other PCI registers.
  573  */
  574 
  575 #define PN_PCI_VENDOR_ID        0x00
  576 #define PN_PCI_DEVICE_ID        0x02
  577 #define PN_PCI_COMMAND          0x04
  578 #define PN_PCI_STATUS           0x06
  579 #define PN_PCI_REVISION         0x08
  580 #define PN_PCI_CLASSCODE        0x09
  581 #define PN_PCI_CACHELEN         0x0C
  582 #define PN_PCI_LATENCY_TIMER    0x0D
  583 #define PN_PCI_HEADER_TYPE      0x0E
  584 #define PN_PCI_LOIO             0x10
  585 #define PN_PCI_LOMEM            0x14
  586 #define PN_PCI_BIOSROM          0x30
  587 #define PN_PCI_INTLINE          0x3C
  588 #define PN_PCI_INTPIN           0x3D
  589 #define PN_PCI_MINGNT           0x3E
  590 #define PN_PCI_MINLAT           0x0F
  591 #define PN_PCI_RESETOPT         0x48
  592 #define PN_PCI_EEPROM_DATA      0x4C
  593 
  594 /* power management registers */
  595 #define PN_PCI_CAPID            0xDC /* 8 bits */
  596 #define PN_PCI_NEXTPTR          0xDD /* 8 bits */
  597 #define PN_PCI_PWRMGMTCAP       0xDE /* 16 bits */
  598 #define PN_PCI_PWRMGMTCTRL      0xE0 /* 16 bits */
  599 
  600 #define PN_PSTATE_MASK          0x0003
  601 #define PN_PSTATE_D0            0x0000
  602 #define PN_PSTATE_D1            0x0002
  603 #define PN_PSTATE_D2            0x0002
  604 #define PN_PSTATE_D3            0x0003
  605 #define PN_PME_EN               0x0010
  606 #define PN_PME_STATUS           0x8000
  607 
  608 #define PHY_UNKNOWN             6
  609 
  610 #define PN_PHYADDR_MIN          0x00
  611 #define PN_PHYADDR_MAX          0x1F
  612 
  613 #define PHY_BMCR                0x00
  614 #define PHY_BMSR                0x01
  615 #define PHY_VENID               0x02
  616 #define PHY_DEVID               0x03
  617 #define PHY_ANAR                0x04
  618 #define PHY_LPAR                0x05
  619 #define PHY_ANEXP               0x06
  620 
  621 #define PHY_ANAR_NEXTPAGE       0x8000
  622 #define PHY_ANAR_RSVD0          0x4000
  623 #define PHY_ANAR_TLRFLT         0x2000
  624 #define PHY_ANAR_RSVD1          0x1000
  625 #define PHY_ANAR_RSVD2          0x0800
  626 #define PHY_ANAR_RSVD3          0x0400
  627 #define PHY_ANAR_100BT4         0x0200
  628 #define PHY_ANAR_100BTXFULL     0x0100
  629 #define PHY_ANAR_100BTXHALF     0x0080
  630 #define PHY_ANAR_10BTFULL       0x0040
  631 #define PHY_ANAR_10BTHALF       0x0020
  632 #define PHY_ANAR_PROTO4         0x0010
  633 #define PHY_ANAR_PROTO3         0x0008
  634 #define PHY_ANAR_PROTO2         0x0004
  635 #define PHY_ANAR_PROTO1         0x0002
  636 #define PHY_ANAR_PROTO0         0x0001
  637 
  638 /*
  639  * These are the register definitions for the PHY (physical layer
  640  * interface chip).
  641  */
  642 /*
  643  * PHY BMCR Basic Mode Control Register
  644  */
  645 #define PHY_BMCR_RESET                  0x8000
  646 #define PHY_BMCR_LOOPBK                 0x4000
  647 #define PHY_BMCR_SPEEDSEL               0x2000
  648 #define PHY_BMCR_AUTONEGENBL            0x1000
  649 #define PHY_BMCR_RSVD0                  0x0800  /* write as zero */
  650 #define PHY_BMCR_ISOLATE                0x0400
  651 #define PHY_BMCR_AUTONEGRSTR            0x0200
  652 #define PHY_BMCR_DUPLEX                 0x0100
  653 #define PHY_BMCR_COLLTEST               0x0080
  654 #define PHY_BMCR_RSVD1                  0x0040  /* write as zero, don't care */
  655 #define PHY_BMCR_RSVD2                  0x0020  /* write as zero, don't care */
  656 #define PHY_BMCR_RSVD3                  0x0010  /* write as zero, don't care */
  657 #define PHY_BMCR_RSVD4                  0x0008  /* write as zero, don't care */
  658 #define PHY_BMCR_RSVD5                  0x0004  /* write as zero, don't care */
  659 #define PHY_BMCR_RSVD6                  0x0002  /* write as zero, don't care */
  660 #define PHY_BMCR_RSVD7                  0x0001  /* write as zero, don't care */
  661 /*
  662  * RESET: 1 == software reset, 0 == normal operation
  663  * Resets status and control registers to default values.
  664  * Relatches all hardware config values.
  665  *
  666  * LOOPBK: 1 == loopback operation enabled, 0 == normal operation
  667  *
  668  * SPEEDSEL: 1 == 100Mb/s, 0 == 10Mb/s
  669  * Link speed is selected byt his bit or if auto-negotiation if bit
  670  * 12 (AUTONEGENBL) is set (in which case the value of this register
  671  * is ignored).
  672  *
  673  * AUTONEGENBL: 1 == Autonegotiation enabled, 0 == Autonegotiation disabled
  674  * Bits 8 and 13 are ignored when autoneg is set, otherwise bits 8 and 13
  675  * determine speed and mode. Should be cleared and then set if PHY configured
  676  * for no autoneg on startup.
  677  *
  678  * ISOLATE: 1 == isolate PHY from MII, 0 == normal operation
  679  *
  680  * AUTONEGRSTR: 1 == restart autonegotiation, 0 = normal operation
  681  *
  682  * DUPLEX: 1 == full duplex mode, 0 == half duplex mode
  683  *
  684  * COLLTEST: 1 == collision test enabled, 0 == normal operation
  685  */
  686 
  687 /* 
  688  * PHY, BMSR Basic Mode Status Register 
  689  */   
  690 #define PHY_BMSR_100BT4                 0x8000
  691 #define PHY_BMSR_100BTXFULL             0x4000
  692 #define PHY_BMSR_100BTXHALF             0x2000
  693 #define PHY_BMSR_10BTFULL               0x1000
  694 #define PHY_BMSR_10BTHALF               0x0800
  695 #define PHY_BMSR_RSVD1                  0x0400  /* write as zero, don't care */
  696 #define PHY_BMSR_RSVD2                  0x0200  /* write as zero, don't care */
  697 #define PHY_BMSR_RSVD3                  0x0100  /* write as zero, don't care */
  698 #define PHY_BMSR_RSVD4                  0x0080  /* write as zero, don't care */
  699 #define PHY_BMSR_MFPRESUP               0x0040
  700 #define PHY_BMSR_AUTONEGCOMP            0x0020
  701 #define PHY_BMSR_REMFAULT               0x0010
  702 #define PHY_BMSR_CANAUTONEG             0x0008
  703 #define PHY_BMSR_LINKSTAT               0x0004
  704 #define PHY_BMSR_JABBER                 0x0002
  705 #define PHY_BMSR_EXTENDED               0x0001
  706 
  707 #ifdef __alpha__
  708 #undef vtophys
  709 #define vtophys(va)             (pmap_kextract(((vm_offset_t) (va))) \
  710                                         + 1*1024*1024*1024)
  711 #endif

Cache object: 8c970a9bf9ee075ec721f52ca7001bd9


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.