1994-02-14 22:24:28 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1990 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
1994-10-10 01:12:27 +00:00
|
|
|
* $Id: fdc.h,v 1.3 1994/09/17 16:56:07 davidg Exp $
|
1994-02-14 22:24:28 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1994-02-07 22:12:45 +00:00
|
|
|
|
|
|
|
/***********************************************************************\
|
|
|
|
* Per controller structure. *
|
|
|
|
\***********************************************************************/
|
|
|
|
struct fdc_data
|
|
|
|
{
|
|
|
|
int fdcu; /* our unit number */
|
|
|
|
int baseport;
|
|
|
|
int dmachan;
|
|
|
|
int flags;
|
|
|
|
#define FDC_ATTACHED 0x01
|
|
|
|
#define FDC_HASFTAPE 0x02
|
|
|
|
#define FDC_TAPE_BUSY 0x04
|
|
|
|
struct fd_data *fd;
|
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 fdu; /* the active drive */
|
|
|
|
int state;
|
|
|
|
int retry;
|
|
|
|
int fdout; /* mirror of the w/o digital output reg */
|
1994-10-10 01:12:27 +00:00
|
|
|
u_long status[7]; /* copy of the registers */
|
1994-02-07 22:12:45 +00:00
|
|
|
struct buf head; /* Head of buf chain */
|
|
|
|
};
|
|
|
|
|
|
|
|
/***********************************************************************\
|
|
|
|
* 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) *
|
|
|
|
\***********************************************************************/
|
|
|
|
typedef int fdu_t;
|
|
|
|
typedef int fdcu_t;
|
|
|
|
typedef int fdsu_t;
|
|
|
|
typedef struct fd_data *fd_p;
|
|
|
|
typedef struct fdc_data *fdc_p;
|
|
|
|
|
|
|
|
#define FDUNIT(s) (((s)>>6)&03)
|
|
|
|
#define FDTYPE(s) ((s)&077)
|