atacontrol broken in 7.1-PR

Jeremy Chadwick koitsu at
Mon Sep 29 03:13:26 UTC 2008

On Sun, Sep 28, 2008 at 08:07:44PM -0700, Jeremy Chadwick wrote:
> On Mon, Sep 29, 2008 at 03:07:48AM +0100, Bruce Cran wrote:
> > On Sun, 28 Sep 2008 17:36:03 -0700
> > Jeremy Chadwick <koitsu at> wrote:
> > > Bruce and Pegasus,
> > > 
> > > Can you please apply the below patch to src/sbin/atacontrol.c and let
> > > me know what the output is when doing "atacontrol list"?
> > > 
> > > This won't solve the problem, but it will help in determining which
> > > piece of code in src/sys/dev/ata/ata-all.c is returning an error to
> > > ioctl() (different pieces of the code return different errors, either
> > > ENXIO, ENODEV, or another error depending upon what gets returned
> > > from ata_raid_ioctl_func()).
> I misread part of the code.  ata_raid_ioctl() only gets called if the
> ata_raid_ioctl_func pointer is non-NULL (it defaults to NULL unless your
> system is found to need/require ataraid support; need/require does not
> mean "compiled in", I assume it means "we found devices/metadata that
> ataraid can handle").
> In your case, there are no arX devices, and the only ATA device you have
> is an ATAPI CD/DVD drive.
> > ATA channel 0:
> >     Master: acd0 <HL-DT-ST DVD+/-RW GSA-T11N/A102> ATA/ATAPI revision 5
> >     Slave:       no device present
> > atacontrol: ioctl(IOCATADEVICES) returned -1: Device not configured
> Right, silly me.  Here I was hoping I could get the return code of
> ata_ioctl(), but that's not the case.  There's no way for me to get that
> information; ioctl() returns -1 on failure, and 0 on success.
> truss isn't going to be enough for this, because I need to see into the
> kernel ioctl() layer to find out what's going on in the ATA code.
> Simply put, I don't know how to efficiently debug this problem under
> FreeBSD.  dtrace is available on 7.1-PRERELEASE, but I'm unfamiliar with
> it.


While working on some other ATA-related code on a test/dev box I just
built about 30 minutes ago, I decided to do "atacontrol list" to see
what would happen:

testbox# atacontrol list
ATA channel 0:
    Master:  ad0 <ST3120026AS/3.05> Serial ATA v1.0
    Slave:       no device present
ATA channel 1:
    Master: acd0 <CD-224E/1.9A> ATA/ATAPI revision 0
    Slave:       no device present
atacontrol: ioctl(IOCATADEVICES): Device not configured

This box I have physical + serial access to, so I should be able to try
and track this down, now that I have something to work with.  :-)

I'll let you guys know what I find.

| Jeremy Chadwick                                jdc at |
| Parodius Networking              |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |

More information about the freebsd-hackers mailing list