1998-07-04 22:30:26 +00:00
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
/*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Copyright (c) 1990 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Don Ahn.
|
|
|
|
*
|
1995-01-11 16:13:01 +00:00
|
|
|
* Copyright (c) 1993, 1994 by
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
* jc@irbs.UUCP (John Capo)
|
|
|
|
* vak@zebub.msk.su (Serge Vakulenko)
|
|
|
|
* ache@astral.msk.su (Andrew A. Chernov)
|
1995-01-11 16:13:01 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) 1993, 1994, 1995 by
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
* joerg_wunsch@uriah.sax.de (Joerg Wunsch)
|
1995-01-06 15:20:00 +00:00
|
|
|
* dufault@hda.com (Peter Dufault)
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1993-09-15 23:27:45 +00:00
|
|
|
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
1998-07-18 03:15:33 +00:00
|
|
|
* $Id: fd.c,v 1.118 1998/07/15 09:59:30 bde Exp $
|
1993-06-12 14:58:17 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1994-02-07 04:27:13 +00:00
|
|
|
#include "ft.h"
|
|
|
|
#if NFT < 1
|
|
|
|
#undef NFDC
|
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
#include "fd.h"
|
1998-01-24 02:54:56 +00:00
|
|
|
#include "opt_devfs.h"
|
1997-09-16 07:45:45 +00:00
|
|
|
#include "opt_fdc.h"
|
1994-02-07 04:27:13 +00:00
|
|
|
|
|
|
|
#if NFDC > 0
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/conf.h>
|
1997-03-23 03:37:54 +00:00
|
|
|
#include <sys/fcntl.h>
|
1995-02-26 01:37:51 +00:00
|
|
|
#include <machine/clock.h>
|
1994-02-07 04:27:13 +00:00
|
|
|
#include <machine/ioctl_fd.h>
|
|
|
|
#include <sys/disklabel.h>
|
|
|
|
#include <sys/buf.h>
|
|
|
|
#include <sys/malloc.h>
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
#include <sys/proc.h>
|
1994-02-07 04:27:13 +00:00
|
|
|
#include <sys/syslog.h>
|
1996-12-18 17:44:31 +00:00
|
|
|
#ifdef notyet
|
1994-10-19 00:08:07 +00:00
|
|
|
#include <sys/dkstat.h>
|
1996-12-18 17:44:31 +00:00
|
|
|
#endif
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <i386/isa/isa.h>
|
|
|
|
#include <i386/isa/isa_device.h>
|
|
|
|
#include <i386/isa/fdreg.h>
|
|
|
|
#include <i386/isa/fdc.h>
|
|
|
|
#include <i386/isa/rtc.h>
|
1995-01-06 15:20:00 +00:00
|
|
|
#include <machine/stdarg.h>
|
1994-09-25 06:04:25 +00:00
|
|
|
#if NFT > 0
|
|
|
|
#include <sys/ftape.h>
|
|
|
|
#include <i386/isa/ftreg.h>
|
|
|
|
#endif
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef DEVFS
|
1995-09-03 05:43:50 +00:00
|
|
|
#include <sys/devfsext.h>
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <dev/slice/slice.h>
|
|
|
|
#endif /* SLICE */
|
|
|
|
#endif /* DEVFS */
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
/* misuse a flag to identify format operation */
|
|
|
|
#define B_FORMAT B_XXX
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1997-10-19 13:12:02 +00:00
|
|
|
/* configuration flags */
|
|
|
|
#define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */
|
|
|
|
|
|
|
|
/* internally used only, not really from CMOS: */
|
|
|
|
#define RTCFDT_144M_PRETENDED 0x1000
|
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/*
|
|
|
|
* this biotab field doubles as a field for the physical unit number
|
|
|
|
* on the controller
|
|
|
|
*/
|
|
|
|
#define id_physid id_scsiid
|
|
|
|
|
1995-01-06 15:20:00 +00:00
|
|
|
/* error returns for fd_cmd() */
|
|
|
|
#define FD_FAILED -1
|
|
|
|
#define FD_NOT_VALID -2
|
|
|
|
#define FDC_ERRMAX 100 /* do not log more */
|
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
#define NUMTYPES 14
|
|
|
|
#define NUMDENS (NUMTYPES - 6)
|
1993-12-16 04:28:42 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/* These defines (-1) must match index for fd_types */
|
1994-02-07 04:27:13 +00:00
|
|
|
#define F_TAPE_TYPE 0x020 /* bit for fd_types to indicate tape */
|
|
|
|
#define NO_TYPE 0 /* must match NO_TYPE in ft.c */
|
|
|
|
#define FD_1720 1
|
|
|
|
#define FD_1480 2
|
|
|
|
#define FD_1440 3
|
|
|
|
#define FD_1200 4
|
|
|
|
#define FD_820 5
|
|
|
|
#define FD_800 6
|
|
|
|
#define FD_720 7
|
|
|
|
#define FD_360 8
|
|
|
|
|
|
|
|
#define FD_1480in5_25 9
|
|
|
|
#define FD_1440in5_25 10
|
|
|
|
#define FD_820in5_25 11
|
|
|
|
#define FD_800in5_25 12
|
|
|
|
#define FD_720in5_25 13
|
|
|
|
#define FD_360in5_25 14
|
|
|
|
|
1993-12-16 04:28:42 +00:00
|
|
|
|
1995-12-10 13:40:44 +00:00
|
|
|
static struct fd_type fd_types[NUMTYPES] =
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1993-12-21 05:09:21 +00:00
|
|
|
{ 21,2,0xFF,0x04,82,3444,1,FDC_500KBPS,2,0x0C,2 }, /* 1.72M in HD 3.5in */
|
|
|
|
{ 18,2,0xFF,0x1B,82,2952,1,FDC_500KBPS,2,0x6C,1 }, /* 1.48M in HD 3.5in */
|
|
|
|
{ 18,2,0xFF,0x1B,80,2880,1,FDC_500KBPS,2,0x6C,1 }, /* 1.44M in HD 3.5in */
|
|
|
|
{ 15,2,0xFF,0x1B,80,2400,1,FDC_500KBPS,2,0x54,1 }, /* 1.2M in HD 5.25/3.5 */
|
|
|
|
{ 10,2,0xFF,0x10,82,1640,1,FDC_250KBPS,2,0x2E,1 }, /* 820K in HD 3.5in */
|
|
|
|
{ 10,2,0xFF,0x10,80,1600,1,FDC_250KBPS,2,0x2E,1 }, /* 800K in HD 3.5in */
|
|
|
|
{ 9,2,0xFF,0x20,80,1440,1,FDC_250KBPS,2,0x50,1 }, /* 720K in HD 3.5in */
|
1994-03-02 18:34:41 +00:00
|
|
|
{ 9,2,0xFF,0x2A,40, 720,1,FDC_250KBPS,2,0x50,1 }, /* 360K in DD 5.25in */
|
1993-12-21 05:09:21 +00:00
|
|
|
|
|
|
|
{ 18,2,0xFF,0x02,82,2952,1,FDC_500KBPS,2,0x02,2 }, /* 1.48M in HD 5.25in */
|
|
|
|
{ 18,2,0xFF,0x02,80,2880,1,FDC_500KBPS,2,0x02,2 }, /* 1.44M in HD 5.25in */
|
|
|
|
{ 10,2,0xFF,0x10,82,1640,1,FDC_300KBPS,2,0x2E,1 }, /* 820K in HD 5.25in */
|
|
|
|
{ 10,2,0xFF,0x10,80,1600,1,FDC_300KBPS,2,0x2E,1 }, /* 800K in HD 5.25in */
|
|
|
|
{ 9,2,0xFF,0x20,80,1440,1,FDC_300KBPS,2,0x50,1 }, /* 720K in HD 5.25in */
|
|
|
|
{ 9,2,0xFF,0x23,40, 720,2,FDC_300KBPS,2,0x50,1 }, /* 360K in HD 5.25in */
|
1993-06-12 14:58:17 +00:00
|
|
|
};
|
|
|
|
|
1994-02-07 04:27:13 +00:00
|
|
|
#define DRVS_PER_CTLR 2 /* 2 floppies */
|
1995-01-11 16:13:01 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/***********************************************************************\
|
|
|
|
* Per controller structure. *
|
|
|
|
\***********************************************************************/
|
1994-02-07 04:27:13 +00:00
|
|
|
struct fdc_data fdc_data[NFDC];
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
/***********************************************************************\
|
|
|
|
* Per drive structure. *
|
1994-02-07 04:27:13 +00:00
|
|
|
* N per controller (DRVS_PER_CTLR) *
|
1993-06-12 14:58:17 +00:00
|
|
|
\***********************************************************************/
|
1995-12-10 13:40:44 +00:00
|
|
|
static struct fd_data {
|
1994-02-07 04:27:13 +00:00
|
|
|
struct fdc_data *fdc; /* pointer to controller structure */
|
1993-06-12 14:58:17 +00:00
|
|
|
int fdsu; /* this units number on this controller */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int type; /* Drive type (FD_1440...) */
|
1993-06-12 14:58:17 +00:00
|
|
|
struct fd_type *ft; /* pointer to the type descriptor */
|
|
|
|
int flags;
|
|
|
|
#define FD_OPEN 0x01 /* it's open */
|
|
|
|
#define FD_ACTIVE 0x02 /* it's active */
|
|
|
|
#define FD_MOTOR 0x04 /* motor should be on */
|
|
|
|
#define FD_MOTOR_WAIT 0x08 /* motor coming up */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int skip;
|
|
|
|
int hddrv;
|
1995-01-06 15:20:00 +00:00
|
|
|
#define FD_NO_TRACK -2
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int track; /* where we think the head is */
|
|
|
|
int options; /* user configurable options, see ioctl_fd.h */
|
1996-12-18 17:44:31 +00:00
|
|
|
#ifdef notyet
|
1994-10-19 00:08:07 +00:00
|
|
|
int dkunit; /* disk stats unit number */
|
1996-12-18 17:44:31 +00:00
|
|
|
#endif
|
1997-09-21 21:41:49 +00:00
|
|
|
struct callout_handle toffhandle;
|
|
|
|
struct callout_handle tohandle;
|
1996-04-07 14:46:42 +00:00
|
|
|
#ifdef DEVFS
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
int unit; /* as in fd0 */
|
|
|
|
void *bdevs[MAXPARTITIONS];
|
|
|
|
void *cdevs[MAXPARTITIONS];
|
|
|
|
struct subdev{
|
|
|
|
struct slice *slice;
|
|
|
|
int minor;
|
|
|
|
struct fd_data *drive;
|
|
|
|
struct slicelimits limit;
|
|
|
|
}subdevs[16];
|
|
|
|
struct intr_config_hook ich;
|
|
|
|
#else /* SLICE */
|
1996-04-07 14:46:42 +00:00
|
|
|
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
|
|
|
|
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif /* SLICE */
|
1995-12-08 11:19:42 +00:00
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
} fd_data[NFD];
|
|
|
|
|
|
|
|
/***********************************************************************\
|
|
|
|
* Throughout this file the following conventions will be used: *
|
|
|
|
* fd is a pointer to the fd_data struct for the drive in question *
|
|
|
|
* fdc is a pointer to the fdc_data struct for the controller *
|
|
|
|
* fdu is the floppy drive unit number *
|
|
|
|
* fdcu is the floppy controller unit number *
|
|
|
|
* fdsu is the floppy drive unit number on that controller. (sub-unit) *
|
|
|
|
\***********************************************************************/
|
1994-02-07 04:27:13 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
#if NFT > 0
|
|
|
|
int ftopen(dev_t, int);
|
|
|
|
int ftintr(ftu_t ftu);
|
|
|
|
int ftclose(dev_t, int);
|
|
|
|
void ftstrategy(struct buf *);
|
1998-07-15 09:59:31 +00:00
|
|
|
int ftioctl(dev_t, unsigned long, caddr_t, int, struct proc *);
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int ftdump(dev_t);
|
|
|
|
int ftsize(dev_t);
|
1995-04-06 07:20:16 +00:00
|
|
|
int ftattach(struct isa_device *, struct isa_device *, int);
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/* autoconfig functions */
|
|
|
|
static int fdprobe(struct isa_device *);
|
|
|
|
static int fdattach(struct isa_device *);
|
|
|
|
|
|
|
|
/* needed for ft driver, thus exported */
|
|
|
|
int in_fdc(fdcu_t);
|
|
|
|
int out_fdc(fdcu_t, int);
|
|
|
|
|
|
|
|
/* internal functions */
|
|
|
|
static void set_motor(fdcu_t, int, int);
|
|
|
|
# define TURNON 1
|
|
|
|
# define TURNOFF 0
|
|
|
|
static timeout_t fd_turnoff;
|
|
|
|
static timeout_t fd_motor_on;
|
|
|
|
static void fd_turnon(fdu_t);
|
|
|
|
static void fdc_reset(fdc_p);
|
1995-03-16 18:17:34 +00:00
|
|
|
static int fd_in(fdcu_t, int *);
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
static void fdstart(fdcu_t);
|
|
|
|
static timeout_t fd_timeout;
|
|
|
|
static timeout_t fd_pseudointr;
|
|
|
|
static int fdstate(fdcu_t, fdc_p);
|
1993-12-19 00:55:01 +00:00
|
|
|
static int retrier(fdcu_t);
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifndef SLICE
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
static int fdformat(dev_t, struct fd_formb *, struct proc *);
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
|
1997-09-17 20:16:17 +00:00
|
|
|
static int enable_fifo(fdc_p fdc);
|
|
|
|
|
|
|
|
static int fifo_threshold = 8; /* XXX: should be accessible via sysctl */
|
|
|
|
|
1993-12-19 00:55:01 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
#define DEVIDLE 0
|
|
|
|
#define FINDWORK 1
|
|
|
|
#define DOSEEK 2
|
|
|
|
#define SEEKCOMPLETE 3
|
|
|
|
#define IOCOMPLETE 4
|
|
|
|
#define RECALCOMPLETE 5
|
|
|
|
#define STARTRECAL 6
|
|
|
|
#define RESETCTLR 7
|
|
|
|
#define SEEKWAIT 8
|
|
|
|
#define RECALWAIT 9
|
|
|
|
#define MOTORWAIT 10
|
|
|
|
#define IOTIMEDOUT 11
|
|
|
|
|
1997-09-16 07:45:45 +00:00
|
|
|
#ifdef FDC_DEBUG
|
1996-07-12 07:41:34 +00:00
|
|
|
static char const * const fdstates[] =
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
"DEVIDLE",
|
|
|
|
"FINDWORK",
|
|
|
|
"DOSEEK",
|
|
|
|
"SEEKCOMPLETE",
|
|
|
|
"IOCOMPLETE",
|
|
|
|
"RECALCOMPLETE",
|
|
|
|
"STARTRECAL",
|
|
|
|
"RESETCTLR",
|
|
|
|
"SEEKWAIT",
|
|
|
|
"RECALWAIT",
|
|
|
|
"MOTORWAIT",
|
|
|
|
"IOTIMEDOUT"
|
|
|
|
};
|
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/* CAUTION: fd_debug causes huge amounts of logging output */
|
1996-07-12 07:41:34 +00:00
|
|
|
static int volatile fd_debug = 0;
|
1993-06-12 14:58:17 +00:00
|
|
|
#define TRACE0(arg) if(fd_debug) printf(arg)
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
#define TRACE1(arg1, arg2) if(fd_debug) printf(arg1, arg2)
|
1997-09-16 07:45:45 +00:00
|
|
|
#else /* FDC_DEBUG */
|
1993-06-12 14:58:17 +00:00
|
|
|
#define TRACE0(arg)
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
#define TRACE1(arg1, arg2)
|
1997-09-16 07:45:45 +00:00
|
|
|
#endif /* FDC_DEBUG */
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1995-01-11 16:13:01 +00:00
|
|
|
/* autoconfig structure */
|
|
|
|
|
|
|
|
struct isa_driver fdcdriver = {
|
|
|
|
fdprobe, fdattach, "fdc",
|
|
|
|
};
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static d_open_t Fdopen; /* NOTE, not fdopen */
|
1998-07-04 22:30:26 +00:00
|
|
|
static d_read_t fdread;
|
|
|
|
static d_write_t fdwrite;
|
1995-12-08 11:19:42 +00:00
|
|
|
static d_close_t fdclose;
|
|
|
|
static d_ioctl_t fdioctl;
|
|
|
|
static d_strategy_t fdstrategy;
|
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
/* even if SLICE defined, these are needed for the ft support. */
|
1995-12-08 11:19:42 +00:00
|
|
|
#define CDEV_MAJOR 9
|
|
|
|
#define BDEV_MAJOR 2
|
1998-07-04 22:30:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
static struct cdevsw fd_cdevsw = {
|
|
|
|
Fdopen, fdclose, fdread, fdwrite,
|
|
|
|
fdioctl, nostop, nullreset, nodevtotty,
|
|
|
|
seltrue, nommap, fdstrategy, "fd",
|
|
|
|
NULL, -1, nodump, nopsize,
|
|
|
|
D_DISK, 0, -1 };
|
1995-12-08 11:19:42 +00:00
|
|
|
|
|
|
|
|
1995-12-10 13:40:44 +00:00
|
|
|
static struct isa_device *fdcdevs[NFDC];
|
1994-10-19 00:08:07 +00:00
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
static sl_h_IO_req_t fdsIOreq; /* IO req downward (to device) */
|
|
|
|
static sl_h_ioctl_t fdsioctl; /* ioctl req downward (to device) */
|
|
|
|
static sl_h_open_t fdsopen; /* downwards travelling open */
|
1998-04-22 10:25:27 +00:00
|
|
|
/*static sl_h_close_t fdsclose; */ /* downwards travelling close */
|
1998-04-19 23:32:49 +00:00
|
|
|
static void fdsinit(void *);
|
|
|
|
|
|
|
|
static struct slice_handler slicetype = {
|
|
|
|
"floppy",
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
NULL, /* constructor */
|
|
|
|
&fdsIOreq,
|
|
|
|
&fdsioctl,
|
|
|
|
&fdsopen,
|
1998-04-22 10:25:27 +00:00
|
|
|
/*&fdsclose*/NULL,
|
1998-04-19 23:32:49 +00:00
|
|
|
NULL, /* revoke */
|
|
|
|
NULL, /* claim */
|
|
|
|
NULL, /* verify */
|
1998-05-06 23:35:36 +00:00
|
|
|
NULL, /* upconfig */
|
|
|
|
NULL /* dump */
|
1998-04-19 23:32:49 +00:00
|
|
|
};
|
|
|
|
#endif /* SLICE */
|
|
|
|
|
1995-01-06 15:20:00 +00:00
|
|
|
static int
|
|
|
|
fdc_err(fdcu_t fdcu, const char *s)
|
|
|
|
{
|
|
|
|
fdc_data[fdcu].fdc_errs++;
|
1995-10-04 07:01:23 +00:00
|
|
|
if(s) {
|
|
|
|
if(fdc_data[fdcu].fdc_errs < FDC_ERRMAX)
|
|
|
|
printf("fdc%d: %s", fdcu, s);
|
|
|
|
else if(fdc_data[fdcu].fdc_errs == FDC_ERRMAX)
|
|
|
|
printf("fdc%d: too many errors, not logging any more\n",
|
|
|
|
fdcu);
|
|
|
|
}
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1995-01-06 15:20:00 +00:00
|
|
|
return FD_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* fd_cmd: Send a command to the chip. Takes a varargs with this structure:
|
|
|
|
* Unit number,
|
|
|
|
* # of output bytes, output bytes as ints ...,
|
1995-05-30 08:16:23 +00:00
|
|
|
* # of input bytes, input bytes as ints ...
|
1995-01-06 15:20:00 +00:00
|
|
|
*/
|
|
|
|
|
1995-12-10 13:40:44 +00:00
|
|
|
static int
|
1995-01-06 15:20:00 +00:00
|
|
|
fd_cmd(fdcu_t fdcu, int n_out, ...)
|
|
|
|
{
|
|
|
|
u_char cmd;
|
|
|
|
int n_in;
|
|
|
|
int n;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, n_out);
|
|
|
|
cmd = (u_char)(va_arg(ap, int));
|
|
|
|
va_end(ap);
|
|
|
|
va_start(ap, n_out);
|
|
|
|
for (n = 0; n < n_out; n++)
|
|
|
|
{
|
|
|
|
if (out_fdc(fdcu, va_arg(ap, int)) < 0)
|
|
|
|
{
|
|
|
|
char msg[50];
|
|
|
|
sprintf(msg,
|
|
|
|
"cmd %x failed at out byte %d of %d\n",
|
|
|
|
cmd, n + 1, n_out);
|
|
|
|
return fdc_err(fdcu, msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
n_in = va_arg(ap, int);
|
|
|
|
for (n = 0; n < n_in; n++)
|
|
|
|
{
|
|
|
|
int *ptr = va_arg(ap, int *);
|
|
|
|
if (fd_in(fdcu, ptr) < 0)
|
|
|
|
{
|
|
|
|
char msg[50];
|
|
|
|
sprintf(msg,
|
|
|
|
"cmd %02x failed at in byte %d of %d\n",
|
|
|
|
cmd, n + 1, n_in);
|
|
|
|
return fdc_err(fdcu, msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1997-09-17 20:16:17 +00:00
|
|
|
static int
|
|
|
|
enable_fifo(fdc_p fdc)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
if ((fdc->flags & FDC_HAS_FIFO) == 0) {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX:
|
|
|
|
* Cannot use fd_cmd the normal way here, since
|
|
|
|
* this might be an invalid command. Thus we send the
|
|
|
|
* first byte, and check for an early turn of data directon.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (out_fdc(fdc->fdcu, I8207X_CONFIGURE) < 0)
|
|
|
|
return fdc_err(fdc->fdcu, "Enable FIFO failed\n");
|
|
|
|
|
|
|
|
/* If command is invalid, return */
|
|
|
|
j = 100000;
|
|
|
|
while ((i = inb(fdc->baseport + FDSTS) & (NE7_DIO | NE7_RQM))
|
|
|
|
!= NE7_RQM && j-- > 0)
|
|
|
|
if (i == (NE7_DIO | NE7_RQM)) {
|
|
|
|
fdc_reset(fdc);
|
|
|
|
return FD_FAILED;
|
|
|
|
}
|
|
|
|
if (j<0 ||
|
|
|
|
fd_cmd(fdc->fdcu, 3,
|
|
|
|
0, (fifo_threshold - 1) & 0xf, 0, 0) < 0) {
|
|
|
|
fdc_reset(fdc);
|
|
|
|
return fdc_err(fdc->fdcu, "Enable FIFO failed\n");
|
|
|
|
}
|
|
|
|
fdc->flags |= FDC_HAS_FIFO;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (fd_cmd(fdc->fdcu, 4,
|
|
|
|
I8207X_CONFIGURE, 0, (fifo_threshold - 1) & 0xf, 0, 0) < 0)
|
|
|
|
return fdc_err(fdc->fdcu, "Re-enable FIFO failed\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1995-12-10 13:40:44 +00:00
|
|
|
static int
|
1995-01-06 15:20:00 +00:00
|
|
|
fd_sense_drive_status(fdc_p fdc, int *st3p)
|
|
|
|
{
|
|
|
|
int st3;
|
|
|
|
|
|
|
|
if (fd_cmd(fdc->fdcu, 2, NE7CMD_SENSED, fdc->fdu, 1, &st3))
|
|
|
|
{
|
1995-03-26 19:28:22 +00:00
|
|
|
return fdc_err(fdc->fdcu, "Sense Drive Status failed\n");
|
1995-01-06 15:20:00 +00:00
|
|
|
}
|
|
|
|
if (st3p)
|
|
|
|
*st3p = st3;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1995-12-10 13:40:44 +00:00
|
|
|
static int
|
1995-01-06 15:20:00 +00:00
|
|
|
fd_sense_int(fdc_p fdc, int *st0p, int *cylp)
|
|
|
|
{
|
|
|
|
int st0, cyl;
|
|
|
|
|
|
|
|
int ret = fd_cmd(fdc->fdcu, 1, NE7CMD_SENSEI, 1, &st0);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
(void)fdc_err(fdc->fdcu,
|
|
|
|
"sense intr err reading stat reg 0\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (st0p)
|
|
|
|
*st0p = st0;
|
|
|
|
|
|
|
|
if ((st0 & NE7_ST0_IC) == NE7_ST0_IC_IV)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* There doesn't seem to have been an interrupt.
|
|
|
|
*/
|
|
|
|
return FD_NOT_VALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fd_in(fdc->fdcu, &cyl) < 0)
|
|
|
|
{
|
|
|
|
return fdc_err(fdc->fdcu, "can't get cyl num\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cylp)
|
|
|
|
*cylp = cyl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1995-12-10 13:40:44 +00:00
|
|
|
static int
|
1995-01-06 15:20:00 +00:00
|
|
|
fd_read_status(fdc_p fdc, int fdsu)
|
|
|
|
{
|
|
|
|
int i, ret;
|
1995-03-16 18:17:34 +00:00
|
|
|
|
1995-01-06 15:20:00 +00:00
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
{
|
1995-03-16 18:17:34 +00:00
|
|
|
/*
|
|
|
|
* XXX types are poorly chosen. Only bytes can by read
|
1998-07-11 06:35:39 +00:00
|
|
|
* from the hardware, but fdc->status[] wants u_ints and
|
1995-03-16 18:17:34 +00:00
|
|
|
* fd_in() gives ints.
|
|
|
|
*/
|
|
|
|
int status;
|
|
|
|
|
|
|
|
ret = fd_in(fdc->fdcu, &status);
|
|
|
|
fdc->status[i] = status;
|
|
|
|
if (ret != 0)
|
1995-01-06 15:20:00 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret == 0)
|
|
|
|
fdc->flags |= FDC_STAT_VALID;
|
|
|
|
else
|
|
|
|
fdc->flags &= ~FDC_STAT_VALID;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* autoconfiguration stuff */
|
|
|
|
/****************************************************************************/
|
1995-01-06 15:20:00 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* probe for existance of controller
|
|
|
|
*/
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
static int
|
1995-01-06 15:20:00 +00:00
|
|
|
fdprobe(struct isa_device *dev)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
fdcu_t fdcu = dev->id_unit;
|
|
|
|
if(fdc_data[fdcu].flags & FDC_ATTACHED)
|
|
|
|
{
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("fdc%d: unit used multiple times\n", fdcu);
|
1993-06-12 14:58:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1994-10-19 00:08:07 +00:00
|
|
|
fdcdevs[fdcu] = dev;
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc_data[fdcu].baseport = dev->id_iobase;
|
|
|
|
|
1993-12-03 05:01:40 +00:00
|
|
|
/* First - lets reset the floppy controller */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
outb(dev->id_iobase+FDOUT, 0);
|
1993-12-03 05:01:40 +00:00
|
|
|
DELAY(100);
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
outb(dev->id_iobase+FDOUT, FDO_FRST);
|
1993-12-03 05:01:40 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/* see if it can handle a command */
|
1995-01-06 15:20:00 +00:00
|
|
|
if (fd_cmd(fdcu,
|
|
|
|
3, NE7CMD_SPECIFY, NE7_SPEC_1(3, 240), NE7_SPEC_2(2, 0),
|
|
|
|
0))
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
return (IO_FDCSIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* wire controller into system, look for floppy units
|
|
|
|
*/
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
static int
|
1995-01-06 15:20:00 +00:00
|
|
|
fdattach(struct isa_device *dev)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
unsigned fdt;
|
1993-06-12 14:58:17 +00:00
|
|
|
fdu_t fdu;
|
|
|
|
fdcu_t fdcu = dev->id_unit;
|
|
|
|
fdc_p fdc = fdc_data + fdcu;
|
|
|
|
fd_p fd;
|
1996-07-12 07:41:34 +00:00
|
|
|
int fdsu, st0, st3, i;
|
|
|
|
#if NFT > 0
|
|
|
|
int unithasfd;
|
|
|
|
#endif
|
1994-02-07 04:27:13 +00:00
|
|
|
struct isa_device *fdup;
|
1995-01-06 15:20:00 +00:00
|
|
|
int ic_type = 0;
|
1996-04-07 14:46:42 +00:00
|
|
|
#ifdef DEVFS
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
char namebuf[64];
|
|
|
|
#else
|
1996-01-27 04:18:15 +00:00
|
|
|
int mynor;
|
1996-04-07 14:46:42 +00:00
|
|
|
int typemynor;
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif /* SLICE */
|
1996-04-07 14:46:42 +00:00
|
|
|
int typesize;
|
|
|
|
#endif
|
1994-10-19 00:08:07 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->fdcu = fdcu;
|
|
|
|
fdc->flags |= FDC_ATTACHED;
|
|
|
|
fdc->dmachan = dev->id_drq;
|
1996-04-08 19:40:57 +00:00
|
|
|
/* Acquire the DMA channel forever, The driver will do the rest */
|
|
|
|
isa_dma_acquire(fdc->dmachan);
|
1996-01-27 02:33:48 +00:00
|
|
|
isa_dmainit(fdc->dmachan, 128 << 3 /* XXX max secsize */);
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->state = DEVIDLE;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/* reset controller, turn motor off, clear fdout mirror reg */
|
|
|
|
outb(fdc->baseport + FDOUT, ((fdc->fdout = 0)));
|
1997-09-21 21:41:49 +00:00
|
|
|
bufq_init(&fdc->head);
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
/* check for each floppy drive */
|
1994-02-07 04:27:13 +00:00
|
|
|
for (fdup = isa_biotab_fdc; fdup->id_driver != 0; fdup++) {
|
|
|
|
if (fdup->id_iobase != dev->id_iobase)
|
|
|
|
continue;
|
|
|
|
fdu = fdup->id_unit;
|
|
|
|
fd = &fd_data[fdu];
|
|
|
|
if (fdu >= (NFD+NFT))
|
|
|
|
continue;
|
|
|
|
fdsu = fdup->id_physid;
|
1995-01-06 15:20:00 +00:00
|
|
|
/* look up what bios thinks we have */
|
1994-02-07 04:27:13 +00:00
|
|
|
switch (fdu) {
|
1997-10-19 13:12:02 +00:00
|
|
|
case 0: if (dev->id_flags & FDC_PRETEND_D0)
|
|
|
|
fdt = RTCFDT_144M | RTCFDT_144M_PRETENDED;
|
|
|
|
else
|
|
|
|
fdt = (rtcin(RTC_FDISKETTE) & 0xf0);
|
1994-02-07 04:27:13 +00:00
|
|
|
break;
|
|
|
|
case 1: fdt = ((rtcin(RTC_FDISKETTE) << 4) & 0xf0);
|
|
|
|
break;
|
|
|
|
default: fdt = RTCFDT_NONE;
|
|
|
|
break;
|
|
|
|
}
|
1993-06-12 14:58:17 +00:00
|
|
|
/* is there a unit? */
|
1994-02-07 04:27:13 +00:00
|
|
|
if ((fdt == RTCFDT_NONE)
|
|
|
|
#if NFT > 0
|
1995-01-11 16:13:01 +00:00
|
|
|
|| (fdsu >= DRVS_PER_CTLR)) {
|
1994-02-07 04:27:13 +00:00
|
|
|
#else
|
|
|
|
) {
|
1994-03-02 08:10:42 +00:00
|
|
|
fd->type = NO_TYPE;
|
1994-02-07 04:27:13 +00:00
|
|
|
#endif
|
|
|
|
#if NFT > 0
|
1994-11-30 12:04:28 +00:00
|
|
|
/* If BIOS says no floppy, or > 2nd device */
|
|
|
|
/* Probe for and attach a floppy tape. */
|
1995-04-06 07:20:16 +00:00
|
|
|
/* Tell FT if there was already a disk */
|
|
|
|
/* with this unit number found. */
|
|
|
|
|
|
|
|
unithasfd = 0;
|
|
|
|
if (fdu < NFD && fd->type != NO_TYPE)
|
|
|
|
unithasfd = 1;
|
1995-05-06 19:34:28 +00:00
|
|
|
if (ftattach(dev, fdup, unithasfd))
|
1994-02-07 04:27:13 +00:00
|
|
|
continue;
|
1995-05-30 08:16:23 +00:00
|
|
|
if (fdsu < DRVS_PER_CTLR)
|
1994-03-02 08:10:42 +00:00
|
|
|
fd->type = NO_TYPE;
|
1994-02-07 04:27:13 +00:00
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
continue;
|
1993-09-14 19:34:32 +00:00
|
|
|
}
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
/* select it */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
set_motor(fdcu, fdsu, TURNON);
|
1994-09-17 18:08:36 +00:00
|
|
|
DELAY(1000000); /* 1 sec */
|
1995-01-06 15:20:00 +00:00
|
|
|
|
|
|
|
if (ic_type == 0 &&
|
|
|
|
fd_cmd(fdcu, 1, NE7CMD_VERSION, 1, &ic_type) == 0)
|
|
|
|
{
|
1997-09-16 07:45:45 +00:00
|
|
|
#ifdef FDC_PRINT_BOGUS_CHIPTYPE
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("fdc%d: ", fdcu);
|
1997-09-16 07:45:45 +00:00
|
|
|
#endif
|
1995-01-06 15:20:00 +00:00
|
|
|
ic_type = (u_char)ic_type;
|
|
|
|
switch( ic_type ) {
|
|
|
|
case 0x80:
|
1997-09-16 07:45:45 +00:00
|
|
|
#ifdef FDC_PRINT_BOGUS_CHIPTYPE
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("NEC 765\n");
|
1997-09-16 07:45:45 +00:00
|
|
|
#endif
|
1995-01-06 15:20:00 +00:00
|
|
|
fdc->fdct = FDC_NE765;
|
|
|
|
break;
|
|
|
|
case 0x81:
|
1997-09-16 07:45:45 +00:00
|
|
|
#ifdef FDC_PRINT_BOGUS_CHIPTYPE
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("Intel 82077\n");
|
1997-09-16 07:45:45 +00:00
|
|
|
#endif
|
1995-01-06 15:20:00 +00:00
|
|
|
fdc->fdct = FDC_I82077;
|
|
|
|
break;
|
|
|
|
case 0x90:
|
1997-09-16 07:45:45 +00:00
|
|
|
#ifdef FDC_PRINT_BOGUS_CHIPTYPE
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("NEC 72065B\n");
|
1997-09-16 07:45:45 +00:00
|
|
|
#endif
|
1995-01-06 15:20:00 +00:00
|
|
|
fdc->fdct = FDC_NE72065;
|
|
|
|
break;
|
|
|
|
default:
|
1997-09-16 07:45:45 +00:00
|
|
|
#ifdef FDC_PRINT_BOGUS_CHIPTYPE
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("unknown IC type %02x\n", ic_type);
|
1997-09-16 07:45:45 +00:00
|
|
|
#endif
|
1995-01-06 15:20:00 +00:00
|
|
|
fdc->fdct = FDC_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
1997-09-17 20:16:17 +00:00
|
|
|
if (fdc->fdct != FDC_NE765 &&
|
|
|
|
fdc->fdct != FDC_UNKNOWN &&
|
|
|
|
enable_fifo(fdc) == 0) {
|
|
|
|
printf("fdc%d: FIFO enabled", fdcu);
|
|
|
|
printf(", %d bytes threshold\n",
|
|
|
|
fifo_threshold);
|
|
|
|
}
|
1995-01-06 15:20:00 +00:00
|
|
|
}
|
|
|
|
if ((fd_cmd(fdcu, 2, NE7CMD_SENSED, fdsu, 1, &st3) == 0) &&
|
|
|
|
(st3 & NE7_ST3_T0)) {
|
1994-09-17 18:08:36 +00:00
|
|
|
/* if at track 0, first seek inwards */
|
1995-01-06 15:20:00 +00:00
|
|
|
/* seek some steps: */
|
|
|
|
(void)fd_cmd(fdcu, 3, NE7CMD_SEEK, fdsu, 10, 0);
|
1994-09-17 18:08:36 +00:00
|
|
|
DELAY(300000); /* ...wait a moment... */
|
1995-01-06 15:20:00 +00:00
|
|
|
(void)fd_sense_int(fdc, 0, 0); /* make ctrlr happy */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we're at track 0 first seek inwards. */
|
|
|
|
if ((fd_sense_drive_status(fdc, &st3) == 0) &&
|
|
|
|
(st3 & NE7_ST3_T0)) {
|
|
|
|
/* Seek some steps... */
|
|
|
|
if (fd_cmd(fdcu, 3, NE7CMD_SEEK, fdsu, 10, 0) == 0) {
|
|
|
|
/* ...wait a moment... */
|
|
|
|
DELAY(300000);
|
|
|
|
/* make ctrlr happy: */
|
|
|
|
(void)fd_sense_int(fdc, 0, 0);
|
|
|
|
}
|
1994-09-17 18:08:36 +00:00
|
|
|
}
|
1995-01-06 15:20:00 +00:00
|
|
|
|
1994-09-17 18:08:36 +00:00
|
|
|
for(i = 0; i < 2; i++) {
|
|
|
|
/*
|
|
|
|
* we must recalibrate twice, just in case the
|
|
|
|
* heads have been beyond cylinder 76, since most
|
|
|
|
* FDCs still barf when attempting to recalibrate
|
|
|
|
* more than 77 steps
|
|
|
|
*/
|
1995-01-06 15:20:00 +00:00
|
|
|
/* go back to 0: */
|
|
|
|
if (fd_cmd(fdcu, 2, NE7CMD_RECAL, fdsu, 0) == 0) {
|
|
|
|
/* a second being enough for full stroke seek*/
|
|
|
|
DELAY(i == 0? 1000000: 300000);
|
|
|
|
|
|
|
|
/* anything responding? */
|
|
|
|
if (fd_sense_int(fdc, &st0, 0) == 0 &&
|
|
|
|
(st0 & NE7_ST0_EC) == 0)
|
|
|
|
break; /* already probed succesfully */
|
|
|
|
}
|
1994-09-17 18:08:36 +00:00
|
|
|
}
|
1995-05-30 08:16:23 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
set_motor(fdcu, fdsu, TURNOFF);
|
1995-05-30 08:16:23 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if (st0 & NE7_ST0_EC) /* no track 0 -> no drive present */
|
1993-06-12 14:58:17 +00:00
|
|
|
continue;
|
|
|
|
|
1995-01-06 15:20:00 +00:00
|
|
|
fd->track = FD_NO_TRACK;
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
fd->unit = fdu;
|
|
|
|
#endif
|
1994-02-07 04:27:13 +00:00
|
|
|
fd->fdc = fdc;
|
|
|
|
fd->fdsu = fdsu;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fd->options = 0;
|
1997-09-21 21:41:49 +00:00
|
|
|
callout_handle_init(&fd->toffhandle);
|
|
|
|
callout_handle_init(&fd->tohandle);
|
1995-05-09 12:26:00 +00:00
|
|
|
printf("fd%d: ", fdu);
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1994-02-07 04:27:13 +00:00
|
|
|
switch (fdt) {
|
1993-12-16 04:28:42 +00:00
|
|
|
case RTCFDT_12M:
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("1.2MB 5.25in\n");
|
1994-02-07 04:27:13 +00:00
|
|
|
fd->type = FD_1200;
|
1993-12-16 04:28:42 +00:00
|
|
|
break;
|
1997-10-19 13:12:02 +00:00
|
|
|
case RTCFDT_144M | RTCFDT_144M_PRETENDED:
|
|
|
|
printf("config-pretended ");
|
|
|
|
fdt = RTCFDT_144M;
|
|
|
|
/* fallthrough */
|
1993-12-16 04:28:42 +00:00
|
|
|
case RTCFDT_144M:
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("1.44MB 3.5in\n");
|
1994-02-07 04:27:13 +00:00
|
|
|
fd->type = FD_1440;
|
1993-12-16 04:28:42 +00:00
|
|
|
break;
|
1994-12-04 20:22:20 +00:00
|
|
|
case RTCFDT_288M:
|
1995-10-09 15:00:39 +00:00
|
|
|
case RTCFDT_288M_1:
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("2.88MB 3.5in - 1.44MB mode\n");
|
1994-12-04 20:22:20 +00:00
|
|
|
fd->type = FD_1440;
|
|
|
|
break;
|
1993-12-16 04:28:42 +00:00
|
|
|
case RTCFDT_360K:
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("360KB 5.25in\n");
|
1994-02-07 04:27:13 +00:00
|
|
|
fd->type = FD_360;
|
1993-12-16 04:28:42 +00:00
|
|
|
break;
|
1993-12-18 01:16:26 +00:00
|
|
|
case RTCFDT_720K:
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("720KB 3.5in\n");
|
1994-02-07 04:27:13 +00:00
|
|
|
fd->type = FD_720;
|
1993-12-18 01:16:26 +00:00
|
|
|
break;
|
1993-12-16 04:28:42 +00:00
|
|
|
default:
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("unknown\n");
|
1994-02-07 04:27:13 +00:00
|
|
|
fd->type = NO_TYPE;
|
1996-04-07 14:46:42 +00:00
|
|
|
continue;
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
Reviewed by: no-one yet, but non-intrusive
Submitted by: julian@tfs.com
Obtained from: written from scratch
slight changes to make space for devfs..
(also conditional test code in i386/isa/fd.c)
===================================================================
RCS file: /home/ncvs/src/sys/sys/malloc.h,v
retrieving revision 1.7
diff -r1.7 malloc.h
113a114,117
> #define M_DEVFSMNT 62 /* DEVFS mount structure */
> #define M_DEVFSBACK 63 /* DEVFS Back node */
> #define M_DEVFSFRONT 64 /* DEVFS Front node */
> #define M_DEVFSNODE 65 /* DEVFS node */
184c188,192
< NULL, NULL, NULL, NULL, NULL, \
---
> "DEVFS mount", /* 62 M_DEVFSMNT */ \
> "DEVFS back", /* 63 M_DEVFSBACK */ \
> "DEVFS front", /* 64 M_DEVFSFRONT */ \
> "DEVFS node", /* 65 M_DEVFSNODE */ \
> NULL, \
Index: sys/mount.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/mount.h,v
retrieving revision 1.16
diff -r1.16 mount.h
100c100,101
< #define MOUNT_MAXTYPE 15
---
> #define MOUNT_DEVFS 16 /* existing device Filesystem */
> #define MOUNT_MAXTYPE 16
118a120
> "devfs", /* 15 MOUNT_DEVFS */ \
Index: sys/vnode.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/vnode.h,v
retrieving revision 1.19
diff -r1.19 vnode.h
61c61
< VT_UNION, VT_MSDOSFS
---
> VT_UNION, VT_MSDOSFS, VT_DEVFS
1995-04-20 03:18:19 +00:00
|
|
|
#ifdef DEVFS
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
sprintf(namebuf,"fd%d",fdu);
|
|
|
|
fd->subdevs[0].minor = 0;
|
|
|
|
fd->subdevs[0].drive = fd;
|
|
|
|
fd->subdevs[0].limit.blksize =
|
|
|
|
128 << (fd_types[fd->type - 1].secsize);
|
|
|
|
fd->subdevs[0].limit.slicesize =
|
|
|
|
fd_types[fd->type - 1].size
|
|
|
|
* fd->subdevs[0].limit.blksize;
|
|
|
|
fd->ft = fd_types + (fd->type - 1); /* default value */
|
|
|
|
sl_make_slice(&slicetype,
|
|
|
|
&fd->subdevs[0],
|
|
|
|
&fd->subdevs[0].limit,
|
|
|
|
&fd->subdevs[0].slice,
|
|
|
|
namebuf);
|
|
|
|
/* Allow full probing */
|
|
|
|
fd->subdevs[0].slice->probeinfo.typespecific = NULL;
|
|
|
|
fd->subdevs[0].slice->probeinfo.type = NULL;
|
|
|
|
|
|
|
|
fd->ich.ich_func = fdsinit;
|
|
|
|
fd->ich.ich_arg = &fd->subdevs[0];
|
|
|
|
config_intrhook_establish(&fd->ich);
|
|
|
|
#else /* SLICE */
|
1996-04-07 14:46:42 +00:00
|
|
|
mynor = fdu << 6;
|
1998-07-04 22:30:26 +00:00
|
|
|
fd->bdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_BLK,
|
1996-04-07 14:46:42 +00:00
|
|
|
UID_ROOT, GID_OPERATOR, 0640,
|
|
|
|
"fd%d", fdu);
|
|
|
|
fd->cdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_CHR,
|
|
|
|
UID_ROOT, GID_OPERATOR, 0640,
|
|
|
|
"rfd%d", fdu);
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif /* SLICE */
|
1996-04-07 14:46:42 +00:00
|
|
|
for (i = 1; i < 1 + NUMDENS; i++) {
|
|
|
|
/*
|
|
|
|
* XXX this and the lookup in Fdopen() should be
|
|
|
|
* data driven.
|
|
|
|
*/
|
|
|
|
switch (fd->type) {
|
|
|
|
case FD_360:
|
|
|
|
if (i != FD_360)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
case FD_720:
|
|
|
|
if (i != FD_720 && i != FD_800 && i != FD_820)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
case FD_1200:
|
|
|
|
if (i != FD_360 && i != FD_720 && i != FD_800
|
|
|
|
&& i != FD_820 && i != FD_1200
|
|
|
|
&& i != FD_1440 && i != FD_1480)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
case FD_1440:
|
|
|
|
if (i != FD_720 && i != FD_800 && i != FD_820
|
|
|
|
&& i != FD_1200 && i != FD_1440
|
|
|
|
&& i != FD_1480 && i != FD_1720)
|
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
typesize = fd_types[i - 1].size / 2;
|
|
|
|
/*
|
|
|
|
* XXX all these conversions give bloated code and
|
|
|
|
* confusing names.
|
|
|
|
*/
|
|
|
|
if (typesize == 1476)
|
|
|
|
typesize = 1480;
|
|
|
|
if (typesize == 1722)
|
|
|
|
typesize = 1720;
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
sprintf(namebuf,"fd%d.%d",fdu,typesize);
|
|
|
|
fd->subdevs[i].minor = i;
|
|
|
|
fd->subdevs[i].drive = fd;
|
|
|
|
fd->subdevs[i].limit.blksize =
|
|
|
|
128 << (fd_types[i - 1].secsize);
|
|
|
|
fd->subdevs[i].limit.slicesize =
|
|
|
|
fd_types[i - 1].size
|
|
|
|
* fd->subdevs[i].limit.blksize;
|
|
|
|
sl_make_slice(&slicetype,
|
|
|
|
&fd->subdevs[i],
|
|
|
|
&fd->subdevs[i].limit,
|
|
|
|
&fd->subdevs[i].slice,
|
|
|
|
namebuf);
|
|
|
|
/* Allow full probing */
|
|
|
|
fd->subdevs[i].slice->probeinfo.typespecific = NULL;
|
|
|
|
fd->subdevs[i].slice->probeinfo.type = NO_SUBPART;
|
|
|
|
}
|
|
|
|
#else /* SLICE */
|
|
|
|
typemynor = mynor | i;
|
1996-04-07 14:46:42 +00:00
|
|
|
fd->bdevs[i] =
|
1998-07-04 22:30:26 +00:00
|
|
|
devfs_add_devswf(&fd_cdevsw, typemynor, DV_BLK,
|
1996-04-07 14:46:42 +00:00
|
|
|
UID_ROOT, GID_OPERATOR, 0640,
|
|
|
|
"fd%d.%d", fdu, typesize);
|
|
|
|
fd->cdevs[i] =
|
|
|
|
devfs_add_devswf(&fd_cdevsw, typemynor, DV_CHR,
|
|
|
|
UID_ROOT, GID_OPERATOR, 0640,
|
|
|
|
"rfd%d.%d", fdu, typesize);
|
|
|
|
}
|
1998-04-19 23:32:49 +00:00
|
|
|
|
1996-04-07 14:46:42 +00:00
|
|
|
for (i = 0; i < MAXPARTITIONS; i++) {
|
1998-04-19 23:32:49 +00:00
|
|
|
fd->bdevs[1 + NUMDENS + i] = devfs_link(fd->bdevs[0],
|
1996-04-07 14:46:42 +00:00
|
|
|
"fd%d%c", fdu, 'a' + i);
|
|
|
|
fd->cdevs[1 + NUMDENS + i] =
|
|
|
|
devfs_link(fd->cdevs[0],
|
|
|
|
"rfd%d%c", fdu, 'a' + i);
|
|
|
|
}
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif /* SLICE */
|
Reviewed by: no-one yet, but non-intrusive
Submitted by: julian@tfs.com
Obtained from: written from scratch
slight changes to make space for devfs..
(also conditional test code in i386/isa/fd.c)
===================================================================
RCS file: /home/ncvs/src/sys/sys/malloc.h,v
retrieving revision 1.7
diff -r1.7 malloc.h
113a114,117
> #define M_DEVFSMNT 62 /* DEVFS mount structure */
> #define M_DEVFSBACK 63 /* DEVFS Back node */
> #define M_DEVFSFRONT 64 /* DEVFS Front node */
> #define M_DEVFSNODE 65 /* DEVFS node */
184c188,192
< NULL, NULL, NULL, NULL, NULL, \
---
> "DEVFS mount", /* 62 M_DEVFSMNT */ \
> "DEVFS back", /* 63 M_DEVFSBACK */ \
> "DEVFS front", /* 64 M_DEVFSFRONT */ \
> "DEVFS node", /* 65 M_DEVFSNODE */ \
> NULL, \
Index: sys/mount.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/mount.h,v
retrieving revision 1.16
diff -r1.16 mount.h
100c100,101
< #define MOUNT_MAXTYPE 15
---
> #define MOUNT_DEVFS 16 /* existing device Filesystem */
> #define MOUNT_MAXTYPE 16
118a120
> "devfs", /* 15 MOUNT_DEVFS */ \
Index: sys/vnode.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/vnode.h,v
retrieving revision 1.19
diff -r1.19 vnode.h
61c61
< VT_UNION, VT_MSDOSFS
---
> VT_UNION, VT_MSDOSFS, VT_DEVFS
1995-04-20 03:18:19 +00:00
|
|
|
#endif /* DEVFS */
|
1996-12-18 17:44:31 +00:00
|
|
|
#ifdef notyet
|
1995-02-26 01:37:51 +00:00
|
|
|
if (dk_ndrive < DK_NDRIVE) {
|
1994-10-19 00:08:07 +00:00
|
|
|
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
|
1995-03-26 19:28:22 +00:00
|
|
|
fd->dkunit = dk_ndrive++;
|
1995-02-26 01:37:51 +00:00
|
|
|
/*
|
|
|
|
* XXX assume rate is FDC_500KBPS.
|
|
|
|
*/
|
|
|
|
dk_wpms[dk_ndrive] = 500000 / 8 / 2;
|
1994-10-19 00:08:07 +00:00
|
|
|
} else {
|
|
|
|
fd->dkunit = -1;
|
|
|
|
}
|
1996-12-18 17:44:31 +00:00
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
return (1);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
|
|
|
|
#ifdef SLICE
|
|
|
|
|
|
|
|
static void
|
|
|
|
fdsinit(void *arg)
|
|
|
|
{
|
|
|
|
struct subdev *sd = arg;
|
|
|
|
sh_p tp;
|
|
|
|
|
1998-07-13 08:23:05 +00:00
|
|
|
slice_start_probe(sd->slice);
|
1998-04-19 23:32:49 +00:00
|
|
|
config_intrhook_disestablish(&sd->drive->ich);
|
1998-07-13 08:23:05 +00:00
|
|
|
DELAY(2000000); /* XXX */
|
1998-04-19 23:32:49 +00:00
|
|
|
}
|
|
|
|
#endif /* SLICE */
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* motor control stuff */
|
1994-11-02 09:08:40 +00:00
|
|
|
/* remember to not deselect the drive we're working on */
|
1993-06-12 14:58:17 +00:00
|
|
|
/****************************************************************************/
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
static void
|
1995-01-06 15:20:00 +00:00
|
|
|
set_motor(fdcu_t fdcu, int fdsu, int turnon)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int fdout = fdc_data[fdcu].fdout;
|
|
|
|
int needspecify = 0;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if(turnon) {
|
1995-05-30 08:16:23 +00:00
|
|
|
fdout &= ~FDO_FDSEL;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdout |= (FDO_MOEN0 << fdsu) + fdsu;
|
|
|
|
} else
|
|
|
|
fdout &= ~(FDO_MOEN0 << fdsu);
|
|
|
|
|
1994-11-02 09:08:40 +00:00
|
|
|
if(!turnon
|
|
|
|
&& (fdout & (FDO_MOEN0+FDO_MOEN1+FDO_MOEN2+FDO_MOEN3)) == 0)
|
|
|
|
/* gonna turn off the last drive, put FDC to bed */
|
|
|
|
fdout &= ~ (FDO_FRST|FDO_FDMAEN);
|
|
|
|
else {
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/* make sure controller is selected and specified */
|
|
|
|
if((fdout & (FDO_FRST|FDO_FDMAEN)) == 0)
|
|
|
|
needspecify = 1;
|
|
|
|
fdout |= (FDO_FRST|FDO_FDMAEN);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
|
|
|
|
outb(fdc_data[fdcu].baseport+FDOUT, fdout);
|
|
|
|
fdc_data[fdcu].fdout = fdout;
|
|
|
|
TRACE1("[0x%x->FDOUT]", fdout);
|
|
|
|
|
|
|
|
if(needspecify) {
|
1994-10-21 16:58:50 +00:00
|
|
|
/*
|
1995-01-06 15:20:00 +00:00
|
|
|
* XXX
|
1994-10-21 16:58:50 +00:00
|
|
|
* special case: since we have just woken up the FDC
|
|
|
|
* from its sleep, we silently assume the command will
|
|
|
|
* be accepted, and do not test for a timeout
|
|
|
|
*/
|
1995-01-06 15:20:00 +00:00
|
|
|
(void)fd_cmd(fdcu, 3, NE7CMD_SPECIFY,
|
|
|
|
NE7_SPEC_1(3, 240), NE7_SPEC_2(2, 0),
|
|
|
|
0);
|
1997-09-17 20:16:17 +00:00
|
|
|
if (fdc_data[fdcu].flags & FDC_HAS_FIFO)
|
|
|
|
(void) enable_fifo(&fdc_data[fdcu]);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1993-11-25 01:38:01 +00:00
|
|
|
static void
|
1994-08-23 07:52:29 +00:00
|
|
|
fd_turnoff(void *arg1)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1993-11-25 01:38:01 +00:00
|
|
|
fdu_t fdu = (fdu_t)arg1;
|
1993-09-14 19:34:32 +00:00
|
|
|
int s;
|
1993-06-12 14:58:17 +00:00
|
|
|
fd_p fd = fd_data + fdu;
|
1995-01-11 16:13:01 +00:00
|
|
|
|
|
|
|
TRACE1("[fd%d: turnoff]", fdu);
|
1996-02-25 21:01:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't turn off the motor yet if the drive is active.
|
|
|
|
* XXX shouldn't even schedule turnoff until drive is inactive
|
|
|
|
* and nothing is queued on it.
|
|
|
|
*/
|
|
|
|
if (fd->fdc->state != DEVIDLE && fd->fdc->fdu == fdu) {
|
1997-09-21 21:41:49 +00:00
|
|
|
fd->toffhandle = timeout(fd_turnoff, arg1, 4 * hz);
|
1996-02-25 21:01:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1993-09-14 19:34:32 +00:00
|
|
|
s = splbio();
|
1993-06-12 14:58:17 +00:00
|
|
|
fd->flags &= ~FD_MOTOR;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
set_motor(fd->fdc->fdcu, fd->fdsu, TURNOFF);
|
1993-09-14 19:34:32 +00:00
|
|
|
splx(s);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
static void
|
1994-08-23 07:52:29 +00:00
|
|
|
fd_motor_on(void *arg1)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1993-11-25 01:38:01 +00:00
|
|
|
fdu_t fdu = (fdu_t)arg1;
|
1993-09-14 19:34:32 +00:00
|
|
|
int s;
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
fd_p fd = fd_data + fdu;
|
1993-09-14 19:34:32 +00:00
|
|
|
s = splbio();
|
1993-06-12 14:58:17 +00:00
|
|
|
fd->flags &= ~FD_MOTOR_WAIT;
|
|
|
|
if((fd->fdc->fd == fd) && (fd->fdc->state == MOTORWAIT))
|
|
|
|
{
|
1993-09-14 19:34:32 +00:00
|
|
|
fdintr(fd->fdc->fdcu);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
1993-09-14 19:34:32 +00:00
|
|
|
splx(s);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
static void
|
1995-05-30 08:16:23 +00:00
|
|
|
fd_turnon(fdu_t fdu)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
fd_p fd = fd_data + fdu;
|
|
|
|
if(!(fd->flags & FD_MOTOR))
|
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fd->flags |= (FD_MOTOR + FD_MOTOR_WAIT);
|
|
|
|
set_motor(fd->fdc->fdcu, fd->fdsu, TURNON);
|
1994-11-02 09:08:40 +00:00
|
|
|
timeout(fd_motor_on, (caddr_t)fdu, hz); /* in 1 sec its ok */
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1993-11-25 01:38:01 +00:00
|
|
|
static void
|
1995-01-06 15:20:00 +00:00
|
|
|
fdc_reset(fdc_p fdc)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdcu_t fdcu = fdc->fdcu;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/* Try a reset, keep motor on */
|
|
|
|
outb(fdc->baseport + FDOUT, fdc->fdout & ~(FDO_FRST|FDO_FDMAEN));
|
|
|
|
TRACE1("[0x%x->FDOUT]", fdc->fdout & ~(FDO_FRST|FDO_FDMAEN));
|
|
|
|
DELAY(100);
|
|
|
|
/* enable FDC, but defer interrupts a moment */
|
|
|
|
outb(fdc->baseport + FDOUT, fdc->fdout & ~FDO_FDMAEN);
|
|
|
|
TRACE1("[0x%x->FDOUT]", fdc->fdout & ~FDO_FDMAEN);
|
|
|
|
DELAY(100);
|
|
|
|
outb(fdc->baseport + FDOUT, fdc->fdout);
|
|
|
|
TRACE1("[0x%x->FDOUT]", fdc->fdout);
|
|
|
|
|
1995-01-06 15:20:00 +00:00
|
|
|
/* XXX after a reset, silently believe the FDC will accept commands */
|
|
|
|
(void)fd_cmd(fdcu, 3, NE7CMD_SPECIFY,
|
|
|
|
NE7_SPEC_1(3, 240), NE7_SPEC_2(2, 0),
|
|
|
|
0);
|
1997-09-17 20:16:17 +00:00
|
|
|
if (fdc->flags & FDC_HAS_FIFO)
|
|
|
|
(void) enable_fifo(fdc);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
/* fdc in/out */
|
|
|
|
/****************************************************************************/
|
|
|
|
int
|
1995-01-06 15:20:00 +00:00
|
|
|
in_fdc(fdcu_t fdcu)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
int baseport = fdc_data[fdcu].baseport;
|
|
|
|
int i, j = 100000;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
while ((i = inb(baseport+FDSTS) & (NE7_DIO|NE7_RQM))
|
1993-06-12 14:58:17 +00:00
|
|
|
!= (NE7_DIO|NE7_RQM) && j-- > 0)
|
1995-01-06 15:20:00 +00:00
|
|
|
if (i == NE7_RQM)
|
1995-03-26 19:28:22 +00:00
|
|
|
return fdc_err(fdcu, "ready for output in input\n");
|
1993-06-12 14:58:17 +00:00
|
|
|
if (j <= 0)
|
1995-10-04 07:01:23 +00:00
|
|
|
return fdc_err(fdcu, bootverbose? "input ready timeout\n": 0);
|
1997-09-16 07:45:45 +00:00
|
|
|
#ifdef FDC_DEBUG
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
i = inb(baseport+FDDATA);
|
|
|
|
TRACE1("[FDDATA->0x%x]", (unsigned char)i);
|
1993-06-12 14:58:17 +00:00
|
|
|
return(i);
|
1997-09-16 07:45:45 +00:00
|
|
|
#else /* !FDC_DEBUG */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
return inb(baseport+FDDATA);
|
1997-09-16 07:45:45 +00:00
|
|
|
#endif /* FDC_DEBUG */
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
1995-01-06 15:20:00 +00:00
|
|
|
/*
|
|
|
|
* fd_in: Like in_fdc, but allows you to see if it worked.
|
|
|
|
*/
|
1995-03-16 18:17:34 +00:00
|
|
|
static int
|
1995-01-06 15:20:00 +00:00
|
|
|
fd_in(fdcu_t fdcu, int *ptr)
|
|
|
|
{
|
|
|
|
int baseport = fdc_data[fdcu].baseport;
|
|
|
|
int i, j = 100000;
|
|
|
|
while ((i = inb(baseport+FDSTS) & (NE7_DIO|NE7_RQM))
|
|
|
|
!= (NE7_DIO|NE7_RQM) && j-- > 0)
|
|
|
|
if (i == NE7_RQM)
|
1995-03-26 19:28:22 +00:00
|
|
|
return fdc_err(fdcu, "ready for output in input\n");
|
1995-01-06 15:20:00 +00:00
|
|
|
if (j <= 0)
|
1995-10-04 07:01:23 +00:00
|
|
|
return fdc_err(fdcu, bootverbose? "input ready timeout\n": 0);
|
1997-09-16 07:45:45 +00:00
|
|
|
#ifdef FDC_DEBUG
|
1995-01-06 15:20:00 +00:00
|
|
|
i = inb(baseport+FDDATA);
|
|
|
|
TRACE1("[FDDATA->0x%x]", (unsigned char)i);
|
|
|
|
*ptr = i;
|
|
|
|
return 0;
|
1997-09-16 07:45:45 +00:00
|
|
|
#else /* !FDC_DEBUG */
|
1995-01-06 15:20:00 +00:00
|
|
|
i = inb(baseport+FDDATA);
|
|
|
|
if (ptr)
|
|
|
|
*ptr = i;
|
|
|
|
return 0;
|
1997-09-16 07:45:45 +00:00
|
|
|
#endif /* FDC_DEBUG */
|
1995-01-06 15:20:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
out_fdc(fdcu_t fdcu, int x)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
int baseport = fdc_data[fdcu].baseport;
|
1993-08-12 09:21:20 +00:00
|
|
|
int i;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1993-08-12 09:21:20 +00:00
|
|
|
/* Check that the direction bit is set */
|
|
|
|
i = 100000;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
while ((inb(baseport+FDSTS) & NE7_DIO) && i-- > 0);
|
1995-03-26 19:28:22 +00:00
|
|
|
if (i <= 0) return fdc_err(fdcu, "direction bit not set\n");
|
1993-08-12 09:21:20 +00:00
|
|
|
|
|
|
|
/* Check that the floppy controller is ready for a command */
|
|
|
|
i = 100000;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
while ((inb(baseport+FDSTS) & NE7_RQM) == 0 && i-- > 0);
|
1995-10-04 07:01:23 +00:00
|
|
|
if (i <= 0)
|
|
|
|
return fdc_err(fdcu, bootverbose? "output ready timeout\n": 0);
|
1993-08-12 09:21:20 +00:00
|
|
|
|
|
|
|
/* Send the command and return */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
outb(baseport+FDDATA, x);
|
|
|
|
TRACE1("[0x%x->FDDATA]", x);
|
1993-06-12 14:58:17 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
/* fdopen/fdclose */
|
|
|
|
/****************************************************************************/
|
1993-11-25 01:38:01 +00:00
|
|
|
int
|
1995-02-26 01:37:51 +00:00
|
|
|
Fdopen(dev_t dev, int flags, int mode, struct proc *p)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
fdu_t fdu = FDUNIT(minor(dev));
|
1993-12-12 16:46:54 +00:00
|
|
|
int type = FDTYPE(minor(dev));
|
1994-02-07 04:27:13 +00:00
|
|
|
fdc_p fdc;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1994-02-07 04:27:13 +00:00
|
|
|
#if NFT > 0
|
|
|
|
/* check for a tape open */
|
|
|
|
if (type & F_TAPE_TYPE)
|
|
|
|
return(ftopen(dev, flags));
|
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
/* check bounds */
|
1995-05-30 08:16:23 +00:00
|
|
|
if (fdu >= NFD)
|
1994-02-07 04:27:13 +00:00
|
|
|
return(ENXIO);
|
|
|
|
fdc = fd_data[fdu].fdc;
|
|
|
|
if ((fdc == NULL) || (fd_data[fdu].type == NO_TYPE))
|
|
|
|
return(ENXIO);
|
|
|
|
if (type > NUMDENS)
|
|
|
|
return(ENXIO);
|
1993-12-16 04:28:42 +00:00
|
|
|
if (type == 0)
|
|
|
|
type = fd_data[fdu].type;
|
|
|
|
else {
|
1998-04-19 23:32:49 +00:00
|
|
|
/*
|
|
|
|
* For each type of basic drive, make sure we are trying
|
|
|
|
* to open a type it can do,
|
|
|
|
*/
|
1993-12-16 04:28:42 +00:00
|
|
|
if (type != fd_data[fdu].type) {
|
|
|
|
switch (fd_data[fdu].type) {
|
|
|
|
case FD_360:
|
|
|
|
return(ENXIO);
|
1993-12-18 01:16:26 +00:00
|
|
|
case FD_720:
|
1993-12-19 00:40:49 +00:00
|
|
|
if ( type != FD_820
|
|
|
|
&& type != FD_800
|
|
|
|
)
|
1993-12-18 01:16:26 +00:00
|
|
|
return(ENXIO);
|
|
|
|
break;
|
1993-12-16 04:28:42 +00:00
|
|
|
case FD_1200:
|
1993-12-19 00:40:49 +00:00
|
|
|
switch (type) {
|
|
|
|
case FD_1480:
|
|
|
|
type = FD_1480in5_25;
|
|
|
|
break;
|
|
|
|
case FD_1440:
|
|
|
|
type = FD_1440in5_25;
|
|
|
|
break;
|
|
|
|
case FD_820:
|
|
|
|
type = FD_820in5_25;
|
|
|
|
break;
|
|
|
|
case FD_800:
|
|
|
|
type = FD_800in5_25;
|
|
|
|
break;
|
|
|
|
case FD_720:
|
|
|
|
type = FD_720in5_25;
|
|
|
|
break;
|
|
|
|
case FD_360:
|
|
|
|
type = FD_360in5_25;
|
|
|
|
break;
|
|
|
|
default:
|
1993-12-16 04:28:42 +00:00
|
|
|
return(ENXIO);
|
1993-12-19 00:40:49 +00:00
|
|
|
}
|
1993-12-16 04:28:42 +00:00
|
|
|
break;
|
|
|
|
case FD_1440:
|
1993-12-19 00:40:49 +00:00
|
|
|
if ( type != FD_1720
|
|
|
|
&& type != FD_1480
|
|
|
|
&& type != FD_1200
|
|
|
|
&& type != FD_820
|
|
|
|
&& type != FD_800
|
|
|
|
&& type != FD_720
|
|
|
|
)
|
1993-12-16 04:28:42 +00:00
|
|
|
return(ENXIO);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1993-12-13 01:34:28 +00:00
|
|
|
}
|
1994-02-07 04:27:13 +00:00
|
|
|
fd_data[fdu].ft = fd_types + type - 1;
|
1993-06-12 14:58:17 +00:00
|
|
|
fd_data[fdu].flags |= FD_OPEN;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1993-11-25 01:38:01 +00:00
|
|
|
int
|
1995-02-26 01:37:51 +00:00
|
|
|
fdclose(dev_t dev, int flags, int mode, struct proc *p)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
fdu_t fdu = FDUNIT(minor(dev));
|
1994-02-07 04:27:13 +00:00
|
|
|
|
|
|
|
#if NFT > 0
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int type = FDTYPE(minor(dev));
|
|
|
|
|
1994-02-07 04:27:13 +00:00
|
|
|
if (type & F_TAPE_TYPE)
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
return ftclose(dev, flags);
|
1994-02-07 04:27:13 +00:00
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
fd_data[fdu].flags &= ~FD_OPEN;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fd_data[fdu].options &= ~FDOPT_NORETRY;
|
1995-01-11 16:13:01 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
1998-07-04 22:30:26 +00:00
|
|
|
static int
|
|
|
|
fdread(dev_t dev, struct uio *uio, int ioflag)
|
|
|
|
{
|
|
|
|
return (physio(fdstrategy, NULL, dev, 1, minphys, uio));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
fdwrite(dev_t dev, struct uio *uio, int ioflag)
|
|
|
|
{
|
|
|
|
return (physio(fdstrategy, NULL, dev, 0, minphys, uio));
|
|
|
|
}
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* fdstrategy */
|
|
|
|
/****************************************************************************/
|
|
|
|
void
|
|
|
|
fdstrategy(struct buf *bp)
|
|
|
|
{
|
1996-11-02 23:31:11 +00:00
|
|
|
unsigned nblocks, blknum, cando;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int s;
|
|
|
|
fdcu_t fdcu;
|
|
|
|
fdu_t fdu;
|
|
|
|
fdc_p fdc;
|
|
|
|
fd_p fd;
|
|
|
|
size_t fdblk;
|
|
|
|
|
|
|
|
fdu = FDUNIT(minor(bp->b_dev));
|
|
|
|
fd = &fd_data[fdu];
|
|
|
|
fdc = fd->fdc;
|
|
|
|
fdcu = fdc->fdcu;
|
|
|
|
|
|
|
|
#if NFT > 0
|
|
|
|
if (FDTYPE(minor(bp->b_dev)) & F_TAPE_TYPE) {
|
|
|
|
/* ft tapes do not (yet) support strategy i/o */
|
1995-06-11 19:33:05 +00:00
|
|
|
bp->b_error = ENODEV;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
bp->b_flags |= B_ERROR;
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
/* check for controller already busy with tape */
|
|
|
|
if (fdc->flags & FDC_TAPE_BUSY) {
|
|
|
|
bp->b_error = EBUSY;
|
|
|
|
bp->b_flags |= B_ERROR;
|
1995-05-30 08:16:23 +00:00
|
|
|
goto bad;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
1995-06-11 19:33:05 +00:00
|
|
|
fdblk = 128 << (fd->ft->secsize);
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if (!(bp->b_flags & B_FORMAT)) {
|
|
|
|
if ((fdu >= NFD) || (bp->b_blkno < 0)) {
|
1995-01-06 15:20:00 +00:00
|
|
|
printf(
|
1995-03-26 19:28:22 +00:00
|
|
|
"fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n",
|
1994-10-10 01:12:27 +00:00
|
|
|
fdu, (u_long)bp->b_blkno, bp->b_bcount);
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
bp->b_error = EINVAL;
|
|
|
|
bp->b_flags |= B_ERROR;
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
if ((bp->b_bcount % fdblk) != 0) {
|
|
|
|
bp->b_error = EINVAL;
|
|
|
|
bp->b_flags |= B_ERROR;
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
}
|
1995-05-30 08:16:23 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/*
|
|
|
|
* Set up block calculations.
|
|
|
|
*/
|
1996-11-02 23:31:11 +00:00
|
|
|
if (bp->b_blkno > 20000000) {
|
|
|
|
/*
|
|
|
|
* Reject unreasonably high block number, prevent the
|
|
|
|
* multiplication below from overflowing.
|
|
|
|
*/
|
|
|
|
bp->b_error = EINVAL;
|
|
|
|
bp->b_flags |= B_ERROR;
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
nblocks = fd->ft->size;
|
1996-11-02 23:31:11 +00:00
|
|
|
bp->b_resid = 0;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if (blknum + (bp->b_bcount / fdblk) > nblocks) {
|
1996-11-02 23:31:11 +00:00
|
|
|
if (blknum <= nblocks) {
|
|
|
|
cando = (nblocks - blknum) * fdblk;
|
|
|
|
bp->b_resid = bp->b_bcount - cando;
|
|
|
|
if (cando == 0)
|
|
|
|
goto bad; /* not actually bad but EOF */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
} else {
|
1996-11-02 23:31:11 +00:00
|
|
|
bp->b_error = EINVAL;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
bp->b_flags |= B_ERROR;
|
1996-11-02 23:31:11 +00:00
|
|
|
goto bad;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
}
|
|
|
|
}
|
1995-11-18 07:48:11 +00:00
|
|
|
bp->b_pblkno = bp->b_blkno;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
s = splbio();
|
1997-09-21 21:41:49 +00:00
|
|
|
bufqdisksort(&fdc->head, bp);
|
|
|
|
untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle); /* a good idea */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdstart(fdcu);
|
|
|
|
splx(s);
|
|
|
|
return;
|
|
|
|
|
|
|
|
bad:
|
|
|
|
biodone(bp);
|
|
|
|
}
|
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
/****************************************************************************/
|
|
|
|
/* fdsIOreq */
|
|
|
|
/****************************************************************************/
|
|
|
|
static void
|
|
|
|
fdsIOreq(void *private ,struct buf *bp)
|
|
|
|
{
|
|
|
|
unsigned nblocks, blknum, cando;
|
|
|
|
int s;
|
|
|
|
fdcu_t fdcu;
|
|
|
|
fdu_t fdu;
|
|
|
|
fdc_p fdc;
|
|
|
|
fd_p fd;
|
|
|
|
size_t fdblk;
|
|
|
|
struct subdev *sd;
|
|
|
|
|
|
|
|
sd = private;
|
|
|
|
fd = sd->drive;
|
|
|
|
fdu = fd->unit;
|
|
|
|
fdc = fd->fdc;
|
|
|
|
fdcu = fdc->fdcu;
|
|
|
|
|
|
|
|
/* check for controller already busy with tape */
|
|
|
|
if (fdc->flags & FDC_TAPE_BUSY) {
|
|
|
|
bp->b_error = EBUSY;
|
|
|
|
bp->b_flags |= B_ERROR;
|
|
|
|
goto bad;
|
|
|
|
}
|
|
|
|
bp->b_driver1 = sd; /* squirrel away which device.. */
|
|
|
|
bp->b_resid = 0;
|
|
|
|
s = splbio();
|
|
|
|
bufqdisksort(&fdc->head, bp);
|
|
|
|
untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle); /* a good idea */
|
|
|
|
fdstart(fdcu);
|
|
|
|
splx(s);
|
|
|
|
return;
|
|
|
|
|
|
|
|
bad:
|
|
|
|
biodone(bp);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif /* SLICE */
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/***************************************************************\
|
|
|
|
* fdstart *
|
|
|
|
* We have just queued something.. if the controller is not busy *
|
|
|
|
* then simulate the case where it has just finished a command *
|
|
|
|
* So that it (the interrupt routine) looks on the queue for more*
|
|
|
|
* work to do and picks up what we just added. *
|
|
|
|
* If the controller is already busy, we need do nothing, as it *
|
|
|
|
* will pick up our work when the present work completes *
|
|
|
|
\***************************************************************/
|
1993-11-25 01:38:01 +00:00
|
|
|
static void
|
1995-01-06 15:20:00 +00:00
|
|
|
fdstart(fdcu_t fdcu)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
int s;
|
|
|
|
|
|
|
|
s = splbio();
|
|
|
|
if(fdc_data[fdcu].state == DEVIDLE)
|
|
|
|
{
|
|
|
|
fdintr(fdcu);
|
|
|
|
}
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
1993-11-25 01:38:01 +00:00
|
|
|
static void
|
1994-08-23 07:52:29 +00:00
|
|
|
fd_timeout(void *arg1)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1993-11-25 01:38:01 +00:00
|
|
|
fdcu_t fdcu = (fdcu_t)arg1;
|
1993-06-12 14:58:17 +00:00
|
|
|
fdu_t fdu = fdc_data[fdcu].fdu;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int baseport = fdc_data[fdcu].baseport;
|
1996-05-03 14:57:27 +00:00
|
|
|
struct buf *bp;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int s;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1997-09-21 21:41:49 +00:00
|
|
|
bp = bufq_first(&fdc_data[fdcu].head);
|
1993-06-12 14:58:17 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/*
|
|
|
|
* Due to IBM's brain-dead design, the FDC has a faked ready
|
|
|
|
* signal, hardwired to ready == true. Thus, any command
|
|
|
|
* issued if there's no diskette in the drive will _never_
|
|
|
|
* complete, and must be aborted by resetting the FDC.
|
|
|
|
* Many thanks, Big Blue!
|
|
|
|
*/
|
|
|
|
|
|
|
|
s = splbio();
|
|
|
|
|
|
|
|
TRACE1("fd%d[fd_timeout()]", fdu);
|
|
|
|
/* See if the controller is still busy (patiently awaiting data) */
|
|
|
|
if(((inb(baseport + FDSTS)) & (NE7_CB|NE7_RQM)) == NE7_CB)
|
|
|
|
{
|
|
|
|
TRACE1("[FDSTS->0x%x]", inb(baseport + FDSTS));
|
|
|
|
/* yup, it is; kill it now */
|
|
|
|
fdc_reset(&fdc_data[fdcu]);
|
|
|
|
printf("fd%d: Operation timeout\n", fdu);
|
|
|
|
}
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
if (bp)
|
|
|
|
{
|
|
|
|
retrier(fdcu);
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdc_data[fdcu].status[0] = NE7_ST0_IC_RC;
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc_data[fdcu].state = IOTIMEDOUT;
|
|
|
|
if( fdc_data[fdcu].retry < 6)
|
|
|
|
fdc_data[fdcu].retry = 6;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fdc_data[fdcu].fd = (fd_p) 0;
|
|
|
|
fdc_data[fdcu].fdu = -1;
|
|
|
|
fdc_data[fdcu].state = DEVIDLE;
|
|
|
|
}
|
1993-09-14 19:34:32 +00:00
|
|
|
fdintr(fdcu);
|
|
|
|
splx(s);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* just ensure it has the right spl */
|
1993-11-25 01:38:01 +00:00
|
|
|
static void
|
1994-08-23 07:52:29 +00:00
|
|
|
fd_pseudointr(void *arg1)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1993-11-25 01:38:01 +00:00
|
|
|
fdcu_t fdcu = (fdcu_t)arg1;
|
1993-06-12 14:58:17 +00:00
|
|
|
int s;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
s = splbio();
|
|
|
|
fdintr(fdcu);
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************\
|
|
|
|
* fdintr *
|
|
|
|
* keep calling the state machine until it returns a 0 *
|
|
|
|
* ALWAYS called at SPLBIO *
|
|
|
|
\***********************************************************************/
|
1993-11-25 01:38:01 +00:00
|
|
|
void
|
|
|
|
fdintr(fdcu_t fdcu)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
fdc_p fdc = fdc_data + fdcu;
|
1994-02-07 04:27:13 +00:00
|
|
|
#if NFT > 0
|
|
|
|
fdu_t fdu = fdc->fdu;
|
|
|
|
|
|
|
|
if (fdc->flags & FDC_TAPE_BUSY)
|
|
|
|
(ftintr(fdu));
|
|
|
|
else
|
|
|
|
#endif
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
while(fdstate(fdcu, fdc))
|
|
|
|
;
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************\
|
|
|
|
* The controller state machine. *
|
|
|
|
* if it returns a non zero value, it should be called again immediatly *
|
|
|
|
\***********************************************************************/
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
static int
|
1995-01-06 15:20:00 +00:00
|
|
|
fdstate(fdcu_t fdcu, fdc_p fdc)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1998-04-19 23:32:49 +00:00
|
|
|
struct subdev *sd;
|
1995-10-28 15:39:31 +00:00
|
|
|
int read, format, head, sec = 0, sectrac, st0, cyl, st3;
|
1996-11-02 23:31:11 +00:00
|
|
|
unsigned blknum = 0, b_cylinder = 0;
|
1993-06-12 14:58:17 +00:00
|
|
|
fdu_t fdu = fdc->fdu;
|
|
|
|
fd_p fd;
|
1996-05-03 14:57:27 +00:00
|
|
|
register struct buf *bp;
|
1993-12-19 00:40:49 +00:00
|
|
|
struct fd_formb *finfo = NULL;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
size_t fdblk;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1997-09-21 21:41:49 +00:00
|
|
|
bp = bufq_first(&fdc->head);
|
1996-05-03 14:57:27 +00:00
|
|
|
if(!bp) {
|
1993-06-12 14:58:17 +00:00
|
|
|
/***********************************************\
|
|
|
|
* nothing left for this controller to do *
|
|
|
|
* Force into the IDLE state, *
|
|
|
|
\***********************************************/
|
|
|
|
fdc->state = DEVIDLE;
|
|
|
|
if(fdc->fd)
|
|
|
|
{
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("fd%d: unexpected valid fd pointer\n",
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdc->fdu);
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->fd = (fd_p) 0;
|
|
|
|
fdc->fdu = -1;
|
|
|
|
}
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
TRACE1("[fdc%d IDLE]", fdcu);
|
1993-06-12 14:58:17 +00:00
|
|
|
return(0);
|
|
|
|
}
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
sd = bp->b_driver1;
|
|
|
|
fd = sd->drive;
|
|
|
|
fdu = fd->unit;
|
|
|
|
#else
|
1993-06-12 14:58:17 +00:00
|
|
|
fdu = FDUNIT(minor(bp->b_dev));
|
|
|
|
fd = fd_data + fdu;
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdblk = 128 << fd->ft->secsize;
|
1993-06-12 14:58:17 +00:00
|
|
|
if (fdc->fd && (fd != fdc->fd))
|
|
|
|
{
|
1995-03-26 19:28:22 +00:00
|
|
|
printf("fd%d: confused fd pointers\n", fdu);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
read = bp->b_flags & B_READ;
|
1993-12-19 00:40:49 +00:00
|
|
|
format = bp->b_flags & B_FORMAT;
|
1996-11-02 23:31:11 +00:00
|
|
|
if(format) {
|
1997-12-02 21:07:20 +00:00
|
|
|
finfo = (struct fd_formb *)bp->b_data;
|
1996-11-02 23:31:11 +00:00
|
|
|
fd->skip = (char *)&(finfo->fd_formb_cylno(0))
|
|
|
|
- (char *)finfo;
|
|
|
|
}
|
|
|
|
if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) {
|
1998-04-19 23:32:49 +00:00
|
|
|
blknum = (unsigned) bp->b_pblkno * DEV_BSIZE/fdblk +
|
1996-11-02 23:31:11 +00:00
|
|
|
fd->skip/fdblk;
|
|
|
|
b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads);
|
|
|
|
}
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
TRACE1("fd%d", fdu);
|
|
|
|
TRACE1("[%s]", fdstates[fdc->state]);
|
|
|
|
TRACE1("(0x%x)", fd->flags);
|
1997-09-21 21:41:49 +00:00
|
|
|
untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle);
|
1997-09-23 22:14:43 +00:00
|
|
|
fd->toffhandle = timeout(fd_turnoff, (caddr_t)fdu, 4 * hz);
|
1993-06-12 14:58:17 +00:00
|
|
|
switch (fdc->state)
|
|
|
|
{
|
|
|
|
case DEVIDLE:
|
|
|
|
case FINDWORK: /* we have found new work */
|
|
|
|
fdc->retry = 0;
|
|
|
|
fd->skip = 0;
|
|
|
|
fdc->fd = fd;
|
|
|
|
fdc->fdu = fdu;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
outb(fdc->baseport+FDCTL, fd->ft->trans);
|
|
|
|
TRACE1("[0x%x->FDCTL]", fd->ft->trans);
|
1993-06-12 14:58:17 +00:00
|
|
|
/*******************************************************\
|
|
|
|
* If the next drive has a motor startup pending, then *
|
1998-04-17 22:37:19 +00:00
|
|
|
* it will start up in its own good time *
|
1993-06-12 14:58:17 +00:00
|
|
|
\*******************************************************/
|
|
|
|
if(fd->flags & FD_MOTOR_WAIT)
|
|
|
|
{
|
|
|
|
fdc->state = MOTORWAIT;
|
|
|
|
return(0); /* come back later */
|
|
|
|
}
|
|
|
|
/*******************************************************\
|
|
|
|
* Maybe if it's not starting, it SHOULD be starting *
|
|
|
|
\*******************************************************/
|
|
|
|
if (!(fd->flags & FD_MOTOR))
|
|
|
|
{
|
|
|
|
fdc->state = MOTORWAIT;
|
|
|
|
fd_turnon(fdu);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
else /* at least make sure we are selected */
|
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
set_motor(fdcu, fd->fdsu, TURNON);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
1994-11-02 09:08:40 +00:00
|
|
|
fdc->state = DOSEEK;
|
1993-06-12 14:58:17 +00:00
|
|
|
break;
|
|
|
|
case DOSEEK:
|
1996-11-02 23:31:11 +00:00
|
|
|
if (b_cylinder == (unsigned)fd->track)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
fdc->state = SEEKCOMPLETE;
|
|
|
|
break;
|
|
|
|
}
|
1995-01-06 15:20:00 +00:00
|
|
|
if (fd_cmd(fdcu, 3, NE7CMD_SEEK,
|
1996-11-02 23:31:11 +00:00
|
|
|
fd->fdsu, b_cylinder * fd->ft->steptrac,
|
1995-01-06 15:20:00 +00:00
|
|
|
0))
|
1994-10-21 16:58:50 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* seek command not accepted, looks like
|
|
|
|
* the FDC went off to the Saints...
|
|
|
|
*/
|
|
|
|
fdc->retry = 6; /* try a reset */
|
|
|
|
return(retrier(fdcu));
|
|
|
|
}
|
1995-01-06 15:20:00 +00:00
|
|
|
fd->track = FD_NO_TRACK;
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->state = SEEKWAIT;
|
|
|
|
return(0); /* will return later */
|
|
|
|
case SEEKWAIT:
|
|
|
|
/* allow heads to settle */
|
1994-11-18 10:18:36 +00:00
|
|
|
timeout(fd_pseudointr, (caddr_t)fdcu, hz / 16);
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->state = SEEKCOMPLETE;
|
|
|
|
return(0); /* will return later */
|
|
|
|
case SEEKCOMPLETE : /* SEEK DONE, START DMA */
|
|
|
|
/* Make sure seek really happened*/
|
1995-01-06 15:20:00 +00:00
|
|
|
if(fd->track == FD_NO_TRACK)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1996-11-02 23:31:11 +00:00
|
|
|
int descyl = b_cylinder * fd->ft->steptrac;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
do {
|
|
|
|
/*
|
1995-01-06 15:20:00 +00:00
|
|
|
* This might be a "ready changed" interrupt,
|
|
|
|
* which cannot really happen since the
|
|
|
|
* RDY pin is hardwired to + 5 volts. This
|
|
|
|
* generally indicates a "bouncing" intr
|
|
|
|
* line, so do one of the following:
|
|
|
|
*
|
|
|
|
* When running on an enhanced FDC that is
|
|
|
|
* known to not go stuck after responding
|
|
|
|
* with INVALID, fetch all interrupt states
|
|
|
|
* until seeing either an INVALID or a
|
|
|
|
* real interrupt condition.
|
|
|
|
*
|
|
|
|
* When running on a dumb old NE765, give
|
|
|
|
* up immediately. The controller will
|
|
|
|
* provide up to four dummy RC interrupt
|
|
|
|
* conditions right after reset (for the
|
|
|
|
* corresponding four drives), so this is
|
|
|
|
* our only chance to get notice that it
|
|
|
|
* was not the FDC that caused the interrupt.
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
*/
|
1995-01-06 15:20:00 +00:00
|
|
|
if (fd_sense_int(fdc, &st0, &cyl)
|
|
|
|
== FD_NOT_VALID)
|
|
|
|
return 0;
|
|
|
|
if(fdc->fdct == FDC_NE765
|
|
|
|
&& (st0 & NE7_ST0_IC) == NE7_ST0_IC_RC)
|
|
|
|
return 0; /* hope for a real intr */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
} while ((st0 & NE7_ST0_IC) == NE7_ST0_IC_RC);
|
1995-01-06 15:20:00 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if (0 == descyl)
|
|
|
|
{
|
1995-01-06 15:20:00 +00:00
|
|
|
int failed = 0;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/*
|
|
|
|
* seek to cyl 0 requested; make sure we are
|
|
|
|
* really there
|
|
|
|
*/
|
1995-01-06 15:20:00 +00:00
|
|
|
if (fd_sense_drive_status(fdc, &st3))
|
|
|
|
failed = 1;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if ((st3 & NE7_ST3_T0) == 0) {
|
|
|
|
printf(
|
|
|
|
"fd%d: Seek to cyl 0, but not really there (ST3 = %b)\n",
|
|
|
|
fdu, st3, NE7_ST3BITS);
|
1995-01-06 15:20:00 +00:00
|
|
|
failed = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (failed)
|
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if(fdc->retry < 3)
|
|
|
|
fdc->retry = 3;
|
|
|
|
return(retrier(fdcu));
|
|
|
|
}
|
|
|
|
}
|
1995-01-06 15:20:00 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
if (cyl != descyl)
|
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
printf(
|
|
|
|
"fd%d: Seek to cyl %d failed; am at cyl %d (ST0 = 0x%x)\n",
|
1995-05-09 12:26:00 +00:00
|
|
|
fdu, descyl, cyl, st0);
|
1998-07-18 03:15:33 +00:00
|
|
|
if (fdc->retry < 3)
|
|
|
|
fdc->retry = 3;
|
1993-06-12 14:58:17 +00:00
|
|
|
return(retrier(fdcu));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1996-11-02 23:31:11 +00:00
|
|
|
fd->track = b_cylinder;
|
1997-12-02 21:07:20 +00:00
|
|
|
isa_dmastart(bp->b_flags, bp->b_data+fd->skip,
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
format ? bp->b_bcount : fdblk, fdc->dmachan);
|
1993-06-12 14:58:17 +00:00
|
|
|
sectrac = fd->ft->sectrac;
|
|
|
|
sec = blknum % (sectrac * fd->ft->heads);
|
|
|
|
head = sec / sectrac;
|
|
|
|
sec = sec % sectrac + 1;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fd->hddrv = ((head&1)<<2)+fdu;
|
|
|
|
|
|
|
|
if(format || !read)
|
|
|
|
{
|
|
|
|
/* make sure the drive is writable */
|
1995-01-06 15:20:00 +00:00
|
|
|
if(fd_sense_drive_status(fdc, &st3) != 0)
|
1994-10-21 16:58:50 +00:00
|
|
|
{
|
|
|
|
/* stuck controller? */
|
|
|
|
fdc->retry = 6; /* reset the beast */
|
|
|
|
return(retrier(fdcu));
|
|
|
|
}
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if(st3 & NE7_ST3_WP)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* XXX YES! this is ugly.
|
|
|
|
* in order to force the current operation
|
|
|
|
* to fail, we will have to fake an FDC
|
|
|
|
* error - all error handling is done
|
|
|
|
* by the retrier()
|
|
|
|
*/
|
|
|
|
fdc->status[0] = NE7_ST0_IC_AT;
|
|
|
|
fdc->status[1] = NE7_ST1_NW;
|
|
|
|
fdc->status[2] = 0;
|
|
|
|
fdc->status[3] = fd->track;
|
|
|
|
fdc->status[4] = head;
|
|
|
|
fdc->status[5] = sec;
|
|
|
|
fdc->retry = 8; /* break out immediately */
|
|
|
|
fdc->state = IOTIMEDOUT; /* not really... */
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
}
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
if(format)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1993-12-19 00:40:49 +00:00
|
|
|
/* formatting */
|
1995-05-30 08:16:23 +00:00
|
|
|
if(fd_cmd(fdcu, 6,
|
1995-01-06 15:20:00 +00:00
|
|
|
NE7CMD_FORMAT,
|
|
|
|
head << 2 | fdu,
|
|
|
|
finfo->fd_formb_secshift,
|
|
|
|
finfo->fd_formb_nsecs,
|
|
|
|
finfo->fd_formb_gaplen,
|
|
|
|
finfo->fd_formb_fillbyte,
|
|
|
|
0))
|
1994-10-21 16:58:50 +00:00
|
|
|
{
|
|
|
|
/* controller fell over */
|
|
|
|
fdc->retry = 6;
|
|
|
|
return(retrier(fdcu));
|
|
|
|
}
|
1995-05-30 08:16:23 +00:00
|
|
|
}
|
1993-06-12 14:58:17 +00:00
|
|
|
else
|
|
|
|
{
|
1995-01-06 15:20:00 +00:00
|
|
|
if (fd_cmd(fdcu, 9,
|
|
|
|
(read ? NE7CMD_READ : NE7CMD_WRITE),
|
|
|
|
head << 2 | fdu, /* head & unit */
|
|
|
|
fd->track, /* track */
|
|
|
|
head,
|
|
|
|
sec, /* sector + 1 */
|
|
|
|
fd->ft->secsize, /* sector size */
|
|
|
|
sectrac, /* sectors/track */
|
|
|
|
fd->ft->gap, /* gap size */
|
|
|
|
fd->ft->datalen, /* data length */
|
|
|
|
0))
|
1993-12-19 00:40:49 +00:00
|
|
|
{
|
1994-10-21 16:58:50 +00:00
|
|
|
/* the beast is sleeping again */
|
|
|
|
fdc->retry = 6;
|
|
|
|
return(retrier(fdcu));
|
1993-12-19 00:40:49 +00:00
|
|
|
}
|
|
|
|
}
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->state = IOCOMPLETE;
|
1997-09-21 21:41:49 +00:00
|
|
|
fd->tohandle = timeout(fd_timeout, (caddr_t)fdcu, hz);
|
1993-06-12 14:58:17 +00:00
|
|
|
return(0); /* will return later */
|
|
|
|
case IOCOMPLETE: /* IO DONE, post-analyze */
|
1997-09-21 21:41:49 +00:00
|
|
|
untimeout(fd_timeout, (caddr_t)fdcu, fd->tohandle);
|
1995-01-06 15:20:00 +00:00
|
|
|
|
|
|
|
if (fd_read_status(fdc, fd->fdsu))
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1995-01-06 15:20:00 +00:00
|
|
|
if (fdc->retry < 6)
|
|
|
|
fdc->retry = 6; /* force a reset */
|
|
|
|
return retrier(fdcu);
|
|
|
|
}
|
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdc->state = IOTIMEDOUT;
|
1995-01-06 15:20:00 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/* FALLTHROUGH */
|
1995-01-06 15:20:00 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
case IOTIMEDOUT:
|
1997-12-02 21:07:20 +00:00
|
|
|
isa_dmadone(bp->b_flags, bp->b_data+fd->skip,
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
format ? bp->b_bcount : fdblk, fdc->dmachan);
|
|
|
|
if (fdc->status[0] & NE7_ST0_IC)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if ((fdc->status[0] & NE7_ST0_IC) == NE7_ST0_IC_AT
|
|
|
|
&& fdc->status[1] & NE7_ST1_OR) {
|
1993-12-19 00:40:49 +00:00
|
|
|
/*
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
* DMA overrun. Someone hogged the bus
|
|
|
|
* and didn't release it in time for the
|
|
|
|
* next FDC transfer.
|
|
|
|
* Just restart it, don't increment retry
|
|
|
|
* count. (vak)
|
1993-12-19 00:40:49 +00:00
|
|
|
*/
|
|
|
|
fdc->state = SEEKCOMPLETE;
|
|
|
|
return (1);
|
|
|
|
}
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
else if((fdc->status[0] & NE7_ST0_IC) == NE7_ST0_IC_IV
|
|
|
|
&& fdc->retry < 6)
|
|
|
|
fdc->retry = 6; /* force a reset */
|
|
|
|
else if((fdc->status[0] & NE7_ST0_IC) == NE7_ST0_IC_AT
|
|
|
|
&& fdc->status[2] & NE7_ST2_WC
|
|
|
|
&& fdc->retry < 3)
|
|
|
|
fdc->retry = 3; /* force recalibrate */
|
1993-06-12 14:58:17 +00:00
|
|
|
return(retrier(fdcu));
|
|
|
|
}
|
|
|
|
/* All OK */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fd->skip += fdblk;
|
1996-11-02 23:31:11 +00:00
|
|
|
if (!format && fd->skip < bp->b_bcount - bp->b_resid)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
/* set up next transfer */
|
|
|
|
fdc->state = DOSEEK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* ALL DONE */
|
|
|
|
fd->skip = 0;
|
1997-09-21 21:41:49 +00:00
|
|
|
bufq_remove(&fdc->head, bp);
|
1993-06-12 14:58:17 +00:00
|
|
|
biodone(bp);
|
|
|
|
fdc->fd = (fd_p) 0;
|
|
|
|
fdc->fdu = -1;
|
|
|
|
fdc->state = FINDWORK;
|
|
|
|
}
|
|
|
|
return(1);
|
|
|
|
case RESETCTLR:
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdc_reset(fdc);
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->retry++;
|
|
|
|
fdc->state = STARTRECAL;
|
|
|
|
break;
|
|
|
|
case STARTRECAL:
|
1996-03-31 18:04:51 +00:00
|
|
|
/* XXX clear the fdc results from the last reset, if any. */
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
(void)fd_sense_int(fdc, &st0, &cyl);
|
|
|
|
}
|
|
|
|
|
1995-01-06 15:20:00 +00:00
|
|
|
if(fd_cmd(fdcu,
|
|
|
|
2, NE7CMD_RECAL, fdu,
|
|
|
|
0)) /* Recalibrate Function */
|
1994-10-21 16:58:50 +00:00
|
|
|
{
|
|
|
|
/* arrgl */
|
|
|
|
fdc->retry = 6;
|
|
|
|
return(retrier(fdcu));
|
|
|
|
}
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->state = RECALWAIT;
|
|
|
|
return(0); /* will return later */
|
|
|
|
case RECALWAIT:
|
|
|
|
/* allow heads to settle */
|
1994-11-18 10:18:36 +00:00
|
|
|
timeout(fd_pseudointr, (caddr_t)fdcu, hz / 8);
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->state = RECALCOMPLETE;
|
|
|
|
return(0); /* will return later */
|
|
|
|
case RECALCOMPLETE:
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
do {
|
|
|
|
/*
|
1995-01-06 15:20:00 +00:00
|
|
|
* See SEEKCOMPLETE for a comment on this:
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
*/
|
1995-01-06 15:20:00 +00:00
|
|
|
if (fd_sense_int(fdc, &st0, &cyl) == FD_NOT_VALID)
|
|
|
|
return 0;
|
|
|
|
if(fdc->fdct == FDC_NE765
|
|
|
|
&& (st0 & NE7_ST0_IC) == NE7_ST0_IC_RC)
|
|
|
|
return 0; /* hope for a real intr */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
} while ((st0 & NE7_ST0_IC) == NE7_ST0_IC_RC);
|
|
|
|
if ((st0 & NE7_ST0_IC) != NE7_ST0_IC_NT || cyl != 0)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1994-10-21 16:58:50 +00:00
|
|
|
if(fdc->retry > 3)
|
|
|
|
/*
|
|
|
|
* a recalibrate from beyond cylinder 77
|
|
|
|
* will "fail" due to the FDC limitations;
|
|
|
|
* since people used to complain much about
|
|
|
|
* the failure message, try not logging
|
|
|
|
* this one if it seems to be the first
|
|
|
|
* time in a line
|
|
|
|
*/
|
|
|
|
printf("fd%d: recal failed ST0 %b cyl %d\n",
|
|
|
|
fdu, st0, NE7_ST0BITS, cyl);
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if(fdc->retry < 3) fdc->retry = 3;
|
1993-06-12 14:58:17 +00:00
|
|
|
return(retrier(fdcu));
|
|
|
|
}
|
|
|
|
fd->track = 0;
|
|
|
|
/* Seek (probably) necessary */
|
|
|
|
fdc->state = DOSEEK;
|
|
|
|
return(1); /* will return immediatly */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
case MOTORWAIT:
|
1993-06-12 14:58:17 +00:00
|
|
|
if(fd->flags & FD_MOTOR_WAIT)
|
|
|
|
{
|
|
|
|
return(0); /* time's not up yet */
|
|
|
|
}
|
1994-11-02 09:08:40 +00:00
|
|
|
/*
|
|
|
|
* since the controller was off, it has lost its
|
|
|
|
* idea about the current track it were; thus,
|
|
|
|
* recalibrate the bastard
|
|
|
|
*/
|
|
|
|
fdc->state = STARTRECAL;
|
1993-06-12 14:58:17 +00:00
|
|
|
return(1); /* will return immediatly */
|
|
|
|
default:
|
1995-01-06 15:20:00 +00:00
|
|
|
printf("fdc%d: Unexpected FD int->", fdcu);
|
|
|
|
if (fd_read_status(fdc, fd->fdsu) == 0)
|
1998-07-11 06:35:39 +00:00
|
|
|
printf("FDC status :%x %x %x %x %x %x %x ",
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdc->status[0],
|
|
|
|
fdc->status[1],
|
|
|
|
fdc->status[2],
|
|
|
|
fdc->status[3],
|
|
|
|
fdc->status[4],
|
|
|
|
fdc->status[5],
|
|
|
|
fdc->status[6] );
|
|
|
|
else
|
1995-01-12 19:20:28 +00:00
|
|
|
printf("No status available ");
|
|
|
|
if (fd_sense_int(fdc, &st0, &cyl) != 0)
|
|
|
|
{
|
|
|
|
printf("[controller is dead now]\n");
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
printf("ST0 = %x, PCN = %x\n", st0, cyl);
|
1993-06-12 14:58:17 +00:00
|
|
|
return(0);
|
|
|
|
}
|
1995-01-12 19:20:28 +00:00
|
|
|
/*XXX confusing: some branches return immediately, others end up here*/
|
1993-06-12 14:58:17 +00:00
|
|
|
return(1); /* Come back immediatly to new state */
|
|
|
|
}
|
|
|
|
|
1993-12-19 00:55:01 +00:00
|
|
|
static int
|
1993-09-14 19:34:32 +00:00
|
|
|
retrier(fdcu)
|
|
|
|
fdcu_t fdcu;
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1998-04-19 23:32:49 +00:00
|
|
|
struct subdev *sd;
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc_p fdc = fdc_data + fdcu;
|
1996-05-03 14:57:27 +00:00
|
|
|
register struct buf *bp;
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
struct fd_data *fd;
|
|
|
|
int fdu;
|
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1997-09-21 21:41:49 +00:00
|
|
|
bp = bufq_first(&fdc->head);
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
sd = bp->b_driver1;
|
|
|
|
fd = sd->drive;
|
|
|
|
fdu = fd->unit;
|
|
|
|
if(fd->options & FDOPT_NORETRY)
|
|
|
|
goto fail;
|
|
|
|
#else
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if(fd_data[FDUNIT(minor(bp->b_dev))].options & FDOPT_NORETRY)
|
|
|
|
goto fail;
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
switch(fdc->retry)
|
|
|
|
{
|
|
|
|
case 0: case 1: case 2:
|
|
|
|
fdc->state = SEEKCOMPLETE;
|
|
|
|
break;
|
|
|
|
case 3: case 4: case 5:
|
|
|
|
fdc->state = STARTRECAL;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
fdc->state = RESETCTLR;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
break;
|
|
|
|
default:
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fail:
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
printf("fd%d: hard error, block %d ", fdu,
|
|
|
|
fd->skip / DEV_BSIZE);
|
|
|
|
#else
|
1993-12-16 04:28:42 +00:00
|
|
|
dev_t sav_b_dev = bp->b_dev;
|
|
|
|
/* Trick diskerr */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
bp->b_dev = makedev(major(bp->b_dev),
|
1998-04-19 23:32:49 +00:00
|
|
|
(FDUNIT(minor(bp->b_dev))<<3)|RAW_PART);
|
>From: bde@kralizec.zeta.org.au (Bruce Evans)
Date: Thu, 16 Sep 93 01:35:10 +1000
Julian writes:
>In fact DEVIDLE and FINDWORK ended up being basically equivalent.
>the bit I wonder about, is the returning of 0.. What (other than
>another request from somewhere else in the kernel) is going to start
>work on the next item on the queue?
I think removing FINDWORK would make things clearer.
Nothing much is going to start work on the next item. However, it is
pointless to continue processing the queue for the same unready drive.
Aborting all reads and trying harder to perform all writes would be
better.
Julian writes.
> no, actually it should be:
> fdt = fd_data[FDUNIT(minor(dev))].ft;
Fixed.
From: bde@kralizec.zeta.org.au (Bruce Evans)
Date: Thu, 16 Sep 93 22:56:01 +1000
The fd driver reported the wrong cylinder/head/sector numbers after an
error (ST3 is only valid after a sense-drive command), and didn't report
fs block numbers (diskerr was not used).
There was an old problem with writes to block fd devices. Try this:
1. write protect floppy in fd0.
2. tar cf /dev/fd0a /dev/null. Repeat a few times. Later writes tend to
terminate earlier.
3. un-write protect floppy.
4. repeat step 2. The writes tend to return 0, 2048, 4096, ... and then
succeed.
This was caused by a bug in vfs__bios.c. (The bug is fixed in NetBSD's
vfs_bio.c.) fd.c sets bp->b_resid to nonzero after an error. vfs__bios.c
was not initializing bp->b_resid. This causes some writes to terminate
early (e.g., writes to block devices; see spec_write()).
Related funnies:
1. Nothing tries to write the residual bytes.
2. The wd driver sets bp->b_resid to 0 after an error, so there's no
way anything else could write the residual bytes.
3. I use the block fd device for tar because the raw device seemed to
have more bugs long ago, and because it ought to be able to handle
buffering more transparently (I don't want to have to know the
device size). But spec_write() always uses the size BLKDEV_IOSIZE
== 2048 which is too small. For disks it should use the size of
one track (rounded down to meet the next track boundary or the i/o
size). Here it would help if the DIOCGPART ioctl worked. But
DIOCGPART is not implemented for floppies, and the disk size is
ignored except for partitions of type FS_BSDFFS.
Bruce
1993-09-23 15:22:57 +00:00
|
|
|
diskerr(bp, "fd", "hard error", LOG_PRINTF,
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdc->fd->skip / DEV_BSIZE,
|
|
|
|
(struct disklabel *)NULL);
|
1993-12-16 04:28:42 +00:00
|
|
|
bp->b_dev = sav_b_dev;
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif /* !SLICE */
|
1995-01-06 15:20:00 +00:00
|
|
|
if (fdc->flags & FDC_STAT_VALID)
|
|
|
|
{
|
|
|
|
printf(
|
1998-07-11 06:35:39 +00:00
|
|
|
" (ST0 %b ST1 %b ST2 %b cyl %u hd %u sec %u)\n",
|
1995-01-06 15:20:00 +00:00
|
|
|
fdc->status[0], NE7_ST0BITS,
|
|
|
|
fdc->status[1], NE7_ST1BITS,
|
|
|
|
fdc->status[2], NE7_ST2BITS,
|
|
|
|
fdc->status[3], fdc->status[4],
|
|
|
|
fdc->status[5]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
printf(" (No status)\n");
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
bp->b_flags |= B_ERROR;
|
|
|
|
bp->b_error = EIO;
|
1996-11-02 23:31:11 +00:00
|
|
|
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
1997-09-21 21:41:49 +00:00
|
|
|
bufq_remove(&fdc->head, bp);
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->fd->skip = 0;
|
|
|
|
biodone(bp);
|
>From: bde@kralizec.zeta.org.au (Bruce Evans)
Date: Thu, 16 Sep 93 01:35:10 +1000
Julian writes:
>In fact DEVIDLE and FINDWORK ended up being basically equivalent.
>the bit I wonder about, is the returning of 0.. What (other than
>another request from somewhere else in the kernel) is going to start
>work on the next item on the queue?
I think removing FINDWORK would make things clearer.
Nothing much is going to start work on the next item. However, it is
pointless to continue processing the queue for the same unready drive.
Aborting all reads and trying harder to perform all writes would be
better.
Julian writes.
> no, actually it should be:
> fdt = fd_data[FDUNIT(minor(dev))].ft;
Fixed.
From: bde@kralizec.zeta.org.au (Bruce Evans)
Date: Thu, 16 Sep 93 22:56:01 +1000
The fd driver reported the wrong cylinder/head/sector numbers after an
error (ST3 is only valid after a sense-drive command), and didn't report
fs block numbers (diskerr was not used).
There was an old problem with writes to block fd devices. Try this:
1. write protect floppy in fd0.
2. tar cf /dev/fd0a /dev/null. Repeat a few times. Later writes tend to
terminate earlier.
3. un-write protect floppy.
4. repeat step 2. The writes tend to return 0, 2048, 4096, ... and then
succeed.
This was caused by a bug in vfs__bios.c. (The bug is fixed in NetBSD's
vfs_bio.c.) fd.c sets bp->b_resid to nonzero after an error. vfs__bios.c
was not initializing bp->b_resid. This causes some writes to terminate
early (e.g., writes to block devices; see spec_write()).
Related funnies:
1. Nothing tries to write the residual bytes.
2. The wd driver sets bp->b_resid to 0 after an error, so there's no
way anything else could write the residual bytes.
3. I use the block fd device for tar because the raw device seemed to
have more bugs long ago, and because it ought to be able to handle
buffering more transparently (I don't want to have to know the
device size). But spec_write() always uses the size BLKDEV_IOSIZE
== 2048 which is too small. For disks it should use the size of
one track (rounded down to meet the next track boundary or the i/o
size). Here it would help if the DIOCGPART ioctl worked. But
DIOCGPART is not implemented for floppies, and the disk size is
ignored except for partitions of type FS_BSDFFS.
Bruce
1993-09-23 15:22:57 +00:00
|
|
|
fdc->state = FINDWORK;
|
1993-06-12 14:58:17 +00:00
|
|
|
fdc->fd = (fd_p) 0;
|
|
|
|
fdc->fdu = -1;
|
1993-09-14 19:34:32 +00:00
|
|
|
/* XXX abort current command, if any. */
|
>From: bde@kralizec.zeta.org.au (Bruce Evans)
Date: Thu, 16 Sep 93 01:35:10 +1000
Julian writes:
>In fact DEVIDLE and FINDWORK ended up being basically equivalent.
>the bit I wonder about, is the returning of 0.. What (other than
>another request from somewhere else in the kernel) is going to start
>work on the next item on the queue?
I think removing FINDWORK would make things clearer.
Nothing much is going to start work on the next item. However, it is
pointless to continue processing the queue for the same unready drive.
Aborting all reads and trying harder to perform all writes would be
better.
Julian writes.
> no, actually it should be:
> fdt = fd_data[FDUNIT(minor(dev))].ft;
Fixed.
From: bde@kralizec.zeta.org.au (Bruce Evans)
Date: Thu, 16 Sep 93 22:56:01 +1000
The fd driver reported the wrong cylinder/head/sector numbers after an
error (ST3 is only valid after a sense-drive command), and didn't report
fs block numbers (diskerr was not used).
There was an old problem with writes to block fd devices. Try this:
1. write protect floppy in fd0.
2. tar cf /dev/fd0a /dev/null. Repeat a few times. Later writes tend to
terminate earlier.
3. un-write protect floppy.
4. repeat step 2. The writes tend to return 0, 2048, 4096, ... and then
succeed.
This was caused by a bug in vfs__bios.c. (The bug is fixed in NetBSD's
vfs_bio.c.) fd.c sets bp->b_resid to nonzero after an error. vfs__bios.c
was not initializing bp->b_resid. This causes some writes to terminate
early (e.g., writes to block devices; see spec_write()).
Related funnies:
1. Nothing tries to write the residual bytes.
2. The wd driver sets bp->b_resid to 0 after an error, so there's no
way anything else could write the residual bytes.
3. I use the block fd device for tar because the raw device seemed to
have more bugs long ago, and because it ought to be able to handle
buffering more transparently (I don't want to have to know the
device size). But spec_write() always uses the size BLKDEV_IOSIZE
== 2048 which is too small. For disks it should use the size of
one track (rounded down to meet the next track boundary or the i/o
size). Here it would help if the DIOCGPART ioctl worked. But
DIOCGPART is not implemented for floppies, and the disk size is
ignored except for partitions of type FS_BSDFFS.
Bruce
1993-09-23 15:22:57 +00:00
|
|
|
return(1);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
fdc->retry++;
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
static int
|
|
|
|
fdformat( struct subdev *sd, struct fd_formb *finfo, struct proc *p)
|
|
|
|
#else /* !SLICE */
|
1993-12-19 00:40:49 +00:00
|
|
|
static int
|
|
|
|
fdformat(dev, finfo, p)
|
|
|
|
dev_t dev;
|
|
|
|
struct fd_formb *finfo;
|
|
|
|
struct proc *p;
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif /* !SLICE */
|
1993-12-19 00:40:49 +00:00
|
|
|
{
|
|
|
|
fdu_t fdu;
|
|
|
|
fd_p fd;
|
|
|
|
|
|
|
|
struct buf *bp;
|
|
|
|
int rv = 0, s;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
size_t fdblk;
|
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
fd = sd->drive;
|
|
|
|
fdu = fd->unit;
|
|
|
|
#else
|
|
|
|
fdu = FDUNIT(minor(dev));
|
|
|
|
fd = &fd_data[fdu];
|
|
|
|
#endif
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdblk = 128 << fd->ft->secsize;
|
1993-12-19 00:40:49 +00:00
|
|
|
|
|
|
|
/* set up a buffer header for fdstrategy() */
|
|
|
|
bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT);
|
|
|
|
if(bp == 0)
|
|
|
|
return ENOBUFS;
|
1995-03-12 22:40:56 +00:00
|
|
|
/*
|
|
|
|
* keep the process from being swapped
|
|
|
|
*/
|
|
|
|
p->p_flag |= P_PHYSIO;
|
1993-12-19 00:40:49 +00:00
|
|
|
bzero((void *)bp, sizeof(struct buf));
|
|
|
|
bp->b_flags = B_BUSY | B_PHYS | B_FORMAT;
|
|
|
|
bp->b_proc = p;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* calculate a fake blkno, so fdstrategy() would initiate a
|
|
|
|
* seek to the requested cylinder
|
|
|
|
*/
|
|
|
|
bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads)
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
+ finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE;
|
1993-12-19 00:40:49 +00:00
|
|
|
|
|
|
|
bp->b_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs;
|
1997-12-02 21:07:20 +00:00
|
|
|
bp->b_data = (caddr_t)finfo;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
/* now do the format */
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
bp->b_driver1 = sd;
|
|
|
|
fdsIOreq(sd, bp);
|
|
|
|
#else /* !SLICE */
|
|
|
|
bp->b_dev = dev;
|
1993-12-19 00:40:49 +00:00
|
|
|
fdstrategy(bp);
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif /* !SLICE */
|
1993-12-19 00:40:49 +00:00
|
|
|
|
|
|
|
/* ...and wait for it to complete */
|
|
|
|
s = splbio();
|
|
|
|
while(!(bp->b_flags & B_DONE))
|
|
|
|
{
|
1994-11-02 09:08:40 +00:00
|
|
|
rv = tsleep((caddr_t)bp, PRIBIO, "fdform", 20 * hz);
|
1993-12-19 00:40:49 +00:00
|
|
|
if(rv == EWOULDBLOCK)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
splx(s);
|
1995-05-30 08:16:23 +00:00
|
|
|
|
1995-03-12 22:40:56 +00:00
|
|
|
if(rv == EWOULDBLOCK) {
|
1993-12-19 00:40:49 +00:00
|
|
|
/* timed out */
|
|
|
|
rv = EIO;
|
1995-03-12 22:40:56 +00:00
|
|
|
biodone(bp);
|
|
|
|
}
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
if(bp->b_flags & B_ERROR)
|
|
|
|
rv = bp->b_error;
|
1995-03-12 22:40:56 +00:00
|
|
|
/*
|
|
|
|
* allow the process to be swapped
|
|
|
|
*/
|
|
|
|
p->p_flag &= ~P_PHYSIO;
|
1993-12-19 00:40:49 +00:00
|
|
|
free(bp, M_TEMP);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1993-09-14 19:34:32 +00:00
|
|
|
/*
|
1995-02-26 01:37:51 +00:00
|
|
|
* TODO: don't allocate buffer on stack.
|
1993-09-14 19:34:32 +00:00
|
|
|
*/
|
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
static int
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdioctl(dev, cmd, addr, flag, p)
|
1993-12-19 00:40:49 +00:00
|
|
|
dev_t dev;
|
1998-06-07 17:13:14 +00:00
|
|
|
u_long cmd;
|
1993-12-19 00:40:49 +00:00
|
|
|
caddr_t addr;
|
|
|
|
int flag;
|
|
|
|
struct proc *p;
|
1993-09-14 19:34:32 +00:00
|
|
|
{
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdu_t fdu = FDUNIT(minor(dev));
|
|
|
|
fd_p fd = &fd_data[fdu];
|
|
|
|
size_t fdblk;
|
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
struct fd_type *fdt;
|
|
|
|
struct disklabel *dl;
|
|
|
|
char buffer[DEV_BSIZE];
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
int error = 0;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1994-02-07 04:27:13 +00:00
|
|
|
#if NFT > 0
|
1994-02-14 22:24:28 +00:00
|
|
|
int type = FDTYPE(minor(dev));
|
|
|
|
|
|
|
|
/* check for a tape ioctl */
|
|
|
|
if (type & F_TAPE_TYPE)
|
1994-02-07 04:27:13 +00:00
|
|
|
return ftioctl(dev, cmd, addr, flag, p);
|
|
|
|
#endif
|
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
/*
|
|
|
|
* if SLICE is defined then only ft accesses come here
|
|
|
|
* so break the rest off to another function for SLICE access.
|
|
|
|
*/
|
|
|
|
return (ENOTTY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Slice ioctls come here
|
|
|
|
*/
|
|
|
|
static int
|
1998-06-07 19:40:41 +00:00
|
|
|
fdsioctl( void *private, u_long cmd, caddr_t addr, int flag, struct proc *p)
|
1998-04-19 23:32:49 +00:00
|
|
|
{
|
|
|
|
struct subdev *sd = private;
|
|
|
|
fd_p fd = sd->drive;
|
|
|
|
fdu_t fdu = fd->unit;
|
|
|
|
fdc_p fdc = fd->fdc;
|
|
|
|
fdcu_t fdcu = fdc->fdcu;
|
|
|
|
size_t fdblk;
|
|
|
|
int error = 0;
|
|
|
|
#endif /* SLICE */
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
fdblk = 128 << fd->ft->secsize;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
switch (cmd)
|
|
|
|
{
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifndef SLICE
|
1993-12-19 00:40:49 +00:00
|
|
|
case DIOCGDINFO:
|
|
|
|
bzero(buffer, sizeof (buffer));
|
|
|
|
dl = (struct disklabel *)buffer;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
dl->d_secsize = fdblk;
|
1993-12-19 00:40:49 +00:00
|
|
|
fdt = fd_data[FDUNIT(minor(dev))].ft;
|
|
|
|
dl->d_secpercyl = fdt->size / fdt->tracks;
|
|
|
|
dl->d_type = DTYPE_FLOPPY;
|
|
|
|
|
1995-09-16 17:04:06 +00:00
|
|
|
if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl)
|
|
|
|
== NULL)
|
1993-12-19 00:40:49 +00:00
|
|
|
error = 0;
|
|
|
|
else
|
|
|
|
error = EINVAL;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
*(struct disklabel *)addr = *dl;
|
|
|
|
break;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
case DIOCSDINFO:
|
|
|
|
if ((flag & FWRITE) == 0)
|
|
|
|
error = EBADF;
|
|
|
|
break;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
case DIOCWLABEL:
|
|
|
|
if ((flag & FWRITE) == 0)
|
|
|
|
error = EBADF;
|
|
|
|
break;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
case DIOCWDINFO:
|
|
|
|
if ((flag & FWRITE) == 0)
|
|
|
|
{
|
|
|
|
error = EBADF;
|
|
|
|
break;
|
|
|
|
}
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
dl = (struct disklabel *)addr;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1995-09-16 17:04:06 +00:00
|
|
|
if ((error = setdisklabel((struct disklabel *)buffer, dl,
|
|
|
|
(u_long)0)) != 0)
|
1993-12-19 00:40:49 +00:00
|
|
|
break;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
error = writedisklabel(dev, fdstrategy,
|
1994-10-27 20:45:13 +00:00
|
|
|
(struct disklabel *)buffer);
|
1993-12-19 00:40:49 +00:00
|
|
|
break;
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif /* !SLICE */
|
1993-12-19 00:40:49 +00:00
|
|
|
case FD_FORM:
|
|
|
|
if((flag & FWRITE) == 0)
|
|
|
|
error = EBADF; /* must be opened for writing */
|
|
|
|
else if(((struct fd_formb *)addr)->format_version !=
|
|
|
|
FD_FORMAT_VERSION)
|
|
|
|
error = EINVAL; /* wrong version of formatting prog */
|
|
|
|
else
|
1998-04-19 23:32:49 +00:00
|
|
|
#ifdef SLICE
|
|
|
|
error = fdformat(sd, (struct fd_formb *)addr, p);
|
|
|
|
#else
|
1993-12-19 00:40:49 +00:00
|
|
|
error = fdformat(dev, (struct fd_formb *)addr, p);
|
1998-04-19 23:32:49 +00:00
|
|
|
#endif
|
1993-12-19 00:40:49 +00:00
|
|
|
break;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
case FD_GTYPE: /* get drive type */
|
1998-04-19 23:32:49 +00:00
|
|
|
*(struct fd_type *)addr = *fd->ft;
|
1993-12-19 00:40:49 +00:00
|
|
|
break;
|
1993-09-14 19:34:32 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
case FD_STYPE: /* set drive type */
|
|
|
|
/* this is considered harmful; only allow for superuser */
|
|
|
|
if(suser(p->p_ucred, &p->p_acflag) != 0)
|
|
|
|
return EPERM;
|
1998-04-19 23:32:49 +00:00
|
|
|
*fd->ft = *(struct fd_type *)addr;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FD_GOPTS: /* get drive options */
|
1998-04-19 23:32:49 +00:00
|
|
|
*(int *)addr = fd->options;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
break;
|
1995-05-30 08:16:23 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
case FD_SOPTS: /* set drive options */
|
1998-04-19 23:32:49 +00:00
|
|
|
fd->options = *(int *)addr;
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
break;
|
|
|
|
|
1993-12-19 00:40:49 +00:00
|
|
|
default:
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
error = ENOTTY;
|
1993-12-19 00:40:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (error);
|
1993-09-14 19:34:32 +00:00
|
|
|
}
|
|
|
|
|
the second set of changes in a move towards getting devices to be
totally dynamic.
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:42:06 +00:00
|
|
|
|
|
|
|
static fd_devsw_installed = 0;
|
|
|
|
|
1995-12-08 11:19:42 +00:00
|
|
|
static void fd_drvinit(void *notused )
|
the second set of changes in a move towards getting devices to be
totally dynamic.
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:42:06 +00:00
|
|
|
{
|
1995-12-08 11:19:42 +00:00
|
|
|
|
the second set of changes in a move towards getting devices to be
totally dynamic.
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:42:06 +00:00
|
|
|
if( ! fd_devsw_installed ) {
|
1998-07-04 22:30:26 +00:00
|
|
|
cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_cdevsw);
|
the second set of changes in a move towards getting devices to be
totally dynamic.
this is only the devices in i386/isa
I'll do more tomorrow.
they're completely masked by #ifdef JREMOD at this stage...
the eventual aim is that every driver will do a SYSINIT
at startup BEFORE the probes, which will effectively
link it into the devsw tables etc.
If I'd thought about it more I'd have put that in in this set (damn)
The ioconf lines generated by config will also end up in the
device's own scope as well, so ioconf.c will eventually be gutted
the SYSINIT call to the driver will include a phase where the
driver links it's ioconf line into a chain of such. when this phase is done
then the user can modify them with the boot: -c
config menu if he wants, just like now..
config will put the config lines out in the .h file
(e.g. in aha.h will be the addresses for the aha driver to look.)
as I said this is a very small first step..
the aim of THIS set of edits is to not have to edit conf.c at all when
adding a new device.. the tabe will be a simple skeleton..
when this is done, it will allow other changes to be made,
all teh time still having a fully working kernel tree,
but the logical outcome is the complete REMOVAL of the devsw tables.
By the end of this, linked in drivers will be exactly the same as
run-time loaded drivers, except they JUST HAPPEN to already be linked
and present at startup..
the SYSINIT calls will be the equivalent of the "init" call
made to a newly loaded driver in every respect.
For this edit,
each of the files has the following code inserted into it:
obviously, tailored to suit..
----------------------somewhere at the top:
#ifdef JREMOD
#include <sys/conf.h>
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
static void sd_devsw_install();
#endif /*JREMOD */
---------------------somewhere that's run during bootup: EVENTUALLY a SYSINIT
#ifdef JREMOD
sd_devsw_install();
#endif /*JREMOD*/
-----------------------at the bottom:
#ifdef JREMOD
struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0 };
struct cdevsw sd_cdevsw =
{ sdopen, sdclose, rawread, rawwrite, /*13*/
sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy };
static sd_devsw_installed = 0;
static void sd_devsw_install()
{
dev_t descript;
if( ! sd_devsw_installed ) {
descript = makedev(CDEV_MAJOR,0);
cdevsw_add(&descript,&sd_cdevsw,NULL);
#if defined(BDEV_MAJOR)
descript = makedev(BDEV_MAJOR,0);
bdevsw_add(&descript,&sd_bdevsw,NULL);
#endif /*BDEV_MAJOR*/
sd_devsw_installed = 1;
}
}
#endif /* JREMOD */
1995-11-28 09:42:06 +00:00
|
|
|
fd_devsw_installed = 1;
|
|
|
|
}
|
|
|
|
}
|
1995-12-08 11:19:42 +00:00
|
|
|
|
|
|
|
SYSINIT(fddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,fd_drvinit,NULL)
|
|
|
|
|
1998-04-19 23:32:49 +00:00
|
|
|
|
|
|
|
#ifdef SLICE
|
|
|
|
static int
|
|
|
|
fdsopen(void *private, int flags, int mode, struct proc *p)
|
|
|
|
{
|
|
|
|
struct subdev *sd;
|
|
|
|
|
|
|
|
sd = private;
|
|
|
|
|
1998-04-22 10:25:27 +00:00
|
|
|
if((flags & (FREAD|FWRITE)) != 0) {
|
1998-05-06 22:14:48 +00:00
|
|
|
return(Fdopen(makedev(0,sd->minor), flags , mode, p));
|
1998-04-22 10:25:27 +00:00
|
|
|
} else {
|
1998-05-06 22:14:48 +00:00
|
|
|
return(fdclose(makedev(0,sd->minor), 0 , mode, p));
|
1998-04-22 10:25:27 +00:00
|
|
|
}
|
1998-04-19 23:32:49 +00:00
|
|
|
}
|
|
|
|
|
1998-04-22 10:25:27 +00:00
|
|
|
#if 0
|
1998-04-19 23:32:49 +00:00
|
|
|
static void
|
|
|
|
fdsclose(void *private, int flags, int mode, struct proc *p)
|
|
|
|
{
|
|
|
|
struct subdev *sd;
|
|
|
|
|
|
|
|
sd = private;
|
|
|
|
|
|
|
|
fdclose(makedev(0,sd->minor), 0 , 0, p);
|
|
|
|
return ;
|
|
|
|
}
|
1998-04-22 10:25:27 +00:00
|
|
|
#endif /* 0 */
|
1998-04-19 23:32:49 +00:00
|
|
|
|
|
|
|
#endif /* SLICE */
|
1993-09-14 19:34:32 +00:00
|
|
|
#endif
|
1998-04-19 23:32:49 +00:00
|
|
|
|
Updated driver to the 1.1.5 version:
date: 1994/05/22 12:35:38; author: joerg; state: Exp; lines: +6 -6
First round of floppy changes. Try making `fd' more robust.
New features:
. ioctl command for setting the drive type (density etc.); restricted
to the super-user
. ioctl for getting/seting `drive options'; currently only option
is FDOPT_NORETRY: inhibit the usual retries; used when verifying
a newly formatted track
Fixes:
. function prototypes
. made all internal functions `static'
. cleaned up & corrected .h files
. restructured, to make the chaotic function sequence more rational
. compiled with -Wall, and cleared all warnings
. introduced a mirror for the (write-only) `digital output register',
to avoid the current kludge
. device probing completed by seeking/recalibrating, and looking
for track 0 being found
. holding the controller down in reset state while it is idle (and
thus saving allot of headaches)
. make requests fail that are not a multiple of the (physical)
sector size
. removed the fixed physical sector size (512 bytes), allowing for any
size the controller could handle (128/256/512/1024 bytes)
. replaced some silly messages
. fixed the TRACE* macro usage, debugging reports should be complete
now again (debugging output is HUGE! though)
. removed fd_timeout for SEEK command; seeks are always reported by
the controller to succeed, since the `success' only refers to the
controller's idea of success - there is no hardware line to tell about
the seek end (other than the `track 0' line)
. catch SENSEI's that report about a `terminated due to READY changed'
status - could happen after a controller reset
. converted ``hz / <something>'' divide operations to divisors that are
powers of two, so gcc can optimize them into shifts
. write/format operations are checked against a write-protected medium
now *prior* starting the operation
. error reports of `invalid command' and `wrong cylinder' will cause
shortcuts in the retrier() now
. fixed a bug in the retrier() causing bogus block numbers to be reported
. fdformat() does care for errors now
Known Bugs:
. no attempts have been made (yet) to improve the performance
. sometimes, bogus ``seek/recalib failed'' messages are logged; this
is still a bug in the driver, but it's not harmful since it's
usually caught by the retrier()
Reviewed by:
Submitted by:
Obtained from:
1994-09-17 16:56:10 +00:00
|
|
|
/*
|
|
|
|
* Hello emacs, these are the
|
|
|
|
* Local Variables:
|
|
|
|
* c-indent-level: 8
|
|
|
|
* c-continued-statement-offset: 8
|
|
|
|
* c-continued-brace-offset: 0
|
|
|
|
* c-brace-offset: -8
|
|
|
|
* c-brace-imaginary-offset: 0
|
|
|
|
* c-argdecl-indent: 8
|
|
|
|
* c-label-offset: -8
|
|
|
|
* c++-hanging-braces: 1
|
|
|
|
* c++-access-specifier-offset: -8
|
|
|
|
* c++-empty-arglist-indent: 8
|
|
|
|
* c++-friend-offset: 0
|
|
|
|
* End:
|
|
|
|
*/
|