[rtems-libbsd commit] if_dwc: Use rtems_bsd_get_mac_address()

Sebastian Huber sebh at rtems.org
Wed Apr 1 07:16:38 UTC 2015


Module:    rtems-libbsd
Branch:    master
Commit:    d3a6abb1a5c09bee8a1410752becf128fb341298
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=d3a6abb1a5c09bee8a1410752becf128fb341298

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Mar 26 15:19:53 2015 +0100

if_dwc: Use rtems_bsd_get_mac_address()

---

 freebsd/sys/dev/dwc/if_dwc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/freebsd/sys/dev/dwc/if_dwc.c b/freebsd/sys/dev/dwc/if_dwc.c
index 4aaad5d..15d4d59 100644
--- a/freebsd/sys/dev/dwc/if_dwc.c
+++ b/freebsd/sys/dev/dwc/if_dwc.c
@@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$");
 #include <rtems/bsd/local/miibus_if.h>
 #ifdef __rtems__
 #pragma GCC diagnostic ignored "-Wpointer-sign"
+#include <rtems/bsd/bsd.h>
 #endif /* __rtems__ */
 
 #define	READ4(_sc, _reg) \
@@ -1061,7 +1062,9 @@ out:
 static int
 dwc_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr)
 {
+#ifndef __rtems__
 	int rnd;
+#endif /* __rtems__ */
 	int lo;
 	int hi;
 
@@ -1084,6 +1087,7 @@ dwc_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr)
 		hwaddr[4] = (hi >>  0) & 0xff;
 		hwaddr[5] = (hi >>  8) & 0xff;
 	} else {
+#ifndef __rtems__
 		rnd = arc4random() & 0x00ffffff;
 		hwaddr[0] = 'b';
 		hwaddr[1] = 's';
@@ -1091,6 +1095,10 @@ dwc_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr)
 		hwaddr[3] = rnd >> 16;
 		hwaddr[4] = rnd >>  8;
 		hwaddr[5] = rnd >>  0;
+#else /* __rtems__ */
+		rtems_bsd_get_mac_address(device_get_name(sc->dev),
+		    device_get_unit(sc->dev), hwaddr);
+#endif /* __rtems__ */
 	}
 
 	return (0);




More information about the vc mailing list