Annotation of sys/dev/ic/dp8390var.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: dp8390var.h,v 1.11 2006/10/20 18:12:50 brad Exp $ */
2: /* $NetBSD: dp8390var.h,v 1.8 1998/08/12 07:19:09 scottr Exp $ */
3:
4: /*
5: * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
6: * adapters.
7: *
8: * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
9: *
10: * Copyright (C) 1993, David Greenman. This software may be used, modified,
11: * copied, distributed, and sold, in both source and binary form provided that
12: * the above copyright and these terms are retained. Under no circumstances is
13: * the author responsible for the proper functioning of this software, nor does
14: * the author assume any responsibility for damages incurred with its use.
15: */
16:
17: /*
18: * We include MII glue here -- some DP8390 compatible chips have
19: * MII interfaces on them (scary, isn't it...).
20: */
21: #include <dev/mii/miivar.h>
22:
23: #define INTERFACE_NAME_LEN 32
24:
25: /*
26: * dp8390_softc: per line info and status
27: */
28: struct dp8390_softc {
29: struct device sc_dev;
30: void *sc_ih;
31: int sc_flags; /* interface flags, from config */
32:
33: struct arpcom sc_arpcom; /* ethernet common */
34: struct mii_data sc_mii; /* MII glue */
35: #define sc_media sc_mii.mii_media /* compatibility definition */
36:
37: bus_space_tag_t sc_regt; /* NIC register space tag */
38: bus_space_handle_t sc_regh; /* NIC register space handle */
39: bus_space_tag_t sc_buft; /* Buffer space tag */
40: bus_space_handle_t sc_bufh; /* Buffer space handle */
41:
42: bus_size_t sc_reg_map[16]; /* register map (offsets) */
43:
44: int is790; /* NIC is a 790 */
45:
46: u_int8_t cr_proto; /* values always set in CR */
47: u_int8_t rcr_proto; /* values always set in RCR */
48: u_int8_t dcr_reg; /* override DCR iff LS is set */
49:
50: int mem_start; /* offset of NIC memory */
51: int mem_end; /* offset of NIC memory end */
52: int mem_size; /* total shared memory size */
53: int mem_ring; /* offset of start of RX ring-buffer */
54:
55: u_short txb_cnt; /* Number of transmit buffers */
56: u_short txb_inuse; /* number of transmit buffers active */
57:
58: u_short txb_new; /* pointer to where new buffer will be added */
59: u_short txb_next_tx; /* pointer to next buffer ready to xmit */
60: u_short txb_len[8]; /* buffered xmit buffer lengths */
61: u_short tx_page_start; /* first page of TX buffer area */
62: u_short rec_page_start; /* first page of RX ring-buffer */
63: u_short rec_page_stop; /* last page of RX ring-buffer */
64: u_short next_packet; /* pointer to next unread RX packet */
65:
66: int sc_enabled; /* boolean; power enabled on interface */
67:
68: int (*test_mem)(struct dp8390_softc *);
69: void (*init_card)(struct dp8390_softc *);
70: void (*stop_card)(struct dp8390_softc *);
71: void (*read_hdr)(struct dp8390_softc *,
72: int, struct dp8390_ring *);
73: void (*recv_int)(struct dp8390_softc *);
74: int (*ring_copy)(struct dp8390_softc *,
75: int, caddr_t, u_short);
76: int (*write_mbuf)(struct dp8390_softc *, struct mbuf *, int);
77:
78: int (*sc_enable)(struct dp8390_softc *);
79: void (*sc_disable)(struct dp8390_softc *);
80:
81: void (*sc_media_init)(struct dp8390_softc *);
82: void (*sc_media_fini)(struct dp8390_softc *);
83:
84: int (*sc_mediachange)(struct dp8390_softc *);
85: void (*sc_mediastatus)(struct dp8390_softc *,
86: struct ifmediareq *);
87: };
88:
89: /*
90: * Vendor types
91: */
92: #define DP8390_VENDOR_UNKNOWN 0xff /* Unknown network card */
93: #define DP8390_VENDOR_WD_SMC 0x00 /* Western Digital/SMC */
94: #define DP8390_VENDOR_3COM 0x01 /* 3Com */
95: #define DP8390_VENDOR_NOVELL 0x02 /* Novell */
96: #define DP8390_VENDOR_APPLE 0x10 /* Apple Ethernet card */
97: #define DP8390_VENDOR_INTERLAN 0x11 /* Interlan A310 card (GatorCard) */
98: #define DP8390_VENDOR_DAYNA 0x12 /* DaynaPORT E/30s (and others?) */
99: #define DP8390_VENDOR_ASANTE 0x13 /* Asante MacCon II/E */
100: #define DP8390_VENDOR_FARALLON 0x14 /* Farallon EtherMac II-TP */
101: #define DP8390_VENDOR_FOCUS 0x15 /* FOCUS Enhancements EtherLAN */
102: #define DP8390_VENDOR_KINETICS 0x16 /* Kinetics EtherPort SE/30 */
103: #define DP8390_VENDOR_CABLETRON 0x17 /* Cabletron Ethernet */
104:
105: /*
106: * Compile-time config flags
107: */
108: /*
109: * This sets the default for enabling/disabling the transceiver.
110: */
111: #define DP8390_DISABLE_TRANSCEIVER 0x0001
112:
113: /*
114: * This forces the board to be used in 8/16-bit mode even if it autoconfigs
115: * differently.
116: */
117: #define DP8390_FORCE_8BIT_MODE 0x0002
118: #define DP8390_FORCE_16BIT_MODE 0x0004
119:
120: /*
121: * This disables the use of multiple transmit buffers.
122: */
123: #define DP8390_NO_MULTI_BUFFERING 0x0008
124:
125: /*
126: * This forces all operations with the NIC memory to use Programmed I/O (i.e.
127: * not via shared memory).
128: */
129: #define DP8390_FORCE_PIO 0x0010
130:
131: /*
132: * The chip is ASIX AX88190 and needs work around.
133: */
134: #define DP8390_DO_AX88190_WORKAROUND 0x0020
135:
136: #define DP8390_ATTACHED 0x0040 /* attach has succeeded */
137:
138: /*
139: * ASIX AX88796 doesn't have remote DMA conmplete bit in ISR, so don't
140: * check ISR.RDC
141: */
142: #define DP8390_NO_REMOTE_DMA_COMPLETE 0x0080
143:
144: /*
145: * NIC register access macros
146: */
147: #define NIC_GET(t, h, reg) bus_space_read_1(t, h, \
148: ((sc)->sc_reg_map[reg]))
149: #define NIC_PUT(t, h, reg, val) bus_space_write_1(t, h, \
150: ((sc)->sc_reg_map[reg]), (val))
151: #define NIC_BARRIER(t, h) bus_space_barrier(t, h, 0, 0x10, \
152: BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE)
153:
154: int dp8390_config(struct dp8390_softc *);
155: int dp8390_intr(void *);
156: int dp8390_ioctl(struct ifnet *, u_long, caddr_t);
157: void dp8390_start(struct ifnet *);
158: void dp8390_watchdog(struct ifnet *);
159: void dp8390_reset(struct dp8390_softc *);
160: void dp8390_init(struct dp8390_softc *);
161: void dp8390_stop(struct dp8390_softc *);
162:
163: int dp8390_mediachange(struct ifnet *);
164: void dp8390_mediastatus(struct ifnet *, struct ifmediareq *);
165:
166: void dp8390_media_init(struct dp8390_softc *);
167:
168: int dp8390_detach(struct dp8390_softc *, int);
169:
170: void dp8390_rint(struct dp8390_softc *);
171:
172: void dp8390_getmcaf(struct arpcom *, u_int8_t *);
173: struct mbuf *dp8390_get(struct dp8390_softc *, int, u_short);
174: void dp8390_read(struct dp8390_softc *, int, u_short);
CVSweb