|
|
1.1 root 1: /*
2: * Copyright (c) 1982, 1986 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution is only permitted until one year after the first shipment
6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
7: * binary forms are permitted provided that: (1) source distributions retain
8: * this entire copyright notice and comment, and (2) distributions including
9: * binaries display the following acknowledgement: This product includes
10: * software developed by the University of California, Berkeley and its
11: * contributors'' in the documentation or other materials provided with the
12: * distribution and in all advertising materials mentioning features or use
13: * of this software. Neither the name of the University nor the names of
14: * its contributors may be used to endorse or promote products derived from
15: * this software without specific prior written permission.
16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19: *
20: * @(#)if_uba.h 7.4 (Berkeley) 6/28/90
21: */
22:
23: /*
24: * Structure and routine definitions
25: * for UNIBUS network interfaces.
26: */
27:
28: #define IF_MAXNUBAMR 10
29: /*
30: * Each interface has structures giving information
31: * about UNIBUS resources held by the interface
32: * for each send and receive buffer.
33: *
34: * We hold IF_NUBAMR map registers for datagram data, starting
35: * at ifr_mr. Map register ifr_mr[-1] maps the local network header
36: * ending on the page boundary. Bdp's are reserved for read and for
37: * write, given by ifr_bdp. The prototype of the map register for
38: * read and for write is saved in ifr_proto.
39: *
40: * When write transfers are not full pages on page boundaries we just
41: * copy the data into the pages mapped on the UNIBUS and start the
42: * transfer. If a write transfer is of a (1024 byte) page on a page
43: * boundary, we swap in UNIBUS pte's to reference the pages, and then
44: * remap the initial pages (from ifu_wmap) when the transfer completes.
45: *
46: * When read transfers give whole pages of data to be input, we
47: * allocate page frames from a network page list and trade them
48: * with the pages already containing the data, mapping the allocated
49: * pages to replace the input pages for the next UNIBUS data input.
50: */
51:
52: /*
53: * Information per interface.
54: */
55: struct ifubinfo {
56: short iff_uban; /* uba number */
57: short iff_hlen; /* local net header length */
58: struct uba_regs *iff_uba; /* uba adaptor regs, in vm */
59: struct pte *iff_ubamr; /* uba map regs, in vm */
60: short iff_flags; /* used during uballoc's */
61: };
62:
63: /*
64: * Information per buffer.
65: */
66: struct ifrw {
67: caddr_t ifrw_addr; /* virt addr of header */
68: short ifrw_bdp; /* unibus bdp */
69: short ifrw_flags; /* type, etc. */
70: #define IFRW_W 0x01 /* is a transmit buffer */
71: int ifrw_info; /* value from ubaalloc */
72: int ifrw_proto; /* map register prototype */
73: struct pte *ifrw_mr; /* base of map registers */
74: };
75:
76: /*
77: * Information per transmit buffer, including the above.
78: */
79: struct ifxmt {
80: struct ifrw ifrw;
81: caddr_t ifw_base; /* virt addr of buffer */
82: struct pte ifw_wmap[IF_MAXNUBAMR]; /* base pages for output */
83: struct mbuf *ifw_xtofree; /* pages being dma'd out */
84: short ifw_xswapd; /* mask of clusters swapped */
85: short ifw_nmr; /* number of entries in wmap */
86: };
87: #define ifw_addr ifrw.ifrw_addr
88: #define ifw_bdp ifrw.ifrw_bdp
89: #define ifw_flags ifrw.ifrw_flags
90: #define ifw_info ifrw.ifrw_info
91: #define ifw_proto ifrw.ifrw_proto
92: #define ifw_mr ifrw.ifrw_mr
93:
94: /*
95: * Most interfaces have a single receive and a single transmit buffer,
96: * and use struct ifuba to store all of the unibus information.
97: */
98: struct ifuba {
99: struct ifubinfo ifu_info;
100: struct ifrw ifu_r;
101: struct ifxmt ifu_xmt;
102: };
103:
104: #define ifu_uban ifu_info.iff_uban
105: #define ifu_hlen ifu_info.iff_hlen
106: #define ifu_uba ifu_info.iff_uba
107: #define ifu_ubamr ifu_info.iff_ubamr
108: #define ifu_flags ifu_info.iff_flags
109: #define ifu_w ifu_xmt.ifrw
110: #define ifu_xtofree ifu_xmt.ifw_xtofree
111:
112: #ifdef KERNEL
113: #define if_ubainit(ifuba, uban, hlen, nmr) \
114: if_ubaminit(&(ifuba)->ifu_info, uban, hlen, nmr, \
115: &(ifuba)->ifu_r, 1, &(ifuba)->ifu_xmt, 1)
116: #define if_rubaget(ifu, totlen, off0, ifp) \
117: if_ubaget(&(ifu)->ifu_info, &(ifu)->ifu_r, totlen, off0, ifp)
118: #define if_wubaput(ifu, m) \
119: if_ubaput(&(ifu)->ifu_info, &(ifu)->ifu_xmt, m)
120: struct mbuf *if_ubaget();
121: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.