- 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().
This commit is contained in:
Marius Strobl 2004-08-14 21:43:37 +00:00
parent 3abefc9e56
commit b7b6c9e6fa
4 changed files with 13 additions and 14 deletions

View File

@ -2063,7 +2063,7 @@ dc_attach(device_t dev)
for (i = 0; i < ETHER_ADDR_LEN; i++)
if (eaddr[i] != 0x00)
break;
if (i >= ETHER_ADDR_LEN && OF_getetheraddr2(dev, eaddr) == -1)
if (i >= ETHER_ADDR_LEN)
OF_getetheraddr(dev, eaddr);
#endif
break;

View File

@ -2063,7 +2063,7 @@ dc_attach(device_t dev)
for (i = 0; i < ETHER_ADDR_LEN; i++)
if (eaddr[i] != 0x00)
break;
if (i >= ETHER_ADDR_LEN && OF_getetheraddr2(dev, eaddr) == -1)
if (i >= ETHER_ADDR_LEN)
OF_getetheraddr(dev, eaddr);
#endif
break;

View File

@ -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 *);

View File

@ -51,26 +51,26 @@
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");
bcopy(&idp.id_ether, addr, ETHER_ADDR_LEN);
}
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)
{