IDE disk geometry + patch

Andries.Brouwer@cwi.nl
Fri, 4 Dec 1998 02:10:49 +0100 (MET)


People complain that the kernel reports
hda: IB<-DTTA-351680, 16124MB w/462kB Cache, CHS=1024/255/63, UDMA
for their large IDE disks.
But 1024*255*63*512=8422686720, so the reported C/H/S describes
only half of the disk.

Conjectured sequence of events: the disk reports 16383,16,63;
these numbers would have been recognized by the kernel,
but unfortunately the user selected LBA, and the BIOS
turned this geometry into 1024,255,63 which the kernel
no longer recognizes. Now the fragment of ide.c:do_identify()
in 2.0.36 or ide-disk.c:idedisk_setup() in 2.1.130

/* Correct the number of cyls if the bios value is too small */
if (drive->sect == drive->bios_sect && drive->head == drive->bios_head) {
if (drive->cyl > drive->bios_cyl)
drive->bios_cyl = drive->cyl;
}

does not update drive->bios_cyl since drive->head != drive->bios_head.
So, I propose that the above fragment be changed into something like

/* Set the cylinder count - the BIOS reported value may be too small */
if (drive->bios_sect && drive->bios_head)
drive->bios_cyl = capacity / (drive->bios_sect * drive->bios_head);

where `capacity' is current_capacity(drive) in the 2.0.36 source,
and idedisk_capacity(drive) in the 2.1.130 source.

Andries

-
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/