svn commit: r200746 - stable/8/sys/dev/ata/chipsets

Marius Strobl marius at FreeBSD.org
Sun Dec 20 01:44:48 UTC 2009


Author: marius
Date: Sun Dec 20 01:44:47 2009
New Revision: 200746
URL: http://svn.freebsd.org/changeset/base/200746

Log:
  MFC: r200482, r200485
  
  o 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.
  o Only set ATA_CHECKS_CABLE for chip versions that actually support
    cable detection, i.e. neither for ALI_OLD nor for ALI_NEW revisions
    >= 0xc7.

Modified:
  stable/8/sys/dev/ata/chipsets/ata-acerlabs.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/chipsets/ata-acerlabs.c
==============================================================================
--- stable/8/sys/dev/ata/chipsets/ata-acerlabs.c	Sun Dec 20 01:38:21 2009	(r200745)
+++ stable/8/sys/dev/ata/chipsets/ata-acerlabs.c	Sun Dec 20 01:44:47 2009	(r200746)
@@ -141,11 +141,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)
@@ -177,7 +180,8 @@ ata_ali_ch_attach(device_t dev)
     if (ata_pci_ch_attach(dev))
 	return ENXIO;
 
-    ch->flags |= ATA_CHECKS_CABLE;
+    if (ctlr->chip->cfg2 & ALI_NEW && ctlr->chip->chiprev < 0xc7)
+	ch->flags |= ATA_CHECKS_CABLE;
     /* older chips can't do 48bit DMA transfers */
     if (ctlr->chip->chiprev <= 0xc4)
 	ch->flags |= ATA_NO_48BIT_DMA;
@@ -276,7 +280,7 @@ ata_ali_setmode(device_t dev, int target
 
         mode = min(mode, ctlr->chip->max_dma);
 
-	if (ctlr->chip->cfg2 & ALI_NEW) {
+	if (ctlr->chip->cfg2 & ALI_NEW && ctlr->chip->chiprev < 0xc7) {
 		if (mode > ATA_UDMA2 &&
 		    pci_read_config(parent, 0x4a, 1) & (1 << ch->unit)) {
 			ata_print_cable(dev, "controller");


More information about the svn-src-stable mailing list