patch-2.2.0-pre5 linux/drivers/block/ide-disk.c

Next file: linux/drivers/block/ide-probe.c
Previous file: linux/drivers/block/genhd.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre4/linux/drivers/block/ide-disk.c linux/drivers/block/ide-disk.c
@@ -5,9 +5,10 @@
  */
 
 /*
- *  Maintained by Mark Lord  <mlord@pobox.com>
- *            and Gadi Oxman <gadio@netvision.net.il>
- *            and Andre Hedrick <hedrick@astro.dyer.vanderbilt.edu>
+ *  Mostly written by Mark Lord <mlord@pobox.com>
+ *                and  Gadi Oxman <gadio@netvision.net.il>
+ *
+ *  See linux/MAINTAINERS for address of current maintainer.
  *
  * This is the IDE/ATA disk driver, as evolved from hd.c and ide.c.
  *
@@ -101,12 +102,17 @@
 		return 1;	/* lba_capacity is our only option */
 	}
 	/*
-	 * very large drives (8GB+) may lie about the number of cylinders
 	 * This is a split test for drives less than 8 Gig only.
+	 * Drives less than 8GB sometimes declare that they have 15 heads.
+	 * This is an accounting trick (0-15) == (1-16), just an initial
+	 * zero point difference.
 	 */
 	if ((id->lba_capacity < 16514064) && (lba_sects > chs_sects) &&
-	    (id->heads == 16) && (id->sectors == 63)) {
-		id->cyls = lba_sects / (16 * 63); /* correct cyls */
+	    ((id->heads == 15) || (id->heads == 16)) && (id->sectors == 63)) {
+		if (id->heads == 15)
+			id->cyls = lba_sects / (15 * 63); /* correct cyls */
+		if (id->heads == 16)
+			id->cyls = lba_sects / (16 * 63); /* correct cyls */
 		return 1;	/* lba_capacity is our only option */
 	}
 	/* perform a rough sanity check on lba_sects:  within 10% is "okay" */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov