1 /*	$OpenBSD: tropicvar.h,v 1.3 2002/03/14 01:26:55 millert Exp $	*/
2 /*	$NetBSD: tropicvar.h,v 1.4 1999/10/17 23:53:45 cgd Exp $	*/
3 
4 /*
5  * Mach Operating System
6  * Copyright (c) 1991 Carnegie Mellon University
7  * Copyright (c) 1991 IBM Corporation
8  * All Rights Reserved.
9  *
10  * Permission to use, copy, modify and distribute this software and its
11  * documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation,
15  * and that the name IBM not be used in advertising or publicity
16  * pertaining to distribution of the software without specific, written
17  * prior permission.
18  *
19  * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
20  * CONDITION.  CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR
21  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
22  *
23  * Carnegie Mellon requests users of this software to return to
24  *
25  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
26  *  School of Computer Science
27  *  Carnegie Mellon University
28  *  Pittsburgh PA 15213-3890
29  *
30  * any improvements or extensions that they make and grant Carnegie Mellon
31  * the rights to redistribute these changes.
32  */
33 
34 /* $ACIS:if_lanvar.h 12.0$ */
35 
36 /*
37  * This file contains structures used in the "tr" driver for the
38  *	IBM TOKEN-RING NETWORK PC ADAPTER
39  */
40 
41 /* Receive buffer control block */
42 struct rbcb {
43 	bus_size_t	rbufp;		/* offset of current receive buffer */
44 	bus_size_t	rbufp_next;	/* offset of next receive buffer */
45 	bus_size_t	rbuf_datap;	/* offset of data in receive buffer */
46 	unsigned short  data_len;	/* amount of data in this rec buffer */
47 };
48 
49 /*
50  *	Token-Ring software status per adapter
51  */
52 struct	tr_softc {
53 	struct device sc_dev;
54 	void 	*sc_ih;
55 	struct arpcom sc_arpcom;
56 	struct ifmedia	sc_media;
57 	u_char	sc_xmit_correlator;
58 	int	sc_xmit_buffers;
59 #if 1
60 	int	sc_xmit_head;
61 	int	sc_xmit_tail;
62 #endif
63 	int	sc_minbuf;
64 	int	sc_nbuf;
65 	bus_size_t sc_txca;
66 
67 	bus_space_tag_t sc_piot;
68 	bus_space_tag_t sc_memt;
69 	bus_space_handle_t sc_pioh;	/* handle pio area */
70 	bus_space_handle_t sc_sramh;	/* handle for the shared ram area */
71 	bus_space_handle_t sc_mmioh;	/* handle for the bios/mmio area */
72 
73 	struct timeout init_timeout;
74 	struct timeout reinit_timeout;
75 
76 	int (*sc_mediachange)(struct tr_softc *);
77 	void (*sc_mediastatus)(struct tr_softc *, struct ifmediareq *);
78 	struct rbcb rbc;	/* receiver buffer control block */
79 	bus_size_t sc_aca;	/* offset of adapter ACA */
80 	bus_size_t sc_ssb;	/* offset of System Status Block */
81 	bus_size_t sc_arb;	/* offset of Adapter Request Block */
82 	bus_size_t sc_srb;	/* offset of System Request Block */
83 	bus_size_t sc_asb;	/* offset of Adapter Status Block */
84 	u_int sc_maddr;		/* mapped shared memory address */
85 	u_int sc_memwinsz;	/* mapped shared memory window size */
86 	u_int sc_memsize;	/* memory installed on adapter */
87 	u_int sc_memreserved;	/* reserved memory on adapter */
88 	int sc_dhb4maxsz;	/* max. dhb size at 4MBIT ring speed */
89 	int sc_dhb16maxsz;	/* max. dbh size at 16MBIT ring speed */
90 	int sc_maxmtu;		/* max. MTU supported by adapter */
91 	unsigned char	sc_init_status;
92 	caddr_t  tr_sleepevent;     	/* tr event signalled on successful */
93 					/* open of adapter  */
94 	unsigned short exsap_station;	/* station assigned by open sap cmd */
95 };
96 
97 int tr_config(struct tr_softc *);
98 int tr_attach(struct tr_softc *);
99 int tr_intr(void *);
100 void tr_init(void *);
101 int tr_ioctl(struct ifnet *, u_long, caddr_t);
102 void tr_stop(struct tr_softc *);
103 int tr_reset(struct tr_softc *);
104 void tr_sleep(struct tr_softc *);
105 int tr_setspeed(struct tr_softc *, u_int8_t);
106