Deleted Added
full compact
if_ed.c (139749) if_ed.c (140468)
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

--- 12 unchanged lines hidden (view full) ---

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
28#include <sys/cdefs.h>
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

--- 12 unchanged lines hidden (view full) ---

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
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/ed/if_ed.c 139749 2005-01-06 01:43:34Z imp $");
29__FBSDID("$FreeBSD: head/sys/dev/ed/if_ed.c 140468 2005-01-19 07:37:32Z imp $");
30
31/*
32 * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
33 * adapters. By David Greenman, 29-April-1993
34 *
35 * Currently supports the Western Digital/SMC 8003 and 8013 series,
36 * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,
37 * and a variety of similar clones.

--- 41 unchanged lines hidden (view full) ---

79static int ed_ioctl (struct ifnet *, u_long, caddr_t);
80static void ed_start (struct ifnet *);
81static void ed_reset (struct ifnet *);
82static void ed_watchdog (struct ifnet *);
83#ifndef ED_NO_MIIBUS
84static void ed_tick (void *);
85#endif
86
30
31/*
32 * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
33 * adapters. By David Greenman, 29-April-1993
34 *
35 * Currently supports the Western Digital/SMC 8003 and 8013 series,
36 * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,
37 * and a variety of similar clones.

--- 41 unchanged lines hidden (view full) ---

79static int ed_ioctl (struct ifnet *, u_long, caddr_t);
80static void ed_start (struct ifnet *);
81static void ed_reset (struct ifnet *);
82static void ed_watchdog (struct ifnet *);
83#ifndef ED_NO_MIIBUS
84static void ed_tick (void *);
85#endif
86
87static void ds_getmcaf (struct ed_softc *, u_int32_t *);
87static void ds_getmcaf (struct ed_softc *, uint32_t *);
88
89static void ed_get_packet (struct ed_softc *, char *, /* u_short */ int);
90
91static __inline void ed_rint (struct ed_softc *);
92static __inline void ed_xmit (struct ed_softc *);
93static __inline char * ed_ring_copy(struct ed_softc *, char *, char *,
94 /* u_short */ int);
95static void ed_hpp_set_physical_link(struct ed_softc *);

--- 2973 unchanged lines hidden (view full) ---

3069 if (sc->hpp_mem_start) {
3070
3071 /* Enable memory mapped access. */
3072 ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options &
3073 ~(ED_HPP_OPTION_MEM_DISABLE |
3074 ED_HPP_OPTION_BOOT_ROM_ENB));
3075
3076 if (use_32bit_access && (amount > 3)) {
88
89static void ed_get_packet (struct ed_softc *, char *, /* u_short */ int);
90
91static __inline void ed_rint (struct ed_softc *);
92static __inline void ed_xmit (struct ed_softc *);
93static __inline char * ed_ring_copy(struct ed_softc *, char *, char *,
94 /* u_short */ int);
95static void ed_hpp_set_physical_link(struct ed_softc *);

--- 2973 unchanged lines hidden (view full) ---

3069 if (sc->hpp_mem_start) {
3070
3071 /* Enable memory mapped access. */
3072 ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options &
3073 ~(ED_HPP_OPTION_MEM_DISABLE |
3074 ED_HPP_OPTION_BOOT_ROM_ENB));
3075
3076 if (use_32bit_access && (amount > 3)) {
3077 u_int32_t *dl = (u_int32_t *) dst;
3078 volatile u_int32_t *const sl =
3079 (u_int32_t *) sc->hpp_mem_start;
3080 u_int32_t *const fence = dl + (amount >> 2);
3077 uint32_t *dl = (uint32_t *) dst;
3078 volatile uint32_t *const sl =
3079 (uint32_t *) sc->hpp_mem_start;
3080 uint32_t *const fence = dl + (amount >> 2);
3081
3082 /* Copy out NIC data. We could probably write this
3083 as a `movsl'. The currently generated code is lousy.
3084 */
3085
3086 while (dl < fence)
3087 *dl++ = *sl;
3088

--- 148 unchanged lines hidden (view full) ---

3237 /* finish the last word of the previous mbuf */
3238 if (wantbyte) {
3239 savebyte[1] = *data;
3240 *d = *((u_short *) savebyte);
3241 data++; len--; wantbyte = 0;
3242 }
3243 /* output contiguous words */
3244 if ((len > 3) && (use_32bit_accesses)) {
3081
3082 /* Copy out NIC data. We could probably write this
3083 as a `movsl'. The currently generated code is lousy.
3084 */
3085
3086 while (dl < fence)
3087 *dl++ = *sl;
3088

--- 148 unchanged lines hidden (view full) ---

3237 /* finish the last word of the previous mbuf */
3238 if (wantbyte) {
3239 savebyte[1] = *data;
3240 *d = *((u_short *) savebyte);
3241 data++; len--; wantbyte = 0;
3242 }
3243 /* output contiguous words */
3244 if ((len > 3) && (use_32bit_accesses)) {
3245 volatile u_int32_t *const dl =
3246 (volatile u_int32_t *) d;
3247 u_int32_t *sl = (u_int32_t *) data;
3248 u_int32_t *fence = sl + (len >> 2);
3245 volatile uint32_t *const dl =
3246 (volatile uint32_t *) d;
3247 uint32_t *sl = (uint32_t *) data;
3248 uint32_t *fence = sl + (len >> 2);
3249
3250 while (sl < fence)
3251 *dl = *sl++;
3252
3253 data += (len & ~3);
3254 len &= 3;
3255 }
3256 /* finish off remain 16 bit writes */

--- 199 unchanged lines hidden (view full) ---

3456 /* Set page 0 registers */
3457 ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP);
3458
3459 ed_nic_outb(sc, ED_P0_RCR, ED_RCR_PRO | ED_RCR_AM |
3460 ED_RCR_AB | ED_RCR_AR | ED_RCR_SEP | reg1);
3461 } else {
3462 /* set up multicast addresses and filter modes */
3463 if (ifp->if_flags & IFF_MULTICAST) {
3249
3250 while (sl < fence)
3251 *dl = *sl++;
3252
3253 data += (len & ~3);
3254 len &= 3;
3255 }
3256 /* finish off remain 16 bit writes */

--- 199 unchanged lines hidden (view full) ---

3456 /* Set page 0 registers */
3457 ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP);
3458
3459 ed_nic_outb(sc, ED_P0_RCR, ED_RCR_PRO | ED_RCR_AM |
3460 ED_RCR_AB | ED_RCR_AR | ED_RCR_SEP | reg1);
3461 } else {
3462 /* set up multicast addresses and filter modes */
3463 if (ifp->if_flags & IFF_MULTICAST) {
3464 u_int32_t mcaf[2];
3464 uint32_t mcaf[2];
3465
3466 if (ifp->if_flags & IFF_ALLMULTI) {
3467 mcaf[0] = 0xffffffff;
3468 mcaf[1] = 0xffffffff;
3469 } else
3470 ds_getmcaf(sc, mcaf);
3471
3472 /*

--- 30 unchanged lines hidden (view full) ---

3503
3504/*
3505 * Compute the multicast address filter from the
3506 * list of multicast addresses we need to listen to.
3507 */
3508static void
3509ds_getmcaf(sc, mcaf)
3510 struct ed_softc *sc;
3465
3466 if (ifp->if_flags & IFF_ALLMULTI) {
3467 mcaf[0] = 0xffffffff;
3468 mcaf[1] = 0xffffffff;
3469 } else
3470 ds_getmcaf(sc, mcaf);
3471
3472 /*

--- 30 unchanged lines hidden (view full) ---

3503
3504/*
3505 * Compute the multicast address filter from the
3506 * list of multicast addresses we need to listen to.
3507 */
3508static void
3509ds_getmcaf(sc, mcaf)
3510 struct ed_softc *sc;
3511 u_int32_t *mcaf;
3511 uint32_t *mcaf;
3512{
3512{
3513 register u_int32_t index;
3513 register uint32_t index;
3514 register u_char *af = (u_char *) mcaf;
3515 struct ifmultiaddr *ifma;
3516
3517 mcaf[0] = 0;
3518 mcaf[1] = 0;
3519
3520 TAILQ_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) {
3521 if (ifma->ifma_addr->sa_family != AF_LINK)
3522 continue;
3523 index = ether_crc32_be(LLADDR((struct sockaddr_dl *)
3524 ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
3525 af[index >> 3] |= 1 << (index & 7);
3526 }
3527}
3514 register u_char *af = (u_char *) mcaf;
3515 struct ifmultiaddr *ifma;
3516
3517 mcaf[0] = 0;
3518 mcaf[1] = 0;
3519
3520 TAILQ_FOREACH(ifma, &sc->arpcom.ac_if.if_multiaddrs, ifma_link) {
3521 if (ifma->ifma_addr->sa_family != AF_LINK)
3522 continue;
3523 index = ether_crc32_be(LLADDR((struct sockaddr_dl *)
3524 ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
3525 af[index >> 3] |= 1 << (index & 7);
3526 }
3527}