From nobody@FreeBSD.org  Thu Apr 17 11:52:13 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 D67DF106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Apr 2008 11:52:13 +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 C9F358FC1F
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Apr 2008 11:52:13 +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 m3HBq1HG027080
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 17 Apr 2008 11:52:01 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m3HBq1U5027079;
	Thu, 17 Apr 2008 11:52:01 GMT
	(envelope-from nobody)
Message-Id: <200804171152.m3HBq1U5027079@www.freebsd.org>
Date: Thu, 17 Apr 2008 11:52:01 GMT
From: Arnaud Houdelette <arnaud.houdelette@tzim.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: atacontrol reports "ioctl(IOCATADEVICES): Device not configured" with ATI IXP600
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         122847
>Category:       kern
>Synopsis:       [ata] [patch] atacontrol reports "ioctl(IOCATADEVICES): Device not configured" with ATI IXP600
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 17 12:00:06 UTC 2008
>Closed-Date:    Thu May 07 19:53:21 UTC 2009
>Last-Modified:  Thu May 07 19:53:21 UTC 2009
>Originator:     Arnaud Houdelette
>Release:        7.0-STABLE
>Organization:
N/A
>Environment:
FreeBSD carenath.tzim.net 7.0-STABLE FreeBSD 7.0-STABLE #0: Wed Apr 16 14:26:10 CEST 2008     tzim@carenath.tzim.net:/usr/obj/usr/src/sys/CARENATH  amd64
Motherboard MSI K9AGM3-F
>Description:
Running FreeBSD 7.0-STABLE (csup today) on AMD64.

I got a MSI K9AGM3-F motherboard, with ATI SB600 chipset. The PATA controller
is well recognised as <ATI IXP600 UDMA133 controller>, but the sata controler
is detected as <ATI (ID=43801002) AHCI controller> : 

The SATA controller is setup in AHCI mode on the BIOS.

(output from dmesg : ) 
atapci0: <ATI (ID=43801002) AHCI controller> port 0xb000-0xb007,0xa000-0xa003,0x9000-0x9007,0x8000-0x8003,0x7000-0x700f mem 0xfe7ff800-0xfe7ffbff irq 22 at device 18.0 on pci0
atapci0: Reserved 0x10 bytes for rid 0x20 type 4 at 0x7000
atapci0: Reserved 0x400 bytes for rid 0x24 type 3 at 0xfe7ff800
ioapic0: routing intpin 22 (PCI IRQ 22) to vector 49
atapci0: [MPSAFE]
atapci0: [ITHREAD]
atapci0: AHCI Version 01.10 controller with 4 ports detected

atacontrol list returns the following : 
[carenath] ~# atacontrol list
ATA channel 0:
    Master:  ad0 <Maxtor 6Y120L0/YAR41BW0> ATA/ATAPI revision 7
    Slave:       no device present
atacontrol: ioctl(IOCATADEVICES): Device not configured

The 4 drives are still recognised and work perfectly.


>How-To-Repeat:
Run the "atacontrol list" command.
>Fix:


>Release-Note:
>Audit-Trail:

From: Benjamin Close <Benjamin.Close@clearchain.com>
To: bug-followup@FreeBSD.org, arnaud.houdelette@tzim.net
Cc:  
Subject: Re: kern/122847: [ata] atacontrol reports "ioctl(IOCATADEVICES):
 Device not configured" with ATI IXP600
Date: Fri, 09 May 2008 21:05:49 +0930

 This bug occurs when there is missing controllers in the 0..n range. Ie, 
 if the box has controllers:
     ata2
     ata3
 
 via a atapci but no native controllers (ie ata0, ata1)
 
 atacontrol list
 
 Will fail to list any controllers.
 This is due to atacontrol requesting information about a non existent 
 channel (ata0) as it sequentially goes from 0..n (where n is obtained 
 from IOATAGMAXCHANNEL). ata(4) notices the invalid controller request 
 and returns EXIO. Hence atacontrol thinks it's an error and exits.
 
 A potential fix is at:
 
 http://lists.freebsd.org/pipermail/freebsd-stable/2008-April/041991.html
 
 However this simply avoids the real problem, that is, there needs to be 
 a way to ask the kernel what channels exist.
 One potential solution is to introduce a IOATAGCHANNELS ioctl which 
 returns a list of valid channels taking a struct like:
 
 struct ata_ioc_channels {
     int max;
     int channels[n];
 }
 
 
 and replace the MAXCHANNELS request.
 Till then the patch will ignore the error state.
State-Changed-From-To: open->closed 
State-Changed-By: mav 
State-Changed-When: Thu May 7 19:52:49 UTC 2009 
State-Changed-Why:  
Patch was committed to 8-CURRENT and merged to 7-STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122847 
>Unformatted:
