From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 15:03:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16953106566B; Sun, 20 Dec 2009 15:03:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 059908FC0A; Sun, 20 Dec 2009 15:03:58 +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 nBKF3vI4067751; Sun, 20 Dec 2009 15:03:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKF3v0n067749; Sun, 20 Dec 2009 15:03:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912201503.nBKF3v0n067749@svn.freebsd.org> From: Alexander Motin Date: Sun, 20 Dec 2009 15:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200753 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 15:03:58 -0000 Author: mav Date: Sun Dec 20 15:03:57 2009 New Revision: 200753 URL: http://svn.freebsd.org/changeset/base/200753 Log: Fairly set master/slave shared PIO/WDMA timings on ITE 821x controllers. Previous implementation could only limit mode, but not rise it back. Modified: head/sys/dev/ata/chipsets/ata-ite.c Modified: head/sys/dev/ata/chipsets/ata-ite.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ite.c Sun Dec 20 11:00:53 2009 (r200752) +++ head/sys/dev/ata/chipsets/ata-ite.c Sun Dec 20 15:03:57 2009 (r200753) @@ -105,6 +105,8 @@ ata_ite_chipinit(device_t dev) pci_write_config(dev, 0x56, 0x31, 1); ctlr->setmode = ata_ite_821x_setmode; + /* No timing restrictions initally. */ + ctlr->chipset_data = (void *)0; } ctlr->ch_attach = ata_ite_ch_attach; return 0; @@ -129,6 +131,7 @@ ata_ite_821x_setmode(device_t dev, int t struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; + uint8_t *timings = (uint8_t*)(&ctlr->chipset_data); u_int8_t udmatiming[] = { 0x44, 0x42, 0x31, 0x21, 0x11, 0xa2, 0x91 }; u_int8_t chtiming[] = @@ -158,11 +161,10 @@ ata_ite_821x_setmode(device_t dev, int t (1 << (devno + 3)), 1); piomode = mode; } + timings[devno] = chtiming[ata_mode2idx(piomode)]; /* set active and recover timing (shared between master & slave) */ - if (pci_read_config(parent, 0x54 + (ch->unit << 2), 1) < - chtiming[ata_mode2idx(piomode)]) - pci_write_config(parent, 0x54 + (ch->unit << 2), - chtiming[ata_mode2idx(piomode)], 1); + pci_write_config(parent, 0x54 + (ch->unit << 2), + max(timings[ch->unit << 1], timings[(ch->unit << 1) + 1]), 1); return (mode); }