Annotation of Net2/arch/vax/if/if_hyreg.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1988 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * This code is derived from software contributed to Berkeley by
                      6:  * Tektronix Inc.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed by the University of
                     19:  *     California, Berkeley and its contributors.
                     20:  * 4. Neither the name of the University nor the names of its contributors
                     21:  *    may be used to endorse or promote products derived from this software
                     22:  *    without specific prior written permission.
                     23:  *
                     24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     34:  * SUCH DAMAGE.
                     35:  *
                     36:  *     @(#)if_hyreg.h  7.3 (Berkeley) 6/28/90
                     37:  */
                     38: 
                     39: /*
                     40:  * Modifications from Berkeley 4.2 BSD
                     41:  * Copyright (c) 1983, Tektronix Inc.
                     42:  * All Rights Reserved
                     43:  */
                     44: 
                     45: /*
                     46:  * Network Systems Corporation Hyperchannel interface
                     47:  *
                     48:  * supports A410 adapter interfaced via a DEC DR-11B, NSC PI-13 or PI-14
                     49:  *     (PI-14 is a PI-13 with different line drivers, software is
                     50:  *     identical to a PI-13)
                     51:  *
                     52:  * Written by Steve Glaser, Tektronix Inc., July 1982
                     53:  *
                     54:  * NOTE:
                     55:  *
                     56:  * DR11B code has not been fully checked out with 4.1a.
                     57:  * The first adapters at Tek came with DR11Bs, and the code once worked,
                     58:  * but those have been upgraded to PI-13s.
                     59:  */
                     60: 
                     61: /*
                     62:  * The HYPERchannel driver sends and receives messages formatted:
                     63:  *
                     64:  *     +---------------------------------------+       ---
                     65:  *     |                                       |       /|\
                     66:  *     |  HYPERchannel adapter header (hy_hdr) |        |
                     67:  *     |                                       |        |
                     68:  *     +---------------------------------------+        |
                     69:  *     |                                       |        |
                     70:  *     |     Internet Protocol header (ip)     |    message proper
                     71:  *     |                                       |    (64 bytes max)
                     72:  *     +---------------------------------------+        |
                     73:  *     |                                       |        |
                     74:  *     |       TCP header + user data          |        |
                     75:  *     |       (if it all fits here)           |        |
                     76:  *     |                                       |       \|/
                     77:  *     +---------------------------------------+       ---
                     78:  *
                     79:  *     +---------------------------------------+       ---
                     80:  *     |                                       |       /|\
                     81:  *     |                                       |        |
                     82:  *     |       TCP header + user data          |  associated data
                     83:  *     |                                       |        |
                     84:  *     |                                       |       \|/
                     85:  *     +---------------------------------------+       ---
                     86:  *
                     87:  * If all of the datagram will fit in the message proper (including
                     88:  * the TCP header and user data) the entire datagram is passed in
                     89:  * the message proper and the associated data feature of the HYPERchannel
                     90:  * is not used.
                     91:  *
                     92:  * The mapping from internet addresses to HYPERchannel addresses is:
                     93:  *
                     94:  *      0       7 8      15 16                   31
                     95:  *     +---------+---------+-----------------------+
                     96:  *     | network | special | HYPERchannel address  |
                     97:  *     +---------+---------+-----------------------+
                     98:  *
                     99:  *     |<------------ internet address ----------->|
                    100:  *
                    101:  * The hyperchannel address is decoded as follows:
                    102:  *
                    103:  *       0                 7 8             13 14  15
                    104:  *     +-------------------+----------------+------+
                    105:  *     |   adapter number  |      zero      | port |
                    106:  *     +-------------------+----------------+------+
                    107:  *
                    108:  * The low 2 bits are port number (interpreted by hyperchannel hardware).
                    109:  *
                    110:  * The encoding of special bits is:
                    111:  *
                    112:  *     00      normal packet
                    113:  *
                    114:  *     01      loop this packet back to the sender at the
                    115:  *             specified adapter (ip header source/destination addresses
                    116:  *             swapped before sending, command bits added to tell the
                    117:  *             remote HYPERchannel adapter debug & performance studies]
                    118:  *             this code acts like 02 (below) if the ip destination (before
                    119:  *             any swapping) and the destination address don't match (e.g.
                    120:  *             this packet is being routed through a gateway)
                    121:  *
                    122:  *     02      loop this packet back to the sender at the
                    123:  *             specified adapter, but go through the specified adapter's
                    124:  *             IP.  This is for testing IP's store and forward mechanism.
                    125:  *
                    126:  *     other   undefined, currently treated as normal packet
                    127:  *
                    128:  */
                    129: #define MPSIZE         64      /* "Message Proper" size */
                    130: #define MAXRETRY       4
                    131: 
                    132: /*
                    133:  * Device registers
                    134:  */
                    135: struct hydevice {
                    136:        short   hyd_wcr;        /* word count (negated) */
                    137:        u_short hyd_bar;        /* bus address bits 15-0 */
                    138:        u_short hyd_csr;        /* control and status */
                    139:        u_short hyd_dbuf;       /* data buffer */
                    140: };
                    141: 
                    142: /*
                    143:  * CSR bit layout
                    144:  */
                    145: #define        S_ERROR    0100000      /* error */
                    146: #define        S_NEX      0040000      /* non-existent memory error */
                    147: #define        S_ATTN     0020000      /* attn (always zero) */
                    148: #ifdef PI13
                    149: #define S_STKINTR  0010000     /* stacked interrupt */
                    150: #else
                    151: #define        S_MAINT    0010000      /* maintenance (not used) */
                    152: #endif
                    153: #define        S_A        0004000      /* device status A (recieve data available) */
                    154: #define        S_B        0002000      /* device status B (normal termination) */
                    155: #define        S_C        0001000      /* device status C (abnormal termination) */
                    156: #ifdef PI13
                    157: #define S_POWEROFF 0000400     /* power off indicator */
                    158: #else
                    159: #define        S_CYCLE    0000400      /* cycle (not used) */
                    160: #endif
                    161: #define        S_READY    0000200      /* ready */
                    162: #define        S_IE       0000100      /* interrupt enable */
                    163: #define        S_XBA      0000060      /* bus address bit bits 17 and 16 */
                    164: #define S_CLRINT   0000014     /* clear stacked interrupt */
                    165: #define        S_IATTN    0000010      /* interrupt on attention only */
                    166: #define S_WC       0000004     /* interrupt on word count == 0 only */
                    167: #define S_IATTNWC  0000000     /* interrupt on word count == 0 and attention */
                    168: #define        S_BURST    0000002      /* burst mode DMA (not used) */
                    169: #define        S_GO       0000001      /* go */
                    170: 
                    171: #define XBASHIFT       12
                    172: 
                    173: #define HY_CSR_BITS "\20\
                    174: \20ERROR\17NEX\16ATTN\15STKINTR\14RECV_DATA\13NORMAL\12ABNORMAL\11POWER\
                    175: \10READY\07IENABLE\06XBA17\05XBA16\04IATTN\03IWC\02BURST\01GO"
                    176: 
                    177: /*
                    178:  * PI13 status conditions
                    179:  */
                    180: #define        HYS_RECVDATA(x) (((x)->hyd_csr & S_A) != 0)     /* get adapter data */
                    181: #define        HYS_NORMAL(x)   (((x)->hyd_csr & S_B) != 0)     /* done normally */
                    182: #define        HYS_ABNORMAL(x) (((x)->hyd_csr & S_C) != 0)     /* done abnormally */
                    183: #define        HYS_ERROR(x)    (((x)->hyd_csr & S_ERROR) != 0) /* error condition */
                    184: #define        HYS_DONE(x)     (((x)->hyd_csr & (S_ERROR|S_B|S_C)) != 0)
                    185: 
                    186: /*
                    187:  * Function Codes for the Hyperchannel Adapter
                    188:  * The codes are offset so they can be "or"ed into
                    189:  * the reg data buffer
                    190:  */
                    191: #define        HYF_XMITMSG     0x04    /* transmit message */
                    192: #define        HYF_XMITDATA    0x08    /* transmit associated data */
                    193: #define        HYF_XMITLSTDATA 0x0C    /* transmit last associated data */
                    194: #define        HYF_XMITLOCMSG  0x10    /* transmit local message */
                    195: #define        HYF_INPUTMSG    0x24    /* input message proper */
                    196: #define        HYF_INPUTDATA   0x28    /* input assiciated data */
                    197: #define        HYF_STATUS      0x40    /* request status */
                    198: #define        HYF_DUMPREGS    0x50    /* dump extention registers */
                    199: #define        HYF_MARKP0      0x60    /* mark down port 0 */
                    200: #define        HYF_MARKP1      0x64    /* mark down port 1 */
                    201: #define        HYF_MARKP2      0x68    /* mark down port 2 */
                    202: #define        HYF_MARKP3      0x6C    /* mark down port 3 */
                    203: #define        HYF_MP0RR       0x70    /* mark down port 0 and reroute messages */
                    204: #define        HYF_MP1RR       0x74    /* mark down port 1 and reroute messages */
                    205: #define        HYF_MP2RR       0x78    /* mark down port 2 and reroute messages */
                    206: #define        HYF_MP3RR       0x7C    /* mark down port 3 and reroute messages */
                    207: #define        HYF_RSTATS      0xA0    /* read statistics */
                    208: #define        HYF_RCSTATS     0xA4    /* read and clear statistics */
                    209: #define        HYF_SETTEST     0xC0    /* enable test operations *set test mode) */
                    210: #define        HYF_SADDR_LEN   0xC4    /* test mode: set address and length */
                    211: #define        HYF_WBUFF       0xC8    /* test mode: write buffer */
                    212: #define        HYF_RBUFF       0xCC    /* test mode: read buffer */
                    213: #define HYF_CLRADAPTER 0xE0    /* clear adapter */
                    214: #define        HYF_END_OP      0xE4    /* end operation */
                    215: #define        HYF_CLRWFMSG    0xE6    /* clear wait for mwssage */
                    216: #define        HYF_WAITFORMSG  0xE8    /* wait for message */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.