From nobody@FreeBSD.org  Fri Mar 14 05:06:57 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A229F106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 14 Mar 2008 05:06:57 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 8CD5E8FC24
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 14 Mar 2008 05:06:57 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m2E53cUP025582
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 14 Mar 2008 05:03:38 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m2E53cea025581;
	Fri, 14 Mar 2008 05:03:38 GMT
	(envelope-from nobody)
Message-Id: <200803140503.m2E53cea025581@www.freebsd.org>
Date: Fri, 14 Mar 2008 05:03:38 GMT
From: Adam Pordzik <tektonaut@fuckner.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: bogus CHS to LBA mapping in (at least) ata
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         121686
>Category:       kern
>Synopsis:       [ata] bogus CHS to LBA mapping in (at least) ata
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 14 05:10:01 UTC 2008
>Closed-Date:    
>Last-Modified:  Sat Nov  7 18:50:03 UTC 2009
>Originator:     Adam Pordzik
>Release:        7-release
>Organization:
>Environment:
>Description:
After attaching a 16GB Transcend CF Disk to an ALIX (pcengine.ch Geode) SBC several DMA timeouts occurred in dmesg before init starts: (boot -v)

atapci0: <AMD CS5536 UDMA100 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xff00-0xff0f at device 15.2 on pci0
ata0-master: pio=PIO4 wdma=WDMA2 udma=UDMA66 cable=40 wire
ad0: setting PIO4 on CS5536 chip
ad0: DMA limited to UDMA33, device found non-ATA66 cable
ad0: setting UDMA33 on CS5536 chip
ad0: 15296MB <TRANSCEND 20070831> at ata0-master UDMA33

ad0: 31326208 sectors [33149C/15H/63S] 1 sectors/interrupt 1 depth queue
ad0: DMA limited to UDMA33, device found non-ATA66 cable
ad0: setting UDMA33 on CS5536 chip
ad0: 15296MB <TRANSCEND 20070831> at ata0-master UDMA33
ad0: setting UDMA33 on CS5536 chip
ad0: TIMEOUT - READ_DMA retrying (1 retry left) LBA=31326207
ad0: setting UDMA33 on CS5536 chip
ad0: TIMEOUT - READ_DMA retrying (0 retries left) LBA=31326207
ad0: setting UDMA33 on CS5536 chip
ad0: FAILURE - READ_DMA timed out LBA=31326207

DMA in general is working, with PIO a get similar results.

According to atacontrol, the CF Card have 31326208 sectors (verified),
so FAILURE is at the last block. I assume GEOM looks here for a label.
 
BIOS claims the CF has either a 1949/255/63 or 1023/240/63 mapping, The
CF announces itself with 16383/15/63 and ata-disc calculates
[33149C/15H/63S]. (sade, fdisk and sysinstall also use this values.)
 
The product of latter c/h/s values is 31325805, which does not equal
the physical 31326208. Actually I cannot access any sector beyond
31325804 with e.g. dd
 
 
>How-To-Repeat:

>Fix:
Make LBA-addressing independent from CHS? I would also be happy with
some device.hints to override calculated cylinder count, where I can
place static values.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: remko 
Responsible-Changed-When: Fri Mar 14 07:09:35 UTC 2008 
Responsible-Changed-Why:  
Hi Soren, could this be something you can help with? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121686 
Responsible-Changed-From-To: sos->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue May 12 04:49:40 UTC 2009 
Responsible-Changed-Why:  
sos@ is not actively working on ATA-related PRs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121686 

From: Alexander Motin <mav@FreeBSD.org>
To: bug-followup@FreeBSD.org, tektonaut@fuckner.net
Cc:  
Subject: Re: kern/121686: [ata] bogus CHS to LBA mapping in (at least) ata
Date: Sat, 07 Nov 2009 20:48:48 +0200

 ATA(4) doesn't uses CHS geometry for drives supporting LBA. I have
 doubts that this is geometry related issue. Reading after media end
 should give other error status, but not timeout. Can you try dd on
 different areas to make sure it is working there?
 
 -- 
 Alexander Motin
>Unformatted:
