summaryrefslogtreecommitdiffstats
path: root/sys/dev/dc
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2004-10-01 15:23:31 +0000
committermux <mux@FreeBSD.org>2004-10-01 15:23:31 +0000
commit05b626ea1779415ac14811eedda367757629b424 (patch)
tree7685fb27f5912f647934f7a3ff75716424e80709 /sys/dev/dc
parent0efc91b067ab28879f1c36e691901b416e50f3bc (diff)
downloadFreeBSD-src-05b626ea1779415ac14811eedda367757629b424.zip
FreeBSD-src-05b626ea1779415ac14811eedda367757629b424.tar.gz
Read the MAC address in the EEPROM in the correct byte order. This
is a no-op on little endian architectures, but fixes getting the MAC address for some dc(4) cards on big endian architectures. This is a RELENG_5 candidate. Tested by: gallatin (powerpc), marius (sparc64) First version of the patch written by: gallatin
Diffstat (limited to 'sys/dev/dc')
-rw-r--r--sys/dev/dc/if_dc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index 40ead6d..22743e8 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -584,7 +584,7 @@ dc_eeprom_getword(struct dc_softc *sc, int addr, u_int16_t *dest)
* Read a sequence of words from the EEPROM.
*/
static void
-dc_read_eeprom(struct dc_softc *sc, caddr_t dest, int off, int cnt, int swap)
+dc_read_eeprom(struct dc_softc *sc, caddr_t dest, int off, int cnt, int be)
{
int i;
u_int16_t word = 0, *ptr;
@@ -597,10 +597,10 @@ dc_read_eeprom(struct dc_softc *sc, caddr_t dest, int off, int cnt, int swap)
else
dc_eeprom_getword(sc, off + i, &word);
ptr = (u_int16_t *)(dest + (i * 2));
- if (swap)
- *ptr = ntohs(word);
+ if (be)
+ *ptr = be16toh(word);
else
- *ptr = word;
+ *ptr = le16toh(word);
}
}
OpenPOWER on IntegriCloud