Thread captured on Compuserve's IBMNET Hardware forum (IBMHW) collected and edited by Ray Tackett, 76416,276 #: 198282 S1/Disk/Disk Utils [H] 14-Jan-92 20:55:39 Sb: #197998-#IDE universal translatn Fm: RICHARD SINGER 76370,164 To: Jeff Bean 70277,720 (X) From what I have heard, the IDE drive looks at what the BIOS drive parameter table says, and then sets up internally the required translation. These drives obviously have some smarts! Richard #: 198419 S1/Disk/Disk Utils [H] 15-Jan-92 01:54:39 Sb: #198282-#IDE universal translatn Fm: Jeff Bean 70277,720 To: RICHARD SINGER 76370,164 (X) Richard: Smart isn't the word for it! In order for the drive to look at what the BIOS drive parameter table says it would have to take control of the bus i.e. be a bus master, which I thought was not possible on the AT bus. The only other alternative would be for the drive to contain a built in ROM containing code which is executed at boot-up time, but from my limited experience with IDE drives, they don't contain any ROM that appears in the 640k to 1024k area of memory. Jeff #: 198904 S1/Disk/Disk Utils [H] 16-Jan-92 17:34:33 Sb: #198419-#IDE universal translatn Fm: RICHARD SINGER 76370,164 To: Jeff Bean 70277,720 (X) I don't know just how they do it, but they certainly do. The AT bus does support bus mastering to a limited degree. Whether the IDE interface uses that method or not, I don't know. The IDE interface does have lines to control DMA data transfers. Here is a quote from the installation pamphlet that came with the HP drive. "The C2230 Series, Option 060 disk drives contain more than the maximum number of DOS-addressable cylinders and sectors per track, and less than the maximum number of DOS-addressable data heads. In order to compensate for these differences and provide the maximum available disk storage area to the host, the drive firmware performs a "logical translation" or "mapping" from the Drive Type parameters selected during the hard drive setup to the addressing structure of the disk drive." You'll have to find someone more knowledgeable than me to find out how they do it, but it definitely works! Richard #: 199044 S1/Disk/Disk Utils [H] 16-Jan-92 23:57:07 Sb: #198904-#IDE universal translatn Fm: Don Gentry 74166,1704 To: RICHARD SINGER 76370,164 (X) Richard, The IDE drive just takes the request from the BIOS in the form of CYL Head and Sector and multiplies Cyl*Head*Sector and derives the absolute sector number. Then it checks its internal tables and calculates the real Cyl, Head & Sector based on read geometry of the drive. Hope this helps...Don Gentry #: 199058 S1/Disk/Disk Utils [H] 17-Jan-92 00:24:12 Sb: #198904-IDE universal translatn Fm: Jeff Bean 70277,720 To: RICHARD SINGER 76370,164 (X) You are right about the AT bus being somewhat capable of bus mastering. I had forgotten that some SCSI controllers do in fact do that. However it would still be quite a feat to take control of the bus, figure out where the drive parameter table is stored and then pick the requisite information out of it, all under the nose of the processor chip (so to speak). Maybe someone else here knows more. Jeff #: 199194 S1/Disk/Disk Utils [H] 17-Jan-92 14:07:09 Sb: #198904-#IDE universal translatn Fm: Andrew Vogan, CV Tech 72260,541 To: RICHARD SINGER 76370,164 (X) The translation is done by the micro-controller inside the IDE drive. The host computer "talks" to the IDE drive through a task file that contains the cylinder, head, and sector number that the host wants to access. During the initialization process the host computer resets the drive and then tells it "You have xxx number of heads and yyy number of sectors per track". Then during operation the IDE controller takes the requested cylinder, head, and sector number and converts it to a logical block number. Logical block = (Cylinder * xxx * yyy) + (head * yyy) + (sector number). From the logical block number the drive determines its own internal cylinder, track, and sector number using the parameters of the media which it has burned into its EPROM. clear as mud ? Drew #: 199248 S1/Disk/Disk Utils [H] 17-Jan-92 17:25:14 Sb: #199044-#IDE universal translatn Fm: RICHARD SINGER 76370,164 To: Don Gentry 74166,1704 (X) Hmmm..., I think I'm beginning to understand. A program makes a request to DOS for something from the disk. DOS looks at the FAT to see what clusters it needs. DOS then figures out what sectors that includes. The BIOS then takes the sector request, and translates it into specific cylinder/head/sector requestst based on what is in the Drive Parameter Table. The IDE drive then translates the cylinder/head/sector stuff back into absolute sectors, and then translates again to what the physical drive really needs. Is that right? The next question is, why does that work fine for DOS, but under OS/2 it worked only for the cylinder/head/sector count the drive reports as a default to the host system. Maybe OS/2 asks the drive, but DOS doesn't? Richard #: 199280 S1/Disk/Disk Utils [H] 17-Jan-92 19:44:39 Sb: #199044-#IDE universal translatn Fm: John C. Brobston 71410,3121 To: Don Gentry 74166,1704 (X) >>Cyl*Head*Sector... Has to be more complex than that--multiplication is commutative, so there several different combinations of cyl, head, sector would address the same point on the disk. --John #: 199253 S1/Disk/Disk Utils [H] 17-Jan-92 17:58:36 Sb: #199194-#IDE universal translatn Fm: Jeff Bean 70277,720 To: Andrew Vogan, CV Tech 72260,541 (X) Ah.... now we are getting to the bottom of this. The key to the whole puzzle is the reset that occurs during the initialization process. The host computer does indeed need to tell the drive that it thinks the drive has "xxx heads and yyy sectors per track" otherwise the drive can't do the translation from one the geometry the host thinks it has to the real geometry of the drive. Now what do you mean by a "reset"? Does this take the form of a simple request to access the maximum cylinder, head and sector or is there some more formal mechanism used to pass the geometry information from the host to the drive. Also, do all BIOS'es do this "reset" or is this a relatively new invention to meet the needs of the drives that do translation? Jeff #: 199267 S1/Disk/Disk Utils [H] 17-Jan-92 18:44:31 Sb: #199194-#IDE universal translatn Fm: RICHARD SINGER 76370,164 To: Andrew Vogan, CV Tech 72260,541 (X) So the initialization doesn't tell the drive the number of cylinders it has, just the heads and sectors per track? What is the reason for the initialization anyways? Oh yeah, for the earlier drives, the controller could have any type of drive attached to it. And those controllers probably didn't have any way to store the head and sector per track info, right? Richard #: 199364 S1/Disk/Disk Utils [H] 17-Jan-92 22:49:30 Sb: #199248-IDE universal translatn Fm: Ron Morse 76164,3420 To: RICHARD SINGER 76370,164 (X) OS/2 doesn't use the system BIOS. They don't work in protected mode. You need a driver routine that does the same thing the BIOS does, but can work in protected mode. Regards #: 199268 S1/Disk/Disk Utils [H] 17-Jan-92 18:44:34 Sb: #199253-IDE universal translatn Fm: Andrew Vogan, CV Tech 72260,541 To: Jeff Bean 70277,720 (X) There is a command that is issued to the IDE drive through the task file called "Initialize Drive Parameters" (Code $91). The host specifies the number of heads and the number of sectors per track and then optionally the number of cylinders. The drive then stores this data under the heading "What the host thinks it is talking to..." (grin). There is also a RESET signal on the IDE interface bus that is used to reset the drive. When the drive is reset it will will use a default number of sectors per track and heads according to whatever whim the manufacturer felt like satisfying. Soooo after a RESET signal most of the 386 and 486 bioses (bios plural ?) will issue the Init Drive Params command with the parameters stored in their battery backed up ram. Drew #: *200048 S1/Disk/Disk Utils [H] 20-Jan-92 11:52:06 Sb: #199267-IDE universal translatn Fm: Andrew Vogan, CV Tech 72260,541 To: RICHARD SINGER 76370,164 You got it. The task file idea is a hold over from the old days of IBM MFM controllers where the task file resided on the interface card. Drew #: 199326 S1/Disk/Disk Utils [H] 17-Jan-92 21:39:58 Sb: #199280-IDE universal translatn Fm: Don Gentry 74166,1704 To: John C. Brobston 71410,3121 (X) John, You're right, I over simplified the formula. I think it's more like: (Cyl*(Heads per Cyl * Sectors per head))+(head*sectors per head) + Sector (minus 1 if you count the first sector as 0 instead of 1) I'm doing this from memory, so I may have an error, but you should get the basic idea. He calculates an absoulte sector address based on the emulated geometry and then translateds that to his native geometry. Since many IDE drive use Variable Density Recording the number of sectors per track is more near the rim than the center, they have to translate anyway and there's really no extra overhead. Don Gentry