summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2009-10-20 23:39:38 +0000
committerTill Straumann <strauman@slac.stanford.edu>2009-10-20 23:39:38 +0000
commit8287eb7e0024033d8b96a04ee0913d238b35bbc2 (patch)
tree4c620c45f90fdc8275ef473e000969d5497b7cbc
parent908739ed6ea937454a1528da485db4a697f954c6 (diff)
2009-10-20 Till Straumann <Till.Straumann@TU-Berlin.de>
* if_pcn/if_pcn.c: fixed 'type-punned pointer' warning. Use 'memcpy' to copy 2 bytes to a short. This requires another #ifdef __rtems__, however.
-rw-r--r--bsd_eth_drivers/if_pcn/if_pcn.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/bsd_eth_drivers/if_pcn/if_pcn.c b/bsd_eth_drivers/if_pcn/if_pcn.c
index 7dde188..b116265 100644
--- a/bsd_eth_drivers/if_pcn/if_pcn.c
+++ b/bsd_eth_drivers/if_pcn/if_pcn.c
@@ -1509,7 +1509,6 @@ pcn_init_locked(sc)
#ifndef __rtems__
mii = device_get_softc(sc->pcn_miibus);
ife = mii->mii_media.ifm_cur;
-#endif
/* Set MAC address */
{ unsigned tmp;
@@ -1521,6 +1520,22 @@ pcn_init_locked(sc)
tmp = htole16(((u_int16_t *)IF_LLADDR(sc->pcn_ifp))[2]);
pcn_csr_write(sc, PCN_CSR_PAR2, tmp);
}
+#else
+ /* Set MAC address */
+ { unsigned tmp;
+ u_int16_t s;
+ /* fix endinanness; LLADDR gets swapped on a BE machine */
+ memcpy(&s, IF_LLADDR(sc->pcn_ifp) + 0, sizeof(s));
+ tmp = htole16(s);
+ pcn_csr_write(sc, PCN_CSR_PAR0, tmp);
+ memcpy(&s, IF_LLADDR(sc->pcn_ifp) + 2, sizeof(s));
+ tmp = htole16(s);
+ pcn_csr_write(sc, PCN_CSR_PAR1, tmp);
+ memcpy(&s, IF_LLADDR(sc->pcn_ifp) + 4, sizeof(s));
+ tmp = htole16(s);
+ pcn_csr_write(sc, PCN_CSR_PAR2, tmp);
+ }
+#endif
/* Init circular RX list. */
if (pcn_list_rx_init(sc) == ENOBUFS) {