diff options
author | Peter Valchev <pvalchev@cvs.openbsd.org> | 2004-12-12 06:13:33 +0000 |
---|---|---|
committer | Peter Valchev <pvalchev@cvs.openbsd.org> | 2004-12-12 06:13:33 +0000 |
commit | 839703c0551ff86eb531372ecdb87134867c86a1 (patch) | |
tree | 67a45db11f833cbb9ef5c41e798d0e6b32b845a0 /sys/dev/pci/if_vge.c | |
parent | 4bb5cdd54e7c2da77fd72fea602398df470ff672 (diff) |
a hack to read MAC address correctly on big endian; ok drahn
however a correct clean way to do this should be found
Diffstat (limited to 'sys/dev/pci/if_vge.c')
-rw-r--r-- | sys/dev/pci/if_vge.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index e166569d260..4ddfe99dd99 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.1 2004/12/01 01:29:00 pvalchev Exp $ */ +/* $OpenBSD: if_vge.c,v 1.2 2004/12/12 06:13:32 pvalchev Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -716,13 +716,14 @@ void vge_attach(struct device *parent, struct device *self, void *aux) { u_char eaddr[ETHER_ADDR_LEN]; + u_int16_t as[3]; struct vge_softc *sc = (struct vge_softc *)self; struct pci_attach_args *pa = aux; pci_chipset_tag_t pc = pa->pa_pc; pci_intr_handle_t ih; const char *intrstr = NULL; struct ifnet *ifp; - int error = 0; + int error = 0, i; bus_size_t iosize; pcireg_t command; @@ -778,7 +779,11 @@ vge_attach(struct device *parent, struct device *self, void *aux) /* * Get station address from the EEPROM. */ - vge_read_eeprom(sc, (caddr_t)eaddr, VGE_EE_EADDR, 3, 0); + vge_read_eeprom(sc, (caddr_t)as, VGE_EE_EADDR, 3, 0); + for (i = 0; i < 3; i++) { + eaddr[(i * 2) + 0] = as[i] & 0xff; + eaddr[(i * 2) + 1] = as[i] >> 8; + } bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); |