if_fe_isa.c (142135) | if_fe_isa.c (147256) |
---|---|
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. --- 8 unchanged lines hidden (view full) --- 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 24#include <sys/cdefs.h> | 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. --- 8 unchanged lines hidden (view full) --- 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 24#include <sys/cdefs.h> |
25__FBSDID("$FreeBSD: head/sys/dev/fe/if_fe_isa.c 142135 2005-02-20 19:33:13Z imp $"); | 25__FBSDID("$FreeBSD: head/sys/dev/fe/if_fe_isa.c 147256 2005-06-10 16:49:24Z brooks $"); |
26 27#include <sys/param.h> 28#include <sys/systm.h> 29#include <sys/kernel.h> 30#include <sys/socket.h> 31#include <sys/module.h> 32 33#include <sys/bus.h> --- 212 unchanged lines hidden (view full) --- 246 fe_softc_defaults(sc); 247 248 /* Simple probe. */ 249 if (!fe_simple_probe(sc, probe_table)) 250 return ENXIO; 251 252 /* Get our station address from EEPROM, and make sure it is 253 Fujitsu's. */ | 26 27#include <sys/param.h> 28#include <sys/systm.h> 29#include <sys/kernel.h> 30#include <sys/socket.h> 31#include <sys/module.h> 32 33#include <sys/bus.h> --- 212 unchanged lines hidden (view full) --- 246 fe_softc_defaults(sc); 247 248 /* Simple probe. */ 249 if (!fe_simple_probe(sc, probe_table)) 250 return ENXIO; 251 252 /* Get our station address from EEPROM, and make sure it is 253 Fujitsu's. */ |
254 fe_inblk(sc, FE_FMV4, sc->sc_enaddr, ETHER_ADDR_LEN); 255 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x00000E)) | 254 fe_inblk(sc, FE_FMV4, sc->enaddr, ETHER_ADDR_LEN); 255 if (!fe_valid_Ether_p(sc->enaddr, 0x00000E)) |
256 return ENXIO; 257 258 /* Find the supported media and "hardware revision" to know 259 the model identification. */ 260 mcode = (fe_inb(sc, FE_FMV0) & FE_FMV0_MEDIA) 261 | ((fe_inb(sc, FE_FMV1) & FE_FMV1_REV) << 8); 262 263 /* Determine the card type. */ --- 117 unchanged lines hidden (view full) --- 381 /* Make sure the EEPROM contains Allied-Telesis/Allied-Telesyn 382 bit pattern. */ 383 if (eeprom[1] != 0x00) return NULL; 384 for (i = 2; i < 8; i++) if (eeprom[i] != 0xFF) return NULL; 385 for (i = 14; i < 24; i++) if (eeprom[i] != 0xFF) return NULL; 386 387 /* Get our station address from EEPROM, and make sure the 388 EEPROM contains ATI's address. */ | 256 return ENXIO; 257 258 /* Find the supported media and "hardware revision" to know 259 the model identification. */ 260 mcode = (fe_inb(sc, FE_FMV0) & FE_FMV0_MEDIA) 261 | ((fe_inb(sc, FE_FMV1) & FE_FMV1_REV) << 8); 262 263 /* Determine the card type. */ --- 117 unchanged lines hidden (view full) --- 381 /* Make sure the EEPROM contains Allied-Telesis/Allied-Telesyn 382 bit pattern. */ 383 if (eeprom[1] != 0x00) return NULL; 384 for (i = 2; i < 8; i++) if (eeprom[i] != 0xFF) return NULL; 385 for (i = 14; i < 24; i++) if (eeprom[i] != 0xFF) return NULL; 386 387 /* Get our station address from EEPROM, and make sure the 388 EEPROM contains ATI's address. */ |
389 bcopy(eeprom + 8, sc->sc_enaddr, ETHER_ADDR_LEN); 390 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x0000F4)) | 389 bcopy(eeprom + 8, sc->enaddr, ETHER_ADDR_LEN); 390 if (!fe_valid_Ether_p(sc->enaddr, 0x0000F4)) |
391 return NULL; 392 393 /* 394 * The following model identification codes are stolen 395 * from the NetBSD port of the fe driver. My reviewers 396 * suggested minor revision. 397 */ 398 --- 111 unchanged lines hidden (view full) --- 510 ICL's. */ 511 if (!fe_valid_Ether_p(eeprom+122, 0x00004B)) 512 return NULL; 513 514 /* Check if the "configured" Ethernet address in the EEPROM is 515 valid. Use it if it is, or use the "permanent" address instead. */ 516 if (fe_valid_Ether_p(eeprom+4, 0x020000)) { 517 /* The configured address is valid. Use it. */ | 391 return NULL; 392 393 /* 394 * The following model identification codes are stolen 395 * from the NetBSD port of the fe driver. My reviewers 396 * suggested minor revision. 397 */ 398 --- 111 unchanged lines hidden (view full) --- 510 ICL's. */ 511 if (!fe_valid_Ether_p(eeprom+122, 0x00004B)) 512 return NULL; 513 514 /* Check if the "configured" Ethernet address in the EEPROM is 515 valid. Use it if it is, or use the "permanent" address instead. */ 516 if (fe_valid_Ether_p(eeprom+4, 0x020000)) { 517 /* The configured address is valid. Use it. */ |
518 bcopy(eeprom+4, sc->sc_enaddr, ETHER_ADDR_LEN); | 518 bcopy(eeprom+4, sc->enaddr, ETHER_ADDR_LEN); |
519 } else { 520 /* The configured address is invalid. Use permanent. */ | 519 } else { 520 /* The configured address is invalid. Use permanent. */ |
521 bcopy(eeprom+122, sc->sc_enaddr, ETHER_ADDR_LEN); | 521 bcopy(eeprom+122, sc->enaddr, ETHER_ADDR_LEN); |
522 } 523 524 /* Determine model and supported media. */ 525 switch (eeprom[0x5E]) { 526 case 0: 527 sc->typestr = "EtherTeam16i/COMBO"; 528 sc->mbitmap = MB_HA | MB_HT | MB_H5 | MB_H2; 529 break; --- 78 unchanged lines hidden (view full) --- 608 609 /* Make sure the EEPROM contains RATOC's config pattern. */ 610 if (eeprom[1] != eeprom[0]) return NULL; 611 for (i = 8; i < 32; i++) if (eeprom[i] != 0xFF) return NULL; 612 613 /* Get our station address from EEPROM. Note that RATOC 614 stores it "byte-swapped" in each word. (I don't know why.) 615 So, we just can't use bcopy().*/ | 522 } 523 524 /* Determine model and supported media. */ 525 switch (eeprom[0x5E]) { 526 case 0: 527 sc->typestr = "EtherTeam16i/COMBO"; 528 sc->mbitmap = MB_HA | MB_HT | MB_H5 | MB_H2; 529 break; --- 78 unchanged lines hidden (view full) --- 608 609 /* Make sure the EEPROM contains RATOC's config pattern. */ 610 if (eeprom[1] != eeprom[0]) return NULL; 611 for (i = 8; i < 32; i++) if (eeprom[i] != 0xFF) return NULL; 612 613 /* Get our station address from EEPROM. Note that RATOC 614 stores it "byte-swapped" in each word. (I don't know why.) 615 So, we just can't use bcopy().*/ |
616 sc->sc_enaddr[0] = eeprom[3]; 617 sc->sc_enaddr[1] = eeprom[2]; 618 sc->sc_enaddr[2] = eeprom[5]; 619 sc->sc_enaddr[3] = eeprom[4]; 620 sc->sc_enaddr[4] = eeprom[7]; 621 sc->sc_enaddr[5] = eeprom[6]; | 616 sc->enaddr[0] = eeprom[3]; 617 sc->enaddr[1] = eeprom[2]; 618 sc->enaddr[2] = eeprom[5]; 619 sc->enaddr[3] = eeprom[4]; 620 sc->enaddr[4] = eeprom[7]; 621 sc->enaddr[5] = eeprom[6]; |
622 623 /* Make sure the EEPROM contains RATOC's station address. */ | 622 623 /* Make sure the EEPROM contains RATOC's station address. */ |
624 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x00C0D0)) | 624 if (!fe_valid_Ether_p(sc->enaddr, 0x00C0D0)) |
625 return NULL; 626 627 /* I don't know any sub-model identification. */ 628 sc->type = FE_TYPE_JLI; 629 sc->typestr = "REX-5586/5587"; 630 631 /* Returns the IRQ for the RATOC board. */ 632 return irqmap_rex; --- 29 unchanged lines hidden (view full) --- 662 continue; 663 } 664 665 /* If no reasonable address was found, we can't go further. */ 666 if (n > romsize - ETHER_ADDR_LEN) 667 return NULL; 668 669 /* Extract our (guessed) station address. */ | 625 return NULL; 626 627 /* I don't know any sub-model identification. */ 628 sc->type = FE_TYPE_JLI; 629 sc->typestr = "REX-5586/5587"; 630 631 /* Returns the IRQ for the RATOC board. */ 632 return irqmap_rex; --- 29 unchanged lines hidden (view full) --- 662 continue; 663 } 664 665 /* If no reasonable address was found, we can't go further. */ 666 if (n > romsize - ETHER_ADDR_LEN) 667 return NULL; 668 669 /* Extract our (guessed) station address. */ |
670 bcopy(eeprom+n, sc->sc_enaddr, ETHER_ADDR_LEN); | 670 bcopy(eeprom+n, sc->enaddr, ETHER_ADDR_LEN); |
671 672 /* We are not sure what type of board it is... */ 673 sc->type = FE_TYPE_JLI; 674 sc->typestr = "(unknown JLI)"; 675 sc->stability |= UNSTABLE_TYPE | UNSTABLE_MAC; 676 677 /* Returns the totally unknown IRQ mapping table. */ 678 return irqmap; --- 157 unchanged lines hidden (view full) --- 836 are not yet sure we have a LAK-AX031 board here.) Don't 837 remember to select BMPRs bofore reading EEPROM, since other 838 register bank may be selected before the probe() is called. */ 839 fe_read_eeprom_ssi(sc, eeprom); 840 841 /* Make sure the Ethernet (MAC) station address is of TDK's. */ 842 if (!fe_valid_Ether_p(eeprom+FE_SSI_EEP_ADDR, 0x008098)) 843 return ENXIO; | 671 672 /* We are not sure what type of board it is... */ 673 sc->type = FE_TYPE_JLI; 674 sc->typestr = "(unknown JLI)"; 675 sc->stability |= UNSTABLE_TYPE | UNSTABLE_MAC; 676 677 /* Returns the totally unknown IRQ mapping table. */ 678 return irqmap; --- 157 unchanged lines hidden (view full) --- 836 are not yet sure we have a LAK-AX031 board here.) Don't 837 remember to select BMPRs bofore reading EEPROM, since other 838 register bank may be selected before the probe() is called. */ 839 fe_read_eeprom_ssi(sc, eeprom); 840 841 /* Make sure the Ethernet (MAC) station address is of TDK's. */ 842 if (!fe_valid_Ether_p(eeprom+FE_SSI_EEP_ADDR, 0x008098)) 843 return ENXIO; |
844 bcopy(eeprom + FE_SSI_EEP_ADDR, sc->sc_enaddr, ETHER_ADDR_LEN); | 844 bcopy(eeprom + FE_SSI_EEP_ADDR, sc->enaddr, ETHER_ADDR_LEN); |
845 846 /* This looks like a TDK-AX031 board. It requires an explicit 847 IRQ setting in config, since we currently don't know how we 848 can find the IRQ value assigned by ISA PnP manager. */ 849 if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) { 850 fe_irq_failure("LAK-AX031", sc->sc_unit, NO_IRQ, NULL); 851 return ENXIO; 852 } --- 44 unchanged lines hidden (view full) --- 897 /* We now have to read the config EEPROM. We should be very 898 careful, since doing so destroys a register. (Remember, we 899 are not yet sure we have a LAC-AX012/AX013 board here.) */ 900 fe_read_eeprom_lnx(sc, eeprom); 901 902 /* Make sure the Ethernet (MAC) station address is of TDK/LANX's. */ 903 if (!fe_valid_Ether_p(eeprom, 0x008098)) 904 return ENXIO; | 845 846 /* This looks like a TDK-AX031 board. It requires an explicit 847 IRQ setting in config, since we currently don't know how we 848 can find the IRQ value assigned by ISA PnP manager. */ 849 if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) { 850 fe_irq_failure("LAK-AX031", sc->sc_unit, NO_IRQ, NULL); 851 return ENXIO; 852 } --- 44 unchanged lines hidden (view full) --- 897 /* We now have to read the config EEPROM. We should be very 898 careful, since doing so destroys a register. (Remember, we 899 are not yet sure we have a LAC-AX012/AX013 board here.) */ 900 fe_read_eeprom_lnx(sc, eeprom); 901 902 /* Make sure the Ethernet (MAC) station address is of TDK/LANX's. */ 903 if (!fe_valid_Ether_p(eeprom, 0x008098)) 904 return ENXIO; |
905 bcopy(eeprom, sc->sc_enaddr, ETHER_ADDR_LEN); | 905 bcopy(eeprom, sc->enaddr, ETHER_ADDR_LEN); |
906 907 /* This looks like a TDK/LANX board. It requires an 908 explicit IRQ setting in config. Make sure we have one, 909 determining an appropriate value for the IRQ control 910 register. */ 911 irq = 0; 912 bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL); 913 switch (irq) { --- 43 unchanged lines hidden (view full) --- 957 /* Setup an I/O address mapping table and some others. */ 958 fe_softc_defaults(sc); 959 960 /* See if the card is on its address. */ 961 if (!fe_simple_probe(sc, probe_table)) 962 return ENXIO; 963 964 /* Get our station address from EEPROM. */ | 906 907 /* This looks like a TDK/LANX board. It requires an 908 explicit IRQ setting in config. Make sure we have one, 909 determining an appropriate value for the IRQ control 910 register. */ 911 irq = 0; 912 bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL); 913 switch (irq) { --- 43 unchanged lines hidden (view full) --- 957 /* Setup an I/O address mapping table and some others. */ 958 fe_softc_defaults(sc); 959 960 /* See if the card is on its address. */ 961 if (!fe_simple_probe(sc, probe_table)) 962 return ENXIO; 963 964 /* Get our station address from EEPROM. */ |
965 fe_inblk(sc, 0x18, sc->sc_enaddr, ETHER_ADDR_LEN); | 965 fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); |
966 967 /* Make sure it is Gateway Communication's. */ | 966 967 /* Make sure it is Gateway Communication's. */ |
968 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x000061)) | 968 if (!fe_valid_Ether_p(sc->enaddr, 0x000061)) |
969 return ENXIO; 970 971 /* Gateway's board requires an explicit IRQ to work, since it 972 is not possible to probe the setting of jumpers. */ 973 if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) { 974 fe_irq_failure("Gateway Ethernet", sc->sc_unit, NO_IRQ, NULL); 975 return ENXIO; 976 } --- 34 unchanged lines hidden (view full) --- 1011 /* Setup an I/O address mapping table and some others. */ 1012 fe_softc_defaults(sc); 1013 1014 /* Simple probe. */ 1015 if (!fe_simple_probe(sc, probe_table)) 1016 return ENXIO; 1017 1018 /* Get our station address form ID ROM and make sure it is UBN's. */ | 969 return ENXIO; 970 971 /* Gateway's board requires an explicit IRQ to work, since it 972 is not possible to probe the setting of jumpers. */ 973 if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) { 974 fe_irq_failure("Gateway Ethernet", sc->sc_unit, NO_IRQ, NULL); 975 return ENXIO; 976 } --- 34 unchanged lines hidden (view full) --- 1011 /* Setup an I/O address mapping table and some others. */ 1012 fe_softc_defaults(sc); 1013 1014 /* Simple probe. */ 1015 if (!fe_simple_probe(sc, probe_table)) 1016 return ENXIO; 1017 1018 /* Get our station address form ID ROM and make sure it is UBN's. */ |
1019 fe_inblk(sc, 0x18, sc->sc_enaddr, ETHER_ADDR_LEN); 1020 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x00DD01)) | 1019 fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); 1020 if (!fe_valid_Ether_p(sc->enaddr, 0x00DD01)) |
1021 return ENXIO; 1022#if 0 1023 /* Calculate checksum. */ 1024 sum = fe_inb(sc, 0x1e); 1025 for (i = 0; i < ETHER_ADDR_LEN; i++) { | 1021 return ENXIO; 1022#if 0 1023 /* Calculate checksum. */ 1024 sum = fe_inb(sc, 0x1e); 1025 for (i = 0; i < ETHER_ADDR_LEN; i++) { |
1026 sum ^= sc->sc_enaddr[i]; | 1026 sum ^= sc->enaddr[i]; |
1027 } 1028 if (sum != 0) 1029 return ENXIO; 1030#endif 1031 /* This looks like an AccessPC/ISA board. It requires an 1032 explicit IRQ setting in config. Make sure we have one, 1033 determining an appropriate value for the IRQ control 1034 register. */ --- 19 unchanged lines hidden --- | 1027 } 1028 if (sum != 0) 1029 return ENXIO; 1030#endif 1031 /* This looks like an AccessPC/ISA board. It requires an 1032 explicit IRQ setting in config. Make sure we have one, 1033 determining an appropriate value for the IRQ control 1034 register. */ --- 19 unchanged lines hidden --- |