2.4.0 ide driver and old disks

From: Paul Gortmaker (p_gortmaker@yahoo.com)
Date: Sat May 27 2000 - 14:30:24 EST


The following small patch is needed if ide is to continue
to support stone-age ST-506 MFM/RLL disks. The question is
whether we want to support them or not. If not, then the whole
probe_cmos_for_drives() cruft should be deleted entirely.

The patch: Around 2.3.28 probe_cmos_for_drives() stopped setting
drive->present=1 -- since the CMOS info is essentially useless
(except for ST-506 drives) - setting it only if the device has
17 or 26 sectors will catch 99% of these stone age drives.
Second problem is that non-IDE drives didn't have their capacity
set, so that the 1st read failed the seek past end of device test.

The IDLEIMMEDIATE command causes some harmless printks at init
(same as I reported for patch-2.2.15) but IIRC you said that was
going away anyways. (Patch against 2.4.0-test1)

Paul.

diff -X /tmp/dontdiff-list -u linux-r/drivers/ide-old/ide-disk.c linux-r/drivers/ide/ide-disk.c
--- linux-r/drivers/ide-old/ide-disk.c Fri May 26 16:37:43 2000
+++ linux-r/drivers/ide/ide-disk.c Sat May 27 14:33:27 2000
@@ -519,7 +519,6 @@
 
 /*
  * Compute drive->capacity, the full capacity of the drive
- * Called with drive->id != NULL.
  */
 static void init_idedisk_capacity (ide_drive_t *drive)
 {
@@ -529,7 +528,7 @@
         drive->select.b.lba = 0;
 
         /* Determine capacity, and use LBA if the drive properly supports it */
- if ((id->capability & 2) && lba_capacity_is_ok(id)) {
+ if (id != NULL && (id->capability & 2) && lba_capacity_is_ok(id)) {
                 capacity = id->lba_capacity;
                 drive->cyl = capacity / (drive->head * drive->sect);
                 drive->select.b.lba = 1;
@@ -759,8 +758,10 @@
         
         idedisk_add_settings(drive);
 
- if (id == NULL)
+ if (id == NULL) { /* Old, non-IDE drive */
+ init_idedisk_capacity(drive);
                 return;
+ }
 
         /*
          * CompactFlash cards and their brethern look just like hard drives
diff -X /tmp/dontdiff-list -u linux-r/drivers/ide-old/ide-geometry.c linux-r/drivers/ide/ide-geometry.c
--- linux-r/drivers/ide-old/ide-geometry.c Fri May 26 17:05:08 2000
+++ linux-r/drivers/ide/ide-geometry.c Sat May 27 14:30:08 2000
@@ -43,6 +43,8 @@
  * may be SCSI disks (even when IDE disks are present), so that
  * the geometry we read here from BIOS is attributed to the wrong disks.
  * Consequently, also the "drive->present = 1" below is a mistake.
+ * Setting it only for 17 and 26 sector devices (allows 99% of stone
+ * age MFM and RLL drives to be detected) mimimizes this problem.
  *
  * Eventually the entire routine below should be removed.
  */
@@ -73,6 +75,8 @@
                                 drive->head = drive->bios_head = head;
                                 drive->sect = drive->bios_sect = sect;
                                 drive->ctl = *(BIOS+8);
+ if (sect == 17 || sect == 26)
+ drive->present = 1;
                         } else {
                                 printk("hd%d: C/H/S=%d/%d/%d from BIOS ignored\n", unit, cyl, head, sect);
                         }

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:18 EST