vserver 1.9.3
[linux-2.6.git] / drivers / ide / ide-probe.c
index 4ffaf90..61c72a7 100644 (file)
@@ -389,15 +389,6 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)
                                 */
                                printk("%s: IRQ probe failed (0x%lx)\n",
                                        drive->name, cookie);
-#ifdef CONFIG_BLK_DEV_CMD640
-#ifdef CMD640_DUMP_REGS
-                               if (hwif->chipset == ide_cmd640) {
-                                       printk("%s: Hmmm.. probably a driver "
-                                               "problem.\n", drive->name);
-                                       CMD640_DUMP_REGS;
-                               }
-#endif /* CMD640_DUMP_REGS */
-#endif /* CONFIG_BLK_DEV_CMD640 */
                        }
                }
        }
@@ -635,12 +626,11 @@ static void hwif_register (ide_hwif_t *hwif)
        device_register(&hwif->gendev);
 }
 
-#ifdef CONFIG_PPC
 static int wait_hwif_ready(ide_hwif_t *hwif)
 {
        int rc;
 
-       printk(KERN_INFO "Probing IDE interface %s...\n", hwif->name);
+       printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name);
 
        /* Let HW settle down a bit from whatever init state we
         * come from */
@@ -671,7 +661,6 @@ static int wait_hwif_ready(ide_hwif_t *hwif)
        
        return rc;
 }
-#endif
 
 /*
  * This routine only knows how to look for drive units 0 and 1
@@ -717,7 +706,6 @@ static void probe_hwif(ide_hwif_t *hwif)
 
        local_irq_set(flags);
 
-#ifdef CONFIG_PPC
        /* This is needed on some PPCs and a bunch of BIOS-less embedded
         * platforms. Typical cases are:
         * 
@@ -738,8 +726,7 @@ static void probe_hwif(ide_hwif_t *hwif)
         *  BenH.
         */
        if (wait_hwif_ready(hwif))
-               printk(KERN_WARNING "%s: Wait for ready failed before probe !\n", hwif->name);
-#endif /* CONFIG_PPC */
+               printk(KERN_DEBUG "%s: Wait for ready failed before probe !\n", hwif->name);
 
        /*
         * Second drive should only exist if first drive was found,
@@ -749,6 +736,18 @@ static void probe_hwif(ide_hwif_t *hwif)
                ide_drive_t *drive = &hwif->drives[unit];
                drive->dn = (hwif->channel ? 2 : 0) + unit;
                (void) probe_for_drive(drive);
+               if (drive->present && hwif->present && unit == 1) {
+                       if (strcmp(hwif->drives[0].id->model, drive->id->model) == 0 &&
+                           /* Don't do this for noprobe or non ATA */
+                           strcmp(drive->id->model, "UNKNOWN") &&
+                           /* And beware of confused Maxtor drives that go "M0000000000"
+                             "The SN# is garbage in the ID block..." [Eric] */
+                           strncmp(drive->id->serial_no, "M0000000000000000000", 20) &&
+                           strncmp(hwif->drives[0].id->serial_no, drive->id->serial_no, 20) == 0) {
+                               printk(KERN_WARNING "ide-probe: ignoring undecoded slave\n");
+                               drive->present = 0;
+                       }
+               }
                if (drive->present && !hwif->present) {
                        hwif->present = 1;
                        if (hwif->chipset != ide_4drives ||
@@ -893,11 +892,15 @@ static int ide_init_queue(ide_drive_t *drive)
        if (!q)
                return 1;
 
-       q->queuedata = HWGROUP(drive);
+       q->queuedata = drive;
        blk_queue_segment_boundary(q, 0xffff);
 
-       if (!hwif->rqsize)
-               hwif->rqsize = hwif->no_lba48 ? 256 : 65536;
+       if (!hwif->rqsize) {
+               if (hwif->no_lba48 || hwif->no_lba48_dma)
+                       hwif->rqsize = 256;
+               else
+                       hwif->rqsize = 65536;
+       }
        if (hwif->rqsize < max_sectors)
                max_sectors = hwif->rqsize;
        blk_queue_max_sectors(q, max_sectors);
@@ -906,11 +909,11 @@ static int ide_init_queue(ide_drive_t *drive)
        /* When we have an IOMMU, we may have a problem where pci_map_sg()
         * creates segments that don't completely match our boundary
         * requirements and thus need to be broken up again. Because it
-        * doesn't align properly neither, we may actually have to break up
+        * doesn't align properly either, we may actually have to break up
         * to more segments than what was we got in the first place, a max
         * worst case is twice as many.
         * This will be fixed once we teach pci_map_sg() about our boundary
-        * requirements, hopefully soon
+        * requirements, hopefully soon. *FIXME*
         */
        if (!PCI_DMA_BUS_IS_PHYS)
                max_sg_entries >>= 1;