summaryrefslogtreecommitdiffstats
path: root/sys/pci
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2003-12-08 07:54:15 +0000
committerobrien <obrien@FreeBSD.org>2003-12-08 07:54:15 +0000
commita1cabe1bbbad4ba662b0615ee6af81256ccca608 (patch)
treea76375ea757ab61d6de7a0c5ec2362d2e15d403f /sys/pci
parent4867d63660a56522f101639e5641133ac86d1636 (diff)
downloadFreeBSD-src-a1cabe1bbbad4ba662b0615ee6af81256ccca608.zip
FreeBSD-src-a1cabe1bbbad4ba662b0615ee6af81256ccca608.tar.gz
Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.
Requested by: bde,imp
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/if_pcn.c10
-rw-r--r--sys/pci/if_rl.c10
-rw-r--r--sys/pci/if_sf.c10
-rw-r--r--sys/pci/if_sis.c8
-rw-r--r--sys/pci/if_sk.c10
-rw-r--r--sys/pci/if_ste.c24
-rw-r--r--sys/pci/if_tl.c8
-rw-r--r--sys/pci/if_vr.c10
-rw-r--r--sys/pci/if_wb.c10
-rw-r--r--sys/pci/if_xl.c10
10 files changed, 56 insertions, 54 deletions
diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c
index 56d57e1..0819db0 100644
--- a/sys/pci/if_pcn.c
+++ b/sys/pci/if_pcn.c
@@ -136,7 +136,7 @@ static void pcn_miibus_statchg (device_t);
static void pcn_setfilt (struct ifnet *);
static void pcn_setmulti (struct pcn_softc *);
-static u_int32_t pcn_mchash (caddr_t);
+static uint32_t pcn_mchash (const uint8_t *);
static void pcn_reset (struct pcn_softc *);
static int pcn_list_rx_init (struct pcn_softc *);
static int pcn_list_tx_init (struct pcn_softc *);
@@ -310,11 +310,11 @@ pcn_miibus_statchg(dev)
static u_int32_t
pcn_mchash(addr)
- caddr_t addr;
+ const uint8_t *addr;
{
- u_int32_t crc;
- int idx, bit;
- u_int8_t data;
+ uint32_t crc;
+ int idx, bit;
+ uint8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c
index 746ecdd..921d047 100644
--- a/sys/pci/if_rl.c
+++ b/sys/pci/if_rl.c
@@ -206,7 +206,7 @@ static int rl_miibus_readreg (device_t, int, int);
static int rl_miibus_writereg (device_t, int, int, int);
static void rl_miibus_statchg (device_t);
-static u_int32_t rl_mchash (caddr_t);
+static uint32_t rl_mchash (const uint8_t *);
static void rl_setmulti (struct rl_softc *);
static void rl_reset (struct rl_softc *);
static int rl_list_tx_init (struct rl_softc *);
@@ -737,11 +737,11 @@ rl_miibus_statchg(dev)
*/
static u_int32_t
rl_mchash(addr)
- caddr_t addr;
+ const uint8_t *addr;
{
- u_int32_t crc, carry;
- int idx, bit;
- u_int8_t data;
+ uint32_t crc, carry;
+ int idx, bit;
+ uint8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c
index 254277a..fc56f3b 100644
--- a/sys/pci/if_sf.c
+++ b/sys/pci/if_sf.c
@@ -159,7 +159,7 @@ static int sf_setvlan (struct sf_softc *, int, u_int32_t);
#endif
static u_int8_t sf_read_eeprom (struct sf_softc *, int);
-static u_int32_t sf_mchash (caddr_t);
+static uint32_t sf_mchash (const uint8_t *);
static int sf_miibus_readreg (device_t, int, int);
static int sf_miibus_writereg (device_t, int, int, int);
@@ -260,11 +260,11 @@ csr_write_4(sc, reg, val)
static u_int32_t
sf_mchash(addr)
- caddr_t addr;
+ const uint8_t *addr;
{
- u_int32_t crc, carry;
- int idx, bit;
- u_int8_t data;
+ uint32_t crc, carry;
+ int idx, bit;
+ uint8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index bd3a265..8177243 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -155,7 +155,7 @@ static void sis_miibus_statchg (device_t);
static void sis_setmulti_sis (struct sis_softc *);
static void sis_setmulti_ns (struct sis_softc *);
-static u_int32_t sis_mchash (struct sis_softc *, caddr_t);
+static uint32_t sis_mchash (struct sis_softc *, const uint8_t *);
static void sis_reset (struct sis_softc *);
static int sis_list_rx_init (struct sis_softc *);
static int sis_list_tx_init (struct sis_softc *);
@@ -839,11 +839,11 @@ sis_miibus_statchg(dev)
static u_int32_t
sis_mchash(sc, addr)
struct sis_softc *sc;
- caddr_t addr;
+ const uint8_t *addr;
{
- u_int32_t crc, carry;
+ uint32_t crc, carry;
int idx, bit;
- u_int8_t data;
+ uint8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c
index 4c6611f..12b6a41 100644
--- a/sys/pci/if_sk.c
+++ b/sys/pci/if_sk.c
@@ -224,7 +224,7 @@ static int sk_marv_miibus_writereg (struct sk_if_softc *, int, int,
int);
static void sk_marv_miibus_statchg (struct sk_if_softc *);
-static u_int32_t sk_mchash (caddr_t);
+static uint32_t sk_mchash (const uint8_t *);
static void sk_setfilt (struct sk_if_softc *, caddr_t, int);
static void sk_setmulti (struct sk_if_softc *);
@@ -714,11 +714,11 @@ sk_marv_miibus_statchg(sc_if)
static u_int32_t
sk_mchash(addr)
- caddr_t addr;
+ const uint8_t *addr;
{
- u_int32_t crc;
- int idx, bit;
- u_int8_t data;
+ uint32_t crc;
+ int idx, bit;
+ uint8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c
index 5c08f85..e85fe96 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -119,7 +119,7 @@ static void ste_miibus_statchg (device_t);
static int ste_eeprom_wait (struct ste_softc *);
static int ste_read_eeprom (struct ste_softc *, caddr_t, int, int, int);
static void ste_wait (struct ste_softc *);
-static u_int32_t ste_mchash (caddr_t);
+static u_int8_t ste_calchash (caddr_t);
static void ste_setmulti (struct ste_softc *);
static int ste_init_rx_list (struct ste_softc *);
static void ste_init_tx_list (struct ste_softc *);
@@ -552,22 +552,24 @@ ste_read_eeprom(sc, dest, off, cnt, swap)
return(err ? 1 : 0);
}
-static u_int32_t
-ste_mchash(addr)
- caddr_t addr;
+static u_int8_t
+ste_calchash(addr)
+ caddr_t addr;
{
- u_int32_t crc, carry;
- int idx, bit;
- u_int8_t data;
+ u_int32_t crc, carry;
+ int i, j;
+ u_int8_t c;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
- for (idx = 0; idx < 6; idx++) {
- for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) {
- carry = ((crc & 0x80000000) ? 1 : 0) ^ (data & 0x01);
+ for (i = 0; i < 6; i++) {
+ c = *(addr + i);
+ for (j = 0; j < 8; j++) {
+ carry = ((crc & 0x80000000) ? 1 : 0) ^ (c & 0x01);
crc <<= 1;
+ c >>= 1;
if (carry)
crc = (crc ^ 0x04c11db6) | carry;
}
@@ -603,7 +605,7 @@ ste_setmulti(sc)
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
- h = ste_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
+ h = ste_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
if (h < 32)
hashes[0] |= (1 << h);
else
diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c
index dd20b2a..47bf52e 100644
--- a/sys/pci/if_tl.c
+++ b/sys/pci/if_tl.c
@@ -298,7 +298,7 @@ static int tl_miibus_writereg (device_t, int, int, int);
static void tl_miibus_statchg (device_t);
static void tl_setmode (struct tl_softc *, int);
-static u_int32_t tl_mchash (caddr_t);
+static uint32_t tl_mchash (const uint8_t *);
static void tl_setmulti (struct tl_softc *);
static void tl_setfilt (struct tl_softc *, caddr_t, int);
static void tl_softreset (struct tl_softc *, int);
@@ -887,11 +887,11 @@ tl_setmode(sc, media)
* Bytes 0-2 and 3-5 are symmetrical, so are folded together. Then
* the folded 24-bit value is split into 6-bit portions and XOR'd.
*/
-static u_int32_t
+static uint32_t
tl_mchash(addr)
- caddr_t addr;
+ const uint8_t *addr;
{
- int t;
+ int t;
t = (addr[0] ^ addr[3]) << 16 | (addr[1] ^ addr[4]) << 8 |
(addr[2] ^ addr[5]);
diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c
index 1d35c3f..c2221be 100644
--- a/sys/pci/if_vr.c
+++ b/sys/pci/if_vr.c
@@ -160,7 +160,7 @@ static int vr_miibus_writereg (device_t, int, int, int);
static void vr_miibus_statchg (device_t);
static void vr_setcfg (struct vr_softc *, int);
-static u_int32_t vr_mchash (caddr_t);
+static uint32_t vr_mchash (const uint8_t *);
static void vr_setmulti (struct vr_softc *);
static void vr_reset (struct vr_softc *);
static int vr_list_rx_init (struct vr_softc *);
@@ -566,11 +566,11 @@ vr_miibus_statchg(dev)
*/
static u_int32_t
vr_mchash(addr)
- caddr_t addr;
+ const uint8_t *addr;
{
- u_int32_t crc, carry;
- int idx, bit;
- u_int8_t data;
+ uint32_t crc, carry;
+ int idx, bit;
+ uint8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c
index 14be722..c4f4dd3 100644
--- a/sys/pci/if_wb.c
+++ b/sys/pci/if_wb.c
@@ -174,7 +174,7 @@ static int wb_mii_readreg (struct wb_softc *, struct wb_mii_frame *);
static int wb_mii_writereg (struct wb_softc *, struct wb_mii_frame *);
static void wb_setcfg (struct wb_softc *, u_int32_t);
-static u_int32_t wb_mchash (caddr_t);
+static uint32_t wb_mchash (const uint8_t *);
static void wb_setmulti (struct wb_softc *);
static void wb_reset (struct wb_softc *);
static void wb_fixmedia (struct wb_softc *);
@@ -588,11 +588,11 @@ wb_miibus_statchg(dev)
static u_int32_t
wb_mchash(addr)
- caddr_t addr;
+ const uint8_t *addr;
{
- u_int32_t crc, carry;
- int idx, bit;
- u_int8_t data;
+ uint32_t crc, carry;
+ int idx, bit;
+ uint8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index e087506..a3a82ae 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -238,7 +238,7 @@ static int xl_mii_writereg (struct xl_softc *, struct xl_mii_frame *);
static void xl_setcfg (struct xl_softc *);
static void xl_setmode (struct xl_softc *, int);
-static u_int32_t xl_mchash (caddr_t);
+static uint32_t xl_mchash (const uint8_t *);
static void xl_setmulti (struct xl_softc *);
static void xl_setmulti_hash (struct xl_softc *);
static void xl_reset (struct xl_softc *);
@@ -812,11 +812,11 @@ xl_read_eeprom(sc, dest, off, cnt, swap)
*/
static u_int32_t
xl_mchash(addr)
- caddr_t addr;
+ const uint8_t *addr;
{
- u_int32_t crc, carry;
- int idx, bit;
- u_int8_t data;
+ uint32_t crc, carry;
+ int idx, bit;
+ uint8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
OpenPOWER on IntegriCloud