2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@login.dknet.dk> 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 * ----------------------------------------------------------------------------
9 * $FreeBSD: src/lib/libdisk/change.c,v 1.14.2.5 2002/10/24 13:03:44 nyan Exp $
10 * $DragonFly: src/lib/libdisk/Attic/change.c,v 1.2 2003/06/17 04:26:49 dillon Exp $
19 #include <sys/types.h>
23 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)
38 if (disk->bios_cyl >= 65536)
40 if (disk->bios_cyl > 1024)
43 if (disk->bios_hd > 16)
46 if (disk->bios_sect >= 256)
48 if (disk->bios_sect > 63)
51 if (disk->bios_cyl*disk->bios_hd*disk->bios_sect != disk->chunks->size)
56 /* First try something that IDE can handle */
59 disk->bios_cyl = disk->chunks->size / (disk->bios_sect*disk->bios_hd);
62 if (disk->bios_cyl < 65536)
64 if (disk->bios_cyl < 1024)
68 /* Hmm, try harder... */
70 /* Assume standard SCSI parameter */
71 disk->bios_sect = 128;
76 disk->bios_cyl = disk->chunks->size / (disk->bios_sect*disk->bios_hd);
82 All_FreeBSD(struct disk *d, int force_all)
87 for (c = d->chunks->part; c; c = c->next)
88 if (c->type != unused) {
94 Sanitize_Bios_Geom(d);
96 Create_Chunk(d, c->offset, c->size, freebsd, 0x494,
97 CHUNK_FORCE_ALL, "FreeBSD");
99 Create_Chunk(d, c->offset, c->size, freebsd, 0xa5,
104 Create_Chunk(d, c->offset, c->size, freebsd, 0x494, 0,
107 Create_Chunk(d, c->offset, c->size, freebsd, 0xa5, 0);