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)
26 disk->bios_sect = sect;
29 /* XXX - parameters should change to fit for PC-98, but I'm not sure */
31 Sanitize_Bios_Geom(struct disk *disk)
37 if (disk->bios_cyl > 1024)
39 if (disk->bios_hd > 16)
41 if (disk->bios_sect > 63)
43 if (disk->bios_cyl*disk->bios_hd*disk->bios_sect != disk->chunks->size)
48 /* First try something that IDE can handle */
51 disk->bios_cyl = disk->chunks->size / (disk->bios_sect*disk->bios_hd);
53 if (disk->bios_cyl < 1024)
56 /* Hmm, try harder... */
58 disk->bios_cyl = disk->chunks->size / (disk->bios_sect*disk->bios_hd);
64 All_FreeBSD(struct disk *d, int force_all)
69 for (c = d->chunks->part; c; c = c->next)
70 if (c->type != unused) {
76 Sanitize_Bios_Geom(d);
78 Create_Chunk(d, c->offset, c->size, freebsd, 0x494,
79 CHUNK_FORCE_ALL, "FreeBSD");
81 Create_Chunk(d, c->offset, c->size, freebsd, 0xa5,
86 Create_Chunk(d, c->offset, c->size, freebsd, 0x494, 0,
89 Create_Chunk(d, c->offset, c->size, freebsd, 0xa5, 0);