if_ed.c (118607) | if_ed.c (121118) |
---|---|
1/* 2 * Copyright (c) 1995, David Greenman 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/* 2 * Copyright (c) 1995, David Greenman 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/dev/ed/if_ed.c 118607 2003-08-07 15:04:27Z jhb $ | 27 * $FreeBSD: head/sys/dev/ed/if_ed.c 121118 2003-10-15 17:22:15Z shiba $ |
28 */ 29 30/* 31 * Device driver for National Semiconductor DS8390/WD83C690 based ethernet 32 * adapters. By David Greenman, 29-April-1993 33 * 34 * Currently supports the Western Digital/SMC 8003 and 8013 series, 35 * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000, --- 870 unchanged lines hidden (view full) --- 906 device_printf(dev, "failed to clear shared memory at %jx - check configuration\n", 907 (uintmax_t)kvtop(sc->mem_start + i)); 908 return (ENXIO); 909 } 910 return (0); 911} 912 913/* | 28 */ 29 30/* 31 * Device driver for National Semiconductor DS8390/WD83C690 based ethernet 32 * adapters. By David Greenman, 29-April-1993 33 * 34 * Currently supports the Western Digital/SMC 8003 and 8013 series, 35 * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000, --- 870 unchanged lines hidden (view full) --- 906 device_printf(dev, "failed to clear shared memory at %jx - check configuration\n", 907 (uintmax_t)kvtop(sc->mem_start + i)); 908 return (ENXIO); 909 } 910 return (0); 911} 912 913/* |
914 * Probe and vendor-specific initialization routine for SIC boards 915 */ 916int 917ed_probe_SIC(dev, port_rid, flags) 918 device_t dev; 919 int port_rid; 920 int flags; 921{ 922 struct ed_softc *sc = device_get_softc(dev); 923 int error; 924 int i; 925 u_int memsize; 926 u_long conf_maddr, conf_msize; 927 u_char sum; 928 929 error = ed_alloc_port(dev, 0, ED_SIC_IO_PORTS); 930 if (error) 931 return (error); 932 933 sc->asic_offset = ED_SIC_ASIC_OFFSET; 934 sc->nic_offset = ED_SIC_NIC_OFFSET; 935 936 error = bus_get_resource(dev, SYS_RES_MEMORY, 0, 937 &conf_maddr, &conf_msize); 938 if (error) 939 return (error); 940 941 memsize = 16384; 942 if (conf_msize > 1) 943 memsize = conf_msize; 944 945 error = ed_alloc_memory(dev, 0, memsize); 946 if (error) 947 return (error); 948 949 sc->mem_start = (caddr_t) rman_get_virtual(sc->mem_res); 950 sc->mem_size = memsize; 951 952 /* Reset card to force it into a known state. */ 953 ed_asic_outb(sc, 0, 0x00); 954 DELAY(100); 955 956 /* 957 * Here we check the card ROM, if the checksum passes, and the 958 * type code and ethernet address check out, then we know we have 959 * an SIC card. 960 */ 961 ed_asic_outb(sc, 0, 0x81); 962 DELAY(100); 963 964 sum = sc->mem_start[6]; 965 for (i = 0; i < ETHER_ADDR_LEN; i++) { 966 sum ^= (sc->arpcom.ac_enaddr[i] = sc->mem_start[i]); 967 } 968#ifdef ED_DEBUG 969 device_printf(dev, "ed_probe_sic: got address %6D\n", 970 sc->arpcom.ac_enaddr, ":"); 971#endif 972 if (sum != 0) { 973 return (ENXIO); 974 } 975 if ((sc->arpcom.ac_enaddr[0] | sc->arpcom.ac_enaddr[1] | 976 sc->arpcom.ac_enaddr[2]) == 0) { 977 return (ENXIO); 978 } 979 980 sc->vendor = ED_VENDOR_SIC; 981 sc->type_str = "SIC"; 982 sc->isa16bit = 0; 983 sc->cr_proto = 0; 984 985 /* 986 * SIC RAM page 0x0000-0x3fff(or 0x7fff) 987 */ 988 ed_asic_outb(sc, 0, 0x80); 989 DELAY(100); 990 991 /* 992 * Now zero memory and verify that it is clear 993 */ 994 bzero(sc->mem_start, sc->mem_size); 995 996 for (i = 0; i < sc->mem_size; i++) { 997 if (sc->mem_start[i]) { 998 device_printf(dev, "failed to clear shared memory " 999 "at %jx - check configuration\n", 1000 (uintmax_t)kvtop(sc->mem_start + i)); 1001 1002 return (ENXIO); 1003 } 1004 } 1005 1006 sc->mem_shared = 1; 1007 sc->mem_end = sc->mem_start + sc->mem_size; 1008 1009 /* 1010 * allocate one xmit buffer if < 16k, two buffers otherwise 1011 */ 1012 if ((sc->mem_size < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) { 1013 sc->txb_cnt = 1; 1014 } else { 1015 sc->txb_cnt = 2; 1016 } 1017 sc->tx_page_start = 0; 1018 1019 sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE * sc->txb_cnt; 1020 sc->rec_page_stop = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE; 1021 1022 sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; 1023 1024 return (0); 1025} 1026 1027/* |
|
914 * Probe and vendor-specific initialization routine for NE1000/2000 boards 915 */ 916int 917ed_probe_Novell_generic(dev, flags) 918 device_t dev; 919 int flags; 920{ 921 struct ed_softc *sc = device_get_softc(dev); --- 2548 unchanged lines hidden --- | 1028 * Probe and vendor-specific initialization routine for NE1000/2000 boards 1029 */ 1030int 1031ed_probe_Novell_generic(dev, flags) 1032 device_t dev; 1033 int flags; 1034{ 1035 struct ed_softc *sc = device_get_softc(dev); --- 2548 unchanged lines hidden --- |