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