Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Feb 2008 15:47:04 +0100
From:      Thomas Quinot <thomas@FreeBSD.ORG>
To:        Andriy Gapon <avg@icyb.net.ua>
Cc:        freebsd-gnome@freebsd.org
Subject:   Re: hal and "criss-crossed" atapicam
Message-ID:  <20080217144704.GA38221@melamine.cuivre.fr.eu.org>
In-Reply-To: <47B81244.9090802@icyb.net.ua>
References:  <47B81244.9090802@icyb.net.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
* Andriy Gapon, 2008-02-17 :

> [Disclaimer: yes, I've read BUGS section of atapicam(4) (should probably
> be named "CAVEATS"), but this is life.]

Ah, well. The whole point of software development is to do things that
are impossible. Or inadvisable. (Occasionally, both.)

> I have a system with two IDE CD/DVD drives. atapicam and atapicd are
> enabled and for some reason cd(4) unit numbers are criss-crossed
> compared to the acd(4) numbers:
> acd0 -> cd1
> acd1 -> cd0
> 
> acd0: CDRW <LITE-ON LTR-40125W/WS03> at ata0-master UDMA33
> acd1: DVDR <HL-DT-ST DVDRAM GSA-4163B/A105> at ata1-master UDMA33
> cd0: <HL-DT-ST DVDRAM GSA-4163B A105> Removable CD-ROM SCSI-0 device
> cd1: <LITE-ON LTR-40125W WS03> Removable CD-ROM SCSI-0 device

That would be an issue of CAM and ATA scanning controllers in a
different order. Hard to say without at least complete "boot -v" and
"camcontrol devlist -v" output.

> These devices are both masters on different IDE channels.

Right, otherwise the numbering would be consistent, since within a
single controller both subsystems scan first the master then the slave.
 
> Maybe this or maybe something else seems to confuse HAL a little bit.
> Relevant snippets from lshal are pasted at the end.
> As you can see, the net result is that HAL sees 3 non-ignored devices:
> cd1 ("light-on"), cd0 ("dvdram"), acd1 ("dvdram" again).
> For some reason, acd1 was not recognized as having a paired atapicam
> device and situation is quite messy in general.

I am not familiar with HAL's handling of ATAPI devices, but if what you
are trying to do is to determine when two device nodes (say, an acd and
a cd one) really are two interfaces to the same underlying device, I
would not advise relying on unit numbers. The correct way to do that
is to first identify the correspondance between ATA buses and CAM buses
(as shown e.g. by "camcontrol devlist -v | grep '^scbus.*on ata'" and
then note that on the CAM side, the master is always target 0 on its
bugs and the slave, target 1.

But then again, you should really ask yourself whether you really need
to do that in the first place. What requirement are you trying to
implement? From the point of view of HAL there are four device nodes on
your system, why do you care whether these really are just two actual
devices seen through different interfaces?

In other words, you see three devices in HAL, and your question seems to
imply that you expect to see only two, but why wouldn't you see *four*
devices in HAL?

> I would appreciate any advice on how to resolve this, either in atapicam
> or in hald, either via configuration or via code.

You can override cam's choice of unit numbers by wiring these down using
kernel hints, see scsi(4) man page.

Thomas.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080217144704.GA38221>