From 8c7ff1f331b0f38f80a4734336d50c9c6b9b3ebc Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Fri, 1 Oct 2004 15:23:31 +0000 Subject: 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 --- sys/dev/dc/if_dc.c | 8 ++++---- sys/pci/if_dc.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sys') diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 40ead6d3d3a7..22743e80dba5 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); } } diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c index 40ead6d3d3a7..22743e80dba5 100644 --- a/sys/pci/if_dc.c +++ b/sys/pci/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); } } -- cgit v1.3