From owner-freebsd-bugs Fri Oct 6 22:50:34 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5F2D537B66C for ; Fri, 6 Oct 2000 22:50:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id WAA96380; Fri, 6 Oct 2000 22:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from niseko.junichi.org (niseko.junichi.org [210.238.191.91]) by hub.freebsd.org (Postfix) with ESMTP id BF05137B503 for ; Fri, 6 Oct 2000 22:45:32 -0700 (PDT) Received: from norn.pn.junichi.org (norn.pn.junichi.org [192.168.31.2]) by niseko.junichi.org (8.9.3+3.2W/3.7W-MQH-3.0) with ESMTP id OAA22860 for ; Sat, 7 Oct 2000 14:45:23 +0900 (JST) Received: (from junichi@localhost) by norn.pn.junichi.org (8.9.3/3.7W-client1.0) id OAA00485; Sat, 7 Oct 2000 14:45:25 +0900 (JST) Message-Id: <200010070545.OAA00485@norn.pn.junichi.org> Date: Sat, 7 Oct 2000 14:45:25 +0900 (JST) From: Junichi Satoh Reply-To: junichi@junichi.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/21810: SiS5571 ATA controller does not work on ATA mode. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 21810 >Category: kern >Synopsis: SiS5571 ATA controller does not work on ATA mode. >Confidential: yes >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Oct 06 22:50:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Junichi Satoh >Release: FreeBSD 4.1-STABLE i386 and FreeBSD 5.0-CURRENT i386 >Organization: >Environment: SiS5571 ATA controller with ATA hard drive. >Description: SiS5571 does not have ATA33 mode. But, it is probed as SiS5591 ATA33 controller like below. ------ atapci0: port 0x4000-0x400f,0x374-0x377,0x170-0x177,0x3f4-0x3f7,0x1f0-0x1f7 irq 14 at device 1.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ------ It fallback to PIO mode. So it does not work on ATA mode. >How-To-Repeat: # mount /dev/ad0s1e /mnt ad0: READ command timeout tag=0 serv=0 - resetting ata0: resetting devices .. done ad0: READ command timeout tag=0 serv=0 - resetting ata0: resetting devices .. done ad0: READ command timeout tag=0 serv=0 - resetting ata0: resetting devices .. done ad0: READ command timeout tag=0 serv=0 - resetting ata0-master: WARNING: WAIT_READY active=ATA_ACTIVE_ATA ad0: trying fallback to PIO mode ata0: resetting devices .. done >Fix: *** ata-all.c.org Tue Sep 19 20:08:37 2000 --- ata-all.c Sat Oct 7 14:32:52 2000 *************** *** 233,238 **** --- 233,263 ---- return 0; } + int + ata_find_maindev(device_t dev, u_int32_t type, u_int32_t revid) + { + device_t *children, child; + int nchildren, i; + + if (device_get_children(device_get_parent(dev), &children, &nchildren)) + return 0; + + for (i = 0; i < nchildren; i++) { + child = children[i]; + + /* check that it's on the same silicon and the device we want */ + if (pci_get_slot(child) == 0 && + pci_get_vendor(child) == (type & 0xffff) && + pci_get_device(child) == ((type & 0xffff0000) >> 16) && + pci_get_revid(child) >= revid) { + free(children, M_TEMP); + return 1; + } + } + free(children, M_TEMP); + return 0; + } + static const char * ata_pci_match(device_t dev) { *************** *** 275,280 **** --- 300,307 ---- return "VIA Apollo ATA controller"; case 0x55131039: + if (ata_find_maindev(dev, 0x55711039, 0)) + return "SiS 5571 ATA controller"; return "SiS 5591 ATA33 controller"; case 0x06461095: *** ata-all.h.org Tue Sep 19 20:08:37 2000 --- ata-all.h Sat Oct 7 14:10:48 2000 *************** *** 350,355 **** --- 350,356 ---- int ata_umode(struct ata_params *); #if NPCI > 0 int ata_find_dev(device_t, u_int32_t, u_int32_t); + int ata_find_maindev(device_t, u_int32_t, u_int32_t); #endif void *ata_dmaalloc(struct ata_softc *, int); *** ata-dma.c.org Tue Sep 19 20:08:37 2000 --- ata-dma.c Sat Oct 7 14:33:02 2000 *************** *** 413,420 **** /* we could set PIO mode timings, but we assume the BIOS did that */ break; ! case 0x55131039: /* SiS 5591 */ ! if (udmamode >= 2) { error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); if (bootverbose) --- 413,420 ---- /* we could set PIO mode timings, but we assume the BIOS did that */ break; ! case 0x55131039: /* SiS 5571, 5591 */ ! if (!ata_find_maindev(parent, 0x55711039, 0) && udmamode >= 2) { error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); if (bootverbose) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message