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

Sebastian Huber sebh at rtems.org
Tue Jan 10 10:06:12 UTC 2017


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jan  9 11:41:24 2017 +0100

if_dwc: Use rtems_bsd_get_mac_address()

---

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

diff --git a/freebsd/sys/dev/dwc/if_dwc.c b/freebsd/sys/dev/dwc/if_dwc.c
index d4c5b95..ba1be1e 100644
--- a/freebsd/sys/dev/dwc/if_dwc.c
+++ b/freebsd/sys/dev/dwc/if_dwc.c
@@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$");
 #ifndef __rtems__
 #include <dev/ofw/ofw_bus.h>
 #include <dev/ofw/ofw_bus_subr.h>
+#else /* __rtems__ */
+#include <rtems/bsd/bsd.h>
 #endif /* __rtems__ */
 
 #ifdef EXT_RESOURCES
@@ -1085,7 +1087,11 @@ out:
 static int
 dwc_get_hwaddr(struct dwc_softc *sc, uint8_t *hwaddr)
 {
+#ifndef __rtems__
 	uint32_t hi, lo, rnd;
+#else /* __rtems__ */
+	uint32_t hi, lo;
+#endif /* __rtems__ */
 
 	/*
 	 * Try to recover a MAC address from the running hardware. If there's
@@ -1106,6 +1112,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';
@@ -1113,6 +1120,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