Deleted Added
full compact
if_rl.c (121939) if_rl.c (122625)
1/*
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

77 *
78 * The 8129 chip is an older version of the 8139 that uses an external PHY
79 * chip. The 8129 has a serial MDIO interface for accessing the MII where
80 * the 8139 lets you directly access the on-board PHY registers. We need
81 * to select which interface to use depending on the chip type.
82 */
83
84#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. 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

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

77 *
78 * The 8129 chip is an older version of the 8139 that uses an external PHY
79 * chip. The 8129 has a serial MDIO interface for accessing the MII where
80 * the 8139 lets you directly access the on-board PHY registers. We need
81 * to select which interface to use depending on the chip type.
82 */
83
84#include <sys/cdefs.h>
85__FBSDID("$FreeBSD: head/sys/pci/if_rl.c 121939 2003-11-03 09:22:18Z dfr $");
85__FBSDID("$FreeBSD: head/sys/pci/if_rl.c 122625 2003-11-13 20:55:53Z obrien $");
86
87#include <sys/param.h>
88#include <sys/endian.h>
89#include <sys/systm.h>
90#include <sys/sockio.h>
91#include <sys/mbuf.h>
92#include <sys/malloc.h>
93#include <sys/kernel.h>

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

202static void rl_mii_send (struct rl_softc *, u_int32_t, int);
203static int rl_mii_readreg (struct rl_softc *, struct rl_mii_frame *);
204static int rl_mii_writereg (struct rl_softc *, struct rl_mii_frame *);
205
206static int rl_miibus_readreg (device_t, int, int);
207static int rl_miibus_writereg (device_t, int, int, int);
208static void rl_miibus_statchg (device_t);
209
86
87#include <sys/param.h>
88#include <sys/endian.h>
89#include <sys/systm.h>
90#include <sys/sockio.h>
91#include <sys/mbuf.h>
92#include <sys/malloc.h>
93#include <sys/kernel.h>

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

202static void rl_mii_send (struct rl_softc *, u_int32_t, int);
203static int rl_mii_readreg (struct rl_softc *, struct rl_mii_frame *);
204static int rl_mii_writereg (struct rl_softc *, struct rl_mii_frame *);
205
206static int rl_miibus_readreg (device_t, int, int);
207static int rl_miibus_writereg (device_t, int, int, int);
208static void rl_miibus_statchg (device_t);
209
210static u_int8_t rl_calchash (caddr_t);
210static u_int32_t rl_mchash (caddr_t);
211static void rl_setmulti (struct rl_softc *);
212static void rl_reset (struct rl_softc *);
213static int rl_list_tx_init (struct rl_softc *);
214
215static void rl_dma_map_rxbuf (void *, bus_dma_segment_t *, int, int);
216static void rl_dma_map_txbuf (void *, bus_dma_segment_t *, int, int);
217
218#ifdef RL_USEIOSPACE

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

730 device_t dev;
731{
732 return;
733}
734
735/*
736 * Calculate CRC of a multicast group address, return the upper 6 bits.
737 */
211static void rl_setmulti (struct rl_softc *);
212static void rl_reset (struct rl_softc *);
213static int rl_list_tx_init (struct rl_softc *);
214
215static void rl_dma_map_rxbuf (void *, bus_dma_segment_t *, int, int);
216static void rl_dma_map_txbuf (void *, bus_dma_segment_t *, int, int);
217
218#ifdef RL_USEIOSPACE

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

730 device_t dev;
731{
732 return;
733}
734
735/*
736 * Calculate CRC of a multicast group address, return the upper 6 bits.
737 */
738static u_int8_t
739rl_calchash(addr)
740 caddr_t addr;
738static u_int32_t
739rl_mchash(addr)
740 caddr_t addr;
741{
741{
742 u_int32_t crc, carry;
743 int i, j;
744 u_int8_t c;
742 u_int32_t crc, carry;
743 int idx, bit;
744 u_int8_t data;
745
746 /* Compute CRC for the address value. */
747 crc = 0xFFFFFFFF; /* initial value */
748
745
746 /* Compute CRC for the address value. */
747 crc = 0xFFFFFFFF; /* initial value */
748
749 for (i = 0; i < 6; i++) {
750 c = *(addr + i);
751 for (j = 0; j < 8; j++) {
752 carry = ((crc & 0x80000000) ? 1 : 0) ^ (c & 0x01);
749 for (idx = 0; idx < 6; idx++) {
750 for (data = *addr++, bit = 0; bit < 8; bit++, data >>=1 ) {
751 carry = ((crc & 0x80000000) ? 1 : 0) ^ (data & 0x01);
753 crc <<= 1;
752 crc <<= 1;
754 c >>= 1;
755 if (carry)
756 crc = (crc ^ 0x04c11db6) | carry;
757 }
758 }
759
760 /* return the filter bit position */
761 return(crc >> 26);
762}

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

790 /* first, zot all the existing hash bits */
791 CSR_WRITE_4(sc, RL_MAR0, 0);
792 CSR_WRITE_4(sc, RL_MAR4, 0);
793
794 /* now program new ones */
795 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
796 if (ifma->ifma_addr->sa_family != AF_LINK)
797 continue;
753 if (carry)
754 crc = (crc ^ 0x04c11db6) | carry;
755 }
756 }
757
758 /* return the filter bit position */
759 return(crc >> 26);
760}

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

788 /* first, zot all the existing hash bits */
789 CSR_WRITE_4(sc, RL_MAR0, 0);
790 CSR_WRITE_4(sc, RL_MAR4, 0);
791
792 /* now program new ones */
793 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
794 if (ifma->ifma_addr->sa_family != AF_LINK)
795 continue;
798 h = rl_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
796 h = rl_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
799 if (h < 32)
800 hashes[0] |= (1 << h);
801 else
802 hashes[1] |= (1 << (h - 32));
803 mcnt++;
804 }
805
806 if (mcnt)

--- 1173 unchanged lines hidden ---
797 if (h < 32)
798 hashes[0] |= (1 << h);
799 else
800 hashes[1] |= (1 << (h - 32));
801 mcnt++;
802 }
803
804 if (mcnt)

--- 1173 unchanged lines hidden ---