PERFORCE change 221677 for review
Bjoern A. Zeeb
bz at FreeBSD.org
Fri Feb 1 16:13:35 UTC 2013
http://p4web.freebsd.org/@@221677?ac=10
Change 221677 by bz at 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;
More information about the p4-projects
mailing list