From owner-svn-src-stable-7@FreeBSD.ORG Thu Jan 27 18:46:26 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76317106566B; Thu, 27 Jan 2011 18:46:26 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 648888FC19; Thu, 27 Jan 2011 18:46:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0RIkQd3029278; Thu, 27 Jan 2011 18:46:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0RIkQf9029275; Thu, 27 Jan 2011 18:46:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201101271846.p0RIkQf9029275@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 27 Jan 2011 18:46:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r217953 - stable/7/sys/dev/jme X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jan 2011 18:46:26 -0000 Author: yongari Date: Thu Jan 27 18:46:26 2011 New Revision: 217953 URL: http://svn.freebsd.org/changeset/base/217953 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/7/sys/dev/jme/if_jme.c stable/7/sys/dev/jme/if_jmevar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/jme/if_jme.c ============================================================================== --- stable/7/sys/dev/jme/if_jme.c Thu Jan 27 18:44:05 2011 (r217952) +++ stable/7/sys/dev/jme/if_jme.c Thu Jan 27 18:46:26 2011 (r217953) @@ -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/7/sys/dev/jme/if_jmevar.h ============================================================================== --- stable/7/sys/dev/jme/if_jmevar.h Thu Jan 27 18:44:05 2011 (r217952) +++ stable/7/sys/dev/jme/if_jmevar.h Thu Jan 27 18:46:26 2011 (r217953) @@ -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