Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Oct 2008 06:45:03 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
Subject:   svn commit: r184046 - in stable/6/sys: . dev/jme
Message-ID:  <200810190645.m9J6j3LT036231@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Sun Oct 19 06:45:03 2008
New Revision: 184046
URL: http://svn.freebsd.org/changeset/base/184046

Log:
  MFC r183814:
    Read PCI device id instead of PCI revision id. Also checks the read
    device id is JMC260 family. Previously it just verified the deivce
    is JMC260 Rev A0. This will make it easy for newer JMC2xx support.
  
    Pointed out by:	bouyer at NetBSD
  
  MFC r183859:
    Make sure to read the last byte of EEPROM descriptor. Previously
    the last byte of the ethernet address was not read which in turn
    resulted in getting 5 out of the 6 bytes of ethernet address and
    always returned ENOENT. I did not notice the bug on FPGA version
    because of additional configuration data in EEPROM.
  
    Pointed out by:	bouyer at NetBSD
  
  Approved by:	re (gnn)

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/dev/jme/if_jme.c
  stable/6/sys/dev/jme/if_jmereg.h

Modified: stable/6/sys/dev/jme/if_jme.c
==============================================================================
--- stable/6/sys/dev/jme/if_jme.c	Sun Oct 19 06:38:34 2008	(r184045)
+++ stable/6/sys/dev/jme/if_jme.c	Sun Oct 19 06:45:03 2008	(r184046)
@@ -439,11 +439,8 @@ jme_eeprom_macaddr(struct jme_softc *sc)
 	do {
 		if (jme_eeprom_read_byte(sc, offset, &fup) != 0)
 			break;
-		/* Check for the end of EEPROM descriptor. */
-		if ((fup & JME_EEPROM_DESC_END) == JME_EEPROM_DESC_END)
-			break;
-		if ((uint8_t)JME_EEPROM_MKDESC(JME_EEPROM_FUNC0,
-		    JME_EEPROM_PAGE_BAR1) == fup) {
+		if (JME_EEPROM_MKDESC(JME_EEPROM_FUNC0, JME_EEPROM_PAGE_BAR1) ==
+		    (fup & (JME_EEPROM_FUNC_MASK | JME_EEPROM_PAGE_MASK))) {
 			if (jme_eeprom_read_byte(sc, offset + 1, &reg) != 0)
 				break;
 			if (reg >= JME_PAR0 &&
@@ -455,6 +452,9 @@ jme_eeprom_macaddr(struct jme_softc *sc)
 				match++;
 			}
 		}
+		/* Check for the end of EEPROM descriptor. */
+		if ((fup & JME_EEPROM_DESC_END) == JME_EEPROM_DESC_END)
+			break;
 		/* Try next eeprom descriptor. */
 		offset += JME_EEPROM_DESC_BYTES;
 	} while (match != ETHER_ADDR_LEN && offset < JME_EEPROM_END);
@@ -648,8 +648,8 @@ jme_attach(device_t dev)
 		goto fail;
 	}
 
-	sc->jme_rev = pci_get_revid(dev);
-	if (sc->jme_rev == DEVICEID_JMC260) {
+	sc->jme_rev = pci_get_device(dev);
+	if ((sc->jme_rev & DEVICEID_JMC2XX_MASK) == DEVICEID_JMC260) {
 		sc->jme_flags |= JME_FLAG_FASTETH;
 		sc->jme_flags |= JME_FLAG_NOJUMBO;
 	}

Modified: stable/6/sys/dev/jme/if_jmereg.h
==============================================================================
--- stable/6/sys/dev/jme/if_jmereg.h	Sun Oct 19 06:38:34 2008	(r184045)
+++ stable/6/sys/dev/jme/if_jmereg.h	Sun Oct 19 06:45:03 2008	(r184046)
@@ -48,6 +48,8 @@
 #define	DEVICEID_JMC260		0x0260
 #define	DEVICEREVID_JMC260_A0	0x00
 
+#define	DEVICEID_JMC2XX_MASK	0x0FF0
+
 /* JMC250 PCI configuration register. */
 #define	JME_PCI_BAR0		0x10	/* 16KB memory window. */
 



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