Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Fix possible endian issue. Untested.
details: https://anonhg.NetBSD.org/src/rev/0842aa63c080
branches: trunk
changeset: 747596:0842aa63c080
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Tue Sep 22 15:25:12 2009 +0000
description:
Fix possible endian issue. Untested.
diffstat:
sys/dev/ic/cs89x0.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diffs (51 lines):
diff -r e03d90487ed8 -r 0842aa63c080 sys/dev/ic/cs89x0.c
--- a/sys/dev/ic/cs89x0.c Tue Sep 22 15:04:41 2009 +0000
+++ b/sys/dev/ic/cs89x0.c Tue Sep 22 15:25:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cs89x0.c,v 1.26 2009/09/22 14:55:19 tsutsui Exp $ */
+/* $NetBSD: cs89x0.c,v 1.27 2009/09/22 15:25:12 tsutsui Exp $ */
/*
* Copyright (c) 2004 Christopher Gilbert
@@ -212,7 +212,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.26 2009/09/22 14:55:19 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.27 2009/09/22 15:25:12 tsutsui Exp $");
#include "opt_inet.h"
@@ -812,7 +812,8 @@
int
cs_get_enaddr(struct cs_softc *sc)
{
- u_int16_t *myea;
+ uint16_t myea[ETHER_ADDR_LEN / sizeof(uint16_t)];
+ int i;
if (cs_verify_eeprom(sc) == CS_ERROR) {
aprint_error_dev(sc->sc_dev,
@@ -820,10 +821,7 @@
return (CS_ERROR);
}
- myea = (u_int16_t *)sc->sc_enaddr;
-
/* Get Ethernet address from the EEPROM */
- /* XXX this will likely lose on a big-endian machine. -- cgd */
if (sc->sc_cfgflags & CFGFLG_PARSE_EEPROM) {
if (cs_read_pktpg_from_eeprom(sc, PKTPG_IND_ADDR, &myea[0])
== CS_ERROR)
@@ -843,6 +841,11 @@
goto eeprom_bad;
}
+ for (i = 0; i < __arraycount(myea); i++) {
+ sc->sc_enaddr[i * 2 + 0] = myea[i];
+ sc->sc_enaddr[i * 2 + 1] = myea[i] >> 8;
+ }
+
return (CS_OK);
eeprom_bad:
Home |
Main Index |
Thread Index |
Old Index