From owner-freebsd-scsi Sat Nov 30 18:35: 7 2002 Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B0EFD37B401; Sat, 30 Nov 2002 18:35:03 -0800 (PST) Received: from net2.dinoex.sub.org (net2.dinoex.de [212.184.201.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F19243EAF; Sat, 30 Nov 2002 18:35:01 -0800 (PST) (envelope-from citylink.dinoex.sub.org!pmc@citylink.dinoex.sub.org) Received: from net2.dinoex.sub.org (uucp@net2.dinoex.de [212.184.201.182]) by net2.dinoex.sub.org (8.12.6/8.12.6) with ESMTP id gB12YcaX000230; Sun, 1 Dec 2002 03:34:39 +0100 (CET) (envelope-from citylink.dinoex.sub.org!pmc@citylink.dinoex.sub.org) X-Authentication-Warning: net2.dinoex.sub.org: Host uucp@net2.dinoex.de [212.184.201.182] claimed to be net2.dinoex.sub.org Received: from citylink.dinoex.sub.org (uucp@localhost) by net2.dinoex.sub.org (8.12.6/8.12.6/Submit) with UUCP id gB12Ybja000229; Sun, 1 Dec 2002 03:34:37 +0100 (CET) (envelope-from citylink.dinoex.sub.org!pmc@citylink.dinoex.sub.org) Received: from disp.oper.dinoex.org by citylink.dinoex.sub.org (8.8.5/PMuch-B3b) with ESMTP id DAA26403; Sun, 1 Dec 2002 03:19:43 +0100 (CET) Received: (from pmc@localhost) by disp.oper.dinoex.org (8.11.6/8.11.6) id gB12LZk02947; Sun, 1 Dec 2002 03:21:35 +0100 (CET) (envelope-from pmc) From: Peter Much Message-Id: <200212010221.gB12LZk02947@disp.oper.dinoex.org> Subject: Getting SCSI Scanner to work (with Symbios 53c810a and FreeBSD 4.4) To: freebsd-scsi@FreeBSD.ORG, freebsd-questions@FreeBSD.ORG Date: Sun, 1 Dec 2002 03:21:35 +0100 (CET) Cc: sane-devel@www.mostang.com X-Mailer: ELM [version 2.5 PL5] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Keywords: FreeBSD SANE Scanner Mustek SCSI MFS-6000CX synchronous disable Symbios 53c810a Just for the records, or: to whom it may concern. This is what I had to do to get a scsi scanner to work. I post it here so others having a similar problem may get inspired. I got some Mustek MFS-6000CX. The SANE docs say this scanner will not run synchronous scsi transfers and will not disconnect/ reconnect. The Qlogic 1020 controller does not detect it, but instead it will hang infinitely at biosboot. The WD7000 controller will detect it, but either it does not report it to the host, or the FreeBSD driver does not recognize it. I did not check this further, as this ISA controller is rather outdated (although it likely might be good enough for a scanner). The Symbios 53c810a will detect the scanner at biosboot as an asynchronous scsi device, and also FreeBSD detects it as devicetype "Scanner" when looking for devices. But it is not possible to send any scsi command (like tur, inquiry, etc.) to the scanner; none will be answered. Modifying parameters with "camcontrol negotiate" does not help. The scanner will be lost at "camcontrol rescan" and will never be detected again until system reboot. Each time a scsi command is issued to the scanner, there will be no answer, but a kernel error message is logged: /kernel: (probe5:sym0:0:6:0): phase change 6-7 6@07c5bf8c resid=5. ------------------------------------------------------------------- I investigated the source of the Symbios driver and found out: It is not possible to switch off synchronous transfer negotiation for a device. There is a variable named "period" in the source, and it is set to 25, and it has to do something with synchronous transfer. The driver will try to negotiate this value with every device, and when it does this to an asynch device, the above error "phase change 6-7" will appear. This happens with other asynch devices too. But there it does happen only once, at detection time. Afterwards the "period" value is changed to 0, and there will be no problems. Obviousely there is some reaction from the device, and this reaction makes that the driver changes that value. And obviousely the Mustek scanner does not provide this expected reaction, so the 25 value is negotiated again and again before each scsi command, and then the command does fail due to the "phase change" error. So, after figuring this out, the solution is rather simple: we need to change the "period" value to 0 on our own initiative. I did not find a quirk table for generic scsi devices where such things could be meddled with. (This would have been the nice solution, making the modification dependent on the scanner's device id string.) Instead, I did hard-code the scanner's scsi-id via a config file option. The tradeoff is, if you have more than one Symbios controller in the machine, then the respective scsi-id on each bus will have synch transfers disabled. I did not notice any other tradeoff - I have a disk and two tapes on that bus, and they work just fine (except for the typical effects of having a device on the bus that does not disconnect/reconnect). The disabling of disconnect/reconnect is simple and works as documented: "camcontrol negotiate 0:6:0 -D disable", where 6 is the scsi-id of the scanner. Here is the diff to the Symbios driver, it applies to the source from RELENG_4_4_0_RELEASE. *** sys/conf/options.i386.orig Wed Aug 15 03:23:48 2001 --- sys/conf/options.i386 Thu Nov 28 02:49:01 2002 *************** *** 1,4 **** ! # $FreeBSD: src/sys/conf/options.i386,v 1.132.2.7 2001/08/15 01:23:48 peter Exp $ DISABLE_PSE IDE_DELAY --- 1,4 ---- ! # $FreeBSD: $ DISABLE_PSE IDE_DELAY *************** *** 133,138 **** --- 133,140 ---- PCVT_SCREENSAVER opt_pcvt.h PCVT_USEKBDSEC opt_pcvt.h PCVT_VT220KEYB opt_pcvt.h + + SYM_MUSTEK_6000CX_ID opt_sym.h # voxware options GUS_DMA2 opt_sound.h *** sys/dev/sym/sym_hipd.c.orig Thu Nov 28 02:50:07 2002 --- sys/dev/sym/sym_hipd.c Thu Nov 28 02:55:11 2002 *************** *** 55,61 **** * SUCH DAMAGE. */ ! /* $FreeBSD: src/sys/dev/sym/sym_hipd.c,v 1.6.2.10 2001/07/08 20:04:04 groudier Exp $ */ #define SYM_DRIVER_NAME "sym-1.6.5-20000902" --- 55,61 ---- * SUCH DAMAGE. */ ! /* $FreeBSD: $ */ #define SYM_DRIVER_NAME "sym-1.6.5-20000902" *************** *** 7836,7841 **** --- 7836,7849 ---- * Build a negotiation message if needed. * (nego_status is filled by sym_prepare_nego()) */ + #ifdef SYM_MUSTEK_6000CX_ID + if (tp->tinfo.current.period != tp->tinfo.goal.period && + ccb_h->target_id == SYM_MUSTEK_6000CX_ID) { + printf("Fixing goal period for Mustek 6000CX: %d->%d\n", + tp->tinfo.goal.period, tp->tinfo.current.period); + tp->tinfo.goal.period = tp->tinfo.current.period; + } + #endif cp->nego_status = 0; if (tp->tinfo.current.width != tp->tinfo.goal.width || tp->tinfo.current.period != tp->tinfo.goal.period || To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message