2006-05-30 12:01:52

by Steven Rostedt

[permalink] [raw]
Subject: Long delay on bootup with wait_hwif_ready

Hi,

I got a board I'm working with which has the following IDE controller.

# lspci
...
0000:00:07.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE (rev 01)
..

On boot up there's a 35 second delay that happens right here:

(happens on 2.6.9 - 2.6.16)

/* Now make sure both master & slave are ready */
SELECT_DRIVE(&hwif->drives[0]);
hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
mdelay(2);
rc = ide_wait_not_busy(hwif, 35000);
if (rc)
return rc;
SELECT_DRIVE(&hwif->drives[1]);
hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
mdelay(2);
Delaying function
|
V
rc = ide_wait_not_busy(hwif, 35000);

There is no secondary drive, but for some reason the return of the
status is 0x80 which is "busy". So on boot up, we wait every time for
this 35 second timeout.

I noticed that this was discussed before (got my CC from this thread):
http://marc.theaimsgroup.com/?l=linux-kernel&m=108890865325793&w=2
But I didn't see a solution at the end.

So my question is. Is this just a bad response from hardware, or is
there a better way to find out if the drive exists or not?

My current work around is to remove the wait for the second drive
(removed the if(rc) from above to always return there), which is not
robust, but suites my needs.

-- Steve



2006-05-30 12:10:11

by David Balazic

[permalink] [raw]
Subject: RE: Long delay on bootup with wait_hwif_ready

Hi!

My "final conclusion" last time was, that there is some memory
area, that comes out too short in certain cases.
This is some early kernel boot code, that deals with the BIOS (and
confuses it, it seems, by running out the mentioned memory area).

As I understood, the kernel could be tweaked to increase/decrease
the problemtatic memory area (or the usage of it).

It is some kind of stack, heap or segment, I don't know, but somebody
mentioned it last time.

Regards,
David

PS: Feel free to ask me for testing patches ;-)
I still have the same PC (with a certain weird behavior lately,
I can't switch the IDE mode from "RAID" to "normal" ...)



> -----Original Message-----
> From: Steven Rostedt [mailto:[email protected]]
> Sent: Tuesday, May 30, 2006 2:01 PM
> To: LKML
> Cc: Jeff Garzik; Andi Kleen; Pavel Machek; Matt Domsch; David Balazic
> Subject: Long delay on bootup with wait_hwif_ready
>
>
> Hi,
>
> I got a board I'm working with which has the following IDE controller.
>
> # lspci
> ...
> 0000:00:07.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4
> IDE (rev 01)
> ..
>
> On boot up there's a 35 second delay that happens right here:
>
> (happens on 2.6.9 - 2.6.16)
>
> /* Now make sure both master & slave are ready */
> SELECT_DRIVE(&hwif->drives[0]);
> hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
> mdelay(2);
> rc = ide_wait_not_busy(hwif, 35000);
> if (rc)
> return rc;
> SELECT_DRIVE(&hwif->drives[1]);
> hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
> mdelay(2);
> Delaying function
> |
> V
> rc = ide_wait_not_busy(hwif, 35000);
>
> There is no secondary drive, but for some reason the return of the
> status is 0x80 which is "busy". So on boot up, we wait every time for
> this 35 second timeout.
>
> I noticed that this was discussed before (got my CC from this thread):
> http://marc.theaimsgroup.com/?l=linux-kernel&m=108890865325793&w=2
> But I didn't see a solution at the end.
>
> So my question is. Is this just a bad response from hardware, or is
> there a better way to find out if the drive exists or not?
>
> My current work around is to remove the wait for the second drive
> (removed the if(rc) from above to always return there), which is not
> robust, but suites my needs.
>
> -- Steve
>
>
>

2006-05-30 14:12:08

by Steven Rostedt

[permalink] [raw]
Subject: RE: Long delay on bootup with wait_hwif_ready

On Tue, 2006-05-30 at 14:10 +0200, David Balazic wrote:
> Hi!
>
> My "final conclusion" last time was, that there is some memory
> area, that comes out too short in certain cases.
> This is some early kernel boot code, that deals with the BIOS (and
> confuses it, it seems, by running out the mentioned memory area).
>
> As I understood, the kernel could be tweaked to increase/decrease
> the problemtatic memory area (or the usage of it).
>
> It is some kind of stack, heap or segment, I don't know, but somebody
> mentioned it last time.
>
> Regards,
> David
>
> PS: Feel free to ask me for testing patches ;-)
> I still have the same PC (with a certain weird behavior lately,
> I can't switch the IDE mode from "RAID" to "normal" ...)
>

After rereading the thread (after my first cup of coffee this time), I
see that the problem was slightly different than what I had. The thread
showed some delay before the console was initialized (the EDD code). But
I'm experiencing the delay with the wait_not_busy.

My problem is that the secondary status register is returning busy when
there isn't anything there. So I have to wait 35 seconds for the
timeout to expire. This could just be a fluke with the way the board is
designed (it wouldn't surprise me).

-- Steve