if_fe_cbus.c (142135) | if_fe_cbus.c (147304) |
---|---|
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_cbus.c 142135 2005-02-20 19:33:13Z imp $"); | 25__FBSDID("$FreeBSD: head/sys/dev/fe/if_fe_cbus.c 147304 2005-06-11 16:30:43Z 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> --- 278 unchanged lines hidden (view full) --- 312 /* Fill the softc struct with default values. */ 313 fe_softc_defaults(sc); 314 315 /* See if the card is on its address. */ 316 if (!fe_simple_probe(sc, probe_table)) 317 return ENXIO; 318 319 /* Get our station address from EEPROM. */ | 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> --- 278 unchanged lines hidden (view full) --- 312 /* Fill the softc struct with default values. */ 313 fe_softc_defaults(sc); 314 315 /* See if the card is on its address. */ 316 if (!fe_simple_probe(sc, probe_table)) 317 return ENXIO; 318 319 /* Get our station address from EEPROM. */ |
320 fe_inblk(sc, 0x18, sc->sc_enaddr, ETHER_ADDR_LEN); | 320 fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); |
321 322 /* Make sure it is Allied-Telesis's. */ | 321 322 /* Make sure it is Allied-Telesis's. */ |
323 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x0000F4)) | 323 if (!fe_valid_Ether_p(sc->enaddr, 0x0000F4)) |
324 return ENXIO; 325#if 1 326 /* Calculate checksum. */ 327 sum = fe_inb(sc, 0x1e); 328 for (i = 0; i < ETHER_ADDR_LEN; i++) | 324 return ENXIO; 325#if 1 326 /* Calculate checksum. */ 327 sum = fe_inb(sc, 0x1e); 328 for (i = 0; i < ETHER_ADDR_LEN; i++) |
329 sum ^= sc->sc_enaddr[i]; | 329 sum ^= sc->enaddr[i]; |
330 if (sum != 0) 331 return ENXIO; 332#endif 333 /* Setup the board type. */ 334 sc->typestr = "RE1000"; 335 336 /* This looks like an RE1000 board. It requires an 337 explicit IRQ setting in config. Make sure we have one, --- 27 unchanged lines hidden (view full) --- 365 366 /* Make sure the EEPROM contains Allied-Telesis bit pattern. */ 367 if (eeprom[1] != 0xFF) return NULL; 368 for (i = 2; i < 8; i++) if (eeprom[i] != 0xFF) return NULL; 369 for (i = 14; i < 24; i++) if (eeprom[i] != 0xFF) return NULL; 370 371 /* Get our station address from EEPROM, and make sure the 372 EEPROM contains Allied-Telesis's address. */ | 330 if (sum != 0) 331 return ENXIO; 332#endif 333 /* Setup the board type. */ 334 sc->typestr = "RE1000"; 335 336 /* This looks like an RE1000 board. It requires an 337 explicit IRQ setting in config. Make sure we have one, --- 27 unchanged lines hidden (view full) --- 365 366 /* Make sure the EEPROM contains Allied-Telesis bit pattern. */ 367 if (eeprom[1] != 0xFF) return NULL; 368 for (i = 2; i < 8; i++) if (eeprom[i] != 0xFF) return NULL; 369 for (i = 14; i < 24; i++) if (eeprom[i] != 0xFF) return NULL; 370 371 /* Get our station address from EEPROM, and make sure the 372 EEPROM contains Allied-Telesis's address. */ |
373 bcopy(eeprom + 8, sc->sc_enaddr, ETHER_ADDR_LEN); 374 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x0000F4)) | 373 bcopy(eeprom + 8, sc->enaddr, ETHER_ADDR_LEN); 374 if (!fe_valid_Ether_p(sc->enaddr, 0x0000F4)) |
375 return NULL; 376 377 /* I don't know any sub-model identification. */ 378 sc->typestr = "RE1000Plus/ME1500"; 379 380 /* Returns the IRQ table for the RE1000Plus. */ 381 return irqmaps_re1000p; 382} --- 153 unchanged lines hidden (view full) --- 536 /* Fill the softc struct with default values. */ 537 fe_softc_defaults(sc); 538 539 /* See if the card is on its address. */ 540 if (!fe_simple_probe(sc, probe_table)) 541 return ENXIO; 542 543 /* Get our station address from EEPROM. */ | 375 return NULL; 376 377 /* I don't know any sub-model identification. */ 378 sc->typestr = "RE1000Plus/ME1500"; 379 380 /* Returns the IRQ table for the RE1000Plus. */ 381 return irqmaps_re1000p; 382} --- 153 unchanged lines hidden (view full) --- 536 /* Fill the softc struct with default values. */ 537 fe_softc_defaults(sc); 538 539 /* See if the card is on its address. */ 540 if (!fe_simple_probe(sc, probe_table)) 541 return ENXIO; 542 543 /* Get our station address from EEPROM. */ |
544 fe_inblk(sc, 0x18, sc->sc_enaddr, ETHER_ADDR_LEN); | 544 fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); |
545 546 /* Make sure it is Contec's. */ | 545 546 /* Make sure it is Contec's. */ |
547 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x00804C)) | 547 if (!fe_valid_Ether_p(sc->enaddr, 0x00804C)) |
548 return ENXIO; 549 550 /* Determine the card type. */ | 548 return ENXIO; 549 550 /* Determine the card type. */ |
551 if (sc->sc_enaddr[3] == 0x06) { | 551 if (sc->enaddr[3] == 0x06) { |
552 sc->typestr = "C-NET(9N)C"; 553 554 /* We seems to need our own IDENT bits... FIXME. */ 555 sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_NICE; 556 557 /* C-NET(9N)C requires an explicit IRQ to work. */ 558 if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) { 559 fe_irq_failure(sc->typestr, sc->sc_unit, NO_IRQ, NULL); --- 67 unchanged lines hidden (view full) --- 627 are not yet sure we have a C-NET(98)P2 board here.) Don't 628 remember to select BMPRs bofore reading EEPROM, since other 629 register bank may be selected before the probe() is called. */ 630 fe_read_eeprom_ssi(sc, eeprom); 631 632 /* Make sure the Ethernet (MAC) station address is of Contec's. */ 633 if (!fe_valid_Ether_p(eeprom + FE_SSI_EEP_ADDR, 0x00804C)) 634 return ENXIO; | 552 sc->typestr = "C-NET(9N)C"; 553 554 /* We seems to need our own IDENT bits... FIXME. */ 555 sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_NICE; 556 557 /* C-NET(9N)C requires an explicit IRQ to work. */ 558 if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) { 559 fe_irq_failure(sc->typestr, sc->sc_unit, NO_IRQ, NULL); --- 67 unchanged lines hidden (view full) --- 627 are not yet sure we have a C-NET(98)P2 board here.) Don't 628 remember to select BMPRs bofore reading EEPROM, since other 629 register bank may be selected before the probe() is called. */ 630 fe_read_eeprom_ssi(sc, eeprom); 631 632 /* Make sure the Ethernet (MAC) station address is of Contec's. */ 633 if (!fe_valid_Ether_p(eeprom + FE_SSI_EEP_ADDR, 0x00804C)) 634 return ENXIO; |
635 bcopy(eeprom + FE_SSI_EEP_ADDR, sc->sc_enaddr, ETHER_ADDR_LEN); | 635 bcopy(eeprom + FE_SSI_EEP_ADDR, sc->enaddr, ETHER_ADDR_LEN); |
636 637 /* Setup the board type. */ 638 sc->typestr = "C-NET(98)P2"; 639 640 /* Non-PnP mode, set static resource from eeprom. */ 641 if (!isa_get_vendorid(dev)) { 642 /* Get IRQ configuration from EEPROM. */ 643 irq = irqmap[eeprom[FE_SSI_EEP_IRQ]]; --- 53 unchanged lines hidden (view full) --- 697 /* We now have to read the config EEPROM. We should be very 698 careful, since doing so destroys a register. (Remember, we 699 are not yet sure we have a LAC-98012/98013 board here.) */ 700 fe_read_eeprom_lnx(sc, eeprom); 701 702 /* Make sure the Ethernet (MAC) station address is of TDK/LANX's. */ 703 if (!fe_valid_Ether_p(eeprom, 0x008098)) 704 return ENXIO; | 636 637 /* Setup the board type. */ 638 sc->typestr = "C-NET(98)P2"; 639 640 /* Non-PnP mode, set static resource from eeprom. */ 641 if (!isa_get_vendorid(dev)) { 642 /* Get IRQ configuration from EEPROM. */ 643 irq = irqmap[eeprom[FE_SSI_EEP_IRQ]]; --- 53 unchanged lines hidden (view full) --- 697 /* We now have to read the config EEPROM. We should be very 698 careful, since doing so destroys a register. (Remember, we 699 are not yet sure we have a LAC-98012/98013 board here.) */ 700 fe_read_eeprom_lnx(sc, eeprom); 701 702 /* Make sure the Ethernet (MAC) station address is of TDK/LANX's. */ 703 if (!fe_valid_Ether_p(eeprom, 0x008098)) 704 return ENXIO; |
705 bcopy(eeprom, sc->sc_enaddr, ETHER_ADDR_LEN); | 705 bcopy(eeprom, sc->enaddr, ETHER_ADDR_LEN); |
706 707 /* Setup the board type. */ 708 sc->typestr = "LAC-98012/98013"; 709 710 /* This looks like a TDK/LANX board. It requires an 711 explicit IRQ setting in config. Make sure we have one, 712 determining an appropriate value for the IRQ control 713 register. */ --- 48 unchanged lines hidden (view full) --- 762 /* Fill the softc struct with default values. */ 763 fe_softc_defaults(sc); 764 765 /* See if the card is on its address. */ 766 if (!fe_simple_probe(sc, probe_table)) 767 return ENXIO; 768 769 /* Get our station address from EEPROM. */ | 706 707 /* Setup the board type. */ 708 sc->typestr = "LAC-98012/98013"; 709 710 /* This looks like a TDK/LANX board. It requires an 711 explicit IRQ setting in config. Make sure we have one, 712 determining an appropriate value for the IRQ control 713 register. */ --- 48 unchanged lines hidden (view full) --- 762 /* Fill the softc struct with default values. */ 763 fe_softc_defaults(sc); 764 765 /* See if the card is on its address. */ 766 if (!fe_simple_probe(sc, probe_table)) 767 return ENXIO; 768 769 /* Get our station address from EEPROM. */ |
770 fe_inblk(sc, 0x18, sc->sc_enaddr, ETHER_ADDR_LEN); 771 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x000000)) | 770 fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); 771 if (!fe_valid_Ether_p(sc->enaddr, 0x000000)) |
772 return ENXIO; 773 774 /* Determine the card type. */ 775 sc->typestr = "Generic MB86960 Ethernet"; | 772 return ENXIO; 773 774 /* Determine the card type. */ 775 sc->typestr = "Generic MB86960 Ethernet"; |
776 if (fe_valid_Ether_p(sc->sc_enaddr, 0x000061)) | 776 if (fe_valid_Ether_p(sc->enaddr, 0x000061)) |
777 sc->typestr = "Gateway Ethernet (Fujitsu chipset)"; 778 779 /* Gateway's board requires an explicit IRQ to work, since it 780 is not possible to probe the setting of jumpers. */ 781 if (bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL) != 0) { 782 fe_irq_failure(sc->typestr, sc->sc_unit, NO_IRQ, NULL); 783 return ENXIO; 784 } --- 43 unchanged lines hidden (view full) --- 828 829 /* Save the current value for the DLCR7 register we are about 830 to destroy. */ 831 save7 = fe_inb(sc, FE_DLCR7); 832 fe_outb(sc, FE_DLCR7, 833 sc->proto_dlcr7 | FE_D7_RBS_BMPR | FE_D7_POWER_UP); 834 835 /* Get our station address form ID ROM and make sure it is UBN's. */ | 777 sc->typestr = "Gateway Ethernet (Fujitsu chipset)"; 778 779 /* Gateway's board requires an explicit IRQ to work, since it 780 is not possible to probe the setting of jumpers. */ 781 if (bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL) != 0) { 782 fe_irq_failure(sc->typestr, sc->sc_unit, NO_IRQ, NULL); 783 return ENXIO; 784 } --- 43 unchanged lines hidden (view full) --- 828 829 /* Save the current value for the DLCR7 register we are about 830 to destroy. */ 831 save7 = fe_inb(sc, FE_DLCR7); 832 fe_outb(sc, FE_DLCR7, 833 sc->proto_dlcr7 | FE_D7_RBS_BMPR | FE_D7_POWER_UP); 834 835 /* Get our station address form ID ROM and make sure it is UBN's. */ |
836 fe_inblk(sc, 0x18, sc->sc_enaddr, ETHER_ADDR_LEN); 837 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x00DD01)) | 836 fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); 837 if (!fe_valid_Ether_p(sc->enaddr, 0x00DD01)) |
838 goto fail_ubn; 839#if 1 840 /* Calculate checksum. */ 841 sum = fe_inb(sc, 0x1e); 842 for (i = 0; i < ETHER_ADDR_LEN; i++) | 838 goto fail_ubn; 839#if 1 840 /* Calculate checksum. */ 841 sum = fe_inb(sc, 0x1e); 842 for (i = 0; i < ETHER_ADDR_LEN; i++) |
843 sum ^= sc->sc_enaddr[i]; | 843 sum ^= sc->enaddr[i]; |
844 if (sum != 0) 845 goto fail_ubn; 846#endif 847 848 /* Setup the board type. */ 849 sc->typestr = "Access/PC"; 850 851 /* This looks like an AccessPC/N98C+ board. It requires an --- 115 unchanged lines hidden (view full) --- 967 if (!fe_simple_probe(sc, probe_table)) 968 return ENXIO; 969 970 /* We now have to read the config EEPROM. We should be very 971 careful, since doing so destroys a register. (Remember, we 972 are not yet sure we have a REX-9880 board here.) */ 973 fe_read_eeprom_rex(sc, eeprom); 974 for (i = 0; i < ETHER_ADDR_LEN; i++) | 844 if (sum != 0) 845 goto fail_ubn; 846#endif 847 848 /* Setup the board type. */ 849 sc->typestr = "Access/PC"; 850 851 /* This looks like an AccessPC/N98C+ board. It requires an --- 115 unchanged lines hidden (view full) --- 967 if (!fe_simple_probe(sc, probe_table)) 968 return ENXIO; 969 970 /* We now have to read the config EEPROM. We should be very 971 careful, since doing so destroys a register. (Remember, we 972 are not yet sure we have a REX-9880 board here.) */ 973 fe_read_eeprom_rex(sc, eeprom); 974 for (i = 0; i < ETHER_ADDR_LEN; i++) |
975 sc->sc_enaddr[i] = eeprom[7 - i]; | 975 sc->enaddr[i] = eeprom[7 - i]; |
976 977 /* Make sure it is RATOC's. */ | 976 977 /* Make sure it is RATOC's. */ |
978 if (!fe_valid_Ether_p(sc->sc_enaddr, 0x00C0D0) && 979 !fe_valid_Ether_p(sc->sc_enaddr, 0x00803D)) | 978 if (!fe_valid_Ether_p(sc->enaddr, 0x00C0D0) && 979 !fe_valid_Ether_p(sc->enaddr, 0x00803D)) |
980 return 0; 981 982 /* Setup the board type. */ 983 sc->typestr = "REX-9880/9883"; 984 985 /* This looks like a REX-9880 board. It requires an 986 explicit IRQ setting in config. Make sure we have one, 987 determining an appropriate value for the IRQ control --- 25 unchanged lines hidden --- | 980 return 0; 981 982 /* Setup the board type. */ 983 sc->typestr = "REX-9880/9883"; 984 985 /* This looks like a REX-9880 board. It requires an 986 explicit IRQ setting in config. Make sure we have one, 987 determining an appropriate value for the IRQ control --- 25 unchanged lines hidden --- |