From owner-svn-src-all@FreeBSD.ORG Sun Dec 20 01:46:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C40C1065695; Sun, 20 Dec 2009 01:46:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C89B8FC17; Sun, 20 Dec 2009 01:46:24 +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 nBK1kNJm049343; Sun, 20 Dec 2009 01:46:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBK1kNjA049341; Sun, 20 Dec 2009 01:46:23 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200912200146.nBK1kNjA049341@svn.freebsd.org> From: Marius Strobl Date: Sun, 20 Dec 2009 01:46:23 +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: r200747 - stable/7/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 01:46:24 -0000 Author: marius Date: Sun Dec 20 01:46:23 2009 New Revision: 200747 URL: http://svn.freebsd.org/changeset/base/200747 Log: MFC: r200482 Properly support M5229 revision 0xc7 and 0xc8: - These revisions no longer have cable detection capability. - The UDMA support bit of register 0x4b has been dropped without an replacement. - According to Linux it's crucial for working ATAPI DMA support to also set the reserved bit 1 of regsiter 0x53 with these revisions. Modified: stable/7/sys/dev/ata/ata-chipset.c 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/ata/ata-chipset.c ============================================================================== --- stable/7/sys/dev/ata/ata-chipset.c Sun Dec 20 01:44:47 2009 (r200746) +++ stable/7/sys/dev/ata/ata-chipset.c Sun Dec 20 01:46:23 2009 (r200747) @@ -1135,11 +1135,14 @@ ata_ali_chipinit(device_t dev) /* use device interrupt as byte count end */ pci_write_config(dev, 0x4a, pci_read_config(dev, 0x4a, 1) | 0x20, 1); - /* enable cable detection and UDMA support on newer chips */ - pci_write_config(dev, 0x4b, pci_read_config(dev, 0x4b, 1) | 0x09, 1); - - /* enable ATAPI UDMA mode */ - pci_write_config(dev, 0x53, pci_read_config(dev, 0x53, 1) | 0x01, 1); + /* enable cable detection and UDMA support on revisions < 0xc7 */ + if (ctlr->chip->chiprev < 0xc7) + pci_write_config(dev, 0x4b, pci_read_config(dev, 0x4b, 1) | + 0x09, 1); + + /* enable ATAPI UDMA mode (even if we are going to do PIO) */ + pci_write_config(dev, 0x53, pci_read_config(dev, 0x53, 1) | + (ctlr->chip->chiprev >= 0xc7 ? 0x03 : 0x01), 1); /* only chips with revision > 0xc4 can do 48bit DMA */ if (ctlr->chip->chiprev <= 0xc4) @@ -1263,7 +1266,7 @@ ata_ali_setmode(device_t dev, int mode) mode = ata_limit_mode(dev, mode, ctlr->chip->max_dma); - if (ctlr->chip->cfg2 & ALINEW) { + if (ctlr->chip->cfg2 & ALINEW && ctlr->chip->chiprev < 0xc7) { if (mode > ATA_UDMA2 && pci_read_config(gparent, 0x4a, 1) & (1 << ch->unit)) { ata_print_cable(dev, "controller");