if_fe.c (13937) | if_fe.c (14645) |
---|---|
1/* 2 * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 3 * 4 * This software may be used, modified, copied, distributed, and sold, in 5 * both source and binary form provided that the above copyright, these 6 * terms and the following disclaimer are retained. The name of the author 7 * and/or the contributor may not be used to endorse or promote products 8 * derived from this software without specific prior written permission. --- 6 unchanged lines hidden (view full) --- 15 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 16 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION. 17 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 18 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 19 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 20 * SUCH DAMAGE. 21 */ 22 | 1/* 2 * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 3 * 4 * This software may be used, modified, copied, distributed, and sold, in 5 * both source and binary form provided that the above copyright, these 6 * terms and the following disclaimer are retained. The name of the author 7 * and/or the contributor may not be used to endorse or promote products 8 * derived from this software without specific prior written permission. --- 6 unchanged lines hidden (view full) --- 15 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 16 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION. 17 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 18 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 19 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 20 * SUCH DAMAGE. 21 */ 22 |
23#define FE_VERSION "if_fe.c ver. 0.8a" 24 | |
25/* | 23/* |
24 * $Id:$ 25 * |
|
26 * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. | 26 * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. |
27 * To be used with FreeBSD 2.0 RELEASE. 28 * Contributed by M.S. <seki@sysrap.cs.fujitsu.co.jp> | 27 * To be used with FreeBSD 2.x 28 * Contributed by M. Sekiguchi. <seki@sysrap.cs.fujitsu.co.jp> |
29 * 30 * This version is intended to be a generic template for various 31 * MB86960A/MB86965A based Ethernet cards. It currently supports | 29 * 30 * This version is intended to be a generic template for various 31 * MB86960A/MB86965A based Ethernet cards. It currently supports |
32 * Fujitsu FMV-180 series (i.e., FMV-181 and FMV-182) and Allied- 33 * Telesis AT1700 series and RE2000 series. There are some 34 * unnecessary hooks embedded, which are primarily intended to support | 32 * Fujitsu FMV-180 series for ISA and Allied-Telesis AT1700/RE2000 33 * series for ISA, as well as Fujitsu MBH10302 PC card. 34 * There are some currently- 35 * unused hooks embedded, which are primarily intended to support |
35 * other types of Ethernet cards, but the author is not sure whether 36 * they are useful. 37 * | 36 * other types of Ethernet cards, but the author is not sure whether 37 * they are useful. 38 * |
39 * This version also includes some alignments for 40 * RE1000/RE1000+/ME1500 support. It is incomplete, however, since the 41 * cards are not for AT-compatibles. (They are for PC98 bus -- a 42 * proprietary bus architecture available only in Japan.) Further 43 * work for PC98 version will be available as a part of FreeBSD(98) 44 * project. 45 * |
|
38 * This software is a derivative work of if_ed.c version 1.56 by David 39 * Greenman available as a part of FreeBSD 2.0 RELEASE source distribution. 40 * 41 * The following lines are retained from the original if_ed.c: 42 * 43 * Copyright (C) 1993, David Greenman. This software may be used, modified, 44 * copied, distributed, and sold, in both source and binary form provided 45 * that the above copyright and these terms are retained. Under no 46 * circumstances is the author responsible for the proper functioning 47 * of this software, nor does the author assume any responsibility 48 * for damages incurred with its use. 49 */ 50 | 46 * This software is a derivative work of if_ed.c version 1.56 by David 47 * Greenman available as a part of FreeBSD 2.0 RELEASE source distribution. 48 * 49 * The following lines are retained from the original if_ed.c: 50 * 51 * Copyright (C) 1993, David Greenman. This software may be used, modified, 52 * copied, distributed, and sold, in both source and binary form provided 53 * that the above copyright and these terms are retained. Under no 54 * circumstances is the author responsible for the proper functioning 55 * of this software, nor does the author assume any responsibility 56 * for damages incurred with its use. 57 */ 58 |
59/* 60 * TODO: 61 * o To support MBH10304 PC card. It is another MB8696x based 62 * PCMCIA Ethernet card by Fujitsu, which is not compatible with 63 * MBH10302. 64 * o To merge FreeBSD(98) efforts into a single source file. 65 * o To support ISA PnP auto configuration for FMV-183/184. 66 * o To reconsider mbuf usage. 67 * o To reconsider transmission buffer usage, including 68 * transmission buffer size (currently 4KB x 2) and pros-and- 69 * cons of multiple frame transmission. 70 * o To test IPX codes. 71 */ 72 |
|
51#include "fe.h" 52#include "bpfilter.h" 53 54#include <sys/param.h> 55#include <sys/systm.h> | 73#include "fe.h" 74#include "bpfilter.h" 75 76#include <sys/param.h> 77#include <sys/systm.h> |
78 |
|
56#include <sys/conf.h> | 79#include <sys/conf.h> |
80 |
|
57#include <sys/errno.h> 58#include <sys/ioctl.h> 59#include <sys/mbuf.h> 60#include <sys/socket.h> 61#include <sys/syslog.h> 62#include <sys/devconf.h> 63 64#include <net/if.h> 65#include <net/if_dl.h> 66#include <net/if_types.h> 67 68#ifdef INET 69#include <netinet/in.h> 70#include <netinet/in_systm.h> 71#include <netinet/in_var.h> 72#include <netinet/ip.h> 73#include <netinet/if_ether.h> 74#endif 75 | 81#include <sys/errno.h> 82#include <sys/ioctl.h> 83#include <sys/mbuf.h> 84#include <sys/socket.h> 85#include <sys/syslog.h> 86#include <sys/devconf.h> 87 88#include <net/if.h> 89#include <net/if_dl.h> 90#include <net/if_types.h> 91 92#ifdef INET 93#include <netinet/in.h> 94#include <netinet/in_systm.h> 95#include <netinet/in_var.h> 96#include <netinet/ip.h> 97#include <netinet/if_ether.h> 98#endif 99 |
100/* IPX code is not tested. FIXME. */ |
|
76#ifdef IPX 77#include <netipx/ipx.h> 78#include <netipx/ipx_if.h> 79#endif 80 | 101#ifdef IPX 102#include <netipx/ipx.h> 103#include <netipx/ipx_if.h> 104#endif 105 |
106/* To be used with IPv6 package of INRIA. */ 107#ifdef INET6 108/* IPv6 added by shin 96.2.6 */ 109#include <netinet/if_ether6.h> 110#endif 111 112/* XNS code is not tested. FIXME. */ |
|
81#ifdef NS 82#include <netns/ns.h> 83#include <netns/ns_if.h> 84#endif 85 86#if NBPFILTER > 0 87#include <net/bpf.h> 88#include <net/bpfdesc.h> 89#endif 90 91#include <machine/clock.h> 92 93#include <i386/isa/isa.h> 94#include <i386/isa/isa_device.h> 95#include <i386/isa/icu.h> 96 | 113#ifdef NS 114#include <netns/ns.h> 115#include <netns/ns_if.h> 116#endif 117 118#if NBPFILTER > 0 119#include <net/bpf.h> 120#include <net/bpfdesc.h> 121#endif 122 123#include <machine/clock.h> 124 125#include <i386/isa/isa.h> 126#include <i386/isa/isa_device.h> 127#include <i386/isa/icu.h> 128 |
129/* PCCARD suport */ 130#include "crd.h" 131#if NCRD > 0 132#include <sys/select.h> 133#include <pccard/card.h> 134#include <pccard/slot.h> 135#include <pccard/driver.h> 136#endif /* NCRD > 0 */ 137 |
|
97#include <i386/isa/ic/mb86960.h> 98#include <i386/isa/if_fereg.h> 99 | 138#include <i386/isa/ic/mb86960.h> 139#include <i386/isa/if_fereg.h> 140 |
100#ifdef __GNUC__ 101#define INLINE inline 102#else 103#define INLINE 104#endif | 141#if NCRD > 0 142#include <i386/include/laptops.h> 143#endif /* NCRD > 0 */ |
105 106/* | 144 145/* |
146 * This version of fe is an ISA device driver. 147 * Override the following macro to adapt it to another bus. 148 * (E.g., PC98.) 149 */ 150#define DEVICE struct isa_device 151 152/* |
|
107 * Default settings for fe driver specific options. 108 * They can be set in config file by "options" statements. 109 */ 110 111/* 112 * Debug control. 113 * 0: No debug at all. All debug specific codes are stripped off. 114 * 1: Silent. No debug messages are logged except emergent ones. 115 * 2: Brief. Lair events and/or important information are logged. 116 * 3: Detailed. Logs all information which *may* be useful for debugging. 117 * 4: Trace. All actions in the driver is logged. Super verbose. 118 */ 119#ifndef FE_DEBUG 120#define FE_DEBUG 1 121#endif 122 123/* | 153 * Default settings for fe driver specific options. 154 * They can be set in config file by "options" statements. 155 */ 156 157/* 158 * Debug control. 159 * 0: No debug at all. All debug specific codes are stripped off. 160 * 1: Silent. No debug messages are logged except emergent ones. 161 * 2: Brief. Lair events and/or important information are logged. 162 * 3: Detailed. Logs all information which *may* be useful for debugging. 163 * 4: Trace. All actions in the driver is logged. Super verbose. 164 */ 165#ifndef FE_DEBUG 166#define FE_DEBUG 1 167#endif 168 169/* |
124 * Delay padding of short transmission packets to minimum Ethernet size. 125 * This may or may not gain performance. An EXPERIMENTAL option. 126 */ 127#ifndef FE_DELAYED_PADDING 128#define FE_DELAYED_PADDING 0 129#endif 130 131/* 132 * Transmit just one packet per a "send"command to 86960. | 170 * Transmit just one packet per a "send" command to 86960. |
133 * This option is intended for performance test. An EXPERIMENTAL option. 134 */ 135#ifndef FE_SINGLE_TRANSMISSION 136#define FE_SINGLE_TRANSMISSION 0 137#endif 138 139/* 140 * Device configuration flags. 141 */ 142 143/* DLCR6 settings. */ 144#define FE_FLAGS_DLCR6_VALUE 0x007F 145 146/* Force DLCR6 override. */ 147#define FE_FLAGS_OVERRIDE_DLCR6 0x0080 148 | 171 * This option is intended for performance test. An EXPERIMENTAL option. 172 */ 173#ifndef FE_SINGLE_TRANSMISSION 174#define FE_SINGLE_TRANSMISSION 0 175#endif 176 177/* 178 * Device configuration flags. 179 */ 180 181/* DLCR6 settings. */ 182#define FE_FLAGS_DLCR6_VALUE 0x007F 183 184/* Force DLCR6 override. */ 185#define FE_FLAGS_OVERRIDE_DLCR6 0x0080 186 |
149/* A cludge for PCMCIA support. */ 150#define FE_FLAGS_PCMCIA 0x8000 | 187/* Shouldn't these be defined somewhere else such as isa_device.h? */ 188#define NO_IOADDR 0xFFFFFFFF 189#define NO_IRQ 0 |
151 | 190 |
152/* Shouldn't this be defined somewhere else such as isa_device.h? */ 153#define NO_IOADDR 0xFFFFFFFF 154 155/* Identification of the driver version. */ 156static char const fe_version [] = FE_VERSION " / " FE_REG_VERSION; 157 | |
158/* | 191/* |
159 * Supported hardware (Ethernet card) types 160 * This information is currently used only for debugging | 192 * Data type for a multicast address filter on 8696x. |
161 */ | 193 */ |
162enum fe_type 163{ 164 /* For cards which are successfully probed but not identified. */ 165 FE_TYPE_UNKNOWN, 166 167 /* Fujitsu FMV-180 series. */ 168 FE_TYPE_FMV181, 169 FE_TYPE_FMV182, 170 171 /* Allied-Telesis AT1700 series and RE2000 series. */ 172 FE_TYPE_AT1700, 173 174 /* PCMCIA by Fujitsu. */ 175 FE_TYPE_MBH10302, 176 FE_TYPE_MBH10304, 177 178 /* More can be here. */ 179}; 180 181/* 182 * Data type for a multicast address filter on 86960. 183 */ | |
184struct fe_filter { u_char data [ FE_FILTER_LEN ]; }; 185 186/* 187 * Special filter values. 188 */ 189static struct fe_filter const fe_filter_nothing = { FE_FILTER_NOTHING }; 190static struct fe_filter const fe_filter_all = { FE_FILTER_ALL }; 191 | 194struct fe_filter { u_char data [ FE_FILTER_LEN ]; }; 195 196/* 197 * Special filter values. 198 */ 199static struct fe_filter const fe_filter_nothing = { FE_FILTER_NOTHING }; 200static struct fe_filter const fe_filter_all = { FE_FILTER_ALL }; 201 |
202/* How many registers does an fe-supported adapter have at maximum? */ 203#define MAXREGISTERS 32 204 |
|
192/* 193 * fe_softc: per line info and status 194 */ 195static struct fe_softc { 196 197 /* Used by "common" codes. */ | 205/* 206 * fe_softc: per line info and status 207 */ 208static struct fe_softc { 209 210 /* Used by "common" codes. */ |
198 struct arpcom arpcom; /* ethernet common */ | 211 struct arpcom arpcom; /* Ethernet common */ |
199 200 /* Used by config codes. */ 201 struct kern_devconf kdc;/* Kernel configuration database info. */ 202 203 /* Set by probe() and not modified in later phases. */ | 212 213 /* Used by config codes. */ 214 struct kern_devconf kdc;/* Kernel configuration database info. */ 215 216 /* Set by probe() and not modified in later phases. */ |
204 enum fe_type type; /* interface type code */ | |
205 char * typestr; /* printable name of the interface. */ | 217 char * typestr; /* printable name of the interface. */ |
206 u_short addr; /* MB86960A I/O base address */ | 218 u_short iobase; /* base I/O address of the adapter. */ 219 u_short ioaddr [ MAXREGISTERS ]; /* I/O addresses of register. */ |
207 u_short txb_size; /* size of TX buffer, in bytes */ 208 u_char proto_dlcr4; /* DLCR4 prototype. */ 209 u_char proto_dlcr5; /* DLCR5 prototype. */ 210 u_char proto_dlcr6; /* DLCR6 prototype. */ 211 u_char proto_dlcr7; /* DLCR7 prototype. */ | 220 u_short txb_size; /* size of TX buffer, in bytes */ 221 u_char proto_dlcr4; /* DLCR4 prototype. */ 222 u_char proto_dlcr5; /* DLCR5 prototype. */ 223 u_char proto_dlcr6; /* DLCR6 prototype. */ 224 u_char proto_dlcr7; /* DLCR7 prototype. */ |
225 u_char proto_bmpr13; /* BMPR13 prototype. */ |
|
212 213 /* Vendor specific hooks. */ 214 void ( * init )( struct fe_softc * ); /* Just before fe_init(). */ 215 void ( * stop )( struct fe_softc * ); /* Just after fe_stop(). */ 216 217 /* Transmission buffer management. */ 218 u_short txb_free; /* free bytes in TX buffer */ 219 u_char txb_count; /* number of packets in TX buffer */ --- 8 unchanged lines hidden (view full) --- 228 229/* Frequently accessed members in arpcom and kdc. */ 230#define sc_if arpcom.ac_if 231#define sc_unit arpcom.ac_if.if_unit 232#define sc_enaddr arpcom.ac_enaddr 233#define sc_dcstate kdc.kdc_state 234#define sc_description kdc.kdc_description 235 | 226 227 /* Vendor specific hooks. */ 228 void ( * init )( struct fe_softc * ); /* Just before fe_init(). */ 229 void ( * stop )( struct fe_softc * ); /* Just after fe_stop(). */ 230 231 /* Transmission buffer management. */ 232 u_short txb_free; /* free bytes in TX buffer */ 233 u_char txb_count; /* number of packets in TX buffer */ --- 8 unchanged lines hidden (view full) --- 242 243/* Frequently accessed members in arpcom and kdc. */ 244#define sc_if arpcom.ac_if 245#define sc_unit arpcom.ac_if.if_unit 246#define sc_enaddr arpcom.ac_enaddr 247#define sc_dcstate kdc.kdc_state 248#define sc_description kdc.kdc_description 249 |
236#define IFNET2SOFTC(P) (P)->if_softc 237 | |
238/* Standard driver entry points. These can be static. */ 239static int fe_probe ( struct isa_device * ); 240static int fe_attach ( struct isa_device * ); 241static void fe_init ( int ); 242static int fe_ioctl ( struct ifnet *, int, caddr_t ); 243static void fe_start ( struct ifnet * ); 244static void fe_reset ( int ); 245static void fe_watchdog ( struct ifnet * ); 246 247/* Local functions. Order of declaration is confused. FIXME. */ | 250/* Standard driver entry points. These can be static. */ 251static int fe_probe ( struct isa_device * ); 252static int fe_attach ( struct isa_device * ); 253static void fe_init ( int ); 254static int fe_ioctl ( struct ifnet *, int, caddr_t ); 255static void fe_start ( struct ifnet * ); 256static void fe_reset ( int ); 257static void fe_watchdog ( struct ifnet * ); 258 259/* Local functions. Order of declaration is confused. FIXME. */ |
248static int fe_probe_fmv ( struct isa_device *, struct fe_softc * ); 249static int fe_probe_ati ( struct isa_device *, struct fe_softc * ); 250static int fe_probe_mbh ( struct isa_device *, struct fe_softc * ); | 260static void fe_registerdev ( struct fe_softc *, DEVICE * ); 261static int fe_probe_fmv ( DEVICE *, struct fe_softc * ); 262static int fe_probe_ati ( DEVICE *, struct fe_softc * ); 263static int fe_probe_mbh ( DEVICE *, struct fe_softc * ); |
251static void fe_init_mbh ( struct fe_softc * ); 252static int fe_get_packet ( struct fe_softc *, u_short ); 253static void fe_stop ( int ); 254static void fe_tint ( struct fe_softc *, u_char ); 255static void fe_rint ( struct fe_softc *, u_char ); 256static void fe_xmit ( struct fe_softc * ); 257static void fe_write_mbufs ( struct fe_softc *, struct mbuf * ); 258static struct fe_filter --- 14 unchanged lines hidden (view full) --- 273#define ETHER_CRC_LEN 4 /* number of bytes in CRC field. */ 274 275/* Driver struct used in the config code. This must be public (external.) */ 276struct isa_driver fedriver = 277{ 278 fe_probe, 279 fe_attach, 280 "fe", | 264static void fe_init_mbh ( struct fe_softc * ); 265static int fe_get_packet ( struct fe_softc *, u_short ); 266static void fe_stop ( int ); 267static void fe_tint ( struct fe_softc *, u_char ); 268static void fe_rint ( struct fe_softc *, u_char ); 269static void fe_xmit ( struct fe_softc * ); 270static void fe_write_mbufs ( struct fe_softc *, struct mbuf * ); 271static struct fe_filter --- 14 unchanged lines hidden (view full) --- 286#define ETHER_CRC_LEN 4 /* number of bytes in CRC field. */ 287 288/* Driver struct used in the config code. This must be public (external.) */ 289struct isa_driver fedriver = 290{ 291 fe_probe, 292 fe_attach, 293 "fe", |
281 0 /* Assume we are insensitive. FIXME. */ | 294 1 /* It's safe to mark as "sensitive" */ |
282}; 283 284/* Initial value for a kdc struct. */ 285static struct kern_devconf const fe_kdc_template = 286{ 287 0, 0, 0, 288 "fe", 0, { MDDT_ISA, 0, "net" }, 289 isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, | 295}; 296 297/* Initial value for a kdc struct. */ 298static struct kern_devconf const fe_kdc_template = 299{ 300 0, 0, 0, 301 "fe", 0, { MDDT_ISA, 0, "net" }, 302 isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, |
290 &kdc_isa0, /* We are an ISA device. */ | 303 &kdc_isa0, /* This is an ISA device. */ |
291 0, 292 DC_UNCONFIGURED, /* Not yet configured. */ | 304 0, 305 DC_UNCONFIGURED, /* Not yet configured. */ |
293 "Ethernet (fe)", /* Tentative description (filled in later.) */ 294 DC_CLS_NETIF /* We are a network interface. */ | 306 "Ethernet (MB8696x)", /* Tentative description (filled in later.) */ 307 DC_CLS_NETIF /* This is a network interface. */ |
295}; 296 297/* 298 * Fe driver specific constants which relate to 86960/86965. | 308}; 309 310/* 311 * Fe driver specific constants which relate to 86960/86965. |
299 * They are here (not in if_fereg.h), since selection of those 300 * values depend on driver design. I want to keep definitions in 301 * if_fereg.h "clean", so that if someone wrote another driver 302 * for 86960/86965, if_fereg.h were usable unchanged. 303 * 304 * The above statement sounds somothing like it's better to name 305 * it "ic/mb86960.h" but "if_fereg.h"... Should I do so? FIXME. | |
306 */ 307 308/* Interrupt masks */ 309#define FE_TMASK ( FE_D2_COLL16 | FE_D2_TXDONE ) 310#define FE_RMASK ( FE_D3_OVRFLO | FE_D3_CRCERR \ 311 | FE_D3_ALGERR | FE_D3_SRTPKT | FE_D3_PKTRDY ) 312 | 312 */ 313 314/* Interrupt masks */ 315#define FE_TMASK ( FE_D2_COLL16 | FE_D2_TXDONE ) 316#define FE_RMASK ( FE_D3_OVRFLO | FE_D3_CRCERR \ 317 | FE_D3_ALGERR | FE_D3_SRTPKT | FE_D3_PKTRDY ) 318 |
313/* Maximum number of iterrations for a receive interrupt. */ | 319/* Maximum number of iterations for a receive interrupt. */ |
314#define FE_MAX_RECV_COUNT ( ( 65536 - 2048 * 2 ) / 64 ) | 320#define FE_MAX_RECV_COUNT ( ( 65536 - 2048 * 2 ) / 64 ) |
315 /* Maximum size of SRAM is 65536, | 321 /* 322 * Maximum size of SRAM is 65536, |
316 * minimum size of transmission buffer in fe is 2x2KB, 317 * and minimum amount of received packet including headers 318 * added by the chip is 64 bytes. 319 * Hence FE_MAX_RECV_COUNT is the upper limit for number | 323 * minimum size of transmission buffer in fe is 2x2KB, 324 * and minimum amount of received packet including headers 325 * added by the chip is 64 bytes. 326 * Hence FE_MAX_RECV_COUNT is the upper limit for number |
320 * of packets in the receive buffer. */ | 327 * of packets in the receive buffer. 328 */ |
321 322/* | 329 330/* |
323 * Convenient routines to access contiguous I/O ports. | 331 * Routines to access contiguous I/O ports. |
324 */ 325 | 332 */ 333 |
326static INLINE void 327inblk ( u_short addr, u_char * mem, int len ) | 334static void 335inblk ( struct fe_softc * sc, int offs, u_char * mem, int len ) |
328{ 329 while ( --len >= 0 ) { | 336{ 337 while ( --len >= 0 ) { |
330 *mem++ = inb( addr++ ); | 338 *mem++ = inb( sc->ioaddr[ offs++ ] ); |
331 } 332} 333 | 339 } 340} 341 |
334static INLINE void 335outblk ( u_short addr, u_char const * mem, int len ) | 342static void 343outblk ( struct fe_softc * sc, int offs, u_char const * mem, int len ) |
336{ 337 while ( --len >= 0 ) { | 344{ 345 while ( --len >= 0 ) { |
338 outb( addr++, *mem++ ); | 346 outb( sc->ioaddr[ offs++ ], *mem++ ); |
339 } 340} 341 | 347 } 348} 349 |
350/* PCCARD Support */ 351#if NCRD > 0 |
|
342/* | 352/* |
353 * PC-Card (PCMCIA) specific code. 354 */ 355static int fe_card_intr(struct pccard_dev *); /* Interrupt handler */ 356static void feunload(struct pccard_dev *); /* Disable driver */ 357static void fesuspend(struct pccard_dev *); /* Suspend driver */ 358static int feinit(struct pccard_dev *, int); /* init device */ 359 360static struct pccard_drv fe_info = 361 { 362 "fe", 363 fe_card_intr, 364 feunload, 365 fesuspend, 366 feinit, 367 0, /* Attributes - presently unused */ 368 &net_imask /* Interrupt mask for device */ 369 /* This should also include net_imask?? */ 370 }; 371/* 372 * Called when a power down is requested. Shuts down the 373 * device and configures the device as unavailable (but 374 * still loaded...). A resume is done by calling 375 * feinit with first=0. This is called when the user suspends 376 * the system, or the APM code suspends the system. 377 */ 378static void 379fesuspend(struct pccard_dev *dp) 380{ 381 printf("fe%d: suspending\n", dp->isahd.id_unit); 382} 383 384/* 385 * Initialize the device - called from Slot manager. 386 * if first is set, then initially check for 387 * the device's existence before initializing it. 388 * Once initialized, the device table may be set up. 389 */ 390static int 391feinit(struct pccard_dev *dp, int first) 392{ 393/* 394 * validate unit number. 395 */ 396 struct fe_softc *sc; 397 if (first) 398 { 399 if (dp->isahd.id_unit >= NFE) 400 return(ENODEV); 401/* 402 * Probe the device. If a value is returned, the 403 * device was found at the location. 404 */ 405#if FE_DEBUG >= 2 406 printf("Start Probe\n"); 407#endif 408 if (fe_probe(&dp->isahd)==0) 409 return(ENXIO); 410#if FE_DEBUG >= 2 411 printf("Start attach\n"); 412#endif 413 if (fe_attach(&dp->isahd)==0) 414 return(ENXIO); 415 416 } 417/* 418 * XXX TODO: 419 * If it was already init'ed before, the device structure 420 * should be already initialized. Here we should 421 * reset (and possibly restart) the hardware, but 422 * I am not sure of the best way to do this... 423 */ 424 return(0); 425} 426 427/* 428 * feunload - unload the driver and clear the table. 429 * XXX TODO: 430 * This is called usually when the card is ejected, but 431 * can be caused by the modunload of a controller driver. 432 * The idea is reset the driver's view of the device 433 * and ensure that any driver entry points such as 434 * read and write do not hang. 435 */ 436static void 437feunload(struct pccard_dev *dp) 438{ 439 printf("fe%d: unload\n", dp->isahd.id_unit); 440 fe_stop(dp->isahd.id_unit); 441} 442 443/* 444 * card_intr - Shared interrupt called from 445 * front end of PC-Card handler. 446 */ 447static int 448fe_card_intr(struct pccard_dev *dp) 449{ 450 feintr(dp->isahd.id_unit); 451 return(1); 452} 453#endif /* NCRD > 0 */ 454 455 456/* |
|
343 * Hardware probe routines. 344 */ 345 346/* How and where to probe; to support automatic I/O address detection. */ 347struct fe_probe_list 348{ | 457 * Hardware probe routines. 458 */ 459 460/* How and where to probe; to support automatic I/O address detection. */ 461struct fe_probe_list 462{ |
349 int ( * probe ) ( struct isa_device *, struct fe_softc * ); | 463 int ( * probe ) ( DEVICE *, struct fe_softc * ); |
350 u_short const * addresses; 351}; 352 353/* Lists of possible addresses. */ 354static u_short const fe_fmv_addr [] = 355 { 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x300, 0x340, 0 }; 356static u_short const fe_ati_addr [] = 357 { 0x240, 0x260, 0x280, 0x2A0, 0x300, 0x320, 0x340, 0x380, 0 }; 358 359static struct fe_probe_list const fe_probe_list [] = 360{ 361 { fe_probe_fmv, fe_fmv_addr }, 362 { fe_probe_ati, fe_ati_addr }, 363 { fe_probe_mbh, NULL }, /* PCMCIAs cannot be auto-detected. */ 364 { NULL, NULL } 365}; 366 | 464 u_short const * addresses; 465}; 466 467/* Lists of possible addresses. */ 468static u_short const fe_fmv_addr [] = 469 { 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x300, 0x340, 0 }; 470static u_short const fe_ati_addr [] = 471 { 0x240, 0x260, 0x280, 0x2A0, 0x300, 0x320, 0x340, 0x380, 0 }; 472 473static struct fe_probe_list const fe_probe_list [] = 474{ 475 { fe_probe_fmv, fe_fmv_addr }, 476 { fe_probe_ati, fe_ati_addr }, 477 { fe_probe_mbh, NULL }, /* PCMCIAs cannot be auto-detected. */ 478 { NULL, NULL } 479}; 480 |
481static void 482fe_registerdev ( struct fe_softc * sc, DEVICE * dev ) 483{ 484 /* Fill the device config data and register it. */ 485 sc->kdc = fe_kdc_template; 486 sc->kdc.kdc_unit = sc->sc_unit; 487 sc->kdc.kdc_parentdata = dev; 488 dev_attach( &sc->kdc ); 489} 490 |
|
367/* 368 * Determine if the device is present 369 * 370 * on entry: 371 * a pointer to an isa_device struct 372 * on exit: 373 * zero if device not found 374 * or number of i/o addresses used (if found) 375 */ 376 377static int | 491/* 492 * Determine if the device is present 493 * 494 * on entry: 495 * a pointer to an isa_device struct 496 * on exit: 497 * zero if device not found 498 * or number of i/o addresses used (if found) 499 */ 500 501static int |
378fe_probe ( struct isa_device * isa_dev ) | 502fe_probe ( DEVICE * dev ) |
379{ | 503{ |
380 struct fe_softc * sc, * u; | 504#if NCRD > 0 505 static int fe_already_init; 506#endif /* NCRD > 0 */ 507 struct fe_softc * sc; 508 int u; |
381 int nports; 382 struct fe_probe_list const * list; 383 u_short const * addr; 384 u_short single [ 2 ]; 385 386 /* Initialize "minimum" parts of our softc. */ | 509 int nports; 510 struct fe_probe_list const * list; 511 u_short const * addr; 512 u_short single [ 2 ]; 513 514 /* Initialize "minimum" parts of our softc. */ |
387 sc = &fe_softc[ isa_dev->id_unit ]; 388 sc->sc_unit = isa_dev->id_unit; | 515 sc = &fe_softc[ dev->id_unit ]; 516 sc->sc_unit = dev->id_unit; |
389 | 517 |
390#if FE_DEBUG >= 2 391 log( LOG_INFO, "fe%d: %s\n", sc->sc_unit, fe_version ); 392#endif 393 | 518#if NCRD == 0 |
394#ifndef DEV_LKM | 519#ifndef DEV_LKM |
395 /* Fill the device config data and register it. */ 396 sc->kdc = fe_kdc_template; 397 sc->kdc.kdc_unit = sc->sc_unit; 398 sc->kdc.kdc_parentdata = isa_dev; 399 dev_attach( &sc->kdc ); 400#endif | 520 fe_registerdev( sc, dev ); 521#endif 522#endif /* NCRD == 0 */ |
401 | 523 |
524#if NCRD > 0 525/* 526 * If PC-Card probe required, then register driver with 527 * slot manager. 528 */ 529 if (fe_already_init != 1) 530 { 531 fe_registerdev(sc,dev); 532 pccard_add_driver(&fe_info); 533 fe_already_init = 1; 534/* return ( 0 ); */ 535 } 536#endif /* NCRD > 0 */ 537 |
|
402 /* Probe each possibility, one at a time. */ 403 for ( list = fe_probe_list; list->probe != NULL; list++ ) { 404 | 538 /* Probe each possibility, one at a time. */ 539 for ( list = fe_probe_list; list->probe != NULL; list++ ) { 540 |
405 if ( isa_dev->id_iobase != NO_IOADDR ) { | 541 if ( dev->id_iobase != NO_IOADDR ) { |
406 /* Probe one specific address. */ | 542 /* Probe one specific address. */ |
407 single[ 0 ] = isa_dev->id_iobase; | 543 single[ 0 ] = dev->id_iobase; |
408 single[ 1 ] = 0; 409 addr = single; 410 } else if ( list->addresses != NULL ) { 411 /* Auto detect. */ 412 addr = list->addresses; 413 } else { 414 /* We need a list of addresses to do auto detect. */ 415 continue; 416 } 417 418 /* Probe all possible addresses for the board. */ 419 while ( *addr != 0 ) { 420 | 544 single[ 1 ] = 0; 545 addr = single; 546 } else if ( list->addresses != NULL ) { 547 /* Auto detect. */ 548 addr = list->addresses; 549 } else { 550 /* We need a list of addresses to do auto detect. */ 551 continue; 552 } 553 554 /* Probe all possible addresses for the board. */ 555 while ( *addr != 0 ) { 556 |
421 /* Don't probe already used address. */ 422 for ( u = &fe_softc[0]; u < &fe_softc[NFE]; u++ ) { 423 if ( u->addr == *addr ) break; | 557 /* See if the address is already in use. */ 558 for ( u = 0; u < NFE; u++ ) { 559 if ( fe_softc[u].iobase == *addr ) break; |
424 } | 560 } |
425 if ( u < &fe_softc[NFE] ) continue; | |
426 | 561 |
427 /* Probe an address. */ 428 sc->addr = *addr; 429 nports = list->probe( isa_dev, sc ); 430 if ( nports > 0 ) { 431 /* Found. */ 432 isa_dev->id_iobase = *addr; 433 return ( nports ); | 562#if FE_DEBUG >= 3 563 if ( u == NFE ) { 564 log( LOG_INFO, "fe%d: probing %d at 0x%x\n", 565 sc->sc_unit, list - fe_probe_list, *addr ); 566 } else if ( u == sc->sc_unit ) { 567 log( LOG_INFO, "fe%d: re-probing %d at 0x%x?\n", 568 sc->sc_unit, list - fe_probe_list, *addr ); 569 } else { 570 log( LOG_INFO, "fe%d: skipping %d at 0x%x\n", 571 sc->sc_unit, list - fe_probe_list, *addr ); |
434 } | 572 } |
573#endif |
|
435 | 574 |
575 /* Probe the address if it is free. */ 576 if ( u == NFE || u == sc->sc_unit ) { 577 578 /* Probe an address. */ 579 sc->iobase = *addr; 580 nports = list->probe( dev, sc ); 581 if ( nports > 0 ) { 582 /* Found. */ 583 dev->id_iobase = *addr; 584 return ( nports ); 585 } 586 sc->iobase = 0; 587 } 588 |
|
436 /* Try next. */ | 589 /* Try next. */ |
437 sc->addr = 0; | |
438 addr++; 439 } 440 } 441 442 /* Probe failed. */ 443 return ( 0 ); 444} 445 446/* 447 * Check for specific bits in specific registers have specific values. 448 */ 449struct fe_simple_probe_struct 450{ 451 u_char port; /* Offset from the base I/O address. */ 452 u_char mask; /* Bits to be checked. */ 453 u_char bits; /* Values to be compared against. */ 454}; 455 | 590 addr++; 591 } 592 } 593 594 /* Probe failed. */ 595 return ( 0 ); 596} 597 598/* 599 * Check for specific bits in specific registers have specific values. 600 */ 601struct fe_simple_probe_struct 602{ 603 u_char port; /* Offset from the base I/O address. */ 604 u_char mask; /* Bits to be checked. */ 605 u_char bits; /* Values to be compared against. */ 606}; 607 |
456static INLINE int 457fe_simple_probe ( u_short addr, struct fe_simple_probe_struct const * sp ) | 608static int 609fe_simple_probe ( struct fe_softc const * sc, 610 struct fe_simple_probe_struct const * sp ) |
458{ 459 struct fe_simple_probe_struct const * p; 460 461 for ( p = sp; p->mask != 0; p++ ) { | 611{ 612 struct fe_simple_probe_struct const * p; 613 614 for ( p = sp; p->mask != 0; p++ ) { |
462 if ( ( inb( addr + p->port ) & p->mask ) != p->bits ) { | 615#if FE_DEBUG >=2 616 printf("Probe Port:%x,Value:%x,Mask:%x.Bits:%x\n", 617 p->port,inb(sc->ioaddr[ p->port]),p->mask,p->bits); 618#endif 619 if ( ( inb( sc->ioaddr[ p->port ] ) & p->mask ) != p->bits ) 620 { |
463 return ( 0 ); 464 } 465 } 466 return ( 1 ); 467} 468 469/* 470 * Routines to read all bytes from the config EEPROM through MB86965A. 471 * I'm not sure what exactly I'm doing here... I was told just to follow 472 * the steps, and it worked. Could someone tell me why the following 473 * code works? (Or, why all similar codes I tried previously doesn't 474 * work.) FIXME. 475 */ 476 | 621 return ( 0 ); 622 } 623 } 624 return ( 1 ); 625} 626 627/* 628 * Routines to read all bytes from the config EEPROM through MB86965A. 629 * I'm not sure what exactly I'm doing here... I was told just to follow 630 * the steps, and it worked. Could someone tell me why the following 631 * code works? (Or, why all similar codes I tried previously doesn't 632 * work.) FIXME. 633 */ 634 |
477static INLINE void 478strobe ( u_short bmpr16 ) | 635static void 636fe_strobe_eeprom ( u_short bmpr16 ) |
479{ 480 /* | 637{ 638 /* |
481 * Output same value twice. To speed-down execution? | 639 * We must guarantee 800ns (or more) interval to access slow 640 * EEPROMs. The following redundant code provides enough 641 * delay with ISA timing. (Even if the bus clock is "tuned.") 642 * Some modification will be needed on faster busses. |
482 */ 483 outb( bmpr16, FE_B16_SELECT ); 484 outb( bmpr16, FE_B16_SELECT ); 485 outb( bmpr16, FE_B16_SELECT | FE_B16_CLOCK ); 486 outb( bmpr16, FE_B16_SELECT | FE_B16_CLOCK ); 487 outb( bmpr16, FE_B16_SELECT ); 488 outb( bmpr16, FE_B16_SELECT ); 489} 490 491static void 492fe_read_eeprom ( struct fe_softc * sc, u_char * data ) 493{ | 643 */ 644 outb( bmpr16, FE_B16_SELECT ); 645 outb( bmpr16, FE_B16_SELECT ); 646 outb( bmpr16, FE_B16_SELECT | FE_B16_CLOCK ); 647 outb( bmpr16, FE_B16_SELECT | FE_B16_CLOCK ); 648 outb( bmpr16, FE_B16_SELECT ); 649 outb( bmpr16, FE_B16_SELECT ); 650} 651 652static void 653fe_read_eeprom ( struct fe_softc * sc, u_char * data ) 654{ |
494 u_short bmpr16 = sc->addr + FE_BMPR16; 495 u_short bmpr17 = sc->addr + FE_BMPR17; | 655 u_short bmpr16 = sc->ioaddr[ FE_BMPR16 ]; 656 u_short bmpr17 = sc->ioaddr[ FE_BMPR17 ]; |
496 u_char n, val, bit; | 657 u_char n, val, bit; |
497 u_char save16, save17; | |
498 | 658 |
499 /* Save old values of the registers. */ 500 save16 = inb( bmpr16 ); 501 save17 = inb( bmpr17 ); 502 503 /* Read bytes from EEPROM; two bytes per an iterration. */ | 659 /* Read bytes from EEPROM; two bytes per an iteration. */ |
504 for ( n = 0; n < FE_EEPROM_SIZE / 2; n++ ) { 505 506 /* Reset the EEPROM interface. */ 507 outb( bmpr16, 0x00 ); 508 outb( bmpr17, 0x00 ); | 660 for ( n = 0; n < FE_EEPROM_SIZE / 2; n++ ) { 661 662 /* Reset the EEPROM interface. */ 663 outb( bmpr16, 0x00 ); 664 outb( bmpr17, 0x00 ); |
509 outb( bmpr16, FE_B16_SELECT ); | |
510 511 /* Start EEPROM access. */ | 665 666 /* Start EEPROM access. */ |
667 outb( bmpr16, FE_B16_SELECT ); |
|
512 outb( bmpr17, FE_B17_DATA ); | 668 outb( bmpr17, FE_B17_DATA ); |
513 strobe( bmpr16 ); | 669 fe_strobe_eeprom( bmpr16 ); |
514 | 670 |
515 /* Pass the iterration count to the chip. */ | 671 /* Pass the iteration count to the chip. */ |
516 val = 0x80 | n; 517 for ( bit = 0x80; bit != 0x00; bit >>= 1 ) { 518 outb( bmpr17, ( val & bit ) ? FE_B17_DATA : 0 ); | 672 val = 0x80 | n; 673 for ( bit = 0x80; bit != 0x00; bit >>= 1 ) { 674 outb( bmpr17, ( val & bit ) ? FE_B17_DATA : 0 ); |
519 strobe( bmpr16 ); | 675 fe_strobe_eeprom( bmpr16 ); |
520 } 521 outb( bmpr17, 0x00 ); 522 523 /* Read a byte. */ 524 val = 0; 525 for ( bit = 0x80; bit != 0x00; bit >>= 1 ) { | 676 } 677 outb( bmpr17, 0x00 ); 678 679 /* Read a byte. */ 680 val = 0; 681 for ( bit = 0x80; bit != 0x00; bit >>= 1 ) { |
526 strobe( bmpr16 ); | 682 fe_strobe_eeprom( bmpr16 ); |
527 if ( inb( bmpr17 ) & FE_B17_DATA ) { 528 val |= bit; 529 } 530 } 531 *data++ = val; 532 533 /* Read one more byte. */ 534 val = 0; 535 for ( bit = 0x80; bit != 0x00; bit >>= 1 ) { | 683 if ( inb( bmpr17 ) & FE_B17_DATA ) { 684 val |= bit; 685 } 686 } 687 *data++ = val; 688 689 /* Read one more byte. */ 690 val = 0; 691 for ( bit = 0x80; bit != 0x00; bit >>= 1 ) { |
536 strobe( bmpr16 ); | 692 fe_strobe_eeprom( bmpr16 ); |
537 if ( inb( bmpr17 ) & FE_B17_DATA ) { 538 val |= bit; 539 } 540 } 541 *data++ = val; 542 } 543 | 693 if ( inb( bmpr17 ) & FE_B17_DATA ) { 694 val |= bit; 695 } 696 } 697 *data++ = val; 698 } 699 |
544 /* Restore register values, in the case we had no 86965. */ 545 outb( bmpr16, save16 ); 546 outb( bmpr17, save17 ); | 700 /* Reset the EEPROM interface, again. */ 701 outb( bmpr16, 0x00 ); 702 outb( bmpr17, 0x00 ); |
547 548#if FE_DEBUG >= 3 549 /* Report what we got. */ 550 data -= FE_EEPROM_SIZE; 551 log( LOG_INFO, "fe%d: EEPROM:" 552 " %02x%02x%02x%02x %02x%02x%02x%02x -" 553 " %02x%02x%02x%02x %02x%02x%02x%02x -" 554 " %02x%02x%02x%02x %02x%02x%02x%02x -" --- 13 unchanged lines hidden (view full) --- 568/* 569 * Hardware (vendor) specific probe routines. 570 */ 571 572/* 573 * Probe and initialization for Fujitsu FMV-180 series boards 574 */ 575static int | 703 704#if FE_DEBUG >= 3 705 /* Report what we got. */ 706 data -= FE_EEPROM_SIZE; 707 log( LOG_INFO, "fe%d: EEPROM:" 708 " %02x%02x%02x%02x %02x%02x%02x%02x -" 709 " %02x%02x%02x%02x %02x%02x%02x%02x -" 710 " %02x%02x%02x%02x %02x%02x%02x%02x -" --- 13 unchanged lines hidden (view full) --- 724/* 725 * Hardware (vendor) specific probe routines. 726 */ 727 728/* 729 * Probe and initialization for Fujitsu FMV-180 series boards 730 */ 731static int |
576fe_probe_fmv ( struct isa_device *isa_dev, struct fe_softc * sc ) | 732fe_probe_fmv ( DEVICE * dev, struct fe_softc * sc ) |
577{ 578 int i, n; 579 | 733{ 734 int i, n; 735 |
580 static u_short const ioaddr [ 8 ] = | 736 static u_short const baseaddr [ 8 ] = |
581 { 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x300, 0x340 }; 582 static u_short const irqmap [ 4 ] = 583 { IRQ3, IRQ7, IRQ10, IRQ15 }; 584 585 static struct fe_simple_probe_struct const probe_table [] = { 586 { FE_DLCR2, 0x70, 0x00 }, 587 { FE_DLCR4, 0x08, 0x00 }, 588 /* { FE_DLCR5, 0x80, 0x00 }, Doesn't work. */ 589 | 737 { 0x220, 0x240, 0x260, 0x280, 0x2A0, 0x2C0, 0x300, 0x340 }; 738 static u_short const irqmap [ 4 ] = 739 { IRQ3, IRQ7, IRQ10, IRQ15 }; 740 741 static struct fe_simple_probe_struct const probe_table [] = { 742 { FE_DLCR2, 0x70, 0x00 }, 743 { FE_DLCR4, 0x08, 0x00 }, 744 /* { FE_DLCR5, 0x80, 0x00 }, Doesn't work. */ 745 |
590 { FE_FMV0, FE_FMV0_MAGIC_MASK, FE_FMV0_MAGIC_VALUE }, 591 { FE_FMV1, FE_FMV1_CARDID_MASK, FE_FMV1_CARDID_ID }, 592 { FE_FMV3, FE_FMV3_EXTRA_MASK, FE_FMV3_EXTRA_VALUE }, | 746 { FE_FMV0, 0x78, 0x50 }, /* ERRDY+PRRDY */ 747 { FE_FMV1, 0xB0, 0x00 }, /* FMV-183/184 has 0x48 bits. */ 748 { FE_FMV3, 0x7F, 0x00 }, |
593#if 1 594 /* 595 * Test *vendor* part of the station address for Fujitsu. 596 * The test will gain reliability of probe process, but 597 * it rejects FMV-180 clone boards manufactured by other vendors. 598 * We have to turn the test off when such cards are made available. 599 */ 600 { FE_FMV4, 0xFF, 0x00 }, 601 { FE_FMV5, 0xFF, 0x00 }, 602 { FE_FMV6, 0xFF, 0x0E }, 603#else 604 /* | 749#if 1 750 /* 751 * Test *vendor* part of the station address for Fujitsu. 752 * The test will gain reliability of probe process, but 753 * it rejects FMV-180 clone boards manufactured by other vendors. 754 * We have to turn the test off when such cards are made available. 755 */ 756 { FE_FMV4, 0xFF, 0x00 }, 757 { FE_FMV5, 0xFF, 0x00 }, 758 { FE_FMV6, 0xFF, 0x0E }, 759#else 760 /* |
605 * We can always verify the *first* 2 bits (in Ehternet | 761 * We can always verify the *first* 2 bits (in Ethernet |
606 * bit order) are "no multicast" and "no local" even for 607 * unknown vendors. 608 */ 609 { FE_FMV4, 0x03, 0x00 }, 610#endif 611 { 0 } 612 }; 613 | 762 * bit order) are "no multicast" and "no local" even for 763 * unknown vendors. 764 */ 765 { FE_FMV4, 0x03, 0x00 }, 766#endif 767 { 0 } 768 }; 769 |
614#if 0 615 /* 616 * Dont probe at all if the config says we are PCMCIA... 617 */ 618 if ( isa_dev->id_flags & FE_FLAGS_PCMCIA ) return ( 0 ); 619#endif | 770 /* "Hardware revision ID" */ 771 int revision; |
620 621 /* | 772 773 /* |
622 * See if the sepcified address is possible for FMV-180 series. | 774 * See if the specified address is possible for FMV-180 series. |
623 */ 624 for ( i = 0; i < 8; i++ ) { | 775 */ 776 for ( i = 0; i < 8; i++ ) { |
625 if ( ioaddr[ i ] == sc->addr ) break; | 777 if ( baseaddr[ i ] == sc->iobase ) break; |
626 } 627 if ( i == 8 ) return 0; 628 | 778 } 779 if ( i == 8 ) return 0; 780 |
781 /* Setup an I/O address mapping table. */ 782 for ( i = 0; i < MAXREGISTERS; i++ ) { 783 sc->ioaddr[ i ] = sc->iobase + i; 784 } 785 |
|
629 /* Simple probe. */ | 786 /* Simple probe. */ |
630 if ( !fe_simple_probe( sc->addr, probe_table ) ) return 0; | 787 if ( !fe_simple_probe( sc, probe_table ) ) return 0; |
631 | 788 |
632 /* Check if our I/O address matches config info on EEPROM. */ 633 n = ( inb( sc->addr + FE_FMV2 ) & FE_FMV2_ADDR ) >> FE_FMV2_ADDR_SHIFT; 634 if ( ioaddr[ n ] != sc->addr ) return 0; | 789 /* Check if our I/O address matches config info. on EEPROM. */ 790 n = ( inb( sc->ioaddr[ FE_FMV2 ] ) & FE_FMV2_IOS ) 791 >> FE_FMV2_IOS_SHIFT; 792 if ( baseaddr[ n ] != sc->iobase ) return 0; |
635 | 793 |
794 /* Find the "hardware revision." */ 795 revision = inb( sc->ioaddr[ FE_FMV1 ] ) & FE_FMV1_REV; 796 |
|
636 /* Determine the card type. */ | 797 /* Determine the card type. */ |
637 switch ( inb( sc->addr + FE_FMV0 ) & FE_FMV0_MODEL ) { 638 case FE_FMV0_MODEL_FMV181: 639 sc->type = FE_TYPE_FMV181; 640 sc->typestr = "FMV-181"; 641 sc->sc_description = "Ethernet adapter: FMV-181"; | 798 sc->typestr = NULL; 799 switch ( inb( sc->ioaddr[ FE_FMV0 ] ) & FE_FMV0_MEDIA ) { 800 case 0: 801 /* No interface? This doesn't seem to be an FMV-180... */ 802 return 0; 803 case FE_FMV0_MEDIUM_T: 804 switch ( revision ) { 805 case 8: 806 sc->typestr = "FMV-183"; 807 sc->sc_description = "Ethernet adapter: FMV-183"; 808 break; 809 } |
642 break; | 810 break; |
643 case FE_FMV0_MODEL_FMV182: 644 sc->type = FE_TYPE_FMV182; 645 sc->typestr = "FMV-182"; 646 sc->sc_description = "Ethernet adapter: FMV-182"; | 811 case FE_FMV0_MEDIUM_T | FE_FMV0_MEDIUM_5: 812 switch ( revision ) { 813 case 0: 814 sc->typestr = "FMV-181"; 815 sc->sc_description = "Ethernet adapter: FMV-181"; 816 break; 817 case 1: 818 sc->typestr = "FMV-181A"; 819 sc->sc_description = "Ethernet adapter: FMV-181A"; 820 break; 821 } |
647 break; | 822 break; |
648 default: 649 /* Unknown card type: maybe a new model, but... */ 650 return 0; | 823 case FE_FMV0_MEDIUM_2: 824 switch ( revision ) { 825 case 8: 826 sc->typestr = "FMV-184 (CSR = 2)"; 827 sc->sc_description = "Ethernet adapter: FMV-184"; 828 break; 829 } 830 break; 831 case FE_FMV0_MEDIUM_5: 832 switch ( revision ) { 833 case 8: 834 sc->typestr = "FMV-184 (CSR = 1)"; 835 sc->sc_description = "Ethernet adapter: FMV-184"; 836 break; 837 } 838 break; 839 case FE_FMV0_MEDIUM_2 | FE_FMV0_MEDIUM_5: 840 switch ( revision ) { 841 case 0: 842 sc->typestr = "FMV-182"; 843 sc->sc_description = "Ethernet adapter: FMV-182"; 844 break; 845 case 1: 846 sc->typestr = "FMV-182A"; 847 sc->sc_description = "Ethernet adapter: FMV-182A"; 848 break; 849 case 8: 850 sc->typestr = "FMV-184 (CSR = 3)"; 851 sc->sc_description = "Ethernet adapter: FMV-184"; 852 break; 853 } 854 break; |
651 } | 855 } |
856 if ( sc->typestr == NULL ) { 857 /* Unknown card type... Hope the driver works. */ 858 sc->typestr = "unknown FMV-180 version"; 859 sc->sc_description 860 = "Ethernet adapter: unknown FMV-180 version"; 861 log( LOG_WARNING, "fe%d: %s: %x-%x-%x-%x\n", 862 sc->sc_unit, sc->typestr, 863 inb( sc->ioaddr[ FE_FMV0 ] ), 864 inb( sc->ioaddr[ FE_FMV1 ] ), 865 inb( sc->ioaddr[ FE_FMV2 ] ), 866 inb( sc->ioaddr[ FE_FMV3 ] ) ); 867 } |
|
652 653 /* | 868 869 /* |
654 * An FMV-180 has successfully been proved. | 870 * An FMV-180 has been proved. |
655 * Determine which IRQ to be used. 656 * | 871 * Determine which IRQ to be used. 872 * |
657 * In this version, we always get an IRQ assignment from the 658 * FMV-180's configuration EEPROM, ignoring that specified in 659 * config file. | 873 * In this version, we give a priority to the kernel config file. 874 * If the EEPROM and config don't match, say it to the user for 875 * an attention. |
660 */ | 876 */ |
661 n = ( inb( sc->addr + FE_FMV2 ) & FE_FMV2_IRQ ) >> FE_FMV2_IRQ_SHIFT; 662 isa_dev->id_irq = irqmap[ n ]; | 877 n = ( inb( sc->ioaddr[ FE_FMV2 ] ) & FE_FMV2_IRS ) 878 >> FE_FMV2_IRS_SHIFT; 879 if ( dev->id_irq == NO_IRQ ) { 880 /* Just use the probed value. */ 881 dev->id_irq = irqmap[ n ]; 882 } else if ( dev->id_irq != irqmap[ n ] ) { 883 /* Don't match. */ 884 log( LOG_WARNING, 885 "fe%d: check IRQ in config; it may be incorrect", 886 sc->sc_unit ); 887 } |
663 664 /* 665 * Initialize constants in the per-line structure. 666 */ 667 668 /* Get our station address from EEPROM. */ | 888 889 /* 890 * Initialize constants in the per-line structure. 891 */ 892 893 /* Get our station address from EEPROM. */ |
669 inblk( sc->addr + FE_FMV4, sc->sc_enaddr, ETHER_ADDR_LEN ); | 894 inblk( sc, FE_FMV4, sc->sc_enaddr, ETHER_ADDR_LEN ); |
670 671 /* Make sure we got a valid station address. */ 672 if ( ( sc->sc_enaddr[ 0 ] & 0x03 ) != 0x00 673 || ( sc->sc_enaddr[ 0 ] == 0x00 674 && sc->sc_enaddr[ 1 ] == 0x00 675 && sc->sc_enaddr[ 2 ] == 0x00 ) ) return 0; 676 | 895 896 /* Make sure we got a valid station address. */ 897 if ( ( sc->sc_enaddr[ 0 ] & 0x03 ) != 0x00 898 || ( sc->sc_enaddr[ 0 ] == 0x00 899 && sc->sc_enaddr[ 1 ] == 0x00 900 && sc->sc_enaddr[ 2 ] == 0x00 ) ) return 0; 901 |
677 /* Register values which depend on board design. */ 678 sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL; 679 sc->proto_dlcr5 = 0; 680 sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_EC; 681 | |
682 /* | 902 /* |
903 * Register values which (may) depend on board design. 904 * |
|
683 * Program the 86960 as follows: 684 * SRAM: 32KB, 100ns, byte-wide access. 685 * Transmission buffer: 4KB x 2. 686 * System bus interface: 16 bits. | 905 * Program the 86960 as follows: 906 * SRAM: 32KB, 100ns, byte-wide access. 907 * Transmission buffer: 4KB x 2. 908 * System bus interface: 16 bits. |
687 * We cannot change these values but TXBSIZE, because they 688 * are hard-wired on the board. Modifying TXBSIZE will affect 689 * the driver performance. | |
690 */ | 909 */ |
910 sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL; 911 sc->proto_dlcr5 = 0; |
|
691 sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x4KB 692 | FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns; | 912 sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x4KB 913 | FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns; |
914 sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_EC; 915 sc->proto_bmpr13 = FE_B13_TPTYPE_UTP | FE_B13_PORT_AUTO; |
|
693 694 /* 695 * Minimum initialization of the hardware. 696 * We write into registers; hope I/O ports have no 697 * overlap with other boards. 698 */ 699 700 /* Initialize ASIC. */ | 916 917 /* 918 * Minimum initialization of the hardware. 919 * We write into registers; hope I/O ports have no 920 * overlap with other boards. 921 */ 922 923 /* Initialize ASIC. */ |
701 outb( sc->addr + FE_FMV3, 0 ); 702 outb( sc->addr + FE_FMV10, 0 ); | 924 outb( sc->ioaddr[ FE_FMV3 ], 0 ); 925 outb( sc->ioaddr[ FE_FMV10 ], 0 ); |
703 | 926 |
704 /* Wait for a while. I'm not sure this is necessary. FIXME. */ 705 DELAY(200); 706 | |
707 /* Initialize 86960. */ | 927 /* Initialize 86960. */ |
708 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); 709 DELAY(200); | 928 DELAY( 200 ); 929 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); 930 DELAY( 200 ); |
710 711 /* Disable all interrupts. */ | 931 932 /* Disable all interrupts. */ |
712 outb( sc->addr + FE_DLCR2, 0 ); 713 outb( sc->addr + FE_DLCR3, 0 ); | 933 outb( sc->ioaddr[ FE_DLCR2 ], 0 ); 934 outb( sc->ioaddr[ FE_DLCR3 ], 0 ); |
714 | 935 |
936 /* "Refresh" hardware configuration. FIXME. */ 937 outb( sc->ioaddr[ FE_FMV2 ], inb( sc->ioaddr[ FE_FMV2 ] ) ); 938 |
|
715 /* Turn the "master interrupt control" flag of ASIC on. */ | 939 /* Turn the "master interrupt control" flag of ASIC on. */ |
716 outb( sc->addr + FE_FMV3, FE_FMV3_ENABLE_FLAG ); | 940 outb( sc->ioaddr[ FE_FMV3 ], FE_FMV3_IRQENB ); |
717 718 /* 719 * That's all. FMV-180 occupies 32 I/O addresses, by the way. 720 */ 721 return 32; 722} 723 724/* 725 * Probe and initialization for Allied-Telesis AT1700/RE2000 series. 726 */ 727static int | 941 942 /* 943 * That's all. FMV-180 occupies 32 I/O addresses, by the way. 944 */ 945 return 32; 946} 947 948/* 949 * Probe and initialization for Allied-Telesis AT1700/RE2000 series. 950 */ 951static int |
728fe_probe_ati ( struct isa_device * isa_dev, struct fe_softc * sc ) | 952fe_probe_ati ( DEVICE * dev, struct fe_softc * sc ) |
729{ 730 int i, n; 731 u_char eeprom [ FE_EEPROM_SIZE ]; | 953{ 954 int i, n; 955 u_char eeprom [ FE_EEPROM_SIZE ]; |
956 u_char save16, save17; |
|
732 | 957 |
733 static u_short const ioaddr [ 8 ] = | 958 static u_short const baseaddr [ 8 ] = |
734 { 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300 }; | 959 { 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300 }; |
735 static u_short const irqmap_lo [ 4 ] = 736 { IRQ3, IRQ4, IRQ5, IRQ9 }; 737 static u_short const irqmap_hi [ 4 ] = 738 { IRQ10, IRQ11, IRQ12, IRQ15 }; | 960 static u_short const irqmaps [ 4 ][ 4 ] = 961 { 962 { IRQ3, IRQ4, IRQ5, IRQ9 }, 963 { IRQ10, IRQ11, IRQ12, IRQ15 }, 964 { IRQ3, IRQ11, IRQ5, IRQ15 }, 965 { IRQ10, IRQ11, IRQ14, IRQ15 }, 966 }; |
739 static struct fe_simple_probe_struct const probe_table [] = { 740 { FE_DLCR2, 0x70, 0x00 }, 741 { FE_DLCR4, 0x08, 0x00 }, 742 { FE_DLCR5, 0x80, 0x00 }, 743#if 0 744 { FE_BMPR16, 0x1B, 0x00 }, 745 { FE_BMPR17, 0x7F, 0x00 }, 746#endif 747 { 0 } 748 }; 749 | 967 static struct fe_simple_probe_struct const probe_table [] = { 968 { FE_DLCR2, 0x70, 0x00 }, 969 { FE_DLCR4, 0x08, 0x00 }, 970 { FE_DLCR5, 0x80, 0x00 }, 971#if 0 972 { FE_BMPR16, 0x1B, 0x00 }, 973 { FE_BMPR17, 0x7F, 0x00 }, 974#endif 975 { 0 } 976 }; 977 |
750#if 0 751 /* 752 * Don't probe at all if the config says we are PCMCIA... 753 */ 754 if ( isa_dev->id_flags & FE_FLAGS_PCMCIA ) return ( 0 ); 755#endif | 978 /* Assume we have 86965 and no need to restore these. */ 979 save16 = 0; 980 save17 = 0; |
756 757#if FE_DEBUG >= 3 | 981 982#if FE_DEBUG >= 3 |
758 log( LOG_INFO, "fe%d: probe (0x%x) for ATI\n", sc->sc_unit, sc->addr ); | 983 log( LOG_INFO, "fe%d: probe (0x%x) for ATI\n", 984 sc->sc_unit, sc->iobase ); |
759 fe_dump( LOG_INFO, sc, NULL ); 760#endif 761 762 /* | 985 fe_dump( LOG_INFO, sc, NULL ); 986#endif 987 988 /* |
763 * See if the sepcified address is possible for MB86965A JLI mode. | 989 * See if the specified address is possible for MB86965A JLI mode. |
764 */ 765 for ( i = 0; i < 8; i++ ) { | 990 */ 991 for ( i = 0; i < 8; i++ ) { |
766 if ( ioaddr[ i ] == sc->addr ) break; | 992 if ( baseaddr[ i ] == sc->iobase ) break; |
767 } | 993 } |
768 if ( i == 8 ) return 0; | 994 if ( i == 8 ) goto NOTFOUND; |
769 | 995 |
996 /* Setup an I/O address mapping table. */ 997 for ( i = 0; i < MAXREGISTERS; i++ ) { 998 sc->ioaddr[ i ] = sc->iobase + i; 999 } 1000 |
|
770 /* 771 * We should test if MB86965A is on the base address now. 772 * Unfortunately, it is very hard to probe it reliably, since 773 * we have no way to reset the chip under software control. 774 * On cold boot, we could check the "signature" bit patterns 775 * described in the Fujitsu document. On warm boot, however, 776 * we can predict almost nothing about register values. 777 */ | 1001 /* 1002 * We should test if MB86965A is on the base address now. 1003 * Unfortunately, it is very hard to probe it reliably, since 1004 * we have no way to reset the chip under software control. 1005 * On cold boot, we could check the "signature" bit patterns 1006 * described in the Fujitsu document. On warm boot, however, 1007 * we can predict almost nothing about register values. 1008 */ |
778 if ( !fe_simple_probe( sc->addr, probe_table ) ) return 0; | 1009 if ( !fe_simple_probe( sc, probe_table ) ) goto NOTFOUND; |
779 780 /* Check if our I/O address matches config info on 86965. */ | 1010 1011 /* Check if our I/O address matches config info on 86965. */ |
781 n = ( inb( sc->addr + FE_BMPR19 ) & FE_B19_ADDR ) >> FE_B19_ADDR_SHIFT; 782 if ( ioaddr[ n ] != sc->addr ) return 0; | 1012 n = ( inb( sc->ioaddr[ FE_BMPR19 ] ) & FE_B19_ADDR ) 1013 >> FE_B19_ADDR_SHIFT; 1014 if ( baseaddr[ n ] != sc->iobase ) goto NOTFOUND; |
783 784 /* 785 * We are now almost sure we have an AT1700 at the given 786 * address. So, read EEPROM through 86965. We have to write 787 * into LSI registers to read from EEPROM. I want to avoid it | 1015 1016 /* 1017 * We are now almost sure we have an AT1700 at the given 1018 * address. So, read EEPROM through 86965. We have to write 1019 * into LSI registers to read from EEPROM. I want to avoid it |
788 * at this stage, but I cannot test the presense of the chip | 1020 * at this stage, but I cannot test the presence of the chip |
789 * any further without reading EEPROM. FIXME. 790 */ | 1021 * any further without reading EEPROM. FIXME. 1022 */ |
1023 save16 = inb( sc->ioaddr[ FE_BMPR16 ] ); 1024 save17 = inb( sc->ioaddr[ FE_BMPR17 ] ); |
|
791 fe_read_eeprom( sc, eeprom ); 792 | 1025 fe_read_eeprom( sc, eeprom ); 1026 |
1027 /* Make sure the EEPROM is turned off. */ 1028 outb( sc->ioaddr[ FE_BMPR16 ], 0 ); 1029 outb( sc->ioaddr[ FE_BMPR17 ], 0 ); 1030 |
|
793 /* Make sure that config info in EEPROM and 86965 agree. */ | 1031 /* Make sure that config info in EEPROM and 86965 agree. */ |
794 if ( eeprom[ FE_EEPROM_CONF ] != inb( sc->addr + FE_BMPR19 ) ) { 795 return 0; | 1032 if ( eeprom[ FE_EEPROM_CONF ] != inb( sc->ioaddr[ FE_BMPR19 ] ) ) { 1033 goto NOTFOUND; |
796 } 797 798 /* | 1034 } 1035 1036 /* |
799 * Determine the card type. 800 * There may be a way to identify various models. FIXME. | 1037 * The following model identification codes are stolen from 1038 * from the NetBSD port of the fe driver. My reviewers 1039 * suggested minor revision. |
801 */ | 1040 */ |
802 sc->type = FE_TYPE_AT1700; 803 sc->typestr = "AT1700/RE2000"; 804 sc->sc_description = "Ethernet adapter: AT1700 or RE2000"; | |
805 | 1041 |
1042 /* Determine the card type. */ 1043 switch (eeprom[FE_ATI_EEP_MODEL]) { 1044 case FE_ATI_MODEL_AT1700T: 1045 sc->typestr = "AT-1700T/RE2001"; 1046 sc->sc_description = "Ethernet adapter: AT1700T or RE2001"; 1047 break; 1048 case FE_ATI_MODEL_AT1700BT: 1049 sc->typestr = "AT-1700BT/RE2003"; 1050 sc->sc_description = "Ethernet adapter: AT1700BT or RE2003"; 1051 break; 1052 case FE_ATI_MODEL_AT1700FT: 1053 sc->typestr = "AT-1700FT/RE2009"; 1054 sc->sc_description = "Ethernet adapter: AT1700FT or RE2009"; 1055 break; 1056 case FE_ATI_MODEL_AT1700AT: 1057 sc->typestr = "AT-1700AT/RE2005"; 1058 sc->sc_description = "Ethernet adapter: AT1700AT or RE2005"; 1059 break; 1060 default: 1061 sc->typestr = "unknown AT-1700/RE2000 ?"; 1062 sc->sc_description = "Ethernet adapter: AT1700 or RE2000 ?"; 1063 break; 1064 } 1065 |
|
806 /* | 1066 /* |
807 * I was told that RE2000 series has two variants on IRQ 808 * selection. They are 3/4/5/9 and 10/11/12/15. I don't know 809 * how we can distinguish which model is which. For now, we 810 * just trust irq setting in config. FIXME. 811 * 812 * I've heard that ATI puts an identification between these 813 * two models in the EEPROM. Sounds reasonable. I've also 814 * heard that Linux driver for AT1700 tests it. O.K. Let's 815 * try using it and see what happens. Anyway, we will use an 816 * IRQ value passed by config (i.e., user), if one is 817 * available. FIXME. | 1067 * Try to determine IRQ settings. 1068 * Different models use different ranges of IRQs. |
818 */ | 1069 */ |
819 n = ( inb( sc->addr + FE_BMPR19 ) & FE_B19_IRQ ) >> FE_B19_IRQ_SHIFT; 820 if ( isa_dev->id_irq == 0 ) { 821 /* Try to determine IRQ settings. */ 822 if ( eeprom[ FE_EEP_ATI_TYPE ] & FE_EEP_ATI_TYPE_HIGHIRQ ) { 823 isa_dev->id_irq = irqmap_hi[ n ]; 824 } else { 825 isa_dev->id_irq = irqmap_lo[ n ]; | 1070 if ( dev->id_irq == NO_IRQ ) { 1071 n = ( inb( sc->ioaddr[ FE_BMPR19 ] ) & FE_B19_IRQ ) 1072 >> FE_B19_IRQ_SHIFT; 1073 switch ( eeprom[ FE_ATI_EEP_REVISION ] & 0xf0 ) { 1074 case 0x30: 1075 dev->id_irq = irqmaps[ 3 ][ n ]; 1076 break; 1077 case 0x10: 1078 case 0x50: 1079 dev->id_irq = irqmaps[ 2 ][ n ]; 1080 break; 1081 case 0x40: 1082 case 0x60: 1083 if ( eeprom[ FE_ATI_EEP_MAGIC ] & 0x04 ) { 1084 dev->id_irq = irqmaps[ 1 ][ n ]; 1085 } else { 1086 dev->id_irq = irqmaps[ 0 ][ n ]; 1087 } 1088 break; 1089 default: 1090 dev->id_irq = irqmaps[ 0 ][ n ]; 1091 break; |
826 } 827 } 828 | 1092 } 1093 } 1094 |
1095 |
|
829 /* 830 * Initialize constants in the per-line structure. 831 */ 832 833 /* Get our station address from EEPROM. */ | 1096 /* 1097 * Initialize constants in the per-line structure. 1098 */ 1099 1100 /* Get our station address from EEPROM. */ |
834 bcopy( eeprom + FE_EEP_ATI_ADDR, sc->sc_enaddr, ETHER_ADDR_LEN ); | 1101 bcopy( eeprom + FE_ATI_EEP_ADDR, sc->sc_enaddr, ETHER_ADDR_LEN ); |
835 836#if 1 837 /* 838 * This test doesn't work well for AT1700 look-alike by 839 * other vendors. 840 */ 841 /* Make sure the vendor part is for Allied-Telesis. */ 842 if ( sc->sc_enaddr[ 0 ] != 0x00 843 || sc->sc_enaddr[ 1 ] != 0x00 844 || sc->sc_enaddr[ 2 ] != 0xF4 ) return 0; 845 846#else 847 /* Make sure we got a valid station address. */ 848 if ( ( sc->sc_enaddr[ 0 ] & 0x03 ) != 0x00 849 || ( sc->sc_enaddr[ 0 ] == 0x00 850 && sc->sc_enaddr[ 1 ] == 0x00 851 && sc->sc_enaddr[ 2 ] == 0x00 ) ) return 0; 852#endif 853 | 1102 1103#if 1 1104 /* 1105 * This test doesn't work well for AT1700 look-alike by 1106 * other vendors. 1107 */ 1108 /* Make sure the vendor part is for Allied-Telesis. */ 1109 if ( sc->sc_enaddr[ 0 ] != 0x00 1110 || sc->sc_enaddr[ 1 ] != 0x00 1111 || sc->sc_enaddr[ 2 ] != 0xF4 ) return 0; 1112 1113#else 1114 /* Make sure we got a valid station address. */ 1115 if ( ( sc->sc_enaddr[ 0 ] & 0x03 ) != 0x00 1116 || ( sc->sc_enaddr[ 0 ] == 0x00 1117 && sc->sc_enaddr[ 1 ] == 0x00 1118 && sc->sc_enaddr[ 2 ] == 0x00 ) ) return 0; 1119#endif 1120 |
854 /* Should find all register prototypes here. FIXME. */ 855 sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL; /* FIXME */ 856 sc->proto_dlcr5 = 0; 857 sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_EC; 858 | |
859 /* 860 * Program the 86960 as follows: 861 * SRAM: 32KB, 100ns, byte-wide access. 862 * Transmission buffer: 4KB x 2. 863 * System bus interface: 16 bits. | 1121 /* 1122 * Program the 86960 as follows: 1123 * SRAM: 32KB, 100ns, byte-wide access. 1124 * Transmission buffer: 4KB x 2. 1125 * System bus interface: 16 bits. |
864 * We cannot change these values but TXBSIZE, because they 865 * are hard-wired on the board. Modifying TXBSIZE will affect 866 * the driver performance. | |
867 */ | 1126 */ |
1127 sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL; /* FIXME */ 1128 sc->proto_dlcr5 = 0; |
|
868 sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x4KB 869 | FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns; | 1129 sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x4KB 1130 | FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns; |
1131 sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_EC; 1132#if 0 /* XXXX Should we use this? FIXME. */ 1133 sc->proto_bmpr13 = eeprom[ FE_ATI_EEP_MEDIA ]; 1134#else 1135 sc->proto_bmpr13 = FE_B13_TPTYPE_UTP | FE_B13_PORT_AUTO; 1136#endif |
|
870 871#if FE_DEBUG >= 3 872 fe_dump( LOG_INFO, sc, "ATI found" ); 873#endif 874 875 /* Initialize 86965. */ | 1137 1138#if FE_DEBUG >= 3 1139 fe_dump( LOG_INFO, sc, "ATI found" ); 1140#endif 1141 1142 /* Initialize 86965. */ |
876 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); 877 DELAY(200); | 1143 DELAY( 200 ); 1144 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); 1145 DELAY( 200 ); |
878 879 /* Disable all interrupts. */ | 1146 1147 /* Disable all interrupts. */ |
880 outb( sc->addr + FE_DLCR2, 0 ); 881 outb( sc->addr + FE_DLCR3, 0 ); | 1148 outb( sc->ioaddr[ FE_DLCR2 ], 0 ); 1149 outb( sc->ioaddr[ FE_DLCR3 ], 0 ); |
882 883#if FE_DEBUG >= 3 884 fe_dump( LOG_INFO, sc, "end of fe_probe_ati()" ); 885#endif 886 887 /* 888 * That's all. AT1700 occupies 32 I/O addresses, by the way. 889 */ 890 return 32; | 1150 1151#if FE_DEBUG >= 3 1152 fe_dump( LOG_INFO, sc, "end of fe_probe_ati()" ); 1153#endif 1154 1155 /* 1156 * That's all. AT1700 occupies 32 I/O addresses, by the way. 1157 */ 1158 return 32; |
1159 1160 NOTFOUND: 1161 /* 1162 * We have no AT1700 at a given address. 1163 * Restore BMPR16 and BMPR17 if we have destroyed them, 1164 * hoping that the hardware on the address didn't get 1165 * bad side effect. 1166 */ 1167 if ( save16 != 0 | save17 != 0 ) { 1168 outb( sc->ioaddr[ FE_BMPR16 ], save16 ); 1169 outb( sc->ioaddr[ FE_BMPR17 ], save17 ); 1170 } 1171 return ( 0 ); |
|
891} 892 893/* 894 * Probe and initialization for Fujitsu MBH10302 PCMCIA Ethernet interface. 895 */ 896static int | 1172} 1173 1174/* 1175 * Probe and initialization for Fujitsu MBH10302 PCMCIA Ethernet interface. 1176 */ 1177static int |
897fe_probe_mbh ( struct isa_device * isa_dev, struct fe_softc * sc ) | 1178fe_probe_mbh ( DEVICE * dev, struct fe_softc * sc ) |
898{ | 1179{ |
1180 int i; 1181 |
|
899 static struct fe_simple_probe_struct probe_table [] = { 900 { FE_DLCR2, 0x70, 0x00 }, 901 { FE_DLCR4, 0x08, 0x00 }, 902 /* { FE_DLCR5, 0x80, 0x00 }, Does not work well. */ 903#if 0 904 /* 905 * Test *vendor* part of the address for Fujitsu. 906 * The test will gain reliability of probe process, but 907 * it rejects clones by other vendors, or OEM product | 1182 static struct fe_simple_probe_struct probe_table [] = { 1183 { FE_DLCR2, 0x70, 0x00 }, 1184 { FE_DLCR4, 0x08, 0x00 }, 1185 /* { FE_DLCR5, 0x80, 0x00 }, Does not work well. */ 1186#if 0 1187 /* 1188 * Test *vendor* part of the address for Fujitsu. 1189 * The test will gain reliability of probe process, but 1190 * it rejects clones by other vendors, or OEM product |
908 * supplied by resalers other than Fujitsu. | 1191 * supplied by retailer other than Fujitsu. |
909 */ 910 { FE_MBH10, 0xFF, 0x00 }, 911 { FE_MBH11, 0xFF, 0x00 }, 912 { FE_MBH12, 0xFF, 0x0E }, 913#else 914 /* | 1192 */ 1193 { FE_MBH10, 0xFF, 0x00 }, 1194 { FE_MBH11, 0xFF, 0x00 }, 1195 { FE_MBH12, 0xFF, 0x0E }, 1196#else 1197 /* |
915 * We can always verify the *first* 2 bits (in Ehternet | 1198 * We can always verify the *first* 2 bits (in Ethernet |
916 * bit order) are "global" and "unicast" even for 917 * unknown vendors. 918 */ 919 { FE_MBH10, 0x03, 0x00 }, 920#endif 921 /* Just a gap? Seems reliable, anyway. */ 922 { 0x12, 0xFF, 0x00 }, 923 { 0x13, 0xFF, 0x00 }, 924 { 0x14, 0xFF, 0x00 }, 925 { 0x15, 0xFF, 0x00 }, 926 { 0x16, 0xFF, 0x00 }, 927 { 0x17, 0xFF, 0x00 }, | 1199 * bit order) are "global" and "unicast" even for 1200 * unknown vendors. 1201 */ 1202 { FE_MBH10, 0x03, 0x00 }, 1203#endif 1204 /* Just a gap? Seems reliable, anyway. */ 1205 { 0x12, 0xFF, 0x00 }, 1206 { 0x13, 0xFF, 0x00 }, 1207 { 0x14, 0xFF, 0x00 }, 1208 { 0x15, 0xFF, 0x00 }, 1209 { 0x16, 0xFF, 0x00 }, 1210 { 0x17, 0xFF, 0x00 }, |
1211#if 0 |
|
928 { 0x18, 0xFF, 0xFF }, 929 { 0x19, 0xFF, 0xFF }, | 1212 { 0x18, 0xFF, 0xFF }, 1213 { 0x19, 0xFF, 0xFF }, |
1214#endif /* 0 */ |
|
930 931 { 0 } 932 }; 933 | 1215 1216 { 0 } 1217 }; 1218 |
934#if 0 | |
935 /* | 1219 /* |
936 * We need a PCMCIA flag. 937 */ 938 if ( ( isa_dev->id_flags & FE_FLAGS_PCMCIA ) == 0 ) return ( 0 ); 939#endif 940 941 /* | |
942 * We need explicit IRQ and supported address. 943 */ | 1220 * We need explicit IRQ and supported address. 1221 */ |
944 if ( isa_dev->id_irq == 0 || ( sc->addr & ~0x3E0 ) != 0 ) return ( 0 ); | 1222 if ( dev->id_irq == NO_IRQ || ( sc->iobase & ~0x3E0 ) != 0 ) { 1223 return ( 0 ); 1224 } |
945 946#if FE_DEBUG >= 3 947 fe_dump( LOG_INFO, sc, "top of probe" ); 948#endif 949 | 1225 1226#if FE_DEBUG >= 3 1227 fe_dump( LOG_INFO, sc, "top of probe" ); 1228#endif 1229 |
1230 /* Setup an I/O address mapping table. */ 1231 for ( i = 0; i < MAXREGISTERS; i++ ) { 1232 sc->ioaddr[ i ] = sc->iobase + i; 1233 } 1234 |
|
950 /* 951 * See if MBH10302 is on its address. 952 * I'm not sure the following probe code works. FIXME. 953 */ | 1235 /* 1236 * See if MBH10302 is on its address. 1237 * I'm not sure the following probe code works. FIXME. 1238 */ |
954 if ( !fe_simple_probe( sc->addr, probe_table ) ) return 0; | 1239 if ( !fe_simple_probe( sc, probe_table ) ) return 0; |
955 956 /* Determine the card type. */ | 1240 1241 /* Determine the card type. */ |
957 sc->type = FE_TYPE_MBH10302; | |
958 sc->typestr = "MBH10302 (PCMCIA)"; 959 sc->sc_description = "Ethernet adapter: MBH10302 (PCMCIA)"; 960 961 /* 962 * Initialize constants in the per-line structure. 963 */ 964 965 /* Get our station address from EEPROM. */ | 1242 sc->typestr = "MBH10302 (PCMCIA)"; 1243 sc->sc_description = "Ethernet adapter: MBH10302 (PCMCIA)"; 1244 1245 /* 1246 * Initialize constants in the per-line structure. 1247 */ 1248 1249 /* Get our station address from EEPROM. */ |
966 inblk( sc->addr + FE_MBH10, sc->sc_enaddr, ETHER_ADDR_LEN ); | 1250 inblk( sc, FE_MBH10, sc->sc_enaddr, ETHER_ADDR_LEN ); |
967 968 /* Make sure we got a valid station address. */ 969 if ( ( sc->sc_enaddr[ 0 ] & 0x03 ) != 0x00 970 || ( sc->sc_enaddr[ 0 ] == 0x00 971 && sc->sc_enaddr[ 1 ] == 0x00 972 && sc->sc_enaddr[ 2 ] == 0x00 ) ) return 0; 973 | 1251 1252 /* Make sure we got a valid station address. */ 1253 if ( ( sc->sc_enaddr[ 0 ] & 0x03 ) != 0x00 1254 || ( sc->sc_enaddr[ 0 ] == 0x00 1255 && sc->sc_enaddr[ 1 ] == 0x00 1256 && sc->sc_enaddr[ 2 ] == 0x00 ) ) return 0; 1257 |
974 /* Should find all register prototypes here. FIXME. */ 975 sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL; 976 sc->proto_dlcr5 = 0; 977 sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_NICE; 978 | |
979 /* 980 * Program the 86960 as follows: 981 * SRAM: 32KB, 100ns, byte-wide access. 982 * Transmission buffer: 4KB x 2. 983 * System bus interface: 16 bits. | 1258 /* 1259 * Program the 86960 as follows: 1260 * SRAM: 32KB, 100ns, byte-wide access. 1261 * Transmission buffer: 4KB x 2. 1262 * System bus interface: 16 bits. |
984 * We cannot change these values but TXBSIZE, because they 985 * are hard-wired on the board. Modifying TXBSIZE will affect 986 * the driver performance. | |
987 */ | 1263 */ |
1264 sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL; 1265 sc->proto_dlcr5 = 0; |
|
988 sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x4KB 989 | FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns; | 1266 sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x4KB 1267 | FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns; |
1268 sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_NICE; 1269 sc->proto_bmpr13 = FE_B13_TPTYPE_UTP | FE_B13_PORT_AUTO; |
|
990 991 /* Setup hooks. We need a special initialization procedure. */ 992 sc->init = fe_init_mbh; 993 994 /* 995 * Minimum initialization. 996 */ 997 | 1270 1271 /* Setup hooks. We need a special initialization procedure. */ 1272 sc->init = fe_init_mbh; 1273 1274 /* 1275 * Minimum initialization. 1276 */ 1277 |
998 /* Wait for a while. I'm not sure this is necessary. FIXME. */ 999 DELAY(200); 1000 1001 /* Minimul initialization of 86960. */ 1002 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); | 1278 /* Minimal initialization of 86960. */ |
1003 DELAY( 200 ); | 1279 DELAY( 200 ); |
1280 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); 1281 DELAY( 200 ); |
|
1004 1005 /* Disable all interrupts. */ | 1282 1283 /* Disable all interrupts. */ |
1006 outb( sc->addr + FE_DLCR2, 0 ); 1007 outb( sc->addr + FE_DLCR3, 0 ); | 1284 outb( sc->ioaddr[ FE_DLCR2 ], 0 ); 1285 outb( sc->ioaddr[ FE_DLCR3 ], 0 ); |
1008 1009#if 1 /* FIXME. */ 1010 /* Initialize system bus interface and encoder/decoder operation. */ | 1286 1287#if 1 /* FIXME. */ 1288 /* Initialize system bus interface and encoder/decoder operation. */ |
1011 outb( sc->addr + FE_MBH0, FE_MBH0_MAGIC | FE_MBH0_INTR_DISABLE ); | 1289 outb( sc->ioaddr[ FE_MBH0 ], FE_MBH0_MAGIC | FE_MBH0_INTR_DISABLE ); |
1012#endif 1013 1014 /* 1015 * That's all. MBH10302 occupies 32 I/O addresses, by the way. 1016 */ 1017 return 32; 1018} 1019 1020/* MBH specific initialization routine. */ 1021static void 1022fe_init_mbh ( struct fe_softc * sc ) 1023{ | 1290#endif 1291 1292 /* 1293 * That's all. MBH10302 occupies 32 I/O addresses, by the way. 1294 */ 1295 return 32; 1296} 1297 1298/* MBH specific initialization routine. */ 1299static void 1300fe_init_mbh ( struct fe_softc * sc ) 1301{ |
1024 /* Probably required after hot-insertion... */ 1025 1026 /* Wait for a while. I'm not sure this is necessary. FIXME. */ 1027 DELAY(200); 1028 1029 /* Minimul initialization of 86960. */ 1030 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); | 1302 /* Minimal initialization of 86960. */ |
1031 DELAY( 200 ); | 1303 DELAY( 200 ); |
1304 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); 1305 DELAY( 200 ); |
|
1032 1033 /* Disable all interrupts. */ | 1306 1307 /* Disable all interrupts. */ |
1034 outb( sc->addr + FE_DLCR2, 0 ); 1035 outb( sc->addr + FE_DLCR3, 0 ); | 1308 outb( sc->ioaddr[ FE_DLCR2 ], 0 ); 1309 outb( sc->ioaddr[ FE_DLCR3 ], 0 ); |
1036 1037 /* Enable master interrupt flag. */ | 1310 1311 /* Enable master interrupt flag. */ |
1038 outb( sc->addr + FE_MBH0, FE_MBH0_MAGIC | FE_MBH0_INTR_ENABLE ); | 1312 outb( sc->ioaddr[ FE_MBH0 ], FE_MBH0_MAGIC | FE_MBH0_INTR_ENABLE ); |
1039} 1040 1041/* 1042 * Install interface into kernel networking data structures 1043 */ 1044static int | 1313} 1314 1315/* 1316 * Install interface into kernel networking data structures 1317 */ 1318static int |
1045fe_attach ( struct isa_device *isa_dev ) | 1319fe_attach ( DEVICE * dev ) |
1046{ | 1320{ |
1047 struct fe_softc *sc = &fe_softc[isa_dev->id_unit]; | 1321#if NCRD > 0 1322static int alredy_ifatch[NFE]; 1323#endif 1324 struct fe_softc *sc = &fe_softc[dev->id_unit]; |
1048 1049 /* 1050 * Initialize ifnet structure 1051 */ | 1325 1326 /* 1327 * Initialize ifnet structure 1328 */ |
1052 sc->sc_if.if_softc = sc; | 1329 sc->sc_if.if_softc = sc; |
1053 sc->sc_if.if_unit = sc->sc_unit; 1054 sc->sc_if.if_name = "fe"; 1055 sc->sc_if.if_output = ether_output; 1056 sc->sc_if.if_start = fe_start; 1057 sc->sc_if.if_ioctl = fe_ioctl; 1058 sc->sc_if.if_watchdog = fe_watchdog; 1059 1060 /* 1061 * Set default interface flags. 1062 */ | 1330 sc->sc_if.if_unit = sc->sc_unit; 1331 sc->sc_if.if_name = "fe"; 1332 sc->sc_if.if_output = ether_output; 1333 sc->sc_if.if_start = fe_start; 1334 sc->sc_if.if_ioctl = fe_ioctl; 1335 sc->sc_if.if_watchdog = fe_watchdog; 1336 1337 /* 1338 * Set default interface flags. 1339 */ |
1063 sc->sc_if.if_flags = IFF_BROADCAST | IFF_MULTICAST; | 1340 sc->sc_if.if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; |
1064 1065 /* 1066 * Set maximum size of output queue, if it has not been set. 1067 * It is done here as this driver may be started after the | 1341 1342 /* 1343 * Set maximum size of output queue, if it has not been set. 1344 * It is done here as this driver may be started after the |
1068 * system intialization (i.e., the interface is PCMCIA.) | 1345 * system initialization (i.e., the interface is PCMCIA.) |
1069 * 1070 * I'm not sure this is really necessary, but, even if it is, 1071 * it should be done somewhere else, e.g., in if_attach(), 1072 * since it must be a common workaround for all network drivers. 1073 * FIXME. 1074 */ 1075 if ( sc->sc_if.if_snd.ifq_maxlen == 0 ) { 1076 sc->sc_if.if_snd.ifq_maxlen = ifqmaxlen; --- 5 unchanged lines hidden (view full) --- 1082 1083#if FE_SINGLE_TRANSMISSION 1084 /* Override txb config to allocate minimum. */ 1085 sc->proto_dlcr6 &= ~FE_D6_TXBSIZ 1086 sc->proto_dlcr6 |= FE_D6_TXBSIZ_2x2KB; 1087#endif 1088 1089 /* Modify hardware config if it is requested. */ | 1346 * 1347 * I'm not sure this is really necessary, but, even if it is, 1348 * it should be done somewhere else, e.g., in if_attach(), 1349 * since it must be a common workaround for all network drivers. 1350 * FIXME. 1351 */ 1352 if ( sc->sc_if.if_snd.ifq_maxlen == 0 ) { 1353 sc->sc_if.if_snd.ifq_maxlen = ifqmaxlen; --- 5 unchanged lines hidden (view full) --- 1359 1360#if FE_SINGLE_TRANSMISSION 1361 /* Override txb config to allocate minimum. */ 1362 sc->proto_dlcr6 &= ~FE_D6_TXBSIZ 1363 sc->proto_dlcr6 |= FE_D6_TXBSIZ_2x2KB; 1364#endif 1365 1366 /* Modify hardware config if it is requested. */ |
1090 if ( isa_dev->id_flags & FE_FLAGS_OVERRIDE_DLCR6 ) { 1091 sc->proto_dlcr6 = isa_dev->id_flags & FE_FLAGS_DLCR6_VALUE; | 1367 if ( dev->id_flags & FE_FLAGS_OVERRIDE_DLCR6 ) { 1368 sc->proto_dlcr6 = dev->id_flags & FE_FLAGS_DLCR6_VALUE; |
1092 } 1093 1094 /* Find TX buffer size, based on the hardware dependent proto. */ 1095 switch ( sc->proto_dlcr6 & FE_D6_TXBSIZ ) { 1096 case FE_D6_TXBSIZ_2x2KB: sc->txb_size = 2048; break; 1097 case FE_D6_TXBSIZ_2x4KB: sc->txb_size = 4096; break; 1098 case FE_D6_TXBSIZ_2x8KB: sc->txb_size = 8192; break; 1099 default: --- 4 unchanged lines hidden (view full) --- 1104#endif 1105 sc->proto_dlcr6 &= ~FE_D6_TXBSIZ; 1106 sc->proto_dlcr6 |= FE_D6_TXBSIZ_2x2KB; 1107 sc->txb_size = 2048; 1108 break; 1109 } 1110 1111 /* Attach and stop the interface. */ | 1369 } 1370 1371 /* Find TX buffer size, based on the hardware dependent proto. */ 1372 switch ( sc->proto_dlcr6 & FE_D6_TXBSIZ ) { 1373 case FE_D6_TXBSIZ_2x2KB: sc->txb_size = 2048; break; 1374 case FE_D6_TXBSIZ_2x4KB: sc->txb_size = 4096; break; 1375 case FE_D6_TXBSIZ_2x8KB: sc->txb_size = 8192; break; 1376 default: --- 4 unchanged lines hidden (view full) --- 1381#endif 1382 sc->proto_dlcr6 &= ~FE_D6_TXBSIZ; 1383 sc->proto_dlcr6 |= FE_D6_TXBSIZ_2x2KB; 1384 sc->txb_size = 2048; 1385 break; 1386 } 1387 1388 /* Attach and stop the interface. */ |
1112 if_attach( &sc->sc_if ); | 1389#if NCRD > 0 1390 if (alredy_ifatch[dev->id_unit] != 1) 1391 { 1392 if_attach( &sc->sc_if ); 1393 alredy_ifatch[dev->id_unit] = 1; 1394 } 1395#else 1396 if_attach( &sc->sc_if ); 1397#endif /* NCRD > 0 */ |
1113 fe_stop( sc->sc_unit ); /* This changes the state to IDLE. */ | 1398 fe_stop( sc->sc_unit ); /* This changes the state to IDLE. */ |
1114 ether_ifattach(&sc->sc_if); 1115 1116 /* Print additional info when attached. */ 1117 printf( "fe%d: address %6D, type %s\n", sc->sc_unit, 1118 sc->sc_enaddr, ":" , sc->typestr ); | 1399 ether_ifattach(&sc->sc_if); 1400 1401 /* Print additional info when attached. */ 1402 printf( "fe%d: address %6D, type %s\n", sc->sc_unit, 1403 sc->sc_enaddr, ":" , sc->typestr ); |
1119#if FE_DEBUG >= 3 1120 { 1121 int buf, txb, bbw, sbw, ram; 1122 1123 buf = txb = bbw = sbw = ram = -1; 1124 switch ( sc->proto_dlcr6 & FE_D6_BUFSIZ ) { 1125 case FE_D6_BUFSIZ_8KB: buf = 8; break; 1126 case FE_D6_BUFSIZ_16KB: buf = 16; break; --- 19 unchanged lines hidden (view full) --- 1146 } 1147 printf( "fe%d: SRAM %dKB %dbit %dns, TXB %dKBx2, %dbit I/O\n", 1148 sc->sc_unit, buf, bbw, ram, txb, sbw ); 1149 } 1150#endif 1151 1152#if NBPFILTER > 0 1153 /* If BPF is in the kernel, call the attach for it. */ | 1404#if FE_DEBUG >= 3 1405 { 1406 int buf, txb, bbw, sbw, ram; 1407 1408 buf = txb = bbw = sbw = ram = -1; 1409 switch ( sc->proto_dlcr6 & FE_D6_BUFSIZ ) { 1410 case FE_D6_BUFSIZ_8KB: buf = 8; break; 1411 case FE_D6_BUFSIZ_16KB: buf = 16; break; --- 19 unchanged lines hidden (view full) --- 1431 } 1432 printf( "fe%d: SRAM %dKB %dbit %dns, TXB %dKBx2, %dbit I/O\n", 1433 sc->sc_unit, buf, bbw, ram, txb, sbw ); 1434 } 1435#endif 1436 1437#if NBPFILTER > 0 1438 /* If BPF is in the kernel, call the attach for it. */ |
1154 bpfattach(&sc->sc_if, DLT_EN10MB, sizeof(struct ether_header)); | 1439 bpfattach( &sc->sc_if, DLT_EN10MB, sizeof(struct ether_header)); |
1155#endif 1156 return 1; 1157} 1158 1159/* 1160 * Reset interface. 1161 */ 1162static void --- 20 unchanged lines hidden (view full) --- 1183 1184 s = splimp(); 1185 1186#if FE_DEBUG >= 3 1187 fe_dump( LOG_INFO, sc, "stop()" ); 1188#endif 1189 1190 /* Disable interrupts. */ | 1440#endif 1441 return 1; 1442} 1443 1444/* 1445 * Reset interface. 1446 */ 1447static void --- 20 unchanged lines hidden (view full) --- 1468 1469 s = splimp(); 1470 1471#if FE_DEBUG >= 3 1472 fe_dump( LOG_INFO, sc, "stop()" ); 1473#endif 1474 1475 /* Disable interrupts. */ |
1191 outb( sc->addr + FE_DLCR2, 0x00 ); 1192 outb( sc->addr + FE_DLCR3, 0x00 ); | 1476 outb( sc->ioaddr[ FE_DLCR2 ], 0x00 ); 1477 outb( sc->ioaddr[ FE_DLCR3 ], 0x00 ); |
1193 1194 /* Stop interface hardware. */ 1195 DELAY( 200 ); | 1478 1479 /* Stop interface hardware. */ 1480 DELAY( 200 ); |
1196 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); | 1481 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); |
1197 DELAY( 200 ); 1198 1199 /* Clear all interrupt status. */ | 1482 DELAY( 200 ); 1483 1484 /* Clear all interrupt status. */ |
1200 outb( sc->addr + FE_DLCR0, 0xFF ); 1201 outb( sc->addr + FE_DLCR1, 0xFF ); | 1485 outb( sc->ioaddr[ FE_DLCR0 ], 0xFF ); 1486 outb( sc->ioaddr[ FE_DLCR1 ], 0xFF ); |
1202 1203 /* Put the chip in stand-by mode. */ 1204 DELAY( 200 ); | 1487 1488 /* Put the chip in stand-by mode. */ 1489 DELAY( 200 ); |
1205 outb( sc->addr + FE_DLCR7, sc->proto_dlcr7 | FE_D7_POWER_DOWN ); | 1490 outb( sc->ioaddr[ FE_DLCR7 ], sc->proto_dlcr7 | FE_D7_POWER_DOWN ); |
1206 DELAY( 200 ); 1207 1208 /* Reset transmitter variables and interface flags. */ 1209 sc->sc_if.if_flags &= ~( IFF_OACTIVE | IFF_RUNNING ); 1210 sc->sc_if.if_timer = 0; 1211 sc->txb_free = sc->txb_size; 1212 sc->txb_count = 0; 1213 sc->txb_sched = 0; --- 19 unchanged lines hidden (view full) --- 1233 * generate an interrupt after a transmit has been started on it. 1234 */ 1235static void 1236fe_watchdog ( struct ifnet *ifp ) 1237{ 1238 struct fe_softc *sc = (struct fe_softc *)ifp; 1239 1240#if FE_DEBUG >= 1 | 1491 DELAY( 200 ); 1492 1493 /* Reset transmitter variables and interface flags. */ 1494 sc->sc_if.if_flags &= ~( IFF_OACTIVE | IFF_RUNNING ); 1495 sc->sc_if.if_timer = 0; 1496 sc->txb_free = sc->txb_size; 1497 sc->txb_count = 0; 1498 sc->txb_sched = 0; --- 19 unchanged lines hidden (view full) --- 1518 * generate an interrupt after a transmit has been started on it. 1519 */ 1520static void 1521fe_watchdog ( struct ifnet *ifp ) 1522{ 1523 struct fe_softc *sc = (struct fe_softc *)ifp; 1524 1525#if FE_DEBUG >= 1 |
1526 /* A "debug" message. */ |
|
1241 log( LOG_ERR, "fe%d: transmission timeout (%d+%d)%s\n", 1242 ifp->if_unit, sc->txb_sched, sc->txb_count, | 1527 log( LOG_ERR, "fe%d: transmission timeout (%d+%d)%s\n", 1528 ifp->if_unit, sc->txb_sched, sc->txb_count, |
1243 ( ifp->if_flags & IFF_UP ) ? "" : " when down" ); | 1529 ( ifp->if_flags & IFF_UP ) ? "" : " when down" ); |
1244#endif | 1530#endif |
1531 1532 /* Suggest users a possible cause. */ 1533 if ( ifp->if_oerrors > 0 ) { 1534 log( LOG_WARNING, "fe%d: wrong IRQ setting in config?", 1535 ifp->if_unit ); 1536 } 1537 |
|
1245#if FE_DEBUG >= 3 1246 fe_dump( LOG_INFO, sc, NULL ); 1247#endif 1248 1249 /* Record how many packets are lost by this accident. */ 1250 ifp->if_oerrors += sc->txb_sched + sc->txb_count; 1251 1252 /* Put the interface into known initial state. */ --- 52 unchanged lines hidden (view full) --- 1305 fe_dump( LOG_INFO, sc, "after init hook" ); 1306#endif 1307 1308 /* 1309 * Make sure to disable the chip, also. 1310 * This may also help re-programming the chip after 1311 * hot insertion of PCMCIAs. 1312 */ | 1538#if FE_DEBUG >= 3 1539 fe_dump( LOG_INFO, sc, NULL ); 1540#endif 1541 1542 /* Record how many packets are lost by this accident. */ 1543 ifp->if_oerrors += sc->txb_sched + sc->txb_count; 1544 1545 /* Put the interface into known initial state. */ --- 52 unchanged lines hidden (view full) --- 1598 fe_dump( LOG_INFO, sc, "after init hook" ); 1599#endif 1600 1601 /* 1602 * Make sure to disable the chip, also. 1603 * This may also help re-programming the chip after 1604 * hot insertion of PCMCIAs. 1605 */ |
1313 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); | 1606 DELAY( 200 ); 1607 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); 1608 DELAY( 200 ); |
1314 1315 /* Power up the chip and select register bank for DLCRs. */ | 1609 1610 /* Power up the chip and select register bank for DLCRs. */ |
1316 DELAY(200); 1317 outb( sc->addr + FE_DLCR7, | 1611 DELAY( 200 ); 1612 outb( sc->ioaddr[ FE_DLCR7 ], |
1318 sc->proto_dlcr7 | FE_D7_RBS_DLCR | FE_D7_POWER_UP ); | 1613 sc->proto_dlcr7 | FE_D7_RBS_DLCR | FE_D7_POWER_UP ); |
1319 DELAY(200); | 1614 DELAY( 200 ); |
1320 1321 /* Feed the station address. */ | 1615 1616 /* Feed the station address. */ |
1322 outblk( sc->addr + FE_DLCR8, sc->sc_enaddr, ETHER_ADDR_LEN ); | 1617 outblk( sc, FE_DLCR8, sc->sc_enaddr, ETHER_ADDR_LEN ); |
1323 1324 /* Clear multicast address filter to receive nothing. */ | 1618 1619 /* Clear multicast address filter to receive nothing. */ |
1325 outb( sc->addr + FE_DLCR7, | 1620 outb( sc->ioaddr[ FE_DLCR7 ], |
1326 sc->proto_dlcr7 | FE_D7_RBS_MAR | FE_D7_POWER_UP ); | 1621 sc->proto_dlcr7 | FE_D7_RBS_MAR | FE_D7_POWER_UP ); |
1327 outblk( sc->addr + FE_MAR8, fe_filter_nothing.data, FE_FILTER_LEN ); | 1622 outblk( sc, FE_MAR8, fe_filter_nothing.data, FE_FILTER_LEN ); |
1328 1329 /* Select the BMPR bank for runtime register access. */ | 1623 1624 /* Select the BMPR bank for runtime register access. */ |
1330 outb( sc->addr + FE_DLCR7, | 1625 outb( sc->ioaddr[ FE_DLCR7 ], |
1331 sc->proto_dlcr7 | FE_D7_RBS_BMPR | FE_D7_POWER_UP ); 1332 1333 /* Initialize registers. */ | 1626 sc->proto_dlcr7 | FE_D7_RBS_BMPR | FE_D7_POWER_UP ); 1627 1628 /* Initialize registers. */ |
1334 outb( sc->addr + FE_DLCR0, 0xFF ); /* Clear all bits. */ 1335 outb( sc->addr + FE_DLCR1, 0xFF ); /* ditto. */ 1336 outb( sc->addr + FE_DLCR2, 0x00 ); 1337 outb( sc->addr + FE_DLCR3, 0x00 ); 1338 outb( sc->addr + FE_DLCR4, sc->proto_dlcr4 ); 1339 outb( sc->addr + FE_DLCR5, sc->proto_dlcr5 ); 1340 outb( sc->addr + FE_BMPR10, 0x00 ); 1341 outb( sc->addr + FE_BMPR11, FE_B11_CTRL_SKIP ); 1342 outb( sc->addr + FE_BMPR12, 0x00 ); 1343 outb( sc->addr + FE_BMPR13, FE_B13_TPTYPE_UTP | FE_B13_PORT_AUTO ); 1344 outb( sc->addr + FE_BMPR14, 0x00 ); 1345 outb( sc->addr + FE_BMPR15, 0x00 ); | 1629 outb( sc->ioaddr[ FE_DLCR0 ], 0xFF ); /* Clear all bits. */ 1630 outb( sc->ioaddr[ FE_DLCR1 ], 0xFF ); /* ditto. */ 1631 outb( sc->ioaddr[ FE_DLCR2 ], 0x00 ); 1632 outb( sc->ioaddr[ FE_DLCR3 ], 0x00 ); 1633 outb( sc->ioaddr[ FE_DLCR4 ], sc->proto_dlcr4 ); 1634 outb( sc->ioaddr[ FE_DLCR5 ], sc->proto_dlcr5 ); 1635 outb( sc->ioaddr[ FE_BMPR10 ], 0x00 ); 1636 outb( sc->ioaddr[ FE_BMPR11 ], FE_B11_CTRL_SKIP | FE_B11_MODE1 ); 1637 outb( sc->ioaddr[ FE_BMPR12 ], 0x00 ); 1638 outb( sc->ioaddr[ FE_BMPR13 ], sc->proto_bmpr13 ); 1639 outb( sc->ioaddr[ FE_BMPR14 ], 0x00 ); 1640 outb( sc->ioaddr[ FE_BMPR15 ], 0x00 ); |
1346 1347#if FE_DEBUG >= 3 1348 fe_dump( LOG_INFO, sc, "just before enabling DLC" ); 1349#endif 1350 1351 /* Enable interrupts. */ | 1641 1642#if FE_DEBUG >= 3 1643 fe_dump( LOG_INFO, sc, "just before enabling DLC" ); 1644#endif 1645 1646 /* Enable interrupts. */ |
1352 outb( sc->addr + FE_DLCR2, FE_TMASK ); 1353 outb( sc->addr + FE_DLCR3, FE_RMASK ); | 1647 outb( sc->ioaddr[ FE_DLCR2 ], FE_TMASK ); 1648 outb( sc->ioaddr[ FE_DLCR3 ], FE_RMASK ); |
1354 1355 /* Enable transmitter and receiver. */ | 1649 1650 /* Enable transmitter and receiver. */ |
1356 DELAY(200); 1357 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_ENABLE ); 1358 DELAY(200); | 1651 DELAY( 200 ); 1652 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_ENABLE ); 1653 DELAY( 200 ); |
1359 1360#if FE_DEBUG >= 3 1361 fe_dump( LOG_INFO, sc, "just after enabling DLC" ); 1362#endif 1363 /* 1364 * Make sure to empty the receive buffer. 1365 * 1366 * This may be redundant, but *if* the receive buffer were full 1367 * at this point, the driver would hang. I have experienced | 1654 1655#if FE_DEBUG >= 3 1656 fe_dump( LOG_INFO, sc, "just after enabling DLC" ); 1657#endif 1658 /* 1659 * Make sure to empty the receive buffer. 1660 * 1661 * This may be redundant, but *if* the receive buffer were full 1662 * at this point, the driver would hang. I have experienced |
1368 * some strange hangups just after UP. I hope the following | 1663 * some strange hang-up just after UP. I hope the following |
1369 * code solve the problem. 1370 * 1371 * I have changed the order of hardware initialization. 1372 * I think the receive buffer cannot have any packets at this 1373 * point in this version. The following code *must* be 1374 * redundant now. FIXME. 1375 */ 1376 for ( i = 0; i < FE_MAX_RECV_COUNT; i++ ) { | 1664 * code solve the problem. 1665 * 1666 * I have changed the order of hardware initialization. 1667 * I think the receive buffer cannot have any packets at this 1668 * point in this version. The following code *must* be 1669 * redundant now. FIXME. 1670 */ 1671 for ( i = 0; i < FE_MAX_RECV_COUNT; i++ ) { |
1377 if ( inb( sc->addr + FE_DLCR5 ) & FE_D5_BUFEMP ) break; 1378 outb( sc->addr + FE_BMPR14, FE_B14_SKIP ); | 1672 if ( inb( sc->ioaddr[ FE_DLCR5 ] ) & FE_D5_BUFEMP ) break; 1673 outb( sc->ioaddr[ FE_BMPR14 ], FE_B14_SKIP ); |
1379 } 1380#if FE_DEBUG >= 1 1381 if ( i >= FE_MAX_RECV_COUNT ) { 1382 log( LOG_ERR, "fe%d: cannot empty receive buffer\n", 1383 sc->sc_unit ); 1384 } 1385#endif 1386#if FE_DEBUG >= 3 1387 if ( i < FE_MAX_RECV_COUNT ) { 1388 log( LOG_INFO, "fe%d: receive buffer emptied (%d)\n", 1389 sc->sc_unit, i ); 1390 } 1391#endif 1392 1393#if FE_DEBUG >= 3 1394 fe_dump( LOG_INFO, sc, "after ERB loop" ); 1395#endif 1396 | 1674 } 1675#if FE_DEBUG >= 1 1676 if ( i >= FE_MAX_RECV_COUNT ) { 1677 log( LOG_ERR, "fe%d: cannot empty receive buffer\n", 1678 sc->sc_unit ); 1679 } 1680#endif 1681#if FE_DEBUG >= 3 1682 if ( i < FE_MAX_RECV_COUNT ) { 1683 log( LOG_INFO, "fe%d: receive buffer emptied (%d)\n", 1684 sc->sc_unit, i ); 1685 } 1686#endif 1687 1688#if FE_DEBUG >= 3 1689 fe_dump( LOG_INFO, sc, "after ERB loop" ); 1690#endif 1691 |
1397 /* Do we need this here? */ 1398 outb( sc->addr + FE_DLCR0, 0xFF ); /* Clear all bits. */ 1399 outb( sc->addr + FE_DLCR1, 0xFF ); /* ditto. */ | 1692 /* Do we need this here? FIXME. */ 1693 outb( sc->ioaddr[ FE_DLCR0 ], 0xFF ); /* Clear all bits. */ 1694 outb( sc->ioaddr[ FE_DLCR1 ], 0xFF ); /* ditto. */ |
1400 1401#if FE_DEBUG >= 3 1402 fe_dump( LOG_INFO, sc, "after FIXME" ); 1403#endif 1404 /* Set 'running' flag, because we are now running. */ 1405 sc->sc_if.if_flags |= IFF_RUNNING; 1406 1407 /* Update device config status. */ 1408 sc->sc_dcstate = DC_BUSY; 1409 1410 /* | 1695 1696#if FE_DEBUG >= 3 1697 fe_dump( LOG_INFO, sc, "after FIXME" ); 1698#endif 1699 /* Set 'running' flag, because we are now running. */ 1700 sc->sc_if.if_flags |= IFF_RUNNING; 1701 1702 /* Update device config status. */ 1703 sc->sc_dcstate = DC_BUSY; 1704 1705 /* |
1411 * At this point, the interface is runnung properly, | 1706 * At this point, the interface is running properly, |
1412 * except that it receives *no* packets. we then call 1413 * fe_setmode() to tell the chip what packets to be 1414 * received, based on the if_flags and multicast group 1415 * list. It completes the initialization process. 1416 */ 1417 fe_setmode( sc ); 1418 1419#if FE_DEBUG >= 3 --- 8 unchanged lines hidden (view full) --- 1428#endif 1429 1430 (void) splx(s); 1431} 1432 1433/* 1434 * This routine actually starts the transmission on the interface 1435 */ | 1707 * except that it receives *no* packets. we then call 1708 * fe_setmode() to tell the chip what packets to be 1709 * received, based on the if_flags and multicast group 1710 * list. It completes the initialization process. 1711 */ 1712 fe_setmode( sc ); 1713 1714#if FE_DEBUG >= 3 --- 8 unchanged lines hidden (view full) --- 1723#endif 1724 1725 (void) splx(s); 1726} 1727 1728/* 1729 * This routine actually starts the transmission on the interface 1730 */ |
1436static INLINE void | 1731static void |
1437fe_xmit ( struct fe_softc * sc ) 1438{ 1439 /* 1440 * Set a timer just in case we never hear from the board again. 1441 * We use longer timeout for multiple packet transmission. 1442 * I'm not sure this timer value is appropriate. FIXME. 1443 */ 1444 sc->sc_if.if_timer = 1 + sc->txb_count; 1445 1446 /* Update txb variables. */ 1447 sc->txb_sched = sc->txb_count; 1448 sc->txb_count = 0; 1449 sc->txb_free = sc->txb_size; 1450 | 1732fe_xmit ( struct fe_softc * sc ) 1733{ 1734 /* 1735 * Set a timer just in case we never hear from the board again. 1736 * We use longer timeout for multiple packet transmission. 1737 * I'm not sure this timer value is appropriate. FIXME. 1738 */ 1739 sc->sc_if.if_timer = 1 + sc->txb_count; 1740 1741 /* Update txb variables. */ 1742 sc->txb_sched = sc->txb_count; 1743 sc->txb_count = 0; 1744 sc->txb_free = sc->txb_size; 1745 |
1451#if FE_DELAYED_PADDING 1452 /* Omit the postponed padding process. */ 1453 sc->txb_padding = 0; 1454#endif 1455 | |
1456 /* Start transmitter, passing packets in TX buffer. */ | 1746 /* Start transmitter, passing packets in TX buffer. */ |
1457 outb( sc->addr + FE_BMPR10, sc->txb_sched | FE_B10_START ); | 1747 outb( sc->ioaddr[ FE_BMPR10 ], sc->txb_sched | FE_B10_START ); |
1458} 1459 1460/* 1461 * Start output on interface. 1462 * We make two assumptions here: 1463 * 1) that the current priority is set to splimp _before_ this code 1464 * is called *and* is returned to the appropriate priority after 1465 * return 1466 * 2) that the IFF_OACTIVE flag is checked before this code is called 1467 * (i.e. that the output part of the interface is idle) 1468 */ 1469void 1470fe_start ( struct ifnet *ifp ) 1471{ | 1748} 1749 1750/* 1751 * Start output on interface. 1752 * We make two assumptions here: 1753 * 1) that the current priority is set to splimp _before_ this code 1754 * is called *and* is returned to the appropriate priority after 1755 * return 1756 * 2) that the IFF_OACTIVE flag is checked before this code is called 1757 * (i.e. that the output part of the interface is idle) 1758 */ 1759void 1760fe_start ( struct ifnet *ifp ) 1761{ |
1472 struct fe_softc *sc = IFNET2SOFTC( ifp ); | 1762 struct fe_softc *sc = ifp->if_softc; |
1473 struct mbuf *m; 1474 1475#if FE_DEBUG >= 1 1476 /* Just a sanity check. */ 1477 if ( ( sc->txb_count == 0 ) != ( sc->txb_free == sc->txb_size ) ) { 1478 /* 1479 * Txb_count and txb_free co-works to manage the 1480 * transmission buffer. Txb_count keeps track of the --- 8 unchanged lines hidden (view full) --- 1489 * So, what should I do, then? 1490 * 1491 * We now know txb_count and txb_free contradicts. We 1492 * cannot, however, tell which is wrong. More 1493 * over, we cannot peek 86960 transmission buffer or 1494 * reset the transmission buffer. (In fact, we can 1495 * reset the entire interface. I don't want to do it.) 1496 * | 1763 struct mbuf *m; 1764 1765#if FE_DEBUG >= 1 1766 /* Just a sanity check. */ 1767 if ( ( sc->txb_count == 0 ) != ( sc->txb_free == sc->txb_size ) ) { 1768 /* 1769 * Txb_count and txb_free co-works to manage the 1770 * transmission buffer. Txb_count keeps track of the --- 8 unchanged lines hidden (view full) --- 1779 * So, what should I do, then? 1780 * 1781 * We now know txb_count and txb_free contradicts. We 1782 * cannot, however, tell which is wrong. More 1783 * over, we cannot peek 86960 transmission buffer or 1784 * reset the transmission buffer. (In fact, we can 1785 * reset the entire interface. I don't want to do it.) 1786 * |
1497 * If txb_count is incorrect, leaving it as is will cause 1498 * sending of gabages after next interrupt. We have to | 1787 * If txb_count is incorrect, leaving it as-is will cause 1788 * sending of garbage after next interrupt. We have to |
1499 * avoid it. Hence, we reset the txb_count here. If 1500 * txb_free was incorrect, resetting txb_count just loose 1501 * some packets. We can live with it. 1502 */ 1503 sc->txb_count = 0; 1504 } 1505#endif 1506 --- 8 unchanged lines hidden (view full) --- 1515 sc->sc_unit, sc->txb_count ); 1516 fe_xmit( sc ); 1517 } 1518#endif 1519 1520 /* 1521 * Stop accepting more transmission packets temporarily, when 1522 * a filter change request is delayed. Updating the MARs on | 1789 * avoid it. Hence, we reset the txb_count here. If 1790 * txb_free was incorrect, resetting txb_count just loose 1791 * some packets. We can live with it. 1792 */ 1793 sc->txb_count = 0; 1794 } 1795#endif 1796 --- 8 unchanged lines hidden (view full) --- 1805 sc->sc_unit, sc->txb_count ); 1806 fe_xmit( sc ); 1807 } 1808#endif 1809 1810 /* 1811 * Stop accepting more transmission packets temporarily, when 1812 * a filter change request is delayed. Updating the MARs on |
1523 * 86960 flushes the transmisstion buffer, so it is delayed | 1813 * 86960 flushes the transmission buffer, so it is delayed |
1524 * until all buffered transmission packets have been sent 1525 * out. 1526 */ 1527 if ( sc->filter_change ) { 1528 /* | 1814 * until all buffered transmission packets have been sent 1815 * out. 1816 */ 1817 if ( sc->filter_change ) { 1818 /* |
1529 * Filter change requst is delayed only when the DLC is | 1819 * Filter change request is delayed only when the DLC is |
1530 * working. DLC soon raise an interrupt after finishing 1531 * the work. 1532 */ 1533 goto indicate_active; 1534 } 1535 1536 for (;;) { 1537 --- 36 unchanged lines hidden (view full) --- 1574 * Copy the mbuf chain into the transmission buffer. 1575 * txb_* variables are updated as necessary. 1576 */ 1577 fe_write_mbufs( sc, m ); 1578 1579 /* Start transmitter if it's idle. */ 1580 if ( sc->txb_sched == 0 ) fe_xmit( sc ); 1581 | 1820 * working. DLC soon raise an interrupt after finishing 1821 * the work. 1822 */ 1823 goto indicate_active; 1824 } 1825 1826 for (;;) { 1827 --- 36 unchanged lines hidden (view full) --- 1864 * Copy the mbuf chain into the transmission buffer. 1865 * txb_* variables are updated as necessary. 1866 */ 1867 fe_write_mbufs( sc, m ); 1868 1869 /* Start transmitter if it's idle. */ 1870 if ( sc->txb_sched == 0 ) fe_xmit( sc ); 1871 |
1582#if 0 /* Turned of, since our interface is now duplex. */ | |
1583 /* | 1872 /* |
1584 * Tap off here if there is a bpf listener. | 1873 * Tap off here if there is a bpf listener, 1874 * and the device is *not* in promiscuous mode. 1875 * (86960 receives self-generated packets if 1876 * and only if it is in "receive everything" 1877 * mode.) |
1585 */ 1586#if NBPFILTER > 0 | 1878 */ 1879#if NBPFILTER > 0 |
1587 if ( sc->bpf ) bpf_mtap( sc->bpf, m ); | 1880 if ( sc->sc_if.if_bpf 1881 && !( sc->sc_if.if_flags & IFF_PROMISC ) ) { 1882 bpf_mtap( &sc->sc_if, m ); 1883 } |
1588#endif | 1884#endif |
1589#endif | |
1590 1591 m_freem( m ); 1592 } 1593 1594 indicate_inactive: 1595 /* 1596 * We are using the !OACTIVE flag to indicate to 1597 * the outside world that we can accept an --- 13 unchanged lines hidden (view full) --- 1611 */ 1612 sc->sc_if.if_flags |= IFF_OACTIVE; 1613 return; 1614} 1615 1616/* 1617 * Drop (skip) a packet from receive buffer in 86960 memory. 1618 */ | 1885 1886 m_freem( m ); 1887 } 1888 1889 indicate_inactive: 1890 /* 1891 * We are using the !OACTIVE flag to indicate to 1892 * the outside world that we can accept an --- 13 unchanged lines hidden (view full) --- 1906 */ 1907 sc->sc_if.if_flags |= IFF_OACTIVE; 1908 return; 1909} 1910 1911/* 1912 * Drop (skip) a packet from receive buffer in 86960 memory. 1913 */ |
1619static INLINE void | 1914static void |
1620fe_droppacket ( struct fe_softc * sc ) 1621{ | 1915fe_droppacket ( struct fe_softc * sc ) 1916{ |
1622 outb( sc->addr + FE_BMPR14, FE_B14_SKIP ); | 1917 outb( sc->ioaddr[ FE_BMPR14 ], FE_B14_SKIP ); |
1623} 1624 1625/* 1626 * Transmission interrupt handler 1627 * The control flow of this function looks silly. FIXME. 1628 */ 1629static void 1630fe_tint ( struct fe_softc * sc, u_char tstat ) --- 5 unchanged lines hidden (view full) --- 1636 * Handle "excessive collision" interrupt. 1637 */ 1638 if ( tstat & FE_D0_COLL16 ) { 1639 1640 /* 1641 * Find how many packets (including this collided one) 1642 * are left unsent in transmission buffer. 1643 */ | 1918} 1919 1920/* 1921 * Transmission interrupt handler 1922 * The control flow of this function looks silly. FIXME. 1923 */ 1924static void 1925fe_tint ( struct fe_softc * sc, u_char tstat ) --- 5 unchanged lines hidden (view full) --- 1931 * Handle "excessive collision" interrupt. 1932 */ 1933 if ( tstat & FE_D0_COLL16 ) { 1934 1935 /* 1936 * Find how many packets (including this collided one) 1937 * are left unsent in transmission buffer. 1938 */ |
1644 left = inb( sc->addr + FE_BMPR10 ); | 1939 left = inb( sc->ioaddr[ FE_BMPR10 ] ); |
1645 1646#if FE_DEBUG >= 2 1647 log( LOG_WARNING, "fe%d: excessive collision (%d/%d)\n", 1648 sc->sc_unit, left, sc->txb_sched ); 1649#endif 1650#if FE_DEBUG >= 3 1651 fe_dump( LOG_INFO, sc, NULL ); 1652#endif --- 4 unchanged lines hidden (view full) --- 1657 sc->sc_if.if_collisions += 16; 1658 sc->sc_if.if_oerrors++; 1659 sc->sc_if.if_opackets += sc->txb_sched - left; 1660 1661 /* 1662 * Collision statistics has been updated. 1663 * Clear the collision flag on 86960 now to avoid confusion. 1664 */ | 1940 1941#if FE_DEBUG >= 2 1942 log( LOG_WARNING, "fe%d: excessive collision (%d/%d)\n", 1943 sc->sc_unit, left, sc->txb_sched ); 1944#endif 1945#if FE_DEBUG >= 3 1946 fe_dump( LOG_INFO, sc, NULL ); 1947#endif --- 4 unchanged lines hidden (view full) --- 1952 sc->sc_if.if_collisions += 16; 1953 sc->sc_if.if_oerrors++; 1954 sc->sc_if.if_opackets += sc->txb_sched - left; 1955 1956 /* 1957 * Collision statistics has been updated. 1958 * Clear the collision flag on 86960 now to avoid confusion. 1959 */ |
1665 outb( sc->addr + FE_DLCR0, FE_D0_COLLID ); | 1960 outb( sc->ioaddr[ FE_DLCR0 ], FE_D0_COLLID ); |
1666 1667 /* 1668 * Restart transmitter, skipping the 1669 * collided packet. 1670 * 1671 * We *must* skip the packet to keep network running 1672 * properly. Excessive collision error is an 1673 * indication of the network overload. If we 1674 * tried sending the same packet after excessive 1675 * collision, the network would be filled with 1676 * out-of-time packets. Packets belonging 1677 * to reliable transport (such as TCP) are resent 1678 * by some upper layer. 1679 */ | 1961 1962 /* 1963 * Restart transmitter, skipping the 1964 * collided packet. 1965 * 1966 * We *must* skip the packet to keep network running 1967 * properly. Excessive collision error is an 1968 * indication of the network overload. If we 1969 * tried sending the same packet after excessive 1970 * collision, the network would be filled with 1971 * out-of-time packets. Packets belonging 1972 * to reliable transport (such as TCP) are resent 1973 * by some upper layer. 1974 */ |
1680 outb( sc->addr + FE_BMPR11, | 1975 outb( sc->ioaddr[ FE_BMPR11 ], |
1681 FE_B11_CTRL_SKIP | FE_B11_MODE1 ); 1682 sc->txb_sched = left - 1; 1683 } 1684 1685 /* 1686 * Handle "transmission complete" interrupt. 1687 */ 1688 if ( tstat & FE_D0_TXDONE ) { 1689 1690 /* 1691 * Add in total number of collisions on last 1692 * transmission. We also clear "collision occurred" flag 1693 * here. 1694 * 1695 * 86960 has a design flaw on collision count on multiple 1696 * packet transmission. When we send two or more packets 1697 * with one start command (that's what we do when the | 1976 FE_B11_CTRL_SKIP | FE_B11_MODE1 ); 1977 sc->txb_sched = left - 1; 1978 } 1979 1980 /* 1981 * Handle "transmission complete" interrupt. 1982 */ 1983 if ( tstat & FE_D0_TXDONE ) { 1984 1985 /* 1986 * Add in total number of collisions on last 1987 * transmission. We also clear "collision occurred" flag 1988 * here. 1989 * 1990 * 86960 has a design flaw on collision count on multiple 1991 * packet transmission. When we send two or more packets 1992 * with one start command (that's what we do when the |
1698 * transmission queue is clauded), 86960 informs us number 1699 * of collisions occured on the last packet on the | 1993 * transmission queue is crowded), 86960 informs us number 1994 * of collisions occurred on the last packet on the |
1700 * transmission only. Number of collisions on previous 1701 * packets are lost. I have told that the fact is clearly 1702 * stated in the Fujitsu document. 1703 * 1704 * I considered not to mind it seriously. Collision 1705 * count is not so important, anyway. Any comments? FIXME. 1706 */ 1707 | 1995 * transmission only. Number of collisions on previous 1996 * packets are lost. I have told that the fact is clearly 1997 * stated in the Fujitsu document. 1998 * 1999 * I considered not to mind it seriously. Collision 2000 * count is not so important, anyway. Any comments? FIXME. 2001 */ 2002 |
1708 if ( inb( sc->addr + FE_DLCR0 ) & FE_D0_COLLID ) { | 2003 if ( inb( sc->ioaddr[ FE_DLCR0 ] ) & FE_D0_COLLID ) { |
1709 1710 /* Clear collision flag. */ | 2004 2005 /* Clear collision flag. */ |
1711 outb( sc->addr + FE_DLCR0, FE_D0_COLLID ); | 2006 outb( sc->ioaddr[ FE_DLCR0 ], FE_D0_COLLID ); |
1712 1713 /* Extract collision count from 86960. */ | 2007 2008 /* Extract collision count from 86960. */ |
1714 col = inb( sc->addr + FE_DLCR4 ); | 2009 col = inb( sc->ioaddr[ FE_DLCR4 ] ); |
1715 col = ( col & FE_D4_COL ) >> FE_D4_COL_SHIFT; 1716 if ( col == 0 ) { 1717 /* 1718 * Status register indicates collisions, 1719 * while the collision count is zero. 1720 * This can happen after multiple packet 1721 * transmission, indicating that one or more 1722 * previous packet(s) had been collided. --- 60 unchanged lines hidden (view full) --- 1783 rstat & FE_D1_SRTPKT ? "LEN " : "", 1784 rstat ); 1785#endif 1786 sc->sc_if.if_ierrors++; 1787 } 1788 1789 /* 1790 * MB86960 has a flag indicating "receive queue empty." | 2010 col = ( col & FE_D4_COL ) >> FE_D4_COL_SHIFT; 2011 if ( col == 0 ) { 2012 /* 2013 * Status register indicates collisions, 2014 * while the collision count is zero. 2015 * This can happen after multiple packet 2016 * transmission, indicating that one or more 2017 * previous packet(s) had been collided. --- 60 unchanged lines hidden (view full) --- 2078 rstat & FE_D1_SRTPKT ? "LEN " : "", 2079 rstat ); 2080#endif 2081 sc->sc_if.if_ierrors++; 2082 } 2083 2084 /* 2085 * MB86960 has a flag indicating "receive queue empty." |
1791 * We just loop cheking the flag to pull out all received | 2086 * We just loop, checking the flag, to pull out all received |
1792 * packets. 1793 * | 2087 * packets. 2088 * |
1794 * We limit the number of iterrations to avoid inifnit-loop. | 2089 * We limit the number of iterations to avoid infinite-loop. |
1795 * It can be caused by a very slow CPU (some broken 1796 * peripheral may insert incredible number of wait cycles) 1797 * or, worse, by a broken MB86960 chip. 1798 */ 1799 for ( i = 0; i < FE_MAX_RECV_COUNT; i++ ) { 1800 | 2090 * It can be caused by a very slow CPU (some broken 2091 * peripheral may insert incredible number of wait cycles) 2092 * or, worse, by a broken MB86960 chip. 2093 */ 2094 for ( i = 0; i < FE_MAX_RECV_COUNT; i++ ) { 2095 |
1801 /* Stop the iterration if 86960 indicates no packets. */ 1802 if ( inb( sc->addr + FE_DLCR5 ) & FE_D5_BUFEMP ) break; | 2096 /* Stop the iteration if 86960 indicates no packets. */ 2097 if ( inb( sc->ioaddr[ FE_DLCR5 ] ) & FE_D5_BUFEMP ) break; |
1803 1804 /* 1805 * Extract A receive status byte. 1806 * As our 86960 is in 16 bit bus access mode, we have to 1807 * use inw() to get the status byte. The significant 1808 * value is returned in lower 8 bits. 1809 */ | 2098 2099 /* 2100 * Extract A receive status byte. 2101 * As our 86960 is in 16 bit bus access mode, we have to 2102 * use inw() to get the status byte. The significant 2103 * value is returned in lower 8 bits. 2104 */ |
1810 status = ( u_char )inw( sc->addr + FE_BMPR8 ); | 2105 status = ( u_char )inw( sc->ioaddr[ FE_BMPR8 ] ); |
1811#if FE_DEBUG >= 4 1812 log( LOG_INFO, "fe%d: receive status = %04x\n", 1813 sc->sc_unit, status ); 1814#endif 1815 1816 /* 1817 * If there was an error, update statistics and drop 1818 * the packet, unless the interface is in promiscuous --- 7 unchanged lines hidden (view full) --- 1826 } 1827 } 1828 1829 /* 1830 * Extract the packet length. 1831 * It is a sum of a header (14 bytes) and a payload. 1832 * CRC has been stripped off by the 86960. 1833 */ | 2106#if FE_DEBUG >= 4 2107 log( LOG_INFO, "fe%d: receive status = %04x\n", 2108 sc->sc_unit, status ); 2109#endif 2110 2111 /* 2112 * If there was an error, update statistics and drop 2113 * the packet, unless the interface is in promiscuous --- 7 unchanged lines hidden (view full) --- 2121 } 2122 } 2123 2124 /* 2125 * Extract the packet length. 2126 * It is a sum of a header (14 bytes) and a payload. 2127 * CRC has been stripped off by the 86960. 2128 */ |
1834 len = inw( sc->addr + FE_BMPR8 ); | 2129 len = inw( sc->ioaddr[ FE_BMPR8 ] ); |
1835 1836 /* 1837 * MB86965 checks the packet length and drop big packet 1838 * before passing it to us. There are no chance we can | 2130 2131 /* 2132 * MB86965 checks the packet length and drop big packet 2133 * before passing it to us. There are no chance we can |
1839 * get [crufty] packets. Hence, if the length exceeds | 2134 * get big packets through it, even if they are actually 2135 * sent over a line. Hence, if the length exceeds |
1840 * the specified limit, it means some serious failure, 1841 * such as out-of-sync on receive buffer management. 1842 * 1843 * Is this statement true? FIXME. 1844 */ 1845 if ( len > ETHER_MAX_LEN || len < ETHER_HDR_SIZE ) { 1846#if FE_DEBUG >= 2 1847 log( LOG_WARNING, --- 22 unchanged lines hidden (view full) --- 1870#endif 1871 1872 /* 1873 * Go get a packet. 1874 */ 1875 if ( fe_get_packet( sc, len ) < 0 ) { 1876 /* Skip a packet, updating statistics. */ 1877#if FE_DEBUG >= 2 | 2136 * the specified limit, it means some serious failure, 2137 * such as out-of-sync on receive buffer management. 2138 * 2139 * Is this statement true? FIXME. 2140 */ 2141 if ( len > ETHER_MAX_LEN || len < ETHER_HDR_SIZE ) { 2142#if FE_DEBUG >= 2 2143 log( LOG_WARNING, --- 22 unchanged lines hidden (view full) --- 2166#endif 2167 2168 /* 2169 * Go get a packet. 2170 */ 2171 if ( fe_get_packet( sc, len ) < 0 ) { 2172 /* Skip a packet, updating statistics. */ 2173#if FE_DEBUG >= 2 |
1878 log( LOG_WARNING, "%s%d: no enough mbuf;" 1879 " a packet (%u bytes) dropped\n", | 2174 log( LOG_WARNING, "%s%d: out of mbuf;" 2175 " dropping a packet (%u bytes)\n", |
1880 sc->sc_unit, len ); 1881#endif 1882 sc->sc_if.if_ierrors++; 1883 fe_droppacket( sc ); 1884 1885 /* 1886 * We stop receiving packets, even if there are 1887 * more in the buffer. We hope we can get more --- 23 unchanged lines hidden (view full) --- 1911 1912#if FE_DEBUG >= 4 1913 fe_dump( LOG_INFO, sc, "intr()" ); 1914#endif 1915 1916 /* 1917 * Get interrupt conditions, masking unneeded flags. 1918 */ | 2176 sc->sc_unit, len ); 2177#endif 2178 sc->sc_if.if_ierrors++; 2179 fe_droppacket( sc ); 2180 2181 /* 2182 * We stop receiving packets, even if there are 2183 * more in the buffer. We hope we can get more --- 23 unchanged lines hidden (view full) --- 2207 2208#if FE_DEBUG >= 4 2209 fe_dump( LOG_INFO, sc, "intr()" ); 2210#endif 2211 2212 /* 2213 * Get interrupt conditions, masking unneeded flags. 2214 */ |
1919 tstat = inb( sc->addr + FE_DLCR0 ) & FE_TMASK; 1920 rstat = inb( sc->addr + FE_DLCR1 ) & FE_RMASK; | 2215 tstat = inb( sc->ioaddr[ FE_DLCR0 ] ) & FE_TMASK; 2216 rstat = inb( sc->ioaddr[ FE_DLCR1 ] ) & FE_RMASK; |
1921 if ( tstat == 0 && rstat == 0 ) break; 1922 1923 /* 1924 * Reset the conditions we are acknowledging. 1925 */ | 2217 if ( tstat == 0 && rstat == 0 ) break; 2218 2219 /* 2220 * Reset the conditions we are acknowledging. 2221 */ |
1926 outb( sc->addr + FE_DLCR0, tstat ); 1927 outb( sc->addr + FE_DLCR1, rstat ); | 2222 outb( sc->ioaddr[ FE_DLCR0 ], tstat ); 2223 outb( sc->ioaddr[ FE_DLCR1 ], rstat ); |
1928 1929 /* 1930 * Handle transmitter interrupts. Handle these first because 1931 * the receiver will reset the board under some conditions. 1932 */ 1933 if ( tstat ) { 1934 fe_tint( sc, tstat ); 1935 } --- 6 unchanged lines hidden (view full) --- 1942 } 1943 1944 /* 1945 * Update the multicast address filter if it is 1946 * needed and possible. We do it now, because 1947 * we can make sure the transmission buffer is empty, 1948 * and there is a good chance that the receive queue 1949 * is empty. It will minimize the possibility of | 2224 2225 /* 2226 * Handle transmitter interrupts. Handle these first because 2227 * the receiver will reset the board under some conditions. 2228 */ 2229 if ( tstat ) { 2230 fe_tint( sc, tstat ); 2231 } --- 6 unchanged lines hidden (view full) --- 2238 } 2239 2240 /* 2241 * Update the multicast address filter if it is 2242 * needed and possible. We do it now, because 2243 * we can make sure the transmission buffer is empty, 2244 * and there is a good chance that the receive queue 2245 * is empty. It will minimize the possibility of |
1950 * packet lossage. | 2246 * packet loss. |
1951 */ 1952 if ( sc->filter_change 1953 && sc->txb_count == 0 && sc->txb_sched == 0 ) { 1954 fe_loadmar(sc); 1955 sc->sc_if.if_flags &= ~IFF_OACTIVE; 1956 } 1957 1958 /* --- 15 unchanged lines hidden (view full) --- 1974 1975 } 1976} 1977 1978/* 1979 * Process an ioctl request. This code needs some work - it looks 1980 * pretty ugly. 1981 */ | 2247 */ 2248 if ( sc->filter_change 2249 && sc->txb_count == 0 && sc->txb_sched == 0 ) { 2250 fe_loadmar(sc); 2251 sc->sc_if.if_flags &= ~IFF_OACTIVE; 2252 } 2253 2254 /* --- 15 unchanged lines hidden (view full) --- 2270 2271 } 2272} 2273 2274/* 2275 * Process an ioctl request. This code needs some work - it looks 2276 * pretty ugly. 2277 */ |
1982int 1983fe_ioctl ( struct ifnet *ifp, int command, caddr_t data ) | 2278static int 2279fe_ioctl ( struct ifnet * ifp, int command, caddr_t data ) |
1984{ | 2280{ |
1985 struct fe_softc *sc = IFNET2SOFTC( ifp ); | 2281 struct fe_softc *sc = ifp->if_softc; |
1986 int s, error = 0; 1987 1988#if FE_DEBUG >= 3 1989 log( LOG_INFO, "fe%d: ioctl(%x)\n", sc->sc_unit, command ); 1990#endif 1991 1992 s = splimp(); 1993 1994 switch (command) { 1995 1996 case SIOCSIFADDR: 1997 { 1998 struct ifaddr * ifa = ( struct ifaddr * )data; 1999 2000 sc->sc_if.if_flags |= IFF_UP; 2001 2002 switch (ifa->ifa_addr->sa_family) { 2003#ifdef INET 2004 case AF_INET: | 2282 int s, error = 0; 2283 2284#if FE_DEBUG >= 3 2285 log( LOG_INFO, "fe%d: ioctl(%x)\n", sc->sc_unit, command ); 2286#endif 2287 2288 s = splimp(); 2289 2290 switch (command) { 2291 2292 case SIOCSIFADDR: 2293 { 2294 struct ifaddr * ifa = ( struct ifaddr * )data; 2295 2296 sc->sc_if.if_flags |= IFF_UP; 2297 2298 switch (ifa->ifa_addr->sa_family) { 2299#ifdef INET 2300 case AF_INET: |
2005 fe_init( sc->sc_unit ); /* before arpwhohas */ | 2301 fe_init( sc->sc_unit ); /* before arp_ifinit */ |
2006 arp_ifinit( &sc->arpcom, ifa ); 2007 break; 2008#endif 2009#ifdef IPX | 2302 arp_ifinit( &sc->arpcom, ifa ); 2303 break; 2304#endif 2305#ifdef IPX |
2010 | |
2011 /* 2012 * XXX - This code is probably wrong 2013 */ 2014 case AF_IPX: 2015 { 2016 register struct ipx_addr *ina 2017 = &(IA_SIPX(ifa)->sipx_addr); 2018 2019 if (ipx_nullhost(*ina)) 2020 ina->x_host = | 2306 /* 2307 * XXX - This code is probably wrong 2308 */ 2309 case AF_IPX: 2310 { 2311 register struct ipx_addr *ina 2312 = &(IA_SIPX(ifa)->sipx_addr); 2313 2314 if (ipx_nullhost(*ina)) 2315 ina->x_host = |
2021 *(union ipx_host *) (sc->sc_enaddr); 2022 else { | 2316 *(union ipx_host *) (sc->sc_enaddr); else { |
2023 bcopy((caddr_t) ina->x_host.c_host, 2024 (caddr_t) sc->sc_enaddr, 2025 sizeof(sc->sc_enaddr)); 2026 } 2027 2028 /* 2029 * Set new address 2030 */ 2031 fe_init(sc->sc_unit); 2032 break; 2033 } 2034#endif | 2317 bcopy((caddr_t) ina->x_host.c_host, 2318 (caddr_t) sc->sc_enaddr, 2319 sizeof(sc->sc_enaddr)); 2320 } 2321 2322 /* 2323 * Set new address 2324 */ 2325 fe_init(sc->sc_unit); 2326 break; 2327 } 2328#endif |
2329#ifdef INET6 2330 case AF_INET6: 2331 /* IPV6 added by shin 96.2.6 */ 2332 fe_init(sc->sc_unit); 2333 ndp6_ifinit(&sc->arpcom, ifa); 2334 break; 2335#endif |
|
2035#ifdef NS 2036 2037 /* 2038 * XXX - This code is probably wrong 2039 */ 2040 case AF_NS: 2041 { 2042 register struct ns_addr *ina --- 45 unchanged lines hidden (view full) --- 2088 } 2089#endif 2090 2091#ifdef notdef 2092#ifdef SIOCSIFPHYSADDR 2093 case SIOCSIFPHYSADDR: 2094 { 2095 /* | 2336#ifdef NS 2337 2338 /* 2339 * XXX - This code is probably wrong 2340 */ 2341 case AF_NS: 2342 { 2343 register struct ns_addr *ina --- 45 unchanged lines hidden (view full) --- 2389 } 2390#endif 2391 2392#ifdef notdef 2393#ifdef SIOCSIFPHYSADDR 2394 case SIOCSIFPHYSADDR: 2395 { 2396 /* |
2096 * Set the physical (Ehternet) address of the interface. | 2397 * Set the physical (Ethernet) address of the interface. |
2097 * When and by whom is this command used? FIXME. 2098 */ 2099 struct ifreq * ifr = ( struct ifreq * )data; 2100 2101 bcopy((caddr_t)&ifr->ifr_data, 2102 (caddr_t)sc->sc_enaddr, ETHER_ADDR_LEN); 2103 fe_setlinkaddr( sc ); 2104 break; --- 81 unchanged lines hidden (view full) --- 2186 error = EINVAL; 2187 } 2188 2189 (void) splx(s); 2190 return (error); 2191} 2192 2193/* | 2398 * When and by whom is this command used? FIXME. 2399 */ 2400 struct ifreq * ifr = ( struct ifreq * )data; 2401 2402 bcopy((caddr_t)&ifr->ifr_data, 2403 (caddr_t)sc->sc_enaddr, ETHER_ADDR_LEN); 2404 fe_setlinkaddr( sc ); 2405 break; --- 81 unchanged lines hidden (view full) --- 2487 error = EINVAL; 2488 } 2489 2490 (void) splx(s); 2491 return (error); 2492} 2493 2494/* |
2194 * Retreive packet from receive buffer and send to the next level up via | 2495 * Retrieve packet from receive buffer and send to the next level up via |
2195 * ether_input(). If there is a BPF listener, give a copy to BPF, too. 2196 * Returns 0 if success, -1 if error (i.e., mbuf allocation failure). 2197 */ 2198static int 2199fe_get_packet ( struct fe_softc * sc, u_short len ) 2200{ 2201 struct ether_header *eh; 2202 struct mbuf *m; --- 19 unchanged lines hidden (view full) --- 2222#endif 2223 2224 /* 2225 * Our strategy has one more problem. There is a policy on 2226 * mbuf cluster allocation. It says that we must have at 2227 * least MINCLSIZE (208 bytes on FreeBSD 2.0 for x86) to 2228 * allocate a cluster. For a packet of a size between 2229 * (MHLEN - 2) to (MINCLSIZE - 2), our code violates the rule... | 2496 * ether_input(). If there is a BPF listener, give a copy to BPF, too. 2497 * Returns 0 if success, -1 if error (i.e., mbuf allocation failure). 2498 */ 2499static int 2500fe_get_packet ( struct fe_softc * sc, u_short len ) 2501{ 2502 struct ether_header *eh; 2503 struct mbuf *m; --- 19 unchanged lines hidden (view full) --- 2523#endif 2524 2525 /* 2526 * Our strategy has one more problem. There is a policy on 2527 * mbuf cluster allocation. It says that we must have at 2528 * least MINCLSIZE (208 bytes on FreeBSD 2.0 for x86) to 2529 * allocate a cluster. For a packet of a size between 2530 * (MHLEN - 2) to (MINCLSIZE - 2), our code violates the rule... |
2230 * On the other hand, the current code is short, simle, | 2531 * On the other hand, the current code is short, simple, |
2231 * and fast, however. It does no harmful thing, just waists 2232 * some memory. Any comments? FIXME. 2233 */ 2234 2235 /* Allocate an mbuf with packet header info. */ 2236 MGETHDR(m, M_DONTWAIT, MT_DATA); 2237 if ( m == NULL ) return -1; 2238 --- 8 unchanged lines hidden (view full) --- 2247 2248 /* Initialize packet header info. */ 2249 m->m_pkthdr.rcvif = &sc->sc_if; 2250 m->m_pkthdr.len = len; 2251 2252 /* Set the length of this packet. */ 2253 m->m_len = len; 2254 | 2532 * and fast, however. It does no harmful thing, just waists 2533 * some memory. Any comments? FIXME. 2534 */ 2535 2536 /* Allocate an mbuf with packet header info. */ 2537 MGETHDR(m, M_DONTWAIT, MT_DATA); 2538 if ( m == NULL ) return -1; 2539 --- 8 unchanged lines hidden (view full) --- 2548 2549 /* Initialize packet header info. */ 2550 m->m_pkthdr.rcvif = &sc->sc_if; 2551 m->m_pkthdr.len = len; 2552 2553 /* Set the length of this packet. */ 2554 m->m_len = len; 2555 |
2255 /* The following sillines is to make NFS happy */ | 2556 /* The following silliness is to make NFS happy */ |
2256 m->m_data += NFS_MAGIC_OFFSET; 2257 2258 /* Get a packet. */ | 2557 m->m_data += NFS_MAGIC_OFFSET; 2558 2559 /* Get a packet. */ |
2259 insw( sc->addr + FE_BMPR8, m->m_data, ( len + 1 ) >> 1 ); | 2560 insw( sc->ioaddr[ FE_BMPR8 ], m->m_data, ( len + 1 ) >> 1 ); |
2260 2261 /* Get (actually just point to) the header part. */ 2262 eh = mtod( m, struct ether_header *); 2263 2264#define ETHER_ADDR_IS_MULTICAST(A) (*(char *)(A) & 1) 2265 2266#if NBPFILTER > 0 2267 /* --- 32 unchanged lines hidden (view full) --- 2300 && bcmp( eh->ether_dhost, sc->sc_enaddr, ETHER_ADDR_LEN ) != 0 ) { 2301 /* 2302 * This packet was not for us. We can't be in promiscuous 2303 * mode since the case was handled by above test. 2304 * We found an error (of this driver.) 2305 */ 2306 log( LOG_WARNING, 2307 "fe%d: got an unwanted packet, dst = %6D\n", | 2561 2562 /* Get (actually just point to) the header part. */ 2563 eh = mtod( m, struct ether_header *); 2564 2565#define ETHER_ADDR_IS_MULTICAST(A) (*(char *)(A) & 1) 2566 2567#if NBPFILTER > 0 2568 /* --- 32 unchanged lines hidden (view full) --- 2601 && bcmp( eh->ether_dhost, sc->sc_enaddr, ETHER_ADDR_LEN ) != 0 ) { 2602 /* 2603 * This packet was not for us. We can't be in promiscuous 2604 * mode since the case was handled by above test. 2605 * We found an error (of this driver.) 2606 */ 2607 log( LOG_WARNING, 2608 "fe%d: got an unwanted packet, dst = %6D\n", |
2308 sc->sc_unit, 2309 eh->ether_dhost , ":" ); | 2609 sc->sc_unit, eh->ether_dhost , ":" ); |
2310 m_freem( m ); 2311 return 0; 2312 } 2313#endif 2314 2315 /* Strip off the Ethernet header. */ 2316 m->m_pkthdr.len -= sizeof ( struct ether_header ); 2317 m->m_len -= sizeof ( struct ether_header ); --- 10 unchanged lines hidden (view full) --- 2328 * 2329 * If an mbuf chain is too long for an Ethernet frame, it is not sent. 2330 * Packets shorter than Ethernet minimum are legal, and we pad them 2331 * before sending out. An exception is "partial" packets which are 2332 * shorter than mandatory Ethernet header. 2333 * 2334 * I wrote a code for an experimental "delayed padding" technique. 2335 * When employed, it postpones the padding process for short packets. | 2610 m_freem( m ); 2611 return 0; 2612 } 2613#endif 2614 2615 /* Strip off the Ethernet header. */ 2616 m->m_pkthdr.len -= sizeof ( struct ether_header ); 2617 m->m_len -= sizeof ( struct ether_header ); --- 10 unchanged lines hidden (view full) --- 2628 * 2629 * If an mbuf chain is too long for an Ethernet frame, it is not sent. 2630 * Packets shorter than Ethernet minimum are legal, and we pad them 2631 * before sending out. An exception is "partial" packets which are 2632 * shorter than mandatory Ethernet header. 2633 * 2634 * I wrote a code for an experimental "delayed padding" technique. 2635 * When employed, it postpones the padding process for short packets. |
2336 * If xmit() occured at the moment, the padding process is omitted, and 2337 * garbages are sent as pad data. If next packet is stored in the | 2636 * If xmit() occurred at the moment, the padding process is omitted, and 2637 * garbage is sent as pad data. If next packet is stored in the |
2338 * transmission buffer before xmit(), write_mbuf() pads the previous 2339 * packet before transmitting new packet. This *may* gain the 2340 * system performance (slightly). 2341 */ 2342static void 2343fe_write_mbufs ( struct fe_softc *sc, struct mbuf *m ) 2344{ | 2638 * transmission buffer before xmit(), write_mbuf() pads the previous 2639 * packet before transmitting new packet. This *may* gain the 2640 * system performance (slightly). 2641 */ 2642static void 2643fe_write_mbufs ( struct fe_softc *sc, struct mbuf *m ) 2644{ |
2345 u_short addr_bmpr8 = sc->addr + FE_BMPR8; | 2645 u_short addr_bmpr8 = sc->ioaddr[ FE_BMPR8 ]; |
2346 u_short length, len; 2347 short pad; 2348 struct mbuf *mp; 2349 u_char *data; 2350 u_short savebyte; /* WARNING: Architecture dependent! */ 2351#define NO_PENDING_BYTE 0xFFFF 2352 | 2646 u_short length, len; 2647 short pad; 2648 struct mbuf *mp; 2649 u_char *data; 2650 u_short savebyte; /* WARNING: Architecture dependent! */ 2651#define NO_PENDING_BYTE 0xFFFF 2652 |
2353#if FE_DELAYED_PADDING 2354 /* Do the "delayed padding." */ 2355 pad = sc->txb_padding >> 1; 2356 if ( pad > 0 ) { 2357 while ( --pad >= 0 ) { 2358 outw( addr_bmpr8, 0 ); 2359 } 2360 sc->txb_padding = 0; 2361 } 2362#endif 2363 | |
2364#if FE_DEBUG >= 2 2365 /* First, count up the total number of bytes to copy */ 2366 length = 0; 2367 for ( mp = m; mp != NULL; mp = mp->m_next ) { 2368 length += mp->m_len; 2369 } 2370 /* Check if this matches the one in the packet header. */ 2371 if ( length != m->m_pkthdr.len ) { --- 34 unchanged lines hidden (view full) --- 2406 /* 2407 * Update buffer status now. 2408 * Truncate the length up to an even number, since we use outw(). 2409 */ 2410 length = ( length + 1 ) & ~1; 2411 sc->txb_free -= FE_DATA_LEN_LEN + max( length, ETHER_MIN_LEN ); 2412 sc->txb_count++; 2413 | 2653#if FE_DEBUG >= 2 2654 /* First, count up the total number of bytes to copy */ 2655 length = 0; 2656 for ( mp = m; mp != NULL; mp = mp->m_next ) { 2657 length += mp->m_len; 2658 } 2659 /* Check if this matches the one in the packet header. */ 2660 if ( length != m->m_pkthdr.len ) { --- 34 unchanged lines hidden (view full) --- 2695 /* 2696 * Update buffer status now. 2697 * Truncate the length up to an even number, since we use outw(). 2698 */ 2699 length = ( length + 1 ) & ~1; 2700 sc->txb_free -= FE_DATA_LEN_LEN + max( length, ETHER_MIN_LEN ); 2701 sc->txb_count++; 2702 |
2414#if FE_DELAYED_PADDING 2415 /* Postpone the packet padding if necessary. */ 2416 if ( length < ETHER_MIN_LEN ) { 2417 sc->txb_padding = ETHER_MIN_LEN - length; 2418 } 2419#endif 2420 | |
2421 /* 2422 * Transfer the data from mbuf chain to the transmission buffer. 2423 * MB86960 seems to require that data be transferred as words, and 2424 * only words. So that we require some extra code to patch 2425 * over odd-length mbufs. 2426 */ 2427 savebyte = NO_PENDING_BYTE; 2428 for ( mp = m; mp != 0; mp = mp->m_next ) { --- 25 unchanged lines hidden (view full) --- 2454 savebyte = *data; 2455 } 2456 } 2457 2458 /* Spit the last byte, if the length is odd. */ 2459 if ( savebyte != NO_PENDING_BYTE ) { 2460 outw( addr_bmpr8, savebyte ); 2461 } | 2703 /* 2704 * Transfer the data from mbuf chain to the transmission buffer. 2705 * MB86960 seems to require that data be transferred as words, and 2706 * only words. So that we require some extra code to patch 2707 * over odd-length mbufs. 2708 */ 2709 savebyte = NO_PENDING_BYTE; 2710 for ( mp = m; mp != 0; mp = mp->m_next ) { --- 25 unchanged lines hidden (view full) --- 2736 savebyte = *data; 2737 } 2738 } 2739 2740 /* Spit the last byte, if the length is odd. */ 2741 if ( savebyte != NO_PENDING_BYTE ) { 2742 outw( addr_bmpr8, savebyte ); 2743 } |
2462 2463#if ! FE_DELAYED_PADDING 2464 /* 2465 * Pad the packet to the minimum length if necessary. 2466 */ 2467 pad = ( ETHER_MIN_LEN >> 1 ) - ( length >> 1 ); 2468 while ( --pad >= 0 ) { 2469 outw( addr_bmpr8, 0 ); 2470 } 2471#endif | |
2472} 2473 2474/* 2475 * Compute hash value for an Ethernet address 2476 */ 2477static int 2478fe_hash ( u_char * ep ) 2479{ --- 74 unchanged lines hidden (view full) --- 2554 /* 2555 * Program 86960 to receive all packets on the segment 2556 * including those directed to other stations. 2557 * Multicast filter stored in MARs are ignored 2558 * under this setting, so we don't need to update it. 2559 * 2560 * Promiscuous mode in FreeBSD 2 is used solely by 2561 * BPF, and BPF only listens to valid (no error) packets. | 2744} 2745 2746/* 2747 * Compute hash value for an Ethernet address 2748 */ 2749static int 2750fe_hash ( u_char * ep ) 2751{ --- 74 unchanged lines hidden (view full) --- 2826 /* 2827 * Program 86960 to receive all packets on the segment 2828 * including those directed to other stations. 2829 * Multicast filter stored in MARs are ignored 2830 * under this setting, so we don't need to update it. 2831 * 2832 * Promiscuous mode in FreeBSD 2 is used solely by 2833 * BPF, and BPF only listens to valid (no error) packets. |
2562 * So, we ignore errornous ones even in this mode. | 2834 * So, we ignore erroneous ones even in this mode. |
2563 * (Older versions of fe driver mistook the point.) 2564 */ | 2835 * (Older versions of fe driver mistook the point.) 2836 */ |
2565 outb( sc->addr + FE_DLCR5, | 2837 outb( sc->ioaddr[ FE_DLCR5 ], |
2566 sc->proto_dlcr5 | FE_D5_AFM0 | FE_D5_AFM1 ); 2567 sc->filter_change = 0; 2568 2569#if FE_DEBUG >= 3 2570 log( LOG_INFO, "fe%d: promiscuous mode\n", sc->sc_unit ); 2571#endif 2572 return; 2573 } 2574 2575 /* 2576 * Turn the chip to the normal (non-promiscuous) mode. 2577 */ | 2838 sc->proto_dlcr5 | FE_D5_AFM0 | FE_D5_AFM1 ); 2839 sc->filter_change = 0; 2840 2841#if FE_DEBUG >= 3 2842 log( LOG_INFO, "fe%d: promiscuous mode\n", sc->sc_unit ); 2843#endif 2844 return; 2845 } 2846 2847 /* 2848 * Turn the chip to the normal (non-promiscuous) mode. 2849 */ |
2578 outb( sc->addr + FE_DLCR5, sc->proto_dlcr5 | FE_D5_AFM1 ); | 2850 outb( sc->ioaddr[ FE_DLCR5 ], sc->proto_dlcr5 | FE_D5_AFM1 ); |
2579 2580 /* 2581 * Find the new multicast filter value. 2582 * I'm not sure we have to handle modes other than MULTICAST. 2583 * Who sets ALLMULTI? Who turns MULTICAST off? FIXME. 2584 */ 2585 if ( flags & IFF_ALLMULTI ) { 2586 sc->filter = fe_filter_all; 2587 } else if ( flags & IFF_MULTICAST ) { 2588 sc->filter = fe_mcaf( sc ); 2589 } else { 2590 sc->filter = fe_filter_nothing; 2591 } 2592 sc->filter_change = 1; 2593 2594#if FE_DEBUG >= 3 | 2851 2852 /* 2853 * Find the new multicast filter value. 2854 * I'm not sure we have to handle modes other than MULTICAST. 2855 * Who sets ALLMULTI? Who turns MULTICAST off? FIXME. 2856 */ 2857 if ( flags & IFF_ALLMULTI ) { 2858 sc->filter = fe_filter_all; 2859 } else if ( flags & IFF_MULTICAST ) { 2860 sc->filter = fe_mcaf( sc ); 2861 } else { 2862 sc->filter = fe_filter_nothing; 2863 } 2864 sc->filter_change = 1; 2865 2866#if FE_DEBUG >= 3 |
2595 log( LOG_INFO, "fe%d: address filter:" 2596 " [%02x %02x %02x %02x %02x %02x %02x %02x]\n", 2597 sc->sc_unit, 2598 sc->filter.data[0], sc->filter.data[1], 2599 sc->filter.data[2], sc->filter.data[3], 2600 sc->filter.data[4], sc->filter.data[5], 2601 sc->filter.data[6], sc->filter.data[7] ); | 2867 log( LOG_INFO, "fe%d: address filter: [%8D]\n", 2868 sc->sc_unit, sc->filter.data, " " ); |
2602#endif 2603 2604 /* 2605 * We have to update the multicast filter in the 86960, A.S.A.P. 2606 * | 2869#endif 2870 2871 /* 2872 * We have to update the multicast filter in the 86960, A.S.A.P. 2873 * |
2607 * Note that the DLC (Data Linc Control unit, i.e. transmitter | 2874 * Note that the DLC (Data Link Control unit, i.e. transmitter |
2608 * and receiver) must be stopped when feeding the filter, and | 2875 * and receiver) must be stopped when feeding the filter, and |
2609 * DLC trushes all packets in both transmission and receive | 2876 * DLC trashes all packets in both transmission and receive |
2610 * buffers when stopped. 2611 * | 2877 * buffers when stopped. 2878 * |
2612 * ... Are the above sentenses correct? I have to check the | 2879 * ... Are the above sentences correct? I have to check the |
2613 * manual of the MB86960A. FIXME. 2614 * | 2880 * manual of the MB86960A. FIXME. 2881 * |
2615 * To reduce the packet lossage, we delay the filter update | 2882 * To reduce the packet loss, we delay the filter update |
2616 * process until buffers are empty. 2617 */ 2618 if ( sc->txb_sched == 0 && sc->txb_count == 0 | 2883 * process until buffers are empty. 2884 */ 2885 if ( sc->txb_sched == 0 && sc->txb_count == 0 |
2619 && !( inb( sc->addr + FE_DLCR1 ) & FE_D1_PKTRDY ) ) { | 2886 && !( inb( sc->ioaddr[ FE_DLCR1 ] ) & FE_D1_PKTRDY ) ) { |
2620 /* 2621 * Buffers are (apparently) empty. Load 2622 * the new filter value into MARs now. 2623 */ 2624 fe_loadmar(sc); 2625 } else { 2626 /* 2627 * Buffers are not empty. Mark that we have to update --- 4 unchanged lines hidden (view full) --- 2632 log( LOG_INFO, "fe%d: filter change delayed\n", sc->sc_unit ); 2633#endif 2634 } 2635} 2636 2637/* 2638 * Load a new multicast address filter into MARs. 2639 * | 2887 /* 2888 * Buffers are (apparently) empty. Load 2889 * the new filter value into MARs now. 2890 */ 2891 fe_loadmar(sc); 2892 } else { 2893 /* 2894 * Buffers are not empty. Mark that we have to update --- 4 unchanged lines hidden (view full) --- 2899 log( LOG_INFO, "fe%d: filter change delayed\n", sc->sc_unit ); 2900#endif 2901 } 2902} 2903 2904/* 2905 * Load a new multicast address filter into MARs. 2906 * |
2640 * The caller must have splimp'ed befor fe_loadmar. | 2907 * The caller must have splimp'ed before fe_loadmar. |
2641 * This function starts the DLC upon return. So it can be called only 2642 * when the chip is working, i.e., from the driver's point of view, when 2643 * a device is RUNNING. (I mistook the point in previous versions.) 2644 */ 2645static void 2646fe_loadmar ( struct fe_softc * sc ) 2647{ 2648 /* Stop the DLC (transmitter and receiver). */ | 2908 * This function starts the DLC upon return. So it can be called only 2909 * when the chip is working, i.e., from the driver's point of view, when 2910 * a device is RUNNING. (I mistook the point in previous versions.) 2911 */ 2912static void 2913fe_loadmar ( struct fe_softc * sc ) 2914{ 2915 /* Stop the DLC (transmitter and receiver). */ |
2649 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); | 2916 DELAY( 200 ); 2917 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_DISABLE ); 2918 DELAY( 200 ); |
2650 2651 /* Select register bank 1 for MARs. */ | 2919 2920 /* Select register bank 1 for MARs. */ |
2652 outb( sc->addr + FE_DLCR7, | 2921 outb( sc->ioaddr[ FE_DLCR7 ], |
2653 sc->proto_dlcr7 | FE_D7_RBS_MAR | FE_D7_POWER_UP ); 2654 2655 /* Copy filter value into the registers. */ | 2922 sc->proto_dlcr7 | FE_D7_RBS_MAR | FE_D7_POWER_UP ); 2923 2924 /* Copy filter value into the registers. */ |
2656 outblk( sc->addr + FE_MAR8, sc->filter.data, FE_FILTER_LEN ); | 2925 outblk( sc, FE_MAR8, sc->filter.data, FE_FILTER_LEN ); |
2657 2658 /* Restore the bank selection for BMPRs (i.e., runtime registers). */ | 2926 2927 /* Restore the bank selection for BMPRs (i.e., runtime registers). */ |
2659 outb( sc->addr + FE_DLCR7, | 2928 outb( sc->ioaddr[ FE_DLCR7 ], |
2660 sc->proto_dlcr7 | FE_D7_RBS_BMPR | FE_D7_POWER_UP ); 2661 2662 /* Restart the DLC. */ | 2929 sc->proto_dlcr7 | FE_D7_RBS_BMPR | FE_D7_POWER_UP ); 2930 2931 /* Restart the DLC. */ |
2663 outb( sc->addr + FE_DLCR6, sc->proto_dlcr6 | FE_D6_DLC_ENABLE ); | 2932 DELAY( 200 ); 2933 outb( sc->ioaddr[ FE_DLCR6 ], sc->proto_dlcr6 | FE_D6_DLC_ENABLE ); 2934 DELAY( 200 ); |
2664 2665 /* We have just updated the filter. */ 2666 sc->filter_change = 0; 2667 2668#if FE_DEBUG >= 3 2669 log( LOG_INFO, "fe%d: address filter changed\n", sc->sc_unit ); 2670#endif 2671} 2672 2673#if FE_DEBUG >= 1 2674static void 2675fe_dump ( int level, struct fe_softc * sc, char * message ) 2676{ 2677 log( level, "fe%d: %s," 2678 " DLCR = %02x %02x %02x %02x %02x %02x %02x %02x," 2679 " BMPR = xx xx %02x %02x %02x %02x %02x %02x," 2680 " asic = %02x %02x %02x %02x %02x %02x %02x %02x" 2681 " + %02x %02x %02x %02x %02x %02x %02x %02x\n", 2682 sc->sc_unit, message ? message : "registers", | 2935 2936 /* We have just updated the filter. */ 2937 sc->filter_change = 0; 2938 2939#if FE_DEBUG >= 3 2940 log( LOG_INFO, "fe%d: address filter changed\n", sc->sc_unit ); 2941#endif 2942} 2943 2944#if FE_DEBUG >= 1 2945static void 2946fe_dump ( int level, struct fe_softc * sc, char * message ) 2947{ 2948 log( level, "fe%d: %s," 2949 " DLCR = %02x %02x %02x %02x %02x %02x %02x %02x," 2950 " BMPR = xx xx %02x %02x %02x %02x %02x %02x," 2951 " asic = %02x %02x %02x %02x %02x %02x %02x %02x" 2952 " + %02x %02x %02x %02x %02x %02x %02x %02x\n", 2953 sc->sc_unit, message ? message : "registers", |
2683 inb( sc->addr + FE_DLCR0 ), inb( sc->addr + FE_DLCR1 ), 2684 inb( sc->addr + FE_DLCR2 ), inb( sc->addr + FE_DLCR3 ), 2685 inb( sc->addr + FE_DLCR4 ), inb( sc->addr + FE_DLCR5 ), 2686 inb( sc->addr + FE_DLCR6 ), inb( sc->addr + FE_DLCR7 ), 2687 inb( sc->addr + FE_BMPR10 ), inb( sc->addr + FE_BMPR11 ), 2688 inb( sc->addr + FE_BMPR12 ), inb( sc->addr + FE_BMPR13 ), 2689 inb( sc->addr + FE_BMPR14 ), inb( sc->addr + FE_BMPR15 ), 2690 inb( sc->addr + 0x10 ), inb( sc->addr + 0x11 ), 2691 inb( sc->addr + 0x12 ), inb( sc->addr + 0x13 ), 2692 inb( sc->addr + 0x14 ), inb( sc->addr + 0x15 ), 2693 inb( sc->addr + 0x16 ), inb( sc->addr + 0x17 ), 2694 inb( sc->addr + 0x18 ), inb( sc->addr + 0x19 ), 2695 inb( sc->addr + 0x1A ), inb( sc->addr + 0x1B ), 2696 inb( sc->addr + 0x1C ), inb( sc->addr + 0x1D ), 2697 inb( sc->addr + 0x1E ), inb( sc->addr + 0x1F ) ); | 2954 inb( sc->ioaddr[ FE_DLCR0 ] ), inb( sc->ioaddr[ FE_DLCR1 ] ), 2955 inb( sc->ioaddr[ FE_DLCR2 ] ), inb( sc->ioaddr[ FE_DLCR3 ] ), 2956 inb( sc->ioaddr[ FE_DLCR4 ] ), inb( sc->ioaddr[ FE_DLCR5 ] ), 2957 inb( sc->ioaddr[ FE_DLCR6 ] ), inb( sc->ioaddr[ FE_DLCR7 ] ), 2958 inb( sc->ioaddr[ FE_BMPR10 ] ), inb( sc->ioaddr[ FE_BMPR11 ] ), 2959 inb( sc->ioaddr[ FE_BMPR12 ] ), inb( sc->ioaddr[ FE_BMPR13 ] ), 2960 inb( sc->ioaddr[ FE_BMPR14 ] ), inb( sc->ioaddr[ FE_BMPR15 ] ), 2961 inb( sc->ioaddr[ 0x10 ] ), inb( sc->ioaddr[ 0x11 ] ), 2962 inb( sc->ioaddr[ 0x12 ] ), inb( sc->ioaddr[ 0x13 ] ), 2963 inb( sc->ioaddr[ 0x14 ] ), inb( sc->ioaddr[ 0x15 ] ), 2964 inb( sc->ioaddr[ 0x16 ] ), inb( sc->ioaddr[ 0x17 ] ), 2965 inb( sc->ioaddr[ 0x18 ] ), inb( sc->ioaddr[ 0x19 ] ), 2966 inb( sc->ioaddr[ 0x1A ] ), inb( sc->ioaddr[ 0x1B ] ), 2967 inb( sc->ioaddr[ 0x1C ] ), inb( sc->ioaddr[ 0x1D ] ), 2968 inb( sc->ioaddr[ 0x1E ] ), inb( sc->ioaddr[ 0x1F ] ) ); |
2698} 2699#endif | 2969} 2970#endif |