Date: Fri, 1 Feb 2013 16:13:34 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 221677 for review Message-ID: <201302011613.r11GDYbk060983@skunkworks.freebsd.org>
index | next in thread | raw e-mail
http://p4web.freebsd.org/@@221677?ac=10 Change 221677 by bz@bz_zenith on 2013/02/01 16:13:23 With isf(4) attaching earlier we can read the the Ethernet addresses from flash even in the fdt(4) case now. Keep the nexus code around as well and try both. Affected files ... .. //depot/projects/ctsrd/beribsd/src/sys/dev/altera/atse/if_atse.c#5 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/sys/dev/altera/atse/if_atse.c#5 (text+ko) ==== @@ -562,7 +562,7 @@ } static int -atse_ethernet_option_bits_read(device_t dev) +atse_ethernet_option_bits_read_nexus(device_t dev) { const char *at, *name; struct resource *res; @@ -628,6 +628,53 @@ } static int +atse_ethernet_option_bits_read_fdt(device_t dev) +{ + struct resource *res; + device_t isfdev; + int i, rid; + + if (atse_ethernet_option_bits_flag & ATSE_ETHERNET_OPTION_BITS_READ) + return (0); + + isfdev = device_find_child(device_get_parent(dev), "isf", 0); + if (isfdev == NULL) + return (ENOENT); + + rid = 0; + res = bus_alloc_resource_any(isfdev, SYS_RES_MEMORY, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (res == NULL) + return (ENXIO); + + for (i = 0; i < ALTERA_ETHERNET_OPTION_BITS_LEN; i++) + atse_ethernet_option_bits[i] = bus_read_1(res, + ALTERA_ETHERNET_OPTION_BITS_OFF + i); + + bus_release_resource(dev, SYS_RES_MEMORY, rid, res); + atse_ethernet_option_bits_flag |= ATSE_ETHERNET_OPTION_BITS_READ; + + return (0); +} + +static int +atse_ethernet_option_bits_read(device_t dev) +{ + int error; + + error = atse_ethernet_option_bits_read_nexus(dev); + if (error == 0) + return (0); + + error = atse_ethernet_option_bits_read_fdt(dev); + if (error == 0) + return (0); + + device_printf(dev, "Cannot read Ethernet addresses from flash.\n"); + return (error); +} + +static int atse_get_eth_address(struct atse_softc *sc) { unsigned long hostid;help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302011613.r11GDYbk060983>
