kern/114605: [patch] ata: new loader tunable for 80-pin cable check

Dmitry Morozovsky marck at FreeBSD.org
Sun Jul 15 16:30:03 UTC 2007


>Number:         114605
>Category:       kern
>Synopsis:       [patch] ata: new loader tunable for 80-pin cable check
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 15 16:30:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Morozovsky
>Release:        FreeBSD 7-CURRENT/6-STABLE
>Organization:
Cronyx Plus LLC (RiNet ISP)
>Environment:
System: FreeBSD 7-CURRENT/6-STABLE 


>Description:

Some laptops like mime MSI S420 reports non-80-wire cable on their ATA disks
hence limiting DMA operations to ATA33.  On the other hand, both win32 and
Linuces use ultra-DMA mode for these disks without a problem.  Attached patch
introduces new loader tunable allowing user to bypass 80-pin cable check
to set DMA mode reported by the device.  My checks did not reveal any problems,
at least with systems available to me.

>How-To-Repeat:

>Fix:


Index: share/man/man4/ata.4
===================================================================
RCS file: /home/ncvs/src/share/man/man4/ata.4,v
retrieving revision 1.72
diff -u -r1.72 ata.4
--- share/man/man4/ata.4	10 Mar 2007 12:44:22 -0000	1.72
+++ share/man/man4/ata.4	15 Jul 2007 14:56:37 -0000
@@ -87,6 +87,9 @@
 set to 1 for DMA access, 0 for PIO (default is DMA).
 .It Va hw.ata.atapi_dma
 set to 1 for DMA access, 0 for PIO (default is DMA).
+.It Va hw.ata.dma_skip80pincheck
+set to 1 to skip checks for 80-pin cable (useful for some laptops).
+Default is disabled.
 .It Va hw.ata.wc
 set to 1 to enable Write Caching, 0 to disable (default is enabled).
 .Em WARNING :
Index: sys/dev/ata/ata-all.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.279
diff -u -r1.279 ata-all.c
--- sys/dev/ata/ata-all.c	23 Feb 2007 16:25:08 -0000	1.279
+++ sys/dev/ata/ata-all.c	15 Jul 2007 14:56:37 -0000
@@ -75,6 +75,7 @@
 uma_zone_t ata_request_zone;
 uma_zone_t ata_composite_zone;
 int ata_wc = 1;
+int dma_skip80pincheck = 0;
 
 /* local vars */
 static int ata_dma = 1;
@@ -88,6 +89,10 @@
 TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
 SYSCTL_INT(_hw_ata, OID_AUTO, atapi_dma, CTLFLAG_RDTUN, &atapi_dma, 0,
 	   "ATAPI device DMA mode control");
+TUNABLE_INT("hw.ata.dma_skip80pincheck", &dma_skip80pincheck);
+SYSCTL_INT(_hw_ata, OID_AUTO, dma_skip80pincheck, CTLFLAG_RDTUN,
+	   &dma_skip80pincheck, 0,
+	   "Skip checks for 80pin cable for ATA device when setting DMA mode");
 TUNABLE_INT("hw.ata.wc", &ata_wc);
 SYSCTL_INT(_hw_ata, OID_AUTO, wc, CTLFLAG_RDTUN, &ata_wc, 0,
 	   "ATA disk write caching");
Index: sys/dev/ata/ata-all.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.h,v
retrieving revision 1.124
diff -u -r1.124 ata-all.h
--- sys/dev/ata/ata-all.h	26 Jun 2007 22:13:43 -0000	1.124
+++ sys/dev/ata/ata-all.h	15 Jul 2007 14:56:37 -0000
@@ -519,6 +519,7 @@
 extern struct intr_config_hook *ata_delayed_attach;
 extern devclass_t ata_devclass;
 extern int ata_wc;
+extern int dma_skip80pincheck;
  
 /* public prototypes */
 /* ata-all.c: */
Index: sys/dev/ata/ata-chipset.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-chipset.c,v
retrieving revision 1.198
diff -u -r1.198 ata-chipset.c
--- sys/dev/ata/ata-chipset.c	25 Jun 2007 08:21:21 -0000	1.198
+++ sys/dev/ata/ata-chipset.c	15 Jul 2007 14:56:37 -0000
@@ -5507,9 +5507,15 @@
     struct ata_device *atadev = device_get_softc(dev);
 
     if (mode > ATA_UDMA2 && !(atadev->param.hwres & ATA_CABLE_ID)) {
-	ata_print_cable(dev, "device");
-	mode = ATA_UDMA2;
+	if (dma_skip80pincheck) {
+	    if (bootverbose)
+		device_printf(dev, "non-ATA66 cable check ignored\n");
+	} else {
+	    ata_print_cable(dev, "device");
+	    mode = ATA_UDMA2;
+	}
     }
+
     return mode;
 }
 
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list