From owner-svn-src-stable-8@FreeBSD.ORG Tue Jan 19 13:26:45 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A35E41065670; Tue, 19 Jan 2010 13:26:45 +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 9208F8FC0A; Tue, 19 Jan 2010 13:26:45 +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 o0JDQjQc001944; Tue, 19 Jan 2010 13:26:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0JDQjDA001941; Tue, 19 Jan 2010 13:26:45 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201001191326.o0JDQjDA001941@svn.freebsd.org> From: Alexander Motin Date: Tue, 19 Jan 2010 13:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202621 - in stable/8/sys/dev/ata: . chipsets X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2010 13:26:45 -0000 Author: mav Date: Tue Jan 19 13:26:45 2010 New Revision: 202621 URL: http://svn.freebsd.org/changeset/base/202621 Log: MFC r200857: Add support for Intel SCH PATA controller. PR: kern/140251 Modified: stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Tue Jan 19 13:25:31 2010 (r202620) +++ stable/8/sys/dev/ata/ata-pci.h Tue Jan 19 13:26:45 2010 (r202621) @@ -204,6 +204,7 @@ struct ata_pci_controller { #define ATA_I82801JI_R1 0x3a258086 #define ATA_I82801JI_S2 0x3a268086 #define ATA_I31244 0x32008086 +#define ATA_ISCH 0x811a8086 #define ATA_ITE_ID 0x1283 #define ATA_IT8211F 0x82111283 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Tue Jan 19 13:25:31 2010 (r202620) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Tue Jan 19 13:26:45 2010 (r202621) @@ -57,6 +57,7 @@ static int ata_intel_ch_attach(device_t static void ata_intel_reset(device_t dev); static int ata_intel_old_setmode(device_t dev, int target, int mode); static int ata_intel_new_setmode(device_t dev, int target, int mode); +static int ata_intel_sch_setmode(device_t dev, int target, int mode); static int ata_intel_sata_getrev(device_t dev, int target); static int ata_intel_31244_ch_attach(device_t dev); static int ata_intel_31244_ch_detach(device_t dev); @@ -140,6 +141,7 @@ ata_intel_probe(device_t dev) { ATA_I82801JI_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, + { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_INTEL_ID) @@ -183,7 +185,13 @@ ata_intel_chipinit(device_t dev) ctlr->setmode = ata_sata_setmode; ctlr->getrev = ata_sata_getrev; } - + /* SCH */ + else if (ctlr->chip->chipid == ATA_ISCH) { + ctlr->channels = 1; + ctlr->ch_attach = ata_intel_ch_attach; + ctlr->ch_detach = ata_pci_ch_detach; + ctlr->setmode = ata_intel_sch_setmode; + } /* non SATA intel chips goes here */ else if (ctlr->chip->max_dma < ATA_SA150) { ctlr->channels = ctlr->chip->cfg2; @@ -245,7 +253,7 @@ ata_intel_ch_attach(device_t dev) (pci_read_config(device_get_parent(dev), 0x90, 1) & 0x04) == 0) ch->flags |= ATA_NO_SLAVE; ch->flags |= ATA_SATA; - } else + } else if (ctlr->chip->chipid != ATA_ISCH) ch->flags |= ATA_CHECKS_CABLE; return 0; } @@ -360,6 +368,35 @@ ata_intel_new_setmode(device_t dev, int } static int +ata_intel_sch_setmode(device_t dev, int target, int mode) +{ + device_t parent = device_get_parent(dev); + struct ata_pci_controller *ctlr = device_get_softc(parent); + u_int8_t dtim = 0x80 + (target << 2); + u_int32_t tim = pci_read_config(parent, dtim, 4); + int piomode; + + mode = min(mode, ctlr->chip->max_dma); + if (mode >= ATA_UDMA0) { + tim |= (0x1 << 31); + tim &= ~(0x7 << 16); + tim |= ((mode & ATA_MODE_MASK) << 16); + piomode = ATA_PIO4; + } else if (mode >= ATA_WDMA0) { + tim &= ~(0x1 << 31); + tim &= ~(0x3 << 8); + tim |= ((mode & ATA_MODE_MASK) << 8); + piomode = (mode == ATA_WDMA0) ? ATA_PIO0 : + (mode == ATA_WDMA1) ? ATA_PIO3 : ATA_PIO4; + } else + piomode = mode; + tim &= ~(0x7); + tim |= (piomode & 0x7); + pci_write_config(parent, dtim, tim, 4); + return (mode); +} + +static int ata_intel_sata_getrev(device_t dev, int target) { struct ata_channel *ch = device_get_softc(dev);