Bug 122847 - [ata] [patch] atacontrol reports "ioctl(IOCATADEVICES): Device not configured" with ATI IXP600
Summary: [ata] [patch] atacontrol reports "ioctl(IOCATADEVICES): Device not configured...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 7.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-17 13:00 UTC by arnaud.houdelette
Modified: 2009-05-07 20:53 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description arnaud.houdelette 2008-04-17 13:00:06 UTC
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.
Comment 1 Benjamin Close 2008-05-09 12:35:49 UTC
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.
Comment 2 Alexander Motin freebsd_committer freebsd_triage 2009-05-07 20:52:49 UTC
State Changed
From-To: open->closed

Patch was committed to 8-CURRENT and merged to 7-STABLE.