From owner-freebsd-bugs Sat Dec 1 0: 0:26 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 6010E37B419 for ; Sat, 1 Dec 2001 00:00:03 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fB1803t44342; Sat, 1 Dec 2001 00:00:03 -0800 (PST) (envelope-from gnats) Date: Sat, 1 Dec 2001 00:00:03 -0800 (PST) Message-Id: <200112010800.fB1803t44342@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Tamotsu HATTORI Subject: Re: kern/32421: patch to support ATA66 Mode (UDMA4) on SiS 630 chips Reply-To: Tamotsu HATTORI Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/32421; it has been noted by GNATS. From: Tamotsu HATTORI To: freebsd-gnats-submit@FreeBSD.org, john@utzweb.net Cc: athlete@kta.att.ne.jp Subject: Re: kern/32421: patch to support ATA66 Mode (UDMA4) on SiS 630 chips Date: Sat, 01 Dec 2001 17:13:25 +0900 I have another patch to ata-all.c and ata-dma.c. This patch supports ATA100 mode on SiS630S/633/635/730/733/735 chipsets. --- ata-all.c.orig Wed Aug 29 02:56:14 2001 +++ ata-all.c Sat Nov 10 12:47:09 2001 @@ -228,8 +228,7 @@ child = children[i]; /* check that it's on the same silicon and the device we want */ - if (pci_get_slot(dev) == pci_get_slot(child) && - pci_get_vendor(child) == (type & 0xffff) && + if (pci_get_vendor(child) == (type & 0xffff) && pci_get_device(child) == ((type & 0xffff0000) >> 16) && pci_get_revid(child) >= revid) { free(children, M_TEMP); @@ -291,6 +290,18 @@ return "VIA Apollo ATA controller"; case 0x55131039: + if (ata_find_dev(dev, 0x06301039, 0x30) || + ata_find_dev(dev, 0x06331039, 0x00) || + ata_find_dev(dev, 0x06351039, 0x00) || + ata_find_dev(dev, 0x07301039, 0x00) || + ata_find_dev(dev, 0x07331039, 0x00) || + ata_find_dev(dev, 0x07351039, 0x00)) + return "SiS 5591 ATA100 controller"; + if (ata_find_dev(dev, 0x05301039, 0x00) || + ata_find_dev(dev, 0x05401039, 0x00) || + ata_find_dev(dev, 0x06201039, 0x00) || + ata_find_dev(dev, 0x06301039, 0x00)) + return "SiS 5591 ATA66 controller"; return "SiS 5591 ATA33 controller"; case 0x06491095: --- ata-dma.c.orig Wed Aug 29 02:56:14 2001 +++ ata-dma.c Sat Nov 10 12:57:54 2001 @@ -514,18 +514,107 @@ /* we could set PIO mode timings, but we assume the BIOS did that */ break; - case 0x55131039: /* SiS 5591 */ - if (udmamode >= 2 && pci_get_revid(parent) > 0xc1) { - error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, - ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); - if (bootverbose) - ata_printf(scp, device, - "%s setting UDMA2 on SiS chip\n", - (error) ? "failed" : "success"); - if (!error) { - pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2); - scp->mode[ATA_DEV(device)] = ATA_UDMA2; - return; + case 0x55131039: /* SiS 5591, 530/540, 620/630/633/635, 730/733/735 */ + if (ata_find_dev(parent, 0x06301039, 0x30) || /* SiS630S */ + ata_find_dev(parent, 0x06331039, 0x00) || /* SiS633 */ + ata_find_dev(parent, 0x06351039, 0x00) || /* SiS635 */ + ata_find_dev(parent, 0x07301039, 0x00) || /* SiS730 */ + ata_find_dev(parent, 0x07331039, 0x00) || /* SiS733 */ + ata_find_dev(parent, 0x07351039, 0x00)) { /* SiS735 */ + int16_t reg = 0; + if (udmamode >= 5) { + error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, + ATA_UDMA5, ATA_C_F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_printf(scp, device, + "%s setting UDMA5 on SiS chip\n", + (error) ? "failed" : "success"); + if (!error) { + reg = pci_read_config(parent, 0x40 + (devno << 1), 2); + reg &= 0x0fff; + pci_write_config(parent, 0x40 + (devno << 1), reg|0x8000, 2); + scp->mode[ATA_DEV(device)] = ATA_UDMA5; + return; + } + } + if (udmamode >= 4) { + error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, + ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_printf(scp, device, + "%s setting UDMA4 on SiS chip\n", + (error) ? "failed" : "success"); + if (!error) { + reg = pci_read_config(parent, 0x40 + (devno << 1), 2); + reg &= 0x0fff; + pci_write_config(parent, 0x40 + (devno << 1), reg|0x9000, 2); + scp->mode[ATA_DEV(device)] = ATA_UDMA4; + return; + } + } + 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) + ata_printf(scp, device, + "%s setting UDMA2 on SiS chip\n", + (error) ? "failed" : "success"); + if (!error) { + reg = pci_read_config(parent, 0x40 + (devno << 1), 2); + reg &= 0x0fff; + pci_write_config(parent, 0x40 + (devno << 1), reg|0xb000, 2); + scp->mode[ATA_DEV(device)] = ATA_UDMA2; + return; + } + } + } else if (ata_find_dev(parent, 0x05301039, 0) || /* SiS530 */ + ata_find_dev(parent, 0x05401039, 0) || /* SiS540 */ + ata_find_dev(parent, 0x06201039, 0) || /* SiS620 */ + ata_find_dev(parent, 0x06301039, 0)) { /* SiS630/E */ + int16_t reg = 0; + if (udmamode >= 4) { + error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, + ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_printf(scp, device, + "%s setting UDMA4 on SiS chip\n", + (error) ? "failed" : "success"); + if (!error) { + reg = pci_read_config(parent, 0x40 + (devno << 1), 2); + reg &= 0x0fff; + pci_write_config(parent, 0x40 + (devno << 1), reg|0xa000, 2); + scp->mode[ATA_DEV(device)] = ATA_UDMA4; + return; + } + } + 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) + ata_printf(scp, device, + "%s setting UDMA2 on SiS chip\n", + (error) ? "failed" : "success"); + if (!error) { + reg = pci_read_config(parent, 0x40 + (devno << 1), 2); + reg &= 0x0fff; + pci_write_config(parent, 0x40 + (devno << 1), reg|0xb000, 2); + scp->mode[ATA_DEV(device)] = ATA_UDMA2; + return; + } + } + } else { + if (udmamode >= 2 && pci_get_revid(parent) > 0xc1) { + error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0, + ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY); + if (bootverbose) + ata_printf(scp, device, + "%s setting UDMA2 on SiS chip\n", + (error) ? "failed" : "success"); + if (!error) { + pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2); + scp->mode[ATA_DEV(device)] = ATA_UDMA2; + return; + } } } if (wdmamode >=2 && apiomode >= 4) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message