Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Feb 1996 11:51:09 EST
From:      Greg Hudson <ghudson@mit.edu>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        darrenr@cyber.com.au, etheisen@teclink.net, etheisen@ozzy.MIT.EDU, freebsd-bugs@freebsd.org, port-i386@NetBSD.ORG
Subject:   Re: Incompatible slices. 
Message-ID:  <199602261651.LAA05895@glacier.MIT.EDU>
In-Reply-To: Your message of "Mon, 26 Feb 1996 19:32:31 %2B1100." <199602260832.TAA29001@godzilla.zeta.org.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
> No, only the FreeBSD sysinstall, fdisk and boot programs use the
> BIOS geometry.  The drivers don't use it, but they attempt to
> determine it (so that they can reporte it to sysinstall and fdisk)
> by looking at the contents of the DOS partition table.

I think you're confused, or perhaps only talking about SCSI disks.
>From sys/i386/boot/biosboot:

	/* Pick up the story from the Bios on geometry of disks */

	for(ret = 0; ret < N_BIOS_GEOM; ret ++)
		bootinfo.bi_bios_geom[ret] = get_diskinfo(ret + 0x80);

and then from sys/i386/isa/wd.c, in wdgetctlr():

		if (du->dk_unit == bootinfo.bi_n_bios_used) {
			du->dk_dd.d_secsize = DEV_BSIZE;
			du->dk_dd.d_nsectors =
			    bootinfo.bi_bios_geom[du->dk_unit] & 0xff;
			[etc.]
			bootinfo.bi_n_bios_used ++;
			return 0;
		}

I haven't examined the SCSI code get.

> Of course, this can only work if the partition table is nonempty,
> and it often gives the wrong results unless the partition table
> follows defacto standard conventions.

I added code to the NetBSD fdisk to do this kind of heuristic
calculation, and it does not rely on any de facto partition table
conventions.  It treats each partition table entry as an equation, and
attempts to find non-degenerate equations in the partition table which
will yield the number of sectors per track and the number of heads.

Arguably, the code should have gone into the disk drivers (so that
disklabel can work properly), but I'd rather see the drivers use the
BIOS geometry.

> 		# The following self-referential step is required
> 		# because many modern SCSI BIOSes attempt to determine
> 		# the geometry by looking at the partition table.

So what do they do if there's no partition table?  They have to return
something; as long as it's a valid geometry for the disk, you should
be able to use it and the next time the BIOS is queried for the disk
geometry, it should return the same thing.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602261651.LAA05895>