Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jan 2011 18:44:05 +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-8@freebsd.org
Subject:   svn commit: r217952 - stable/8/sys/dev/jme
Message-ID:  <201101271844.p0RIi5KK029079@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Thu Jan 27 18:44:05 2011
New Revision: 217952
URL: http://svn.freebsd.org/changeset/base/217952

Log:
  MFC r216546,216548-216550:
  r216546:
    Consistently put a tab character between #define and the macro name.
  
  r216548:
    Fix a regression introduced in r213893. FPGA version requires PHY
    probing so allow PHY probing on all possible addresses.
  
  r216549:
    Make sure whether driver allocated resource before releasing it.
  
  r216550:
    Use system defined PCIR_EXPRESS_DEVICE_CTL instead of using magic
    number.

Modified:
  stable/8/sys/dev/jme/if_jme.c
  stable/8/sys/dev/jme/if_jmevar.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/jme/if_jme.c
==============================================================================
--- stable/8/sys/dev/jme/if_jme.c	Thu Jan 27 18:38:48 2011	(r217951)
+++ stable/8/sys/dev/jme/if_jme.c	Thu Jan 27 18:44:05 2011	(r217952)
@@ -683,7 +683,7 @@ jme_attach(device_t dev)
 	/* Set max allowable DMA size. */
 	if (pci_find_extcap(dev, PCIY_EXPRESS, &i) == 0) {
 		sc->jme_flags |= JME_FLAG_PCIE;
-		burst = pci_read_config(dev, i + 0x08, 2);
+		burst = pci_read_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, 2);
 		if (bootverbose) {
 			device_printf(dev, "Read request size : %d bytes.\n",
 			    128 << ((burst >> 12) & 0x07));
@@ -738,8 +738,9 @@ jme_attach(device_t dev)
 
 	/* Set up MII bus. */
 	error = mii_attach(dev, &sc->jme_miibus, ifp, jme_mediachange,
-	    jme_mediastatus, BMSR_DEFCAPMASK, sc->jme_phyaddr, MII_OFFSET_ANY,
-	    MIIF_DOPAUSE);
+	    jme_mediastatus, BMSR_DEFCAPMASK,
+	    sc->jme_flags & JME_FLAG_FPGA ? MII_PHY_ANY : sc->jme_phyaddr,
+	    MII_OFFSET_ANY, MIIF_DOPAUSE);
 	if (error != 0) {
 		device_printf(dev, "attaching PHYs failed\n");
 		goto fail;
@@ -861,10 +862,12 @@ jme_detach(device_t dev)
 		}
 	}
 
-	bus_release_resources(dev, sc->jme_irq_spec, sc->jme_irq);
+	if (sc->jme_irq[0] != NULL)
+		bus_release_resources(dev, sc->jme_irq_spec, sc->jme_irq);
 	if ((sc->jme_flags & (JME_FLAG_MSIX | JME_FLAG_MSI)) != 0)
 		pci_release_msi(dev);
-	bus_release_resources(dev, sc->jme_res_spec, sc->jme_res);
+	if (sc->jme_res[0] != NULL)
+		bus_release_resources(dev, sc->jme_res_spec, sc->jme_res);
 	mtx_destroy(&sc->jme_mtx);
 
 	return (0);

Modified: stable/8/sys/dev/jme/if_jmevar.h
==============================================================================
--- stable/8/sys/dev/jme/if_jmevar.h	Thu Jan 27 18:38:48 2011	(r217951)
+++ stable/8/sys/dev/jme/if_jmevar.h	Thu Jan 27 18:44:05 2011	(r217952)
@@ -66,8 +66,8 @@
  * JMC250 can send 9K jumbo frame on Tx path and can receive
  * 65535 bytes.
  */
-#define JME_JUMBO_FRAMELEN	9216
-#define JME_JUMBO_MTU							\
+#define	JME_JUMBO_FRAMELEN	9216
+#define	JME_JUMBO_MTU							\
 	(JME_JUMBO_FRAMELEN - sizeof(struct ether_vlan_header) -	\
 	 ETHER_HDR_LEN - ETHER_CRC_LEN)
 #define	JME_MAX_MTU							\
@@ -143,14 +143,14 @@ struct jme_ring_data {
 	bus_addr_t		jme_ssb_block_paddr;
 };
 
-#define JME_TX_RING_ADDR(sc, i)	\
+#define	JME_TX_RING_ADDR(sc, i)	\
     ((sc)->jme_rdata.jme_tx_ring_paddr + sizeof(struct jme_desc) * (i))
-#define JME_RX_RING_ADDR(sc, i)	\
+#define	JME_RX_RING_ADDR(sc, i)	\
     ((sc)->jme_rdata.jme_rx_ring_paddr + sizeof(struct jme_desc) * (i))
 
-#define JME_TX_RING_SIZE	\
+#define	JME_TX_RING_SIZE	\
     (sizeof(struct jme_desc) * JME_TX_RING_CNT)
-#define JME_RX_RING_SIZE	\
+#define	JME_RX_RING_SIZE	\
     (sizeof(struct jme_desc) * JME_RX_RING_CNT)
 #define	JME_SSB_SIZE		sizeof(struct jme_ssb)
 
@@ -223,14 +223,14 @@ struct jme_softc {
 };
 
 /* Register access macros. */
-#define CSR_WRITE_4(_sc, reg, val)	\
+#define	CSR_WRITE_4(_sc, reg, val)	\
 	bus_write_4((_sc)->jme_res[0], (reg), (val))
-#define CSR_READ_4(_sc, reg)		\
+#define	CSR_READ_4(_sc, reg)		\
 	bus_read_4((_sc)->jme_res[0], (reg))
 
-#define JME_LOCK(_sc)		mtx_lock(&(_sc)->jme_mtx)
-#define JME_UNLOCK(_sc)		mtx_unlock(&(_sc)->jme_mtx)
-#define JME_LOCK_ASSERT(_sc)	mtx_assert(&(_sc)->jme_mtx, MA_OWNED)
+#define	JME_LOCK(_sc)		mtx_lock(&(_sc)->jme_mtx)
+#define	JME_UNLOCK(_sc)		mtx_unlock(&(_sc)->jme_mtx)
+#define	JME_LOCK_ASSERT(_sc)	mtx_assert(&(_sc)->jme_mtx, MA_OWNED)
 
 #define	JME_MAXERR	5
 
@@ -242,8 +242,8 @@ do {									\
 } while (0)
 
 #define	JME_TX_TIMEOUT		5
-#define JME_TIMEOUT		1000
-#define JME_PHY_TIMEOUT		1000
-#define JME_EEPROM_TIMEOUT	1000
+#define	JME_TIMEOUT		1000
+#define	JME_PHY_TIMEOUT		1000
+#define	JME_EEPROM_TIMEOUT	1000
 
 #endif



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