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