public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/ide/ide-probe.c, kernel 2.6.23.1
@ 2007-11-09 10:22 Jonas Stare
  2007-11-12 21:24 ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: Jonas Stare @ 2007-11-09 10:22 UTC (permalink / raw)
  To: torvalds, linux-kernel

Hi.

This week I ran into a strange hardware problem. During boot I got a 35 
second delay while waiting for IDE-disks that weren't there to report 
that they were not in a BSY state. The problem was most likely in the 
hardware but this patch enables you to ignore waiting for disks by 
setting hdX=noprobe (and not setting the geometry by hand) as a kernel 
option.

If no noprobe-option is set the code will work (more or less) as the 
original but if set the code will skip the ide_wait_not_busy() for that 
drive. Even if there would be a drive there and it is still BSY 
afterwards it should not matter since it isn't probed for later.

There are other ways to get around the "35-seconds-of-waiting-in-vain", 
like actually fix the hardware, insert a second drive that works or 
recompile the kernel with edd-support builtin (atleast I've seen that 
solution on a forum) and possibly others. But this patch would allow 
people to get Linux to boot quickly on wonky hardware without having to 
recompile anything.

(The code also honors the MAX_DRIVES variable instead of assuming that 
ther will be 2 drives on the bus.)

I will be happy for all the comments I can get. :) But be gentle, this 
is my first patch...

   Best regards
   Jonas Stare

Signed-off-by: Jonas Stare <jonas.stare@purplescout.se>
--
diff -u linux-2.6.23.1-orig/drivers/ide/ide-probe.c 
linux-2.6.23.1/drivers/ide/ide-probe.c
--- linux-2.6.23.1-orig/drivers/ide/ide-probe.c 2007-10-12 
18:43:44.000000000 +0200
+++ linux-2.6.23.1/drivers/ide/ide-probe.c      2007-11-09 
10:43:16.000000000 +0100
@@ -643,6 +643,7 @@
  static int wait_hwif_ready(ide_hwif_t *hwif)
  {
         int rc;
+       int unit;

         printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name);

@@ -659,20 +660,24 @@
                 return rc;

         /* 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);
-       rc = ide_wait_not_busy(hwif, 35000);
+       for (unit = 0; unit < MAX_DRIVES; ++unit) {
+               /* Ignore disks that we will not probe for later. */
+               if (!hwif->drives[unit].noprobe ||
+                   hwif->drives[unit].forced_geom) {
+                       SELECT_DRIVE(&hwif->drives[unit]);
+                       hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
+                       mdelay(2);
+                       rc = ide_wait_not_busy(hwif, 35000);
+                       /* Exit function with master selected (let's be 
sane) */
+                       SELECT_DRIVE(&hwif->drives[0]);
+                       if (rc)
+                               return rc;
+               } else {
+                       printk(KERN_DEBUG "Skip ide_wait_not_busy for 
%s:%d\n",
+                         hwif->name, unit);
+               }
+       }

-       /* Exit function with master reselected (let's be sane) */
-       SELECT_DRIVE(&hwif->drives[0]);
-
         return rc;
  }

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-11-18 21:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-09 10:22 [PATCH] drivers/ide/ide-probe.c, kernel 2.6.23.1 Jonas Stare
2007-11-12 21:24 ` Andrew Morton
2007-11-13  2:29   ` Alan Cox
2007-11-13 22:03   ` Bartlomiej Zolnierkiewicz
2007-11-15  8:52     ` Jonas Stare
2007-11-15 20:59       ` Bartlomiej Zolnierkiewicz
2007-11-16 12:10         ` [PATCH][RESUBMIT] " Jonas Stare
2007-11-16 12:51           ` Sergei Shtylyov
2007-11-16 17:46             ` Jonas Stare
2007-11-16 21:22           ` Bartlomiej Zolnierkiewicz
2007-11-16 22:57             ` [PATCH] drivers/ide/ide-probe.c Skip ide_wait_not_busy on noprobe-disks. was: " Jonas Stare
2007-11-18 21:39               ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox