[kernel] Fix BIOS track read retry errors under QEMU by ghaerr · Pull Request #2063 · ghaerr/elks (original) (raw)

Fixes #1119.

While this fix has been coded using RESET_DISK_CHG for some time in bios.c, a test for running QEMU now makes the fix permanent, with no further bioshd(0) track read retry errors being displayed on the console.

Discussed recently in Mellvik/TLVC#88 (comment), this issue has been previously tested by @Mellvik on real hardware and was found to be a QEMU BIOS issue only. On QEMU, a BIOS disk reset is required when changing I/O (single or multi-sector) between floppy drives, for reasons unknown. This fix will allow for upcoming performance testing on QEMU without being concerned about track or sector I/O retries by automatically performing the required BIOS disk reset when needed.

The IODELAY option in bios.c is now enhanced to simulate realistic 1440k and 360k drive delays under QEMU (default OFF). A 1440k drive is assumed to be spinning at 300rpm (200ms/revolution) and 360k at 360rpm (167ms/revolution). A half-revolution delay plus additional time for the number of sectors read/written (~10ms/sector for 1440k and ~20ms for 360k) is performed, simulating average-case real hardware. Soon, this will be compared with the jiffies calculations @Mellvik is performing on real hardware in Mellvik/TLVC#88 for comparison and subsequent development of faster-booting disk images.

@Mellvik, feel free to comment on whether my floppy timings make sense for the two drives being simulated.