Subject: Re: Floppy - weird behaviour?
To: None <port-i386@netbsd.org>
From: hypno <hypno@evilworks.com>
List: port-i386
Date: 02/05/2003 22:34:38
Aye aye, Captain ...

!hypno <hypno@alpha.evilworks.com> writes:
> is the correct behaviour for the floppy to continue running the floppy
> motor after a boot into the kernel?
> after the fdc initialization it turns itself off.

! The machine has no way of knowing it should turn off the floppy motor
! until it attaches the floppy controller. The boot blocks should turn
! off the floppy drive before starting the system -- indeed, I thought
! they did. This is probably something David Laight could do as he is
! fixing the boot blocks up.

Yes, correct.

! I fixed a related bug many years ago, btw, which was that the system
! did not turn off the floppy motor if it was rebooted while the motor
! was on. (I fixed this with a shutdown hook.)

> this:
> 	movl $0x3f2,%edx
> 	movb $0x0c,%al
> 	outb %al,%dx
>
> in locore.S did the trick for me ...

! Simply putting code in locore.S will not properly fix this -- locore
! cannot properly make assumptions about devices that might not be in
! particular locations. There might be something entirely different at
! that location on someone else's box.

As far as I can tell, the io ports used in the above code is "standard"
for the i386 arch. The same code, or very similiar (the io ports should be
the same at least) will probaby (definetly?) be used in the [modified]
boot blocks too.

Anyways, was just a quick hack to get the behaviour I wanted ...

All in all, I agree with you though - people, do not trust that code.

! Perry

Cheers,
// hypno