1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * Copyright (c) 1991 IBM Corporation
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation,
12 * and that the name IBM not be used in advertising or publicity
13 * pertaining to distribution of the software without specific, written
14 * prior permission.
15 *
16 * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR
18 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie Mellon
28 * the rights to redistribute these changes.
29 */
30
31 /*
32 * HISTORY
33 * $Log: if_trvar.h,v $
34 * Revision 2.2 93/02/04 08:00:33 danner
35 * Integrate PS2 code from IBM.
36 * [93/01/18 prithvi]
37 *
38 */
39
40 /* $Header: if_trvar.h,v 2.2 93/02/04 08:00:33 danner Exp $ */
41 /* $ACIS:if_lanvar.h 12.0$ */
42
43 #if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
44 static char *rcsidif_lanvar = "$Header: if_trvar.h,v 2.2 93/02/04 08:00:33 danner Exp $";
45 #endif
46
47 /*
48 * This file contains structures used in the "tr" driver for the
49 * IBM TOKEN-RING NETWORK PC ADAPTER
50 */
51
52
53 /*
54 * Adapter PIO registers
55 */
56 struct trdevice {
57 unsigned char switch_read; /* ROM/MMIO domain switches */
58 unsigned char reset; /* write causes adapter reset */
59 unsigned char release_reset; /* write releases adapter reset */
60 unsigned char clear_interrupt; /* write clears adapter
61 * interrupt */
62 };
63
64
65
66
67 /* ACA registers */
68 struct aca_reg {
69 union { /* RAM Relocation Register */
70 #define rrr aca_RRR.RRR /* Whole register */
71 #define rrr_h aca_RRR.b.RRRh /* High byte */
72 #define rrr_l aca_RRR.b.RRRl /* Low byte */
73 unsigned short RRR;
74 struct {
75 unsigned char RRRh;
76 unsigned char RRRl;
77 } b;
78 } aca_RRR;
79 union { /* Write Region Base management register */
80 #define wrb aca_WRB.WRB /* Whole register */
81 #define wrb_h aca_WRB.b.WRBh /* High byte */
82 #define wrb_l aca_WRB.b.WRBl /* Low byte */
83 unsigned short WRB;
84 struct {
85 unsigned char WRBh;
86 unsigned char WRBl;
87 } b;
88 } aca_WRB;
89 union { /* Write Window Open management register */
90 #define wwo aca_WWO.WWO /* Whole register */
91 #define wwo_h aca_WWO.b.WWOh /* High byte */
92 #define wwo_l aca_WWO.b.WWOl /* Low byte */
93 unsigned short WWO;
94 struct {
95 unsigned char WWOh;
96 unsigned char WWOl;
97 } b;
98 } aca_WWO;
99 union { /* Write Window Close management register */
100 #define wwc aca_WWC.WWC /* Whole register */
101 #define wwc_h aca_WWC.b.WWCh /* High byte */
102 #define wwc_l aca_WWC.b.WWCl /* Low byte */
103 unsigned short WWC;
104 struct {
105 unsigned char WWCh;
106 unsigned char WWCl;
107 } b;
108 } aca_WWC;
109 union { /* Interrupt Status Register-PC */
110 #define isrp aca_ISRP.ISRP /* Whole register */
111 #define isrp_h aca_ISRP.b.ISRPh/* High byte */
112 #define isrp_l aca_ISRP.b.ISRPl/* Low byte */
113 unsigned short ISRP;
114 struct {
115 unsigned char ISRPh;
116 unsigned char ISRPl;
117 } b;
118 } aca_ISRP;
119 union { /* Interrupt Status Register-Adapter */
120 #define isra aca_ISRA.ISRA /* Whole register */
121 #define isra_h aca_ISRA.b.ISRAh/* High byte */
122 #define isra_l aca_ISRA.b.ISRAl/* Low byte */
123 unsigned short ISRA;
124 struct {
125 unsigned char ISRAh;
126 unsigned char ISRAl;
127 } b;
128 } aca_ISRA;
129 union { /* Timer Control Register */
130 #define tcr aca_TCR.TCR /* Whole register */
131 #define tcr_h aca_TCR.b.TCRh /* High byte */
132 #define tcr_l aca_TCR.b.TCRl /* Low byte */
133 unsigned short TCR;
134 struct {
135 unsigned char TCRh;
136 unsigned char TCRl;
137 } b;
138 } aca_TCR;
139 union { /* Timer Value Register */
140 #define tvr aca_TVR.TVR /* Whole register */
141 #define tvr_h aca_TVR.b.TVRh /* High byte */
142 #define tvr_l aca_TVR.b.TVRl /* Low byte */
143 unsigned short TVR;
144 struct {
145 unsigned char TVRh;
146 unsigned char TVRl;
147 } b;
148 } aca_TVR;
149 };
150
151
152
153
154 /*
155 * Adapter Attachment Control Area (ACA)
156 */
157 struct aca {
158 struct aca_reg rw; /* Read/write access to ACA */
159 char space0[16];
160 struct aca_reg reset; /* Reset access to ACA */
161 char space1[16];
162 struct aca_reg set; /* Set access to ACA */
163 };
164
165
166
167
168 /*
169 * Structure of SSB (System Status Block)
170 */
171 struct sr_ssb {
172 unsigned char command;/* The xmit command from the SRB */
173 unsigned char cmd_corr; /* PC/Adapter command correlator */
174 unsigned char retcode;/* Completion code */
175 unsigned char res0; /* reserved */
176 unsigned short station_id; /* ID of station providing status */
177 unsigned char xmit_err; /* The FS byte if retcode=0x22 */
178 };
179
180
181
182 /*
183 * Structure of ARB (Adapter Request Block)
184 */
185 union sr_arb {
186 struct { /* Receive-data command block */
187 unsigned char command;
188 unsigned char res0[3];
189 unsigned short station_id; /* ID of receiving station */
190 unsigned short buf_addr; /* RAM offset of 1st rec buf */
191 unsigned char lan_hdr_len; /* Length of LAN header */
192 unsigned char dlc_hdr_len; /* Length of DLC header */
193 unsigned short frame_len; /* Length of entire frame */
194 unsigned char msg_type; /* Category of message */
195 } rec;
196 struct { /* Ring-Status_Change information block */
197 unsigned char command;
198 unsigned char res0[5]; /* reserved */
199 unsigned short ring_status; /* Current ring status */
200 } stat;
201 struct { /* Transmit-data-request cmd and response
202 * block */
203 unsigned char command;
204 unsigned char cmd_corr; /* Command correlator */
205 unsigned char res0[2]; /* reserved */
206 unsigned short station_id; /* ID of sending station */
207 unsigned short dhb_addr; /* Addr of Data Holding Buf */
208 } xmit;
209 struct { /* DLC status change response block */
210 unsigned char command;
211 unsigned char res0[3]; /* reserved */
212 unsigned short station_id; /* ID of sending station */
213 unsigned short status; /* status info field */
214 unsigned char frmr_data[5]; /* ? */
215 unsigned char acc_priority;
216 unsigned char rem_address[6]; /* remote address */
217 unsigned char rsap; /* remote sap */
218 } dlc;
219 };
220
221
222
223
224 /*
225 * Contents of SRB after adapter reset
226 */
227 struct init_resp {
228 union {
229 unsigned char top[2];
230 unsigned short align; /* force short alignment of struct */
231 } s;
232 #define init_command s.top[0]; /* should be 0x80: init complete */
233 unsigned char res0[4];/* reserved */
234 unsigned short bring_up_res; /* bring up code result */
235 unsigned short encoded_addr; /* RAM address of adapter's */
236 /* permanent encoded address */
237 unsigned short level_addr; /* RAM address of adapter's */
238 /* microcode level */
239 unsigned short adap_addr; /* Address of adapter address */
240 unsigned short params_addr; /* address of adapter parameters */
241 unsigned short mac_addr; /* address of adapter MAC buffer */
242 };
243
244
245
246
247 /*
248 * Structure of SRB (System Request Block)
249 */
250 union sr_srb {
251 struct init_resp reset_resp; /* Adapter card reset response block */
252 struct { /* Open command block */
253 unsigned char command;
254 unsigned char res0[7]; /* reserved */
255 unsigned short open_options; /* Open options */
256 unsigned char node_addr[6]; /* Adapter's ring address */
257 unsigned char group_addr[4]; /* The group address to set */
258 unsigned char funct_addr[4]; /* Functional address to set */
259 unsigned short num_rcv_buf; /* Number of receive buffers */
260 unsigned short rcv_buf_len; /* Length of receive buffers */
261 unsigned short dhb_length; /* Length of xmit buffers */
262 unsigned char num_dhb; /* Number of DHBs */
263 unsigned char res1; /* reserved */
264 unsigned char dlc_max_sap; /* Max number of SAPs */
265 unsigned char dlc_max_sta; /* Max num of link stations */
266 unsigned char dlc_max_gsap; /* Max number of group SAPs */
267 unsigned char dlc_max_gmem; /* Max members per group SAP */
268 unsigned char dlc_t1_tick_one; /* Timer T1 interval grp
269 * one */
270 unsigned char dlc_t2_tick_one; /* Timer T2 interval grp
271 * one */
272 unsigned char dlc_ti_tick_one; /* Timer TI interval grp
273 * one */
274 unsigned char dlc_t1_tick_two; /* Timer T1 interval grp
275 * two */
276 unsigned char dlc_t2_tick_two; /* Timer T2 interval grp
277 * two */
278 unsigned char dlc_ti_tick_two; /* Timer TI interval grp
279 * two */
280 unsigned char product_id[18]; /* Product Identification */
281 } open_cmd;
282 struct { /* Open response block */
283 unsigned char command;
284 unsigned char res0; /* reserved */
285 unsigned char retcode; /* Return code */
286 unsigned char res1[3]; /* reserved */
287 unsigned short open_err_code; /* Open error code */
288 unsigned short asb_addr; /* ASB addr in shared RAM */
289 unsigned short srb_addr; /* SRB addr in shared RAM */
290 unsigned short arb_addr; /* ARB addr in shared RAM */
291 unsigned short ssb_addr; /* SSB addr in shared RAM */
292 } open_resp;
293 struct { /* Close command and response block */
294 unsigned char command;
295 unsigned char res0; /* reserved */
296 unsigned char retcode; /* Return code */
297 } close;
298 struct { /* Interrupt-PC cmd and resp block */
299 unsigned char command;
300 unsigned char res0; /* reserved */
301 unsigned char retcode; /* Return code */
302 } intr;
303 struct { /* Mod-open-params cmd and resp block */
304 unsigned char command;
305 unsigned char res0; /* reserved */
306 unsigned char retcode; /* Return code */
307 unsigned char res1; /* reserved */
308 unsigned short open_options; /* New options */
309 } mod_params;
310 struct { /* Set-funct-addr cmd and resp block */
311 /* Set-group-addr cmd and resp block */
312 unsigned char command;
313 unsigned char res0; /* reserved */
314 unsigned char retcode; /* Return code */
315 unsigned char res1[3]; /* reserved */
316 unsigned char new_addr[4]; /* New funct or grp addr */
317 } set_addr;
318 struct { /* Transmit cmd and response block */
319 unsigned char command;
320 unsigned char cmd_corr; /* Command correlator */
321 unsigned char retcode; /* Return code */
322 unsigned char res0; /* reserved */
323 unsigned short station_id; /* ID of sending station */
324 } xmit;
325 struct { /* open sap cmd response block */
326 unsigned char command;
327 unsigned char res0; /* reserved */
328 unsigned char retcode; /* return code */
329 unsigned char res1; /* reserved */
330 unsigned short station_id; /* ID of SAP after open */
331 unsigned char timer_t1; /* response timer */
332 unsigned char timer_t2; /* acknowledge timer */
333 unsigned char timer_ti; /* inactivity timer */
334 unsigned char maxout; /* max xmits without ack */
335 unsigned char maxin; /* max recvs without ack */
336 unsigned char maxout_incr; /* window increment value */
337 unsigned char maxretry; /* N2 value ? */
338 unsigned char gsapmaxmem; /* max saps for a group sap */
339 unsigned short max_i_field; /* max recv info field length */
340 unsigned char sap_value; /* sap to be opened */
341 unsigned char sap_options; /* optiions to be set */
342 unsigned char station_cnt; /* num of res link stations */
343 unsigned char sap_gsap_mems; /* num of gsap members
344 * allowed */
345 unsigned char gsap1; /* first gsap request */
346 } open_sap;
347 struct { /* Adapter card error log */
348 unsigned char command;
349 unsigned char res0; /* reserved */
350 unsigned char retcode; /* Set by adapter on return */
351 unsigned char res1[3]; /* reserved */
352 unsigned char data[14]; /* Log data set by adapter */
353 } log;
354 };
355
356
357
358 /*
359 * Structure of ASB (Adapter Status Block)
360 */
361 union sr_asb {
362 struct { /* PC response to adapter receive cmd */
363 unsigned char command;
364 unsigned char res0; /* reserved */
365 unsigned char retcode; /* Return code */
366 unsigned char res1; /* reserved */
367 unsigned short station_id; /* Receiving station ID */
368 unsigned short rec_buf_addr; /* Receive buffer address */
369 } rec_resp;
370 struct { /* PC response to xmit-req-data cmd */
371 unsigned char command;
372 unsigned char cmd_corr; /* Command correlator */
373 unsigned char retcode; /* Return code */
374 unsigned char res0; /* reserved */
375 unsigned short station_id; /* ID of sending station */
376 unsigned short frame_len; /* Length of entire frame */
377 unsigned char header_len; /* Length of LAN header */
378 unsigned char rsap_value; /* Remote SAP */
379 } xmit_resp;
380 };
381
382
383
384
385 /*
386 * Adapter addresses
387 */
388 struct adapt_addr {
389 unsigned char node_addr[6]; /* Adapter node address */
390 unsigned char grp_addr[4]; /* Adapter group address */
391 unsigned char func_addr[4]; /* Adapter functional address */
392 };
393
394
395
396
397 /*
398 * Addresses of shared RAM control blocks
399 */
400 struct trs_cb {
401 struct sr_ssb *ssb; /* pointer to System Status Block */
402 union sr_arb *arb; /* pointer to Adapter Request Block */
403 union sr_srb *srb; /* pointer to System Request Block */
404 union sr_asb *asb; /* pointer to Adapter Status Block */
405 };
406
407
408
409
410 /*
411 * Adapter parameters
412 */
413 struct param_addr {
414 unsigned char phys_addr[4]; /* Adapter physical address */
415 unsigned char up_node_addr[6]; /* Next active upstream node
416 * addr */
417 unsigned char up_phys_addr[4]; /* Next active upstream phys
418 * addr */
419 unsigned char poll_addr[6]; /* Last poll address */
420 unsigned char res0[2];/* Reserved */
421 unsigned char acc_priority[2]; /* Transmit access priority */
422 unsigned char src_class[2]; /* Source class authorization */
423 unsigned char att_code[2]; /* Last attention code */
424 unsigned char src_addr[6]; /* Last source address */
425 unsigned char bcon_type[2]; /* Last beacon type */
426 unsigned char major_vector[2]; /* Last major vector */
427 unsigned char ring_stat[2]; /* ring status */
428 unsigned char soft_error[2]; /* soft error timer value */
429 unsigned char fe_error[2]; /* front end error counter */
430 unsigned char next_state[2]; /* next state indicator */
431 unsigned char mon_error[2]; /* Monitor error code */
432 unsigned char bcon_xmit[2]; /* Beacon transmit type */
433 unsigned char bcon_receive[2]; /* Beacon receive type */
434 unsigned char frame_correl[2]; /* Frame correlator save */
435 unsigned char bcon_naun[6]; /* beacon station NAUN */
436 unsigned char res1[4];/* Reserved */
437 unsigned char bcon_phys[4]; /* Beacon station physical addr */
438 };
439
440
441 /* Adapter receive buffer structure */
442 struct rec_buf {
443 unsigned short res0; /* reserved */
444 unsigned short buf_pointer; /* addr of next buf plus 2, in sram */
445 unsigned char res1; /* reserved */
446 unsigned char rec_fs; /* FS/addr match (last buf only) */
447 unsigned short buf_len;/* length of data in this buffer */
448 unsigned char data[RCV_BUF_DLEN]; /* frame data */
449 };
450
451
452 /* Receive buffer control block */
453 struct rbcb {
454 struct rec_buf *rbufp; /* pointer to current receive buffer */
455 struct rec_buf *rbufp_next; /* pointer to next receive buffer */
456 unsigned char *rbuf_datap; /* pointer to data in receive buffer */
457 unsigned short data_len; /* amount of data in this rec buffer */
458 };
459
460
461 /* Token-Ring physical header */
462 struct tr_head {
463 unsigned char ac; /* access control field */
464 unsigned char fc; /* frame control field */
465 unsigned char daddr[TR_ADDR_LEN]; /* destination address */
466 unsigned char saddr[TR_ADDR_LEN]; /* source address */
467 unsigned short rcf; /* route control field */
468 unsigned short rseg[8];/* routing registers */
469 };
470 /* Token Ring LLC structure */
471 struct tr_llc {
472 unsigned char dsap; /* destination SAP */
473 unsigned char ssap; /* source SAP */
474 unsigned char llc; /* LLC control field */
475 unsigned char protid[3]; /* protocol id */
476 unsigned short ethertype; /* ether type field */
477 };
Cache object: a08f8349d123ed1a61900544a8bdbaa0
|