|
|
1.1 root 1: /* */
2: /* ACC ethernet controller definitions, VERSAbus version */
3: /* product name V/EIU, unix name ACE */
4: /* */
5:
6: /* */
7: /* register definitions */
8: /* */
9: struct acedevice{
10: struct rx_addr_ram { /* receive address match ram. */
11: short station_addr[6]; /* Ethernet Station Addr */
12: short broadcast_en[2]; /* Broadcast Reception OK */
13: short mcast_hash_code[8]; /* Multicast Hash Code */
14: } rar;
15: short csr; /* hardwired control and status register */
16: short tseg; /* active transmit segment # */
17: short rseg; /* active receive segment # */
18: short segb; /* segment boundary register */
19: short lrf; /* lost receive frame counter */
20: short ivct; /* interrupt vector register. */
21: short nada0; /* -- reserved for future use -- */
22: short fcoll; /* force collision register. */
23: };
24:
25: /*
26: The following two structure define the format of "transmit and receive
27: segments" in the V/EIU's Dual-Ported Memory. Each segment is 2KBytes
28: long and buffers either an outgoing (transmit segment) or incoming
29: (receive segment) Ethernet Frame.
30: */
31:
32: struct tx_segment {
33: short tx_csr; /* control and status register */
34: char tx_data[2014]; /* frame buffer area */
35: short tx_backoff[16]; /* control and status register */
36: };
37:
38: struct rx_segment {
39: short rx_csr; /* control and status register */
40: char rx_data[2046]; /* frame buffer area */
41: };
42:
43: /*
44: The following two structures define the descriptors used to represent a logical
45: queue of Ethernet frames. The structure supports a FIFO queue mechanism.
46: For each queue there is a general control structure that tracks the location
47: of the first and last elements of the queue. Each element contains infromation
48: relating to the location of the Ethernet frame & the # of bytes it contains,
49: and the location of the next element in the queue.
50: */
51:
52: struct ace_element {
53: struct ace_element *pNext; /* ptr to the next element of the queue */
54: char *pFrame; /* ptr to Ethernet frame assoc w/ elem. */
55: };
56:
57:
58: struct ace_queue {
59: struct ace_element* phead; /* ptr to first element of queue */
60: struct ace_element* ptail; /* ptr to last element of queue */
61: };
62:
63:
64: /*
65: The following structure defines the statistics control block which maintains
66: the Ethernet data transfer statistics for a single V/EIU unit.
67: */
68:
69: struct ace_stats {
70: int rx_datagrams; /* # valid datagrams received */
71: int rx_crc_errors; /* # rcv'd w/ CRC errors */
72: int rx_overruns; /* # rcv'd too large( > 1514) */
73: int rx_underruns; /* # rcv'd too small( < 64) */
74: int rx_align_errors; /* # rcv'd w/ odd # bytes */
75: int rx_reserved; /* <reserved for future use> */
76: int rx_busy; /* # of busy recv segment */
77: int rx_mbuf; /* # of recvd mbufs */
78: int rx_oddoff; /* # of odd offset in recv mbuf */
79: int rx_rintcnt; /* # of incoming packets */
80: int rx_rwoint; /* # of recv WITHOUT interrpt */
81:
82: int tx_datagrams; /* # datagrams tx'd successful */
83: int tx_retries; /* # tx retries due to collision */
84: int tx_discarded; /* # tx dropped from >15 retries */
85: int tx_busy; /* # of busy xmit segment */
86: int tx_cbusy; /* # acecint() finds busy segment*/
87: int tx_mbuf; /* # of transmitted mbufs */
88: int tx_oddoff; /* # of odd offset in xmit mbuf */
89: int tx_outcnt; /* # of outputting requests */
90: int tx_startcnt; /* # of calls to acestart() */
91: int tx_cintcnt; /* # of completed transmissions */
92: int tx_xwoint; /* # of xmit WITHOUT interrpt */
93: };
94:
95: /*
96: The following structure defines the format of Ethernet Station Address and
97: the format of the Hash Code used by the V/EIU do filter receipt of multicast
98: datagram incoming from the Ethernet.
99: */
100:
101: struct station_addr {
102: char esa[6]; /* 6 byte field in address */
103: };
104:
105: struct hash_code {
106: char mhc[8]; /* 8 byte field in hash code */
107: };
108:
109: /*
110: The following structure defines the descriptor used to represent a logical
111: V/EIU unit. Often referred to as "Unit Control Block (UCB)", this structure
112: maintains information as to the location, state, and status of the controller.
113: */
114:
115: #ifdef INLINE
116: struct ace_unit {
117: struct ace_regs *pReg; /* ptr to unit's I/O registers */
118: char* pDpm; /* ptr to unit's Dual-Port Memory */
119: short segboundry; /* first Tx Seg in unit's DPM */
120: short eictr; /* Rx segment tracking counter */
121: short eoctr; /* Tx segment tracking counter */
122: short tx_next; /* next available Tx segment ctr */
123: EVENTCOUNT rx_arrived; /* received frames eventcounter */
124: EVENTCOUNT rx_processed; /* rx'd & processed frames EC */
125: EVENTCOUNT tx_complete; /* tx'd frames eventcounter */
126: SEMAPHORE rx_semaphore; /* receive frame semaphore */
127: SEMAPHORE tx_semaphore; /* transmit frame semaphore */
128: short cur_rnd; /* current random # value */
129: short diag_code; /* diagnostic error & test codes */
130: short state; /* status of unit */
131: struct ace_queue rx_queue; /* received frame queue */
132: struct ace_queue av_queue; /* available queue (free list) */
133: struct ace_element av_elements[9]; /* unit queue elements */
134: struct ace_stats statistics; /* unit's statistics */
135: short rx_reset; /* receive code's reset ctl word */
136: short tx_reset; /* transmit code's reset ctl word */
137: short rx_waiting; /* receiver sleeping status flag */
138: short tx_waiting; /* transmitter sleeping status flg*/
139: };
140: #endif INLINE
141:
142: /*
143: V/EIU CONTROL/STATUS REGISTER BIT DEFINITIONS
144: =============================================
145:
146: The following defines the bits in the V/EIU's "Control/Status Register".
147: Each bit definition is followed by a brief description which includes
148: a reference to its read/write capabilities as well as it's active state
149: if appropriate. "r/w" := read/write, "r" := read only, and "w" := write
150: only. "aL" := active LOW and "aH" := active high". The first three letters
151: of the bits' names, "CSR", indicate definition for the "CSR register" only.
152: */
153:
154: #define CSR_UNUSED 0xFD00 /* unused bits "??_??" */
155: #define CSR_ENXMITODD 0x0200 /* Enable Odd # byte transmission "rw_aH" */
156: #define CSR_ACTIVE 0x0080 /* V/EIU is active & running "r _aH" */
157: #define CSR_RESET 0x0040 /* V/EIU reset control line " w_aH" */
158: #define CSR_PROMISCUOUS 0x0020 /* Enable "promiscous mode" operation"rw_aH" */
159: #define CSR_NOXMITCRC 0x0010 /* Disable CRC generation & checking "rw_aH" */
160: #define CSR_LOOP3 0x0008 /* Enable MODE 3 LOOPBACK mode "rw_aH" */
161: #define CSR_LOOP2 0x0004 /* Enable MODE 2 LOOPBACK mode "rw_aH" */
162: #define CSR_ENINT 0x0002 /* Enable Interrupts to VERSAbus "rw_aH" */
163: #define CSR_GO 0x0001 /* Enable V/EIU operations " w_aH" */
164:
165: /*
166: V/EIU VALID BIT MASKS
167: =====================
168:
169: The following defines the valid bits of "short" fields contained in
170: the V/EIU's "Receive Address Match Ram". The first three letters
171: of the masks' names indicate definition for the following:
172: RAR ==> Receive Address Ram IVC ==> Interrupt Vector Register
173: LRF ==> Lost Receive Frame Counter FCL ==> Force Collision Register
174: */
175:
176: #define RAR_VALID 0x00FF /* Valid bits in Receive Address Ram fields */
177: #define LRF_VALID 0x000F /* Valid bits in Lost Receive Frame register */
178: #define IVC_VALID 0x00F8 /* Valid bits in Interrupt Vector register */
179: #define FCL_VALID 0xFFFF /* Valid bits in Force Collision register */
180:
181: /*
182: V/EIU TRANSMIT SEGMENT CONTROL/STATUS BIT DEFINITIONS
183: =====================================================
184:
185: The following defines the bit-fields in the "Control/Status Field" of a
186: Transmit Segment in the V/EIU's Dual-Ported Memory. There are two
187: types of bit-fields it this field, those that produce a response by the
188: V/EIU ("command") and those that indicate the response ("status")
189: The first three letters of the bits' names, "TCS", indicate definition
190: for the "Tx segment CSr" only.
191: */
192:
193: /* commands */
194: #define TCS_TBFULL (short)0x8000 /* Tx Bfr Full so send it */
195: #define TCS_TBC (short)0x07FF /* Tx Byte Count */
196: /* status */
197: #define TCS_TBMT (short)0x8000 /* Tx Buffer Empty (avail for Tx) */
198: #define TCS_RTFAIL (short)0x4000 /* Tx Retries Failed (frame dropped)*/
199: #define TCS_RTC (short)0x000F /* Tx # Retries which collided */
200:
201: /*
202: V/EIU RECEIVE SEGMENT CONTROL/STATUS BIT DEFINITIONS
203: ====================================================
204:
205: The following defines the bit-fields in the "Control/Status Field" of a
206: Receive Segment in the V/EIU's Dual-Ported Memory. There are two
207: types of bit-fields it this field, those that produce a response by the
208: V/EIU ("command") and those that indicate the response ("status")
209: The first three letters of the bits' names, "RCS", indicate definition
210: for the "Rx segment CSr" only.
211: */
212:
213: #define RCS_RBMT 0x8000 /* command: Rx Bfr Empty (avail for Rx) */
214: #define RCS_RBFULL 0x8000 /* status : Rx Bfr Full (frame Rx'd) */
215: #define RCS_ROVRN 0x4000 /* : Rx Bfr Overrun Error (too long) */
216: #define RCS_RCRC 0x2000 /* : Rx Bfr CRC Error (bad data) */
217: #define RCS_RODD 0x1000 /* : Rx Bfr Alignment Error (odd cnt) */
218: #define RCS_RBC 0x07FF /* : Rx Bfr Byte Count */
219:
220: /*
221: V/EIU SPECIAL FUNCTION CODE DEFINITIONS
222: =======================================
223:
224: The following define the valid functions codes available for use with
225: the "spfun ()" entry point into this driver.
226: */
227:
228: #define ACE_INIT 0x0001 /* V/EIU Initialize command */
229: #define ACE_RESP 0x0002 /* V/EIU Initialize response */
230: #define ACE_STATS 0x0003 /* V/EIU Statistics query */
231: #define ACE_ECMAP 0x0004 /* V/EIU Event counter map request */
232: #define ACE_IOPORTS 0x0005 /* V/EIU I/O Ports Dump */
233: #define ACE_UCBSTATS 0x0006 /* V/EIU UCB contents Dump */
234:
235: /*
236: V/EIU RETURNED ERROR CODES
237: ==========================
238:
239: The following define the range of error codes which may be returned by
240: this driver to calling user processes. The first letter of the error code's
241: names, "E", indicates definition for "returned error codes" only.
242: */
243:
244: #define E_BADDEV (-100) /* illegal minor device */
245: #define E_OFFLINE (-101) /* requested unit is not on-line */
246: #define E_LOSTSYNC (-102) /* driver syncronization lost w/ hardware */
247: #define E_SIGNALED (-103) /* I/O request terminated due to signal() */
248: #define E_2BIG (-104) /* transmit request for oversize frame */
249: #define E_2SMALL (-105) /* receive request for undersize frame */
250: #define E_BADCALL (-106) /* illegal "spfun()" call */
251: #define E_RESET (-107) /* unit reset while waiting for i/o to end*/
252:
253: /*
254: V/EIU MISCELLANEOUS DEFINTIIONS
255: ===============================
256:
257: The following are miscellaneous constant definitions and come from
258: a number of places for a number of different reasons.
259: */
260:
261: #define ACE_OFFLINE 0 /* off-line unit status */
262: #define ACE_ONLINE 0 /* on-line unit status */
263: #define CRC_SIZE 4 /* number of bytes in a rx seg's CRC */
264: #define RCW_SIZE 2 /* number of bytes in a rx seg's csr */
265: #define M_READ "read" /* read diagnostic string */
266: #define M_WRITE "write" /* write diagnostic string */
267: #define SEG_MAX 15 /* largest valid V/EIU segment number */
268: #define MXRXPKTSZ 1516 /* max. size of allowed rx/tx frames +RCW */
269: #define ET_MINLEN 64 /* min. size of allowed rx/tx frames */
270: #define ET_MAXLEN 1514 /* max. size of rx/tx frames w/o CRC & RCW*/
271: #define EC_ARRIVED 42 /* EC mapping number for "rx_arrived EC */
272: #define EC_PROCESSED 43 /* EC mapping number for "rx_processed EC */
273: #define RX_ARVD_EC 42 /* Select code for rx_arrived EC mapping */
274: #define RX_PRCD_EC 43 /* Select code for rx_processed EC mapping*/
275:
276:
277: /*
278: * Ethernet software status per interface.
279: *
280: * Each interface is referenced by a network interface structure,
281: * is_if, which the routing code uses to locate the interface.
282: * This structure contains the output queue for the interface, its address, ...
283: */
284: struct ace_softc {
285: struct arpcom is_ac; /* Ethernet common part */
286: #define is_if is_ac.ac_if /* network-visible interface */
287: #define is_addr is_ac.ac_enaddr /* hardware Ethernet address */
288: char *is_dpm;
289: short is_flags;
290: #define ACEF_OACTIVE 0x1 /* output is active */
291: #define ACEF_RCVPENDING 0x2 /* start rcv in acecint */
292: short is_promiscuous; /* true is enabled */
293: short is_segboundry; /* first TX Seg in dpm */
294: short is_eictr; /* Rx segment tracking ctr */
295: short is_eoctr; /* Tx segment tracking ctr */
296: short is_txnext; /* Next available Tx segment */
297: short is_currnd; /* current random backoff */
298: struct ace_stats is_stats; /* holds board statistics */
299: short is_xcnt; /* count xmitted segments to be acked
300: by the controller */
301: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.