2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
10 #include <sys/cdefs.h>
11 __FBSDID("$FreeBSD$");
18 #include <sys/types.h>
22 Set_Bios_Geom(struct disk *disk, u_long cyl, u_long hd, u_long sect)
27 disk->bios_sect = sect;
31 Sanitize_Bios_Geom(struct disk *disk)
37 if (disk->bios_cyl >= 65536)
40 if (disk->bios_hd >= 256)
42 if (disk->bios_sect >= 256)
45 if (disk->bios_hd > 256)
47 if (disk->bios_sect > 63)
50 #if 0 /* Disable a check on a disk size. It's too strict. */
51 if (disk->bios_cyl * disk->bios_hd * disk->bios_sect !=
58 /* First try something that IDE can handle */
61 disk->bios_cyl = disk->chunks->size /
62 (disk->bios_sect * disk->bios_hd);
65 if (disk->bios_cyl < 65536)
67 if (disk->bios_cyl < 1024)
71 /* Hmm, try harder... */
72 /* Assume standard SCSI parameter */
74 disk->bios_sect = 128;
79 disk->bios_cyl = disk->chunks->size /
80 (disk->bios_sect * disk->bios_hd);
83 if (disk->bios_cyl < 65536)
86 /* Assume UIDE-133/98-A Challenger BIOS 0.9821C parameter */
87 disk->bios_sect = 255;
89 disk->bios_cyl = disk->chunks->size /
90 (disk->bios_sect * disk->bios_hd);
92 if (disk->bios_cyl < 65536)
97 disk->bios_cyl = disk->chunks->size /
98 (disk->bios_sect * disk->bios_hd);
103 All_FreeBSD(struct disk *d, int force_all)
115 for (c = d->chunks->part; c; c = c->next)
116 if (c->type != unused) {
122 Sanitize_Bios_Geom(d);
123 Create_Chunk(d, c->offset, c->size, freebsd, type,
124 CHUNK_FORCE_ALL, "FreeBSD");
126 Create_Chunk(d, c->offset, c->size, freebsd, type, 0,