Received: with ECARTIS (v1.0.0; list netdev); Wed, 09 Mar 2005 11:37:21 -0800 (PST) Received: from smtp.osdl.org (fire.osdl.org [65.172.181.4]) by oss.sgi.com (8.13.0/8.13.0) with ESMTP id j29JbDW2029764 for ; Wed, 9 Mar 2005 11:37:13 -0800 Received: from shell0.pdx.osdl.net (fw.osdl.org [65.172.181.6]) by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j29Jaxqi018551 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Wed, 9 Mar 2005 11:37:00 -0800 Received: from dxpl.pdx.osdl.net (dxpl.pdx.osdl.net [172.20.1.103]) by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id j29Jax6J014938; Wed, 9 Mar 2005 11:36:59 -0800 Date: Wed, 9 Mar 2005 11:29:25 -0800 From: Stephen Hemminger To: Francois Romieu Cc: netdev@oss.sgi.com Subject: [PATCH 1/5] r8169: auto detect 32-bit slot Message-ID: <20050309112925.7f7900ab@dxpl.pdx.osdl.net> Organization: Open Source Development Lab X-Mailer: Sylpheed-Claws 1.0.1 (GTK+ 1.2.10; x86_64-unknown-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Received-SPF: pass (domain of shemminger@osdl.org designates 65.172.181.6 as permitted sender) X-MIMEDefang-Filter: osdl$Revision: 1.104 $ X-Scanned-By: MIMEDefang 2.36 X-Virus-Scanned: ClamAV 0.83/757/Tue Mar 8 15:14:36 2005 on oss.sgi.com X-Virus-Status: Clean X-archive-position: 2722 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev Content-Length: 1792 Lines: 64 Change driver to auto-detect when the board is in a 32-bit PCI slot and avoid setting 64-bit dma mask. The module parameter method is no longer needed. Signed-off-by: Stephen Hemminger diff -Nru a/drivers/net/r8169.c b/drivers/net/r8169.c --- a/drivers/net/r8169.c 2005-03-09 11:23:58 -08:00 +++ b/drivers/net/r8169.c 2005-03-09 11:23:58 -08:00 @@ -182,7 +182,6 @@ MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); static int rx_copybreak = 200; -static int use_dac; enum RTL8169_registers { MAC0 = 0, /* Ethernet hardware address. */ @@ -419,8 +418,6 @@ MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver"); module_param_array(media, int, &num_media, 0); module_param(rx_copybreak, int, 0); -module_param(use_dac, int, 0); -MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); MODULE_LICENSE("GPL"); MODULE_VERSION(RTL8169_VERSION); @@ -1224,18 +1221,6 @@ tp->cp_cmd = PCIMulRW | RxChkSum; - if ((sizeof(dma_addr_t) > 4) && - !pci_set_dma_mask(pdev, DMA_64BIT_MASK) && use_dac) { - tp->cp_cmd |= PCIDAC; - dev->features |= NETIF_F_HIGHDMA; - } else { - rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); - if (rc < 0) { - printk(KERN_ERR PFX "DMA configuration failed.\n"); - goto err_out_free_res; - } - } - pci_set_master(pdev); /* ioremap MMIO region */ @@ -1278,6 +1263,19 @@ i++; } tp->chipset = i; + + if ((sizeof(dma_addr_t) > 4) && + (RTL_R32(Config2) & (1<<3)) && + !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { + tp->cp_cmd |= PCIDAC; + dev->features |= NETIF_F_HIGHDMA; + } else { + rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); + if (rc < 0) { + printk(KERN_ERR PFX "DMA configuration failed.\n"); + goto err_out_free_res; + } + } *ioaddr_out = ioaddr; *dev_out = dev;