From 88dad3bc9298d18c56db35ad9bc7712ea5b11be6 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 9 Jan 2017 11:41:24 +0100 Subject: 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 d4c5b959..ba1be1ea 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 #include +#else /* __rtems__ */ +#include #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); -- cgit v1.2.3