Skip to contentSkip to conversation

Floppy: Remove Sense Interrupt Hack

PATCH Justin Chevrier 3 participants 6 messages Dec 23, 2008

lore
Share & tools
lore
#0 lore raw
Quoted 101 lines · Blue Swirl

From: Blue Swirl <[email protected]>
Subject: Re: [Qemu-devel] [PATCH] Floppy: Remove Sense Interrupt Hack
To: [email protected]
Cc: [email protected]
Date: Saturday, December 20, 2008, 5:54 AM

Quoted 4 lines · Justin Chevrier

--- On Fri, 12/19/08, Blue Swirl

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines

From: Blue Swirl <[email protected]>
Subject: Re: [Qemu-devel] [PATCH] Floppy: Remove

Sense Interrupt Hack

Quoted 4 lines
Quoted 4 lines

To: [email protected], [email protected]
Date: Friday, December 19, 2008, 2:43 PM

On 12/18/08, Justin Chevrier

<[email protected]>

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:

Hey guys,

I'm tracking down the next issue(s)

with the

Quoted 1 line
Quoted 1 line

Openserver installation. The current issue is

that during

Quoted 1 line
Quoted 1 line

installation when the installer tries to link

the BLTD (eg.

Quoted 1 line
Quoted 1 line

SCSI drivers) drivers into the kernel it is

unable to access

Quoted 1 line
Quoted 1 line

the floppy drive. After reviewing the debug logs

it turns

Quoted 1 line
Quoted 1 line

out that the installer dosen't like the

value being

Quoted 1 line
Quoted 1 line

returned by Sense Interrupt. The cause of this

is a hack in

Quoted 1 line
Quoted 1 line

the Sense Interrupt code that always returns an

OR'd

Quoted 1 line
Quoted 1 line

value based on FD_SR0_SEEK instead of the actual

Status0

Quoted 1 line
Quoted 1 line

regsiter. The hack identifies that the floppy

code is broken

Quoted 1 line
Quoted 1 line

with regard to Status0 and Read/Writes. Outside

of setting

Quoted 1 line
Quoted 1 line

particular values in case of CRC errors/etc I

can't

Quoted 1 line
Quoted 1 line

identify from datasheets what we should be

doing. I've

Quoted 1 line
Quoted 1 line

tracked down what I believe is the original

mailing list

Quoted 1 line
Quoted 1 line

post regarding this hack and it seems to be

related to

Quoted 1 line
Quoted 1 line

Windows 2000 and higher OS's recognizing the

floppy

Quoted 1 line
Quoted 1 line

drive. I applied the patch below and verified

that

Quoted 1 line
Quoted 1 line
Quoted 1 line

detection/read/writes/formatting still

work in

Quoted 5 lines
Quoted 5 lines

Windows XP SP2.

Quoted 3 lines

Original post:

http://lists.gnu.org/archive/html/qemu-devel/2004-10/msg00076.html

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

SVN change:

http://svn.savannah.gnu.org/viewvc?view=rev&root=qemu&revision=1118

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Having said the above does anyone know

what the

Quoted 1 line
Quoted 1 line

comment in the hack is referencing? Is it still

needed? If

Quoted 3 lines
Quoted 3 lines

so what needs to be done to eliminate it?

Quoted 2 lines

If it's no longer needed I propose the

patch

Quoted 4 lines
Quoted 4 lines

below.

Quoted 3 lines

Justin

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Changelog:

Remove Sense Interrupt hack

Signed-off-by Justin Chevrier

<[email protected]>

It may be a hack, but if we remove it, Sparc64

refuses to

Quoted 8 lines
Quoted 6 lines

boot and
prints endlessly:
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00

Quoted 7 lines
Quoted 3 lines

Okay, thanks for the feedback!

I'll start looking into what SPARC64 expects

here.

The message is printed here:
http://tracker.coreboot.org/trac/openbios/browser/openbios-devel/drivers/floppy.c#L359

Thanks again!

Does the patch below work for you?

In this version we return 0xc0 (polling) for the first interrupt status after reset (Openserver appears to require this). After returning 0xc0 we set the Status0 register to 0x20 (seek complete). This should work as the spec says Sense Interrupt should be called up to 4 times to retrieve the queued status values. Tested successfully in both Windows 98 and XP SP2.

It also appears that the code referenced in the link loops infinitely due to a missing: "max_sensei--;" which is present in the Linux Kernel's equivalent code.

Justin

fdc.c (working copy) renamed from fdc.c (revision 6121) +2 -9
Index: fdc.c
===================================================================
@@ -1601,20 +1601,13 @@
 {
     fdrive_t *cur_drv = get_cur_drv(fdctrl);
 
-#if 0
     fdctrl->fifo[0] =
         fdctrl->status0 | (cur_drv->head << 2) | GET_CUR_DRV(fdctrl);
-#else
-    /* XXX: status0 handling is broken for read/write
-       commands, so we do this hack. It should be suppressed
-       ASAP */
-    fdctrl->fifo[0] =
-        FD_SR0_SEEK | (cur_drv->head << 2) | GET_CUR_DRV(fdctrl);
-#endif
+
     fdctrl->fifo[1] = cur_drv->track;
     fdctrl_set_fifo(fdctrl, 2, 0);
     fdctrl_reset_irq(fdctrl);
-    fdctrl->status0 = FD_SR0_RDYCHG;
+    fdctrl->status0 = FD_SR0_SEEK;
 }
 
 static void fdctrl_handle_seek (fdctrl_t *fdctrl, int direction)
#1 lore raw
Quoted 114 lines · Justin Chevrier
Quoted 103 lines · Blue Swirl

From: Blue Swirl <[email protected]>
Subject: Re: [Qemu-devel] [PATCH] Floppy: Remove Sense Interrupt Hack
To: [email protected]

Cc: [email protected]
Date: Saturday, December 20, 2008, 5:54 AM

Quoted 4 lines · Justin Chevrier

--- On Fri, 12/19/08, Blue Swirl

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines

From: Blue Swirl <[email protected]>
Subject: Re: [Qemu-devel] [PATCH] Floppy: Remove

Sense Interrupt Hack

Quoted 4 lines
Quoted 4 lines

To: [email protected], [email protected]
Date: Friday, December 19, 2008, 2:43 PM

On 12/18/08, Justin Chevrier

<[email protected]>

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines · wrote:

Hey guys,

I'm tracking down the next issue(s)

with the

Quoted 1 line
Quoted 1 line

Openserver installation. The current issue is

that during

Quoted 1 line
Quoted 1 line

installation when the installer tries to link

the BLTD (eg.

Quoted 1 line
Quoted 1 line

SCSI drivers) drivers into the kernel it is

unable to access

Quoted 1 line
Quoted 1 line

the floppy drive. After reviewing the debug logs

it turns

Quoted 1 line
Quoted 1 line

out that the installer dosen't like the

value being

Quoted 1 line
Quoted 1 line

returned by Sense Interrupt. The cause of this

is a hack in

Quoted 1 line
Quoted 1 line

the Sense Interrupt code that always returns an

OR'd

Quoted 1 line
Quoted 1 line

value based on FD_SR0_SEEK instead of the actual

Status0

Quoted 1 line
Quoted 1 line

regsiter. The hack identifies that the floppy

code is broken

Quoted 1 line
Quoted 1 line

with regard to Status0 and Read/Writes. Outside

of setting

Quoted 1 line
Quoted 1 line

particular values in case of CRC errors/etc I

can't

Quoted 1 line
Quoted 1 line

identify from datasheets what we should be

doing. I've

Quoted 1 line
Quoted 1 line

tracked down what I believe is the original

mailing list

Quoted 1 line
Quoted 1 line

post regarding this hack and it seems to be

related to

Quoted 1 line
Quoted 1 line

Windows 2000 and higher OS's recognizing the

floppy

Quoted 1 line
Quoted 1 line

drive. I applied the patch below and verified

that

Quoted 1 line
Quoted 1 line
Quoted 1 line

detection/read/writes/formatting still

work in

Quoted 5 lines
Quoted 5 lines

Windows XP SP2.

Quoted 3 lines

Original post:

http://lists.gnu.org/archive/html/qemu-devel/2004-10/msg00076.html

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

SVN change:

http://svn.savannah.gnu.org/viewvc?view=rev&root=qemu&revision=1118

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Having said the above does anyone know

what the

Quoted 1 line
Quoted 1 line

comment in the hack is referencing? Is it still

needed? If

Quoted 3 lines
Quoted 3 lines

so what needs to be done to eliminate it?

Quoted 2 lines

If it's no longer needed I propose the

patch

Quoted 4 lines
Quoted 4 lines

below.

Quoted 3 lines

Justin

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Changelog:

Remove Sense Interrupt hack

Signed-off-by Justin Chevrier

<[email protected]>

It may be a hack, but if we remove it, Sparc64

refuses to

Quoted 8 lines
Quoted 6 lines

boot and
prints endlessly:
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00

Quoted 7 lines
Quoted 3 lines

Okay, thanks for the feedback!

I'll start looking into what SPARC64 expects

here.

The message is printed here:
http://tracker.coreboot.org/trac/openbios/browser/openbios-devel/drivers/floppy.c#L359

Quoted 5 lines

Thanks again!

Does the patch below work for you?

In this version we return 0xc0 (polling) for the first interrupt status after reset (Openserver appears to require this). After returning 0xc0 we set the Status0 register to 0x20 (seek complete). This should work as the spec says Sense Interrupt should be called up to 4 times to retrieve the queued status values. Tested successfully in both Windows 98 and XP SP2.

Yes, now it also works on Sparc64:

floppy_motor_off
SENSEI c0 00
SENSEI 20 00
status = 80, reply_buffer= 20 0

Quoted 2 lines

It also appears that the code referenced in the link loops infinitely due to a missing: "max_sensei--;" which is present in the Linux Kernel's equivalent code.

Thanks, I'll try that.

#2 lore raw
In reply to Justin Chevrier
Quoted 1 line · Justin Chevrier

It also appears that the code referenced in the link loops infinitely due to a missing: "max_sensei--;" which is present in the Linux Kernel's equivalent code.

This one:
http://fxr.watson.org/fxr/source/drivers/block/floppy.c?v=linux-2.4.22;im=bigexcerpts#L1800

Adding max_sensei-- to OpenBIOS allows it to survive your previous patch, which caused an infinite loop earlier:

floppy_motor_off
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
status = 80, reply_buffer= c0 0

Thanks!

#3 lore raw
Quoted 11 lines · Blue Swirl
Quoted 2 lines · Justin Chevrier

It also appears that the code referenced in the link loops infinitely due to a missing: "max_sensei--;" which is present in the Linux Kernel's equivalent code.

This one:
http://fxr.watson.org/fxr/source/drivers/block/floppy.c?v=linux-2.4.22;im=bigexcerpts#L1800

Adding max_sensei-- to OpenBIOS allows it to survive your previous patch, which caused an infinite loop earlier:

Quoted 7 lines

floppy_motor_off
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
status = 80, reply_buffer= c0 0

Can you send a patch for this issue to upstream OpenBIOS?

Thanks!

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/
#4 lore raw
Quoted 21 lines · Carl-Daniel Hailfinger
Quoted 11 lines · Blue Swirl
Quoted 2 lines · Justin Chevrier

It also appears that the code referenced in the link loops infinitely due to a missing: "max_sensei--;" which is present in the Linux Kernel's equivalent code.

This one:
http://fxr.watson.org/fxr/source/drivers/block/floppy.c?v=linux-2.4.22;im=bigexcerpts#L1800

Adding max_sensei-- to OpenBIOS allows it to survive your previous patch, which caused an infinite loop earlier:

Quoted 7 lines

floppy_motor_off
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
status = 80, reply_buffer= c0 0

Quoted 1 line

Can you send a patch for this issue to upstream OpenBIOS?

I've already applied it (r321).

#5 lore raw
Quoted 23 lines · Blue Swirl
Quoted 21 lines · Carl-Daniel Hailfinger
Quoted 18 lines · Blue Swirl
Quoted 2 lines · Justin Chevrier

It also appears that the code referenced in the link loops infinitely due to a missing: "max_sensei--;" which is present in the Linux Kernel's equivalent code.

This one:
http://fxr.watson.org/fxr/source/drivers/block/floppy.c?v=linux-2.4.22;im=bigexcerpts#L1800

Adding max_sensei-- to OpenBIOS allows it to survive your previous patch, which caused an infinite loop earlier:

floppy_motor_off
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
SENSEI c0 00
status = 80, reply_buffer= c0 0

Quoted 5 lines
Quoted 2 lines

Can you send a patch for this issue to upstream OpenBIOS?

I've already applied it (r321).

Great, thanks!

Regards,
Carl-Daniel