Skip to contentSkip to conversation

arch/i386/boot/bootsect.S incompatibility problem

PATCH New Mikael Pettersson 1 participant 1 message Oct 27, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/i386/boot/bootsect.S incompatibility problem

Alan,

The patch below fixes an incompatibility in arch/i386/boot/bootsect.S, which kills Linux' floppy driver on some recent motherboards (e.g. my new ASUS P4T-E Pentium4/I850/S478 mb).

After reading the kernel image, bootsect.S calls kill_motor to stop the floppy drive, which it does by poking port 0x3f2. On the P4T-E, this locks up the FDC, casing drivers/block/floppy to report:

Floppy drive(s): fd0 is 1.44M
// long delay here
floppy0: no floppy controllers found

drivers/block/floppy.c:reset_fdc() knows about different vintages of FDCs, and uses a different method for non-antique FDCs (poking port 0x3f4 instead). If I use that method in bootsect.S, then the FDC doesn't hang and the floppy driver can identify and use it properly.

However, instead of poking an I/O port there is a BIOS call to reset the FDC: bootsect.S itself uses that call further up, so my patch simply replaces the broken I/O port poke with that BIOS call. Tested on a number of different boxes here, with no breakage observed.

/Mikael

arch/i386/boot/bootsect.S renamed from arch/i386/boot/bootsect.S.~1~ +6 -0
@@ -395,9 +395,15 @@
 # NOTE: Doesn't save %ax or %dx; do it yourself if you need to.
 
 kill_motor:
+#if 1
+	xorw	%ax, %ax		# reset FDC
+	xorb	%dl, %dl
+	int	$0x13
+#else
 	movw	$0x3f2, %dx
 	xorb	%al, %al
 	outb	%al, %dx
+#endif
 	ret
 
 sectors:	.word 0