From owner-freebsd-bugs@FreeBSD.ORG Wed Feb 25 01:50:01 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF98A1065676 for ; Wed, 25 Feb 2009 01:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CA0F28FC16 for ; Wed, 25 Feb 2009 01:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n1P1o11C056950 for ; Wed, 25 Feb 2009 01:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n1P1o13r056949; Wed, 25 Feb 2009 01:50:01 GMT (envelope-from gnats) Resent-Date: Wed, 25 Feb 2009 01:50:01 GMT Resent-Message-Id: <200902250150.n1P1o13r056949@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dieter Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8520106564A for ; Wed, 25 Feb 2009 01:42:23 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id A58498FC0C for ; Wed, 25 Feb 2009 01:42:23 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n1P1gM7S085206 for ; Wed, 25 Feb 2009 01:42:22 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n1P1gMWb085188; Wed, 25 Feb 2009 01:42:22 GMT (envelope-from nobody) Message-Id: <200902250142.n1P1gMWb085188@www.freebsd.org> Date: Wed, 25 Feb 2009 01:42:22 GMT From: Dieter To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/132082: [ patch ] ATA driver does not find PATA drives attached to JMB363 controller X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2009 01:50:02 -0000 >Number: 132082 >Category: kern >Synopsis: [ patch ] ATA driver does not find PATA drives attached to JMB363 controller >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 25 01:50:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Dieter >Release: 7.1 amd64 >Organization: >Environment: 7.1-RELEASE amd64 >Description: FreeBSD 7.1 amd64 nforce4-ultra (ad2 - ad10) 2 JMicron JMB363 controllers (ad12 and above) 7.1 kernel (without my patch) # dmesg | grep 363 atapci4: port 0x5c00-0x5c07,0x5800-0x5803,0x 5400-0x5407,0x5000-0x5003,0x4c00-0x4c0f mem 0xfe3fe000-0xfe3fffff irq 12 at devi ce 0.0 on pci6 # dmesg | grep ^ad ad2: 305245MB at ata1-master UDMA100 ad4: 715404MB at ata2-master SATA300 ad6: 715404MB at ata3-master SATA300 ad8: 953869MB at ata4-master SATA300 ad10: 953869MB at ata5-master SATA300 ad12: 238475MB at ata6-master SATA150 ad14: 715404MB at ata7-master SATA300 ad16: 953869MB at ata8-master SATA300 # The stock 7.1 kernel (7.0 was the same) does not see any PATA devices connected to the JMicron JMB363 controllers. It does see PATA and SATA devices connected to the nforce4-ultra controller, and they work. It does see SATA devices connected to the JMicron JMB363 controllers and they work. I added a quick-and-dirty patch to ata-pci.c that tries ata_jmicron_ident() before ata_ahci_ident(). # dmesg | grep 363 atapci3: at device 0.0 on pci3 atapci4: port 0x5c00-0x5c07,0x5800-0x5803,0x5400-0x5407,0x5000-0x5003,0x4c00-0x4c0f mem \ 0xfe3fe000-0xfe3fffff irq 12 at device 0.0 on pci6 # dmesg | grep ^ad ad2: 305245MB at ata1-master UDMA100 ad4: 715404MB at ata2-master SATA300 ad6: 715404MB at ata3-master SATA300 ad8: 953869MB at ata4-master SATA300 ad10: 953869MB at ata5-master SATA300 ad12: 238475MB at ata6-master SATA150 ad14: 715404MB at ata7-master SATA300 ad16: 305245MB at ata8-master UDMA100 ad18: 953869MB at ata9-master SATA300 With my patch, the kernel does see PATA devices (ad16) connected to the JMicron JMB363 controllers. The WDC SATA drive gets moved from ad16 to ad18. Perhaps unrelated, the Seagate PATA drive connects at UDMA100. Reading works fine, but writing consistantly fails: ad16: WARNING - WRITE_DMA UDMA ICRC error (retrying request) LBA=191 ad16: WARNING - WRITE_DMA UDMA ICRC error (retrying request) LBA=191 ad16: FAILURE - WRITE_DMA status=51 error=84 LBA=191 I downgraded it from 100 to 66 # atacontrol mode ad16 UDMA66 and at 66 writing works ok. The same disk works fine at 100 with other controllers. Standard 80 wire flat ribbon cable, not round or extra long or anything wierd. My patch might not be the best way to fix this problem. For all I know it might even break something on other systems. All I can say is it works for me. :-) >How-To-Repeat: Connect a PATA device to a JMB363 controller. Boot 7.0 or 7.1 and observe that the kernel does not find the drive. >Fix: My patch works for me. Patch attached with submission follows: --- ata-pci.c 2008/04/21 23:14:03 1.1 +++ ata-pci.c 2008/04/21 23:15:41 @@ -76,6 +76,13 @@ if (pci_get_class(dev) != PCIC_STORAGE) return ENXIO; + if ( pci_get_vendor(dev) == ATA_JMICRON_ID ) + { + printf("DEBUG ata-pci.c ata_pci_probe() trying ata_jmicron_ident() before ata_ahci_ident()\n"); + if (!ata_jmicron_ident(dev)) + return ATA_PROBE_OK; + } + /* if this is an AHCI chipset grab it */ if (pci_get_subclass(dev) == PCIS_STORAGE_SATA) { if (!ata_ahci_ident(dev)) >Release-Note: >Audit-Trail: >Unformatted: