[BACK]Return to if_uba.h CVS log [TXT][DIR] Up to [local] / sys / arch / vax / if

Annotation of sys/arch/vax/if/if_uba.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: if_uba.h,v 1.7 2003/11/10 21:05:04 miod Exp $ */
        !             2: /*     $NetBSD: if_uba.h,v 1.6 1996/08/20 14:07:50 ragge Exp $ */
        !             3:
        !             4: /*
        !             5:  * Copyright (c) 1982, 1986 Regents of the University of California.
        !             6:  * All rights reserved.
        !             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. Neither the name of the University nor the names of its 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 THE REGENTS 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 THE REGENTS OR CONTRIBUTORS BE LIABLE
        !            24:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            25:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            26:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            27:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            28:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            29:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            30:  * SUCH DAMAGE.
        !            31:  *
        !            32:  *     @(#)if_uba.h    7.4 (Berkeley) 6/28/90
        !            33:  */
        !            34:
        !            35: /*
        !            36:  * Structure and routine definitions
        !            37:  * for UNIBUS network interfaces.
        !            38:  */
        !            39:
        !            40: #define        IF_MAXNUBAMR    10
        !            41: /*
        !            42:  * Each interface has structures giving information
        !            43:  * about UNIBUS resources held by the interface
        !            44:  * for each send and receive buffer.
        !            45:  *
        !            46:  * We hold IF_NUBAMR map registers for datagram data, starting
        !            47:  * at ifr_mr.  Map register ifr_mr[-1] maps the local network header
        !            48:  * ending on the page boundary.  Bdp's are reserved for read and for
        !            49:  * write, given by ifr_bdp.  The prototype of the map register for
        !            50:  * read and for write is saved in ifr_proto.
        !            51:  *
        !            52:  * When write transfers are not full pages on page boundaries we just
        !            53:  * copy the data into the pages mapped on the UNIBUS and start the
        !            54:  * transfer.  If a write transfer is of a (1024 byte) page on a page
        !            55:  * boundary, we swap in UNIBUS pte's to reference the pages, and then
        !            56:  * remap the initial pages (from ifu_wmap) when the transfer completes.
        !            57:  *
        !            58:  * When read transfers give whole pages of data to be input, we
        !            59:  * allocate page frames from a network page list and trade them
        !            60:  * with the pages already containing the data, mapping the allocated
        !            61:  * pages to replace the input pages for the next UNIBUS data input.
        !            62:  */
        !            63:
        !            64: /*
        !            65:  * Information per interface.
        !            66:  */
        !            67: struct ifubinfo {
        !            68:        short   iff_flags;                      /* used during uballoc's */
        !            69:        short   iff_hlen;                       /* local net header length */
        !            70:        struct  uba_regs *iff_uba;              /* uba adaptor regs, in vm */
        !            71:        pt_entry_t *iff_ubamr;                  /* uba map regs, in vm */
        !            72:        struct  uba_softc *iff_softc;           /* uba */
        !            73: };
        !            74:
        !            75: /*
        !            76:  * Information per buffer.
        !            77:  */
        !            78: struct ifrw {
        !            79:        caddr_t ifrw_addr;                      /* virt addr of header */
        !            80:        short   ifrw_bdp;                       /* unibus bdp */
        !            81:        short   ifrw_flags;                     /* type, etc. */
        !            82: #define        IFRW_W  0x01                            /* is a transmit buffer */
        !            83:        int     ifrw_info;                      /* value from ubaalloc */
        !            84:        int     ifrw_proto;                     /* map register prototype */
        !            85:        pt_entry_t *ifrw_mr;                    /* base of map registers */
        !            86: };
        !            87:
        !            88: /*
        !            89:  * Information per transmit buffer, including the above.
        !            90:  */
        !            91: struct ifxmt {
        !            92:        struct  ifrw ifrw;
        !            93:        caddr_t ifw_base;                       /* virt addr of buffer */
        !            94:        pt_entry_t ifw_wmap[IF_MAXNUBAMR];      /* base pages for output */
        !            95:        struct  mbuf *ifw_xtofree;              /* pages being dma'd out */
        !            96:        short   ifw_xswapd;                     /* mask of clusters swapped */
        !            97:        short   ifw_nmr;                        /* number of entries in wmap */
        !            98: };
        !            99: #define        ifw_addr        ifrw.ifrw_addr
        !           100: #define        ifw_bdp         ifrw.ifrw_bdp
        !           101: #define        ifw_flags       ifrw.ifrw_flags
        !           102: #define        ifw_info        ifrw.ifrw_info
        !           103: #define        ifw_proto       ifrw.ifrw_proto
        !           104: #define        ifw_mr          ifrw.ifrw_mr
        !           105:
        !           106: /*
        !           107:  * Most interfaces have a single receive and a single transmit buffer,
        !           108:  * and use struct ifuba to store all of the unibus information.
        !           109:  */
        !           110: struct ifuba {
        !           111:        struct  ifubinfo ifu_info;
        !           112:        struct  ifrw ifu_r;
        !           113:        struct  ifxmt ifu_xmt;
        !           114: };
        !           115:
        !           116: #define        ifu_softc       ifu_info.iff_softc
        !           117: #define        ifu_hlen        ifu_info.iff_hlen
        !           118: #define        ifu_uba         ifu_info.iff_uba
        !           119: #define        ifu_ubamr       ifu_info.iff_ubamr
        !           120: #define        ifu_flags       ifu_info.iff_flags
        !           121: #define        ifu_w           ifu_xmt.ifrw
        !           122: #define        ifu_xtofree     ifu_xmt.ifw_xtofree
        !           123:
        !           124: #ifdef         _KERNEL
        !           125: #define        if_ubainit(ifuba, uban, hlen, nmr) \
        !           126:                if_ubaminit(&(ifuba)->ifu_info, uban, hlen, nmr, \
        !           127:                        &(ifuba)->ifu_r, 1, &(ifuba)->ifu_xmt, 1)
        !           128: #define        if_rubaget(ifu, totlen, off0, ifp) \
        !           129:                if_ubaget(&(ifu)->ifu_info, &(ifu)->ifu_r, totlen, off0, ifp)
        !           130: #define        if_wubaput(ifu, m) \
        !           131:                if_ubaput(&(ifu)->ifu_info, &(ifu)->ifu_xmt, m)
        !           132:
        !           133: /* Prototypes */
        !           134: int    if_ubaminit(struct ifubinfo *, struct uba_softc *, int, int,
        !           135:            struct ifrw *, int, struct ifxmt *, int);
        !           136: int    if_ubaput(struct ifubinfo *, struct ifxmt *, struct mbuf *);
        !           137: struct mbuf *if_ubaget(struct ifubinfo *, struct ifrw *, int,
        !           138:        struct ifnet *);
        !           139:
        !           140: #endif

CVSweb