From 4dc1839cca3b1b5992930e9b0f9e04394a878746 Mon Sep 17 00:00:00 2001 From: mux Date: Thu, 8 Jan 2004 19:08:27 +0000 Subject: Some integrated Davicom cards in sparc64 boxes have an all zeros MAC address in the EEPROM, and we need to get it from OpenFirmware. This isn't very pretty but time is lacking to do this in a better way this near 5.2-RELEASE. This is a RELENG_5_2 candidate. Original version by: Marius Strobl Tested by: Pete Bentley Reviewed by: jake --- sys/dev/dc/if_dc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sys/dev/dc') diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 6068194..ac095cd 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -131,6 +131,11 @@ __FBSDID("$FreeBSD$"); #include +#ifdef __sparc64__ +#include +#include +#endif + MODULE_DEPEND(dc, pci, 1, 1, 1); MODULE_DEPEND(dc, ether, 1, 1, 1); MODULE_DEPEND(dc, miibus, 1, 1, 1); @@ -2106,6 +2111,19 @@ dc_attach(device_t dev) dc_read_eeprom(sc, (caddr_t)&eaddr, 0, 3, 1); break; case DC_TYPE_DM9102: + dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); +#ifdef __sparc64__ + /* + * If this is an onboard dc(4) the station address read from + * the EEPROM is all zero and we have to get it from the fcode. + */ + for (i = 0; i < ETHER_ADDR_LEN; i++) + if (eaddr[i] != 0x00) + break; + if (i >= ETHER_ADDR_LEN && OF_getetheraddr2(dev, eaddr) == -1) + OF_getetheraddr(dev, eaddr); +#endif + break; case DC_TYPE_21143: case DC_TYPE_ASIX: dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); -- cgit v1.1