From owner-freebsd-bugs@FreeBSD.ORG Sat Sep 22 05:50:01 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8FD716A421 for ; Sat, 22 Sep 2007 05:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CFF9213C455 for ; Sat, 22 Sep 2007 05:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l8M5o1jC067040 for ; Sat, 22 Sep 2007 05:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l8M5o1Ge067039; Sat, 22 Sep 2007 05:50:01 GMT (envelope-from gnats) Resent-Date: Sat, 22 Sep 2007 05:50:01 GMT Resent-Message-Id: <200709220550.l8M5o1Ge067039@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Eugene Grosbein Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DD4916A419 for ; Sat, 22 Sep 2007 05:45:49 +0000 (UTC) (envelope-from eugen@grosbein.pp.ru) Received: from grosbein.pp.ru (grgw.svzserv.kemerovo.su [213.184.64.166]) by mx1.freebsd.org (Postfix) with ESMTP id E4BE213C46E for ; Sat, 22 Sep 2007 05:45:48 +0000 (UTC) (envelope-from eugen@grosbein.pp.ru) Received: from grosbein.pp.ru (localhost [127.0.0.1]) by grosbein.pp.ru (8.14.1/8.14.1) with ESMTP id l8M5jluj002239 for ; Sat, 22 Sep 2007 13:45:47 +0800 (KRAST) (envelope-from eugen@grosbein.pp.ru) Received: (from eugen@localhost) by grosbein.pp.ru (8.14.1/8.14.1/Submit) id l8M5jlrt002238; Sat, 22 Sep 2007 13:45:47 +0800 (KRAST) (envelope-from eugen) Message-Id: <200709220545.l8M5jlrt002238@grosbein.pp.ru> Date: Sat, 22 Sep 2007 13:45:47 +0800 (KRAST) From: Eugene Grosbein To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/116538: [fdc] [patch] reintroduce FD_NO_CHLINE flag for fdc(4) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eugene Grosbein List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Sep 2007 05:50:02 -0000 >Number: 116538 >Category: kern >Synopsis: [fdc] [patch] reintroduce FD_NO_CHLINE flag for fdc(4) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Sep 22 05:50:01 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Eugene Grosbein >Release: FreeBSD 6.2-STABLE i386 >Organization: Svyaz-Service JSC >Environment: System: FreeBSD grosbein.pp.ru 6.2-STABLE FreeBSD 6.2-STABLE #2: Sun Sep 16 16:54:23 KRAST 2007 eu@grosbein.pp.ru:/home/obj/usr/local/src/sys/DADV i386 >Description: Workaround for floppy disk drives missing media change indication support (FD_NO_CHLINE flag for fdc(4)) was removed in 2001 after media change detection was fixed in fdc(4) and believed to work reliably. This is no longer true these days when new motherboards have FDD controlles that miss Configuration Control Register, so fdc(4) cannot detect media change. We need FD_NO_CHLINE flag again until fdc(4) fixed. See commit log message for sys/dev/fdc/fdc.c,v.1.307.2.4 for additional details. >How-To-Repeat: Take motherboard which FDD controller does not have CCR. Modern Intel desktop motherboards fit, also you may get more examples from http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/103841 Boot kernel with fdc(4) compiled in or kldload fdc.ko when there is write-protected floppy in the drive. Then do: echo -n > /dev/fd0 You'll get 'Read-only file system' error. Remove disk from the drive, uprotect it, insert back and repeat 'echo -n > /dev/fd0'. You'll get the same error because media change detection does not work. For real example replace 'echo -n' with 'fdformat' that also opens device for writing. So it's impossible to format floppy drive until reboot if there was write-protected disk in the drive and the boot time. Note that fdc(4) man page still mentions 0x10 flag that was ever used as valuse for FD_NO_CHLINE flag it does not exist in the code many years. More, the value 0x10 is now used by fdc(4) internally for other means and we need to choose another value. >Fix: --- share/man/man4/fdc.4.orig 2007-09-16 16:23:27.000000000 +0800 +++ share/man/man4/fdc.4 2007-09-16 16:23:34.000000000 +0800 @@ -101,7 +101,7 @@ the driver. To indicate a drive that does not have the changeline support, this can be overridden using the per-drive device flags value of -.Ar 0x10 +.Ar 0x40 (causing each call to .Xr open 2 to perform the autodetection). @@ -98,6 +98,8 @@ * and fd1 */ #define FD_NO_PROBE 0x20 /* don't probe drive (seek test), just * assume it is there */ +#define FD_NO_CHLINE 0x40 /* drive does not support changeline + * aka. unit attention */ /* * Things that could conceiveably considered parameters or tweakables @@ -827,7 +829,8 @@ if (bp->bio_cmd & BIO_PROBE) { - if (!(fdin_rd(fdc) & FDI_DCHG) && !(fd->flags & FD_EMPTY)) + if (!(fd->flags & FD_NO_CHLINE) && + !(fdin_rd(fdc) & FDI_DCHG) && !(fd->flags & FD_EMPTY)) return (fdc_biodone(fdc, 0)); /* >Release-Note: >Audit-Trail: >Unformatted: