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

unix.superglobalmegacorp.com

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