Skip to content

Commit

Permalink
Fix DIR register requiring recalibrate first time through
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Oct 6, 2023
1 parent 80e582a commit 48aa86f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 9 additions & 6 deletions elks/arch/i86/drivers/block/directfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
*/

#define USE_IMPLIED_SEEK 0 /* =1 for QEMU with 360k/AT stretch floppies (not real hw) */
#define CHECK_DIR_REG 0 /* =1 to read and clear DIR DSKCHG when media changed */
#define CHECK_DIR_REG 1 /* =1 to read and clear DIR DSKCHG when media changed */
#define CHECK_DISK_CHANGE 1 /* =1 to inform kernel of media changed */

//#define DEBUG printk
Expand Down Expand Up @@ -1084,11 +1084,14 @@ static void DFPROC floppy_ready(void)
|| (fdc_version >= FDC_TYPE_8272PC_AT && (inb(FD_DIR) & 0x80))
#endif
) {
/* this will discard any queued I/O immediately */
changed_floppies |= 1 << current_drive;

printk("df%d: Disk media change detected, suspending I/O\n", current_drive);
current_type[current_drive] = NULL; /* comment out to keep last media format */
/* first time through the FDC requires recalibrate in order to clear DIR,
* so just recalibrate instead of starting to discard I/O in that case.
*/
if (current_type[current_drive]) {
changed_floppies |= 1 << current_drive; /* this will discard any queued I/O */
printk("df%d: Disk media change detected, suspending I/O\n", current_drive);
current_type[current_drive] = NULL; /* comment out to keep last media format */
}

if (current_drive == buffer_drive)
buffer_track = -1;
Expand Down
1 change: 0 additions & 1 deletion elks/arch/i86/drivers/char/ntty.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ int tty_intcheck(register struct tty *ttyp, unsigned char key)
kill_pg(ttyp->pgrp, sig, 1);
}
}
(void) check_disk_change(0); /* check any floppy media changed */
return sig;
}

Expand Down

0 comments on commit 48aa86f

Please sign in to comment.