Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Oct 2009 17:11:16 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r198211 - head/sys/dev/gem
Message-ID:  <200910181711.n9IHBG6W074471@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Sun Oct 18 17:11:16 2009
New Revision: 198211
URL: http://svn.freebsd.org/changeset/base/198211

Log:
  Work around a quirk with the G5 Xserve, which has a fake GMAC controller
  with an all-zero MAC address. In this case, don't attach.
  
  Discussed with:	marius

Modified:
  head/sys/dev/gem/if_gem_pci.c

Modified: head/sys/dev/gem/if_gem_pci.c
==============================================================================
--- head/sys/dev/gem/if_gem_pci.c	Sun Oct 18 17:10:39 2009	(r198210)
+++ head/sys/dev/gem/if_gem_pci.c	Sun Oct 18 17:11:16 2009	(r198211)
@@ -295,6 +295,16 @@ gem_pci_attach(device_t dev)
 	    GEM_PCI_ROM_OFFSET + j + PCI_VPDRES_LARGE_SIZE + PCI_VPD_SIZE,
 	    sc->sc_enaddr, ETHER_ADDR_LEN);
 #endif
+	/*
+	 * The Xserve G5 has a fake GMAC with an all-zero MAC address.
+	 * Check for this, and don't attach in this case.
+	 */
+
+	for (i = 0; i < ETHER_ADDR_LEN && sc->sc_enaddr[i] == 0; i++) {}
+	if (i == ETHER_ADDR_LEN) {
+		device_printf(dev, "invalid MAC address\n");
+		goto fail;
+	}
 
 	if (gem_attach(sc) != 0) {
 		device_printf(dev, "could not be attached\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910181711.n9IHBG6W074471>