CVS log for floppy-darwin/floppy_iocache.c

Up to floppy-darwin/
Request diff between arbitrary revisions
1.2 Wed May 29 7:22:07 2002 by dgatwood
CVS Tags: RELEASE_0_96, RELEASE_0_95, HEAD
Diffs to 1.1

This update documents a number of timing details that are essential
to the correct operation of the SWIM3 controller.  Many if not most
of these details are relevant to other SWIM and IWM controllers on
Macintosh hardware.  Developers, take note.  :-)

Fixed a bug where the interrupt handler routines could read the status
of the wrong SWIM chip.  I'm not sure if this could ever actually occur,
though, since the chip should only be sending an interrupt when asked
to do something, and the two driver instances are wrapped by a mutex
to keep them from ever doing an operation at the same time.  This is
one of those "theoretical" bugs.

Fixed a bug where if you write to a block in a given track without
reading from the track first, then read from a different block in
that track, you could get back the data from a different track,
since writing doesn't necessarily cause the track to be read.  This
is a deferred read on write bug introduced late in the life of the
Copland driver, or possibly after it moved to Mac OS X Server, since
the comments in the code still talked about reading the track
before writing until recently.  :-)

Fixed a race condition in signal handler as triggered by a hardware
race condition between the DMA controller's interrupt and the floppy
controller's interrupt.  The DMA interrupt is now ignored.

Found actual timing information and determined that the drive reports
itself ready after seeking and after power-up before it is actually
ready, much as we already suspected.  Corrected the amount of delay
in the workaround.

Fixed a timing bug where the driver was out of spec, since the drive
requires a period of rest after writing before a head switch or seek
is permitted.

Fixed a bug where the wrong variable was checked for return status
of a function when determining the reason for failure of a read or write.

Forced the driver to report 720k and 800k as (potentially) valid formats
for disks formatted single-sided, since there's no easy way to tell
if the back side can be correctly formatted without trying it.  (Okay,
there is.  You could switch heads and wait for an index mark.  I'll
fix this for real eventually, time permitting.)

Improved detection of unformatted/bad disks by test-reading block 0
immediately on insertion as part of the media test.  There might be a
better way, but my first attempt caused the I/O Kit to wedge.  If
that turns out to no longer be an issue, I'll take out this hack
later.

Fixed bug in dbdma support code (in two places) where data was being sent
in weird sizes for large DMA transactions.  This was caused by some bad
math.

Fixed an issue in the old (unused) dbdma support code that was
inherited by MkLinux along with the floppy driver (but only used for
a few weeks until I could write a better one).  Anyway, I wanted to
make it a little better just in case someone was brave enough to try
to use it....  :-)  The issue was that it could set dbdma interrupts
too often (in theory) for really long requests.  Not that it matters,
since we ignore DMA interrupts anyway, but why waste the PCI
bandwidth....  Also fixed the DMA block size bug in the old code.

Fixed numerous missing cast warnings and incorrect long vs. int errors in
printf and IOLog statements.

Fixed a number of missing casts in other places to get rid of some warnings.

Fixed bug where polling for a disk could be very slow (potentially
causing mount delays) in rare cases.

Fixed an issue where excessive use of delay() for multi-millisecond delays
was causing some mouse jerkiness.  Replaced all delays over a millisecond
with FloppyTimedSleep.

Cleaned up PrintRegs() to print certain registers on the SWIM III.
Turned it off by default to avoid slowing things down unnecessarily.

Finished format support.

Fixed a bug in format support where you couldn't change from GCR to MFM
encoding on a disk and vice-versa.

Fixed a bug in format support where you couldn't reformat a single-sided
disk as double-sided.  If I ever add support for index mark detection
on the back side to determine double-sidedness, we will want to add
the ability to format double-sided floppies as single-sided.  We
do not want to do that currently, though, since a disk must be
formatted as double-sided in order to show up as double-sided currently
(meaning that the disk would end up being formatted double-sided,
but the driver would only know about one side, which would be bad. :-)

Fixed a huge delay on disk insertion caused by doing a RecalDrive from
track 40.  This only occurred for the second and subsequent disks
inserted.  Fixed by believing the SWIM 3's current track register
and seeking from the current head position to track zero, and -then-
doing a RecalDrive.  :-)

Added a delay after recalibrate drive to match the one used after
seeking, with a little extra just to be safe (since a Recal only
occurs after an error condition or when formatting, both of which
are more delicate states than a normal read or write).

Made the gap length be an unsigned int instead of an unsigned char.
Another driver's code suggests that it isn't unreasonable to allow
for a longer postamble after you've written a track, although from
what I can see, they were just being cautious/overly pessimistic.

Changed cachedTrack to a signed char, since it can go from -1
through 80.

Changed the GCR track format to match that used in Mac OS X
Server 1.0.  This still needs to be tested and verified.

Removed all the retry code when waiting for an interrupt, since
if an interrupt is missed, it won't ever happen anyway.  Added
diagnostic printf calls to indicate when a wait for an interrupt
times out.

Removed the hack where the GCR track setup code was basically
return'ed out.

Removed unnecessary waits.  Fixed waits in mode set code.  Turns
out the pulse between phase changes must be at -least- 1 msec, not
exactly 1 msec.  And it should be less than 2 msec.  When I had
it "exactly" 1 msec.  according to the SWIM3 chip's internal
timer, the chip started consistently failing to notice the state
changes.  Oops.

Fixed a theoretical timing bug in format switch code.  SWIM needs
a delay when switching between GCR and MFM.  I'm not sure if this is
still true for SWIM3.

Fixed a timing bug where (in theory) the drive power could be
turned back on immediately after it is turned off.  The spec
requires a rest period.

Fixed a timing bug in RecalDrive which could potentially cause
stepping beyond track 0 (thrashing) on faster machines.  The
track 0 sensor lies to us for a few milliseconds after track
zero is reached.  The amount of time differs according to the
drive in question.  The smaller timing values used in newer
drives are used, but the older drives' timing information is
also recorded in the comments.

Fixed several sub-millisecond timing bugs that are not worth noting
in detail.

Updated copyright dates at top of files, added MkLinux copyright
and license notices to a bunch of files that were missing it.


dgatwood@mklinux.org

1.1 Thu Mar 28 5:12:29 2002 by dgatwood
CVS Tags: RELEASE_0_91, RELEASE_0_9, RELEASE_0_8, RELEASE_0_7

Added missing file.


dgatwood@mklinux.org

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric revision using the type-in text box.

Diffs between and
Unidiff
Context diff

Created by cvsweb 1.0

cvsadmin@mklinux.org