From owner-freebsd-hackers Mon Aug 19 13:27:34 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9665037B400 for ; Mon, 19 Aug 2002 13:27:25 -0700 (PDT) Received: from panzer.kdm.org (panzer.kdm.org [216.160.178.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA69143E6A for ; Mon, 19 Aug 2002 13:27:24 -0700 (PDT) (envelope-from ken@panzer.kdm.org) Received: from panzer.kdm.org (localhost [127.0.0.1]) by panzer.kdm.org (8.12.5/8.12.5) with ESMTP id g7JKR8KD089666; Mon, 19 Aug 2002 14:27:08 -0600 (MDT) (envelope-from ken@panzer.kdm.org) Received: (from ken@localhost) by panzer.kdm.org (8.12.5/8.12.5/Submit) id g7JKR8Hj089665; Mon, 19 Aug 2002 14:27:08 -0600 (MDT) (envelope-from ken) Date: Mon, 19 Aug 2002 14:27:08 -0600 From: "Kenneth D. Merry" To: Gardner Buchanan Cc: "'freebsd-hackers@freebsd.org'" Subject: Re: CAM "wiring", LUNs and duplicate wired entries Message-ID: <20020819142708.A89419@panzer.kdm.org> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="opJtzjQTFsWo+cga" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from gardner.buchanan@adobe.com on Mon, Aug 19, 2002 at 01:45:52PM -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --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: 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: 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