summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2004-08-14 21:43:37 +0000
committermarius <marius@FreeBSD.org>2004-08-14 21:43:37 +0000
commitcd9e845490f35e203d0b972430feab6499bb55d6 (patch)
treee93e32a033367a06e910444e3e45b701b5ff8e22 /sys/sparc64
parentc14fee263230d98381c73b8c0b4f9cb9fb9cd54a (diff)
downloadFreeBSD-src-cd9e845490f35e203d0b972430feab6499bb55d6.zip
FreeBSD-src-cd9e845490f35e203d0b972430feab6499bb55d6.tar.gz
- Make OF_getetheraddr() honour the "local-mac-address?" system config
variable. If set to "true" OF_getetheraddr() will now return the unique MAC address stored in the "local-mac-address" property of the device's OFW node if present and the host address/system default MAC address if the node doesn't doesn't have such a property. If set to "false" the host address will be returned for all devices like before this change. This brings the behaviour of device drivers for NICs with OFW support/ FCode, i.e. dc(4) for on-board DM9102A on Sun machines, gem(4) and hme(4), regarding "local-mac-address?" in line with NetBSD and Solaris. The man pages of the respective drivers will be updated separately to reflect this change. - Remove OF_getetheraddr2() which was used as a stopgap in dc(4). Its functionality is now part of OF_getetheraddr().
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/ofw_machdep.h1
-rw-r--r--sys/sparc64/sparc64/ofw_machdep.c22
2 files changed, 11 insertions, 12 deletions
diff --git a/sys/sparc64/include/ofw_machdep.h b/sys/sparc64/include/ofw_machdep.h
index c40a7bc..f7062f7 100644
--- a/sys/sparc64/include/ofw_machdep.h
+++ b/sys/sparc64/include/ofw_machdep.h
@@ -32,7 +32,6 @@
int OF_decode_addr(phandle_t, int *, bus_addr_t *);
void OF_getetheraddr(device_t, u_char *);
-int OF_getetheraddr2(device_t, u_char *);
void cpu_shutdown(void *);
void openfirmware_exit(void *);
diff --git a/sys/sparc64/sparc64/ofw_machdep.c b/sys/sparc64/sparc64/ofw_machdep.c
index f4ba52a..74a6176 100644
--- a/sys/sparc64/sparc64/ofw_machdep.c
+++ b/sys/sparc64/sparc64/ofw_machdep.c
@@ -51,9 +51,20 @@
void
OF_getetheraddr(device_t dev, u_char *addr)
{
+ char buf[sizeof("true")];
phandle_t node;
struct idprom idp;
+ if ((node = OF_finddevice("/options")) > 0 &&
+ OF_getprop(node, "local-mac-address?", buf, sizeof(buf)) > 0) {
+ buf[sizeof(buf) - 1] = '\0';
+ if (strcmp(buf, "true") == 0 &&
+ (node = ofw_bus_get_node(dev)) > 0 &&
+ OF_getprop(node, "local-mac-address", addr,
+ ETHER_ADDR_LEN) == ETHER_ADDR_LEN)
+ return;
+ }
+
node = OF_peer(0);
if (node <= 0 || OF_getprop(node, "idprom", &idp, sizeof(idp)) == -1)
panic("Could not determine the machine ethernet address");
@@ -61,17 +72,6 @@ OF_getetheraddr(device_t dev, u_char *addr)
}
int
-OF_getetheraddr2(device_t dev, u_char *addr)
-{
- phandle_t node;
-
- node = ofw_bus_get_node(dev);
- if (node <= 0)
- return (-1);
- return (OF_getprop(node, "local-mac-address", addr, ETHER_ADDR_LEN));
-}
-
-int
OF_decode_addr(phandle_t node, int *space, bus_addr_t *addr)
{
char name[32];
OpenPOWER on IntegriCloud