Re: 10.2 Gig HDD

Guest section DW (dwguest@win.tue.nl)
Thu, 21 Jan 1999 00:41:16 +0100 (MET)


From nconway.list@ukaea.org.uk Wed Jan 20 23:03:49 1999

Hmm, perhaps you can clarify something that confuses me...

If you do invent your own geometry, how does the DRIVE know what you are
using? Suppose for example, the drive has native geometry of 3200,16,63
and you decide you want to have less than 1000 cylinders, so you pick
something like 800,64,63. When the drive is first asked for Sector
(1,62,54) it can make a good guess that you have got a custom geometry,
but if you have previously asked it for Sector (1,2,2) will it have
given you the wrong sector? If not, who told it that the geometry was
custom... In DOS, perhaps the boot sector? In Linux, the LILO boot
sector?

Internally, Linux only uses sector numbers (or block numbers); the kernel
never works with (1,62,54) or so - instead it asks for sector 123456.
If the disk is a SCSI disk then this sector number goes directly into
a SCSI command. No geometry involved. If the disk is an IDE disk that uses
LBA, then again the sector number goes directly into the I/O command.
No geometry involved. But if it is an old drive, and it doesnt know about LBA,
then a geometry is used and (c,h,s) is computed and used for disk I/O.
If the disk has C cylinders, H heads and S sectors/track, then (c,h,s)
corresponds to sector c*H*S + h*S + s - 1.
Which geometry is used? We can (and do) specify that ourselves with the
INITIALIZE DRIVE PARAMETERS command to the disk.

(Look at ide.c in the 2.0.36 source. We request setting a geometry by
drive->special.b.set_geometry = 1;
The routine do_special() will then output drive->cyl, drive->head,
drive->sect using the WIN_SPECIFY=0x91=INITIALIZE DRIVE PARAMETERS command.)

So, for modern hardware the disk never sees what we invented.
For old hardware, we tell it.

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/