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

1.1       root        1: /*
                      2:  * Copyright (c) 1982, 1986 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_hy.h     7.4 (Berkeley) 6/28/90
                     37:  */
                     38: 
                     39: /*
                     40:  * 4.2 BSD Unix Kernel - Vax Network Interface Support
                     41:  *
                     42:  * $Header: if_hy.h,v 10.0 84/06/30 19:51:21 steveg Stable $
                     43:  * $Locker:  $
                     44:  *
                     45:  * Modifications from Berkeley 4.2 BSD
                     46:  * Copyright (c) 1983, Tektronix Inc.
                     47:  * All Rights Reserved
                     48:  *
                     49:  *
                     50:  * $Log:       if_hy.h,v $
                     51:  *     Revision 10.0  84/06/30  19:51:21  steveg
                     52:  *     Big Build
                     53:  *     
                     54:  *     Revision 3.13  84/05/30  19:40:58  steveg
                     55:  *     update hy_stat to reflect new microcode
                     56:  *     
                     57:  *     Revision 3.12  84/05/30  19:06:57  steveg
                     58:  *     move driver state number definition here from if_hy.c
                     59:  *     
                     60:  *     Revision 3.11  84/05/30  18:56:15  steveg
                     61:  *     add definition of HYE_MAX and HYE_SIZE
                     62:  *     
                     63:  *     Revision 3.10  84/05/30  17:14:04  steveg
                     64:  *     add hyl_filter
                     65:  *     
                     66:  *     Revision 3.9  84/05/30  13:45:24  steveg
                     67:  *     rework logging
                     68:  *     
                     69:  *     Revision 3.8  84/05/04  05:18:59  steveg
                     70:  *     hyr_key now a u_long
                     71:  *     
                     72:  *     Revision 3.7  84/05/01  22:45:20  steveg
                     73:  *     add H_RLOOPBK for A710 remote end loopback command
                     74:  *     
                     75:  *
                     76:  */
                     77: 
                     78: 
                     79: /*
                     80:  * Structure of a HYPERchannel adapter header
                     81:  */
                     82: struct hy_hdr {
                     83:        short   hyh_ctl;                /* control */
                     84:        short   hyh_access;             /* access code */
                     85:        union {
                     86:                short   hyh_addr;
                     87:                char    hyh_baddr[2];
                     88:        } hyh_uto, hyh_ufrom;           /* to/from address */
                     89:        short   hyh_param;              /* parameter word */
                     90:        short   hyh_type;               /* record type */
                     91: };
                     92: 
                     93: 
                     94: #define hyh_to         hyh_uto.hyh_addr
                     95: #define hyh_to_port    hyh_uto.hyh_baddr[1]
                     96: #define hyh_to_adapter hyh_uto.hyh_baddr[0]
                     97: 
                     98: #define hyh_from       hyh_ufrom.hyh_addr
                     99: #define hyh_from_port  hyh_ufrom.hyh_baddr[1]
                    100: #define hyh_from_adapter hyh_ufrom.hyh_baddr[0]
                    101: 
                    102: /*
                    103:  * Structure of a HYPERchannel message header (from software)
                    104:  */
                    105: struct hym_hdr {
                    106:        struct {
                    107:                short   hymd_mplen;     /* message proper len, if associated data */
                    108:        } hym_d;
                    109:        struct  hy_hdr hym_h;   /* hardware header, MUST BE LAST */
                    110: };
                    111: 
                    112: #define hym_mplen      hym_d.hymd_mplen
                    113: 
                    114: #define hym_ctl                hym_h.hyh_ctl
                    115: #define hym_access     hym_h.hyh_access
                    116: #define hym_param      hym_h.hyh_param
                    117: #define hym_type       hym_h.hyh_type
                    118: 
                    119: #define hym_to         hym_h.hyh_to
                    120: #define hym_to_port    hym_h.hyh_to_port
                    121: #define hym_to_adapter hym_h.hyh_to_adapter
                    122: 
                    123: #define hym_from       hym_h.hyh_from
                    124: #define hym_from_port  hym_h.hyh_from_port
                    125: #define hym_from_adapter hym_h.hyh_from_adapter
                    126: 
                    127: #define HYM_SWLEN (sizeof(struct hym_hdr) - sizeof(struct hy_hdr))
                    128: 
                    129: /*
                    130:  * HYPERchannel header word control bits
                    131:  */
                    132: #define H_XTRUNKS      0x00F0  /* transmit trunks */
                    133: #define H_RTRUNKS      0x000F  /* remote trunks to transmit on for loopback */
                    134: #define H_ASSOC                0x0100  /* has associated data */
                    135: #define H_LOOPBK       0x00FF  /* loopback command */
                    136: #define H_RLOOPBK      0x008F  /* A710 remote loopback command */
                    137: 
                    138: /*
                    139:  * Hyperchannel record types
                    140:  */
                    141: #define HYLINK_IP      0       /* Internet Protocol Packet */
                    142: 
                    143: /*
                    144:  * Routing database
                    145:  */
                    146: #define HYRSIZE  37    /* max number of adapters in routing tables */
                    147: 
                    148: struct hy_route {
                    149:        time_t hyr_lasttime;            /* last update time */
                    150:        u_char hyr_gateway[256];
                    151:        struct hyr_hash {
                    152:                u_long  hyr_key;        /* desired address */
                    153:                u_short hyr_flags;      /* status flags - see below */
                    154:                u_short hyr_size;       /* number of entries */
                    155:                union {
                    156:                        /*
                    157:                         * direct entry (can get there directly)
                    158:                         */
                    159:                        struct {
                    160:                                u_short hyru_dst;       /* adapter number & port */
                    161:                                u_short hyru_ctl;       /* trunks to try */
                    162:                                u_short hyru_access;    /* access code (mostly unused) */
                    163:                        } hyr_d;
                    164: #define hyr_dst                hyr_u.hyr_d.hyru_dst
                    165: #define hyr_ctl                hyr_u.hyr_d.hyru_ctl
                    166: #define hyr_access     hyr_u.hyr_d.hyru_access
                    167:                        /*
                    168:                         * indirect entry (one or more hops required)
                    169:                         */
                    170:                        struct {
                    171:                                u_char hyru_pgate;      /* 1st gateway slot */
                    172:                                u_char hyru_egate;      /* # gateways */
                    173:                                u_char hyru_nextgate;   /* gateway to use next */
                    174:                        } hyr_i;
                    175: #define hyr_pgate      hyr_u.hyr_i.hyru_pgate
                    176: #define hyr_egate      hyr_u.hyr_i.hyru_egate
                    177: #define hyr_nextgate   hyr_u.hyr_i.hyru_nextgate
                    178:                } hyr_u;
                    179:        } hyr_hash[HYRSIZE];
                    180: };
                    181: 
                    182: /*
                    183:  * routing table set/get structure
                    184:  *
                    185:  * used to just pass the entire routing table through, but 4.2 ioctls
                    186:  * limit the data part of an ioctl to 128 bytes or so and use the
                    187:  * interface name to get things sent the right place.
                    188:  * see ../net/if.h for additional details.
                    189:  */
                    190: struct hyrsetget {
                    191:        char    hyrsg_name[IFNAMSIZ];   /* if name, e.g. "hy0" */
                    192:        struct hy_route *hyrsg_ptr;     /* pointer to routing table */
                    193:        unsigned        hyrsg_len;      /* size of routing table provided */
                    194: };
                    195: 
                    196: #define HYR_INUSE      0x01    /* entry in use */
                    197: #define HYR_DIR                0x02    /* direct entry */
                    198: #define HYR_GATE       0x04    /* gateway entry */
                    199: #define HYR_LOOP       0x08    /* hardware loopback entry */
                    200: #define HYR_RLOOP      0x10    /* remote adapter hardware loopback entry */
                    201: 
                    202: #define HYRHASH(x) (((x) ^ ((x) >> 16)) % HYRSIZE)
                    203: 
                    204: #define HYSETROUTE     _IOW('i', 0x80, struct hyrsetget)
                    205: #define HYGETROUTE     _IOW('i', 0x81, struct hyrsetget)
                    206: 
                    207: struct hylsetget {
                    208:        char    hylsg_name[IFNAMSIZ];   /* if name, e.g. "hy0" */
                    209:        int     hylsg_cmd;              /* logging command */
                    210:        caddr_t hylsg_ptr;              /* pointer to table */
                    211:        u_long  hylsg_len;              /* size of table provided */
                    212: };     
                    213: 
                    214: #define HYSETLOG       _IOW('i', 0x82, struct hylsetget)
                    215: #define HYGETLOG       _IOW('i', 0x83, struct hylsetget)
                    216: #define HYGETELOG      _IOW('i', 0x84, struct hylsetget)
                    217: 
                    218: /*
                    219:  * Structure of Statistics Record (counters)
                    220:  */
                    221: struct hy_stat {
                    222:        u_char  hyc_df0[3];             /* # data frames trunk 0 */
                    223:        u_char  hyc_df1[3];             /* # data frames trunk 1 */
                    224:        u_char  hyc_df2[3];             /* # data frames trunk 2 */
                    225:        u_char  hyc_df3[3];             /* # data frames trunk 3 */
                    226:        u_char  hyc_cancel[2];          /* # cancel operations */
                    227:        u_char  hyc_abort[2];           /* # aborts */
                    228:        u_char  hyc_ret0[3];            /* # retransmissions trunk 0 */
                    229:        u_char  hyc_ret1[3];            /* # retransmissions trunk 1 */
                    230:        u_char  hyc_ret2[3];            /* # retransmissions trunk 2 */
                    231:        u_char  hyc_ret3[3];            /* # retransmissions trunk 3 */
                    232:        u_char  hyc_atype[3];           /* adapter type and revision level */
                    233:        u_char  hyc_uaddr;              /* adapter unit number */
                    234: };
                    235: 
                    236: /*
                    237:  * Structure of the Status Record
                    238:  */
                    239: struct hy_status {
                    240:        u_char  hys_gen_status;         /* general status byte */
                    241:        u_char  hys_last_fcn;           /* last function code issued */
                    242:        u_char  hys_resp_trunk;         /* trunk response byte */
                    243:        u_char  hys_status_trunk;       /* trunk status byte */
                    244:        u_char  hys_recd_resp;          /* recieved response byte */
                    245:        u_char  hys_error;              /* error code */
                    246:        u_char  hys_caddr;              /* compressed addr of 1st msg on chain */
                    247:        u_char  hys_pad;                /* not used */
                    248: };
                    249: 
                    250: /*
                    251:  * Get port number from status record
                    252:  */
                    253: #define PORTNUM(p)     (((p)->hys_gen_status >> 6) & 0x03)
                    254: 
                    255: #define HYL_SIZE 16*1024
                    256: struct hy_log {
                    257:        struct  hy_log *hyl_self;
                    258:        u_char  hyl_enable;             /* logging enabled? */
                    259:        u_char  hyl_onerr;              /* state to enter on error */
                    260:        u_short hyl_wait;               /* number of bytes till next wakeup */
                    261:        u_short hyl_count;              /* number of samples till stop */
                    262:        u_short hyl_icount;             /* initial value of hyl_count */
                    263:        u_long  hyl_filter;             /* log items with specific bits set */
                    264:        u_char  *hyl_eptr;              /* &hy_log.hyl_buf[HYL_SIZE] */
                    265:        u_char  *hyl_ptr;               /* pointer into hyl_buf */
                    266:        u_char  hyl_buf[HYL_SIZE];      /* log buffer space */
                    267: };
                    268: 
                    269: #define HYL_NOP                0
                    270: #define HYL_UP         1       /* markup */
                    271: #define HYL_STATUS     2       /* status results (struct hy_status) */
                    272: #define HYL_STATISTICS 3       /* statistics (struct hy_stat) */
                    273: #define HYL_XMIT       4       /* packed being send (struct hym_hdr) */
                    274: #define HYL_RECV       5       /* recieved pkt (short len; struct hym_hdr) */
                    275: #define HYL_CMD                6       /* cmd issued (uchar cmd, state; short count) */
                    276: #define HYL_INT                7       /* interrupt (short csr, wcr) */
                    277: #define        HYL_CANCEL      8       /* cancel transmit attempt */
                    278: #define        HYL_RESET       9       /* hyinit or unibus reset */
                    279: #define        HYL_IOCTL       10      /* hyioctl */
                    280: 
                    281: #define HYL_DISABLED   0       /* logging disabled */
                    282: #define HYL_CONTINUOUS 1       /* continuous logging */
                    283: #define HYL_CATCHN     2       /* hyl_count transactions being captured */
                    284: 
                    285: /*
                    286:  * error code histograms
                    287:  */
                    288: #define        HYE_MAX         0x18            /* maximum adapter error code */
                    289: #define        HYE_BINS        4               /* number of command bins */
                    290: #define        HYE_SIZE  (HYE_MAX+1)*HYE_BINS  /* size of histogram buffer */
                    291: 
                    292: /*
                    293:  * Requests for service (in order by descending priority).
                    294:  */
                    295: #define RQ_ENDOP       001     /* end the last adapter function */
                    296: #define RQ_REISSUE     002     /* reissue previous cmd after status */
                    297: #define RQ_STATUS      004     /* get the status of the adapter */
                    298: #define RQ_STATISTICS  010     /* get the statistics of the adapter */
                    299: #define RQ_MARKDOWN    020     /* mark this adapter port down */
                    300: #define RQ_MARKUP      040     /* mark this interface up */
                    301: 
                    302: #define RQ_XASSOC      0100    /* associated data to transmit */
                    303: 
                    304: /* 
                    305:  * Driver states.
                    306:  */
                    307: #define        STARTUP         0       /* initial state (before fully there) */
                    308: #define        IDLE            1       /* idle state */
                    309: #define        STATSENT        2       /* status cmd sent to adapter */
                    310: #define        ENDOPSENT       3       /* end operation cmd sent */
                    311: #define        RECVSENT        4       /* input message cmd sent */
                    312: #define        RECVDATASENT    5       /* input data cmd sent */
                    313: #define        XMITSENT        6       /* transmit message cmd sent */
                    314: #define        XMITDATASENT    7       /* transmit data cmd sent */
                    315: #define        WAITING         8       /* waiting for messages */
                    316: #define        CLEARSENT       9       /* clear wait for message cmd sent */
                    317: #define MARKPORT       10      /* mark this host's adapter port down issued */
                    318: #define RSTATSENT      11      /* read statistics cmd sent to adapter */
                    319: 
                    320: #ifdef HYLOG
                    321: char *hy_state_names[] = {
                    322:        "Startup",
                    323:        "Idle",
                    324:        "Status Sent",
                    325:        "End op Sent",
                    326:        "Recieve Message Proper Sent",
                    327:        "Recieve Data Sent",
                    328:        "Transmit Message Proper Sent",
                    329:        "Transmit Data Sent",
                    330:        "Wait for Message Sent",
                    331:        "Clear Wait for Message Sent",
                    332:        "Mark Port Down Sent",
                    333:        "Read Statistics Sent"
                    334: };
                    335: #endif
                    336: 

unix.superglobalmegacorp.com

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