Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2002 14:27:08 -0600
From:      "Kenneth D. Merry" <ken@kdm.org>
To:        Gardner Buchanan <gardner.buchanan@adobe.com>
Cc:        "'freebsd-hackers@freebsd.org'" <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: CAM "wiring", LUNs and duplicate wired entries
Message-ID:  <20020819142708.A89419@panzer.kdm.org>
In-Reply-To: <F0599FEE436AD411A77B00805F6512CA01B284A9@ottmail1.jetform.com>; from gardner.buchanan@adobe.com on Mon, Aug 19, 2002 at 01:45:52PM -0400
References:  <F0599FEE436AD411A77B00805F6512CA01B284A9@ottmail1.jetform.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--opJtzjQTFsWo+cga
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Aug 19, 2002 at 13:45:52 -0400, Gardner Buchanan wrote:
> Recently I've noticed that the SCSI ID "wiring" logic is missidentifying
> duplicate IDs with seperate LUNs as "duplicates": my kernel config says
> this:
> 
> # Wired down SCSI unit numbers.
> #
> device        scbus0 at sym0
> device        da0 at scbus0 target 3 unit 0
> device        cd0 at scbus0 target 3 unit 1
> device        da1 at scbus0 target 6
> device        da2 at scbus0 target 9
> 
> Here cd0 and da0 have the same bus and target, but are different LUNs.  The
> probe messages look like this:
> 
> Aug 18 17:26:38 akbar /kernel: FreeBSD 4.6-STABLE #7: Sat Aug 17 19:19:11
> EDT 2002
> ...
> Aug 18 17:26:39 akbar /kernel: Waiting 3 seconds for SCSI devices to settle
> Aug 18 17:26:39 akbar /kernel: (noperiph:sym0:0:-1:-1): SCSI BUS reset
> delivered
> Aug 18 17:26:39 akbar /kernel: (da0:sym0:0:3:0): Duplicate Wired Device
> entry!
> Aug 18 17:26:39 akbar /kernel: (da0:sym0:0:3:0): Second device (da device at
> scbus0 target 8 lun 0) will not be wired
> Aug 18 17:26:39 akbar /kernel: da3 at sym0 bus 0 target 8 lun 0
> Aug 18 17:26:39 akbar /kernel: da3: <Quantum XP32150W 81HB> Fixed Direct
> Access SCSI-2 device
> Aug 18 17:26:39 akbar /kernel: da3: 20.000MB/s transfers (10.000MHz, offset
> 15, 16bit), Tagged Queueing Enabled
> Aug 18 17:26:39 akbar /kernel: da3: 2050MB (4199760 512 byte sectors: 255H
> 63S/T 261C)

[ ... ]

> Aug 18 17:26:40 akbar /kernel: da0 at sym0 bus 0 target 3 lun 0
> Aug 18 17:26:40 akbar /kernel: da0: <MATSHITA PD-1 LF-1000 A109> Removable
> Optical SCSI-2 device
> Aug 18 17:26:40 akbar /kernel: da0: 5.000MB/s transfers (5.000MHz, offset 8)
> Aug 18 17:26:40 akbar /kernel: da0: Attempt to query device size failed: NOT
> READY, Medium not present
> 
> As near as I can make out, the code in cam_periph.c doesn't take into
> account LUN when testing for duplicates.  I seem to be getting the correct
> wired value though.  My understanding is I should get cd1, rather than cd0,
> if the "wired" cd0 doesn't probe properly.

I don't think that's the problem.  I think the problem is that the device
at target 8 is getting identified to camperiphnextunit() as a wired device,
when it isn't.

Try the attached patch and see if it fixes things for you.

I haven't tried compiling or running this, so beware.

> Am I missing the boat on how wiring is meant to work?

I don't think so.  It may be that you should use 'lun 0' instead of 'unit
0', but that isn't the source of your problem in this case.  (The code
looks for 'lun', not 'unit', but I don't know whether 'unit' is aliased to
'lun' somewhere or other.)

Ken
-- 
Kenneth Merry
ken@kdm.org

--opJtzjQTFsWo+cga
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cam_periph.c.stable.20020819"

==== //depot/FreeBSD-ken-RELENG_4/src/sys/cam/cam_periph.c#1 - /usr/home/ken/perforce/FreeBSD-ken-RELENG_4/src/sys/cam/cam_periph.c ====
*** /tmp/tmp.576.0	Mon Aug 19 14:23:24 2002
--- /usr/home/ken/perforce/FreeBSD-ken-RELENG_4/src/sys/cam/cam_periph.c	Mon Aug 19 14:23:12 2002
***************
*** 335,341 ****
  	periph_name = p_drv->driver_name;
  	snprintf(pathbuf, sizeof(pathbuf), "scbus%d", pathid);
  	i = -1;
! 	while ((i = resource_locate(i, periph_name)) != -1) {
  		dname = resource_query_name(i);
  		dunit = resource_query_unit(i);
  		if (resource_string_value(dname, dunit, "at", &strval) == 0) {
--- 335,341 ----
  	periph_name = p_drv->driver_name;
  	snprintf(pathbuf, sizeof(pathbuf), "scbus%d", pathid);
  	i = -1;
! 	for (hit = 0; (i = resource_locate(i, periph_name)) != -1; hit = 0) {
  		dname = resource_query_name(i);
  		dunit = resource_query_unit(i);
  		if (resource_string_value(dname, dunit, "at", &strval) == 0) {

--opJtzjQTFsWo+cga--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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