[comp.os.minix] floppy disk driver

holgi@nadia.UUCP (Holger Kollmer) (07/19/89)

I have a strange problem with my floppy disk driver. I am running minix
v1.2 on a 80286 12/16 MHz AT. Sometimes it does not read my disks while
I am running with 16 MHz clock speed. It complains: 

	Unrecoverable disk error on device 2/0, block1


Does  anyone  has expirience with that kind of error ? I appreciate any
help and advice. 

-- 
Holger Kollmer			uucp: uunet!unido!pfm!nadia!holgi
"With a rubber duck, one's never alone."	-- Douglas Adams

evans@ditsyda.oz (Bruce Evans) (07/29/89)

>I have a strange problem with my floppy disk driver. I am running minix
>v1.2 on a 80286 12/16 MHz AT. Sometimes it does not read my disks while
>I am running with 16 MHz clock speed. It complains: 
>
>	Unrecoverable disk error on device 2/0, block1

This problem has been seen on 386's.  I posted a patch involving a delay
loop.  This is in 1.3.  Recently, Steve Ackerman posted a floppy.c with
yet another delay loop.

I have been working on floppy.c lately, trying to make it keep up with the
standard 1-1 interleave.  It does with a 386 - backups at least get 41K/sec
instead of 6K/sec.  It almost does with a 10MHz 286.  There is little hope
of keeping up with an 8088.  The hardware is verbose and requires about 2000
instructions per block.  Multi-block i/o could be done at the cost of more
complexity and latency.

Anyway, the delay loops were killing 1-1 interleave performance, so I got
rid of them by changing the "ready" test slightly.  It seems that the
MASTER bit changes a little before the DIRECTION bit has properly changed,
so the bits need to be tested together.

This is for the protected mode kernel.  To use it with 1.2 or 1.3, delete
the calls to cim_floppy().  For all systems, reduce MAX_RESULTS to 7.
The guard position fdc_results[7] is no longer needed.

#! /bin/sh
# Contents:  fdc_results.c
# Wrapped by evans@ditsyda on Sun Jul 30 01:08:05 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'fdc_results.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fdc_results.c'\"
else
echo shar: Extracting \"'fdc_results.c'\" \(1405 characters\)
sed "s/^X//" >'fdc_results.c' <<'END_OF_FILE'
X/*==========================================================================*
X *				fdc_results				    *
X *==========================================================================*/
XPRIVATE int fdc_results(fp)
Xstruct floppy *fp;		/* pointer to the drive struct */
X{
X/* Extract results from the controller after an operation, then reenable the
X * interrupt controller.
X */
X
X  int result_nr;
X  register int retries;
X  register int status;
X
X  /* Extract bytes from FDC until it says it has no more.  The loop is
X   * really an outer loop on result_nr and an inner loop on status.
X   */
X  result_nr = 0;
X  retries = MAX_FDC_RETRY;
X  while (TRUE) {
X	/* Reading one byte is almost a mirror of fdc_out() - the DIRECTION
X	 * bit must be set instead of clear, but the CTL_BUSY bit destroys
X	 * the perfection of the mirror.
X	 */
X	status = inportb(FDC_STATUS) & (MASTER | DIRECTION | CTL_BUSY);
X	if (status == (MASTER | DIRECTION | CTL_BUSY)) {
X		if (result_nr >= MAX_RESULTS) break; /* too many results */
X		fp->fl_results[result_nr++] = inportb(FDC_DATA);
X		retries = MAX_FDC_RETRY;
X		continue;
X	}
X	if (status == MASTER) {	/* all read */
X		cim_floppy();	/* reenable interrupt controller */
X		return(OK);	/* only good exit */
X	}
X	if (--retries == 0) break;	/* time out */
X  }
X  need_reset = TRUE;		/* controller chip must be reset */
X  cim_floppy();			/* reenable interrupt controller */
X  return(ERR_STATUS);
X}
END_OF_FILE
if test 1405 -ne `wc -c <'fdc_results.c'`; then
    echo shar: \"'fdc_results.c'\" unpacked with wrong size!
fi
# end of 'fdc_results.c'
fi
echo shar: End of shell archive.
exit 0
-- 
Bruce Evans		evans@ditsyda.oz.au

holgi@pfm.UUCP (Holger Kollmer) (08/01/89)

I have a strange problem with my floppy disk driver. I am running minix
v1.2 on a 80286 12/16 MHz AT. It sometimes does not read my disks while
running with 16 MHz clock speed. It complains: 

	Unrecoverable disk error on device 2/0, block1


Does  anyone  has expirience with that kind of error ? I appreciate any
help and advice. 

-- 
Holger Kollmer			uucp: uunet!mcvax!unido!pfm!holgi
"With a rubber duck one's never alone !"