Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!philmtl!philabs!linus!gwr From: gwr@linus.UUCP (Gordon W. Ross) Newsgroups: comp.os.minix Subject: How to get hard disk parameters at boot time Message-ID: <83311@linus.UUCP> Date: 15 Dec 89 20:17:55 GMT References: <26317@sequent.UUCP> <901@crash.cts.com> <832@ocsmd.ocs.com> Reply-To: gwr@linus.mitre.org Organization: The MITRE Corporation, Bedford, MA. Lines: 72 I have noticed that recent discussions about the wini driver and its adaptation to differing hard disk geometries have not included any mention of the PC BIOS hard disk parameter vectors. The best way to determine the hard disk geometry at boot time (on a PC/AT compatible) is to examine the BIOS hard disk parameter tables. All PC/AT compatible (and 386/AT) systems have boot-time initialization code in the system BIOS that sets two interrupt vectors (0x41, 0x46) to point at parameter tables for the first and second hard disk, respectively. The content of these tables is described below. These tables are the best source of information about hard disk geometry for two reasons: First, many hard disk controllers include a controller BIOS with a boot-time routine that installs correct disk geometry parameters in some area of RAM and then points the parameter vectors at those new parameters. Adaptec and Western Digital controllers for RLL and ESDI drives are usually configured to do this "parameter fixing." Note that when the controller changes the hard disk parameters, the values indicated by the CMOS RAM are no longer valid. Second, these hard disk parameter tables use a 16-bit word to store any cylinder number quantities and are therefore not limited to a 10-bit cylinder number as is BIOS int 0x13 sub-function 8. Though MS-DOS can't deal with cylinder numbers greater than 1024, some other systems that want to know the true disk geometry use these parameter tables to determine the disk geometry. (AT&T Sys V/386 Rel 2 does it this way.) Unfortunately, I haven't had time to work on the at-wini driver. I am posting this information in hopes that someone will use it to make the at-wini driver figure out the disk parameters at boot time. Gordon W. Ross (E025) ARPA: gwr@linus.mitre.org The MITRE Corporation UUCP: {decvax,philabs}!linus!gwr Burlington Road, Bedford, MA 01730 (617) 271-3205 Attached is a description of the PC/AT BIOS hard disk parameters. /**************************************************************** * The structure declaration below represents the layout of the * PC/AT BIOS hard disk parameter tables. Interrupt vectors * 0x41 and 0x46 point to parameter structures for the first and * second hard disks, respectively. This information was found * in the "IBM PC/AT Hardware Technical Reference Manual." * * Note that the number of cylinders is not limited to a * ten-bit quantity in this structure, so it is possible to * have num_cyl > 1024 (even though MS-LOSS can't handle it). ****************************************************************/ typedef unsigned short word; /* a 16-bit quantity */ typedef unsigned char byte; /* an 8-bit quantity */ struct BIOSHDParms { word num_cyl; /* NUMber of CYLinders (arm positions) */ byte heads; /* tracks per cylinder */ word xt3; /* PC/XT (unknown use) */ word wpc_cyl; /* Write PreCompensation CYL */ byte xt7; /* PC/XT (unknown use) */ byte control; /* control bits for retry (ignore) */ byte xt9, xtA, xtB; /* PC/XT (unknown use) */ word off_cyl; /* power-OFF Landing CYLinder */ byte sectors; /* sectors per track */ byte reserved; /* IBM says "for future use" */ } -- Gordon W. Ross (E025) ARPA: gwr@linus.mitre.org The MITRE Corporation UUCP: {decvax,philabs}!linus!gwr Burlington Road, Bedford, MA 01730 (617) 271-3205