10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*4658Smg147109 * Common Development and Distribution License (the "License"). 6*4658Smg147109 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*4658Smg147109 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988 AT&T */ 260Sstevel@tonic-gate /* All Rights Reserved */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifndef _SYS_DKTP_FDISK_H 300Sstevel@tonic-gate #define _SYS_DKTP_FDISK_H 310Sstevel@tonic-gate 320Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 330Sstevel@tonic-gate 340Sstevel@tonic-gate #ifdef __cplusplus 350Sstevel@tonic-gate extern "C" { 360Sstevel@tonic-gate #endif 370Sstevel@tonic-gate 380Sstevel@tonic-gate /* 390Sstevel@tonic-gate * fdisk.h 400Sstevel@tonic-gate * This file defines the structure of physical disk sector 0 for use on 410Sstevel@tonic-gate * AT386 systems. The format of this sector is constrained by the ROM 420Sstevel@tonic-gate * BIOS and MS-DOS conventions. 430Sstevel@tonic-gate * Note that this block does not define the partitions used by the unix 440Sstevel@tonic-gate * driver. The unix partitions are obtained from the VTOC. 450Sstevel@tonic-gate */ 460Sstevel@tonic-gate 47*4658Smg147109 /* 48*4658Smg147109 * BOOTSZ was reduced from 446 to 440 bytes to NOT overwrite the Windows 49*4658Smg147109 * Vista DISKID. Otherwise Vista won't boot from Solaris GRUB in a dual-boot 50*4658Smg147109 * setup. 51*4658Smg147109 * The actual size of mboot code is 425 bytes while that of GRUB stage1 is 52*4658Smg147109 * 423 bytes. So this changes does not harm them. 53*4658Smg147109 */ 54*4658Smg147109 #define BOOTSZ 440 /* size of boot code in master boot block */ 550Sstevel@tonic-gate #define FD_NUMPART 4 /* number of 'partitions' in fdisk table */ 560Sstevel@tonic-gate #define MBB_MAGIC 0xAA55 /* magic number for mboot.signature */ 570Sstevel@tonic-gate #define DEFAULT_INTLV 4 /* default interleave for testing tracks */ 580Sstevel@tonic-gate #define MINPSIZE 4 /* minimum number of cylinders in a partition */ 590Sstevel@tonic-gate #define TSTPAT 0xE5 /* test pattern for verifying disk */ 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* 620Sstevel@tonic-gate * structure to hold the fdisk partition table 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate struct ipart { 650Sstevel@tonic-gate unsigned char bootid; /* bootable or not */ 660Sstevel@tonic-gate unsigned char beghead; /* beginning head, sector, cylinder */ 670Sstevel@tonic-gate unsigned char begsect; /* begcyl is a 10-bit number. High 2 bits */ 680Sstevel@tonic-gate unsigned char begcyl; /* are in begsect. */ 690Sstevel@tonic-gate unsigned char systid; /* OS type */ 700Sstevel@tonic-gate unsigned char endhead; /* ending head, sector, cylinder */ 710Sstevel@tonic-gate unsigned char endsect; /* endcyl is a 10-bit number. High 2 bits */ 720Sstevel@tonic-gate unsigned char endcyl; /* are in endsect. */ 730Sstevel@tonic-gate int relsect; /* first sector relative to start of disk */ 740Sstevel@tonic-gate int numsect; /* number of sectors in partition */ 750Sstevel@tonic-gate }; 760Sstevel@tonic-gate /* 770Sstevel@tonic-gate * Values for bootid. 780Sstevel@tonic-gate */ 790Sstevel@tonic-gate #define NOTACTIVE 0 800Sstevel@tonic-gate #define ACTIVE 128 810Sstevel@tonic-gate /* 820Sstevel@tonic-gate * Values for systid. 830Sstevel@tonic-gate */ 840Sstevel@tonic-gate #define DOSOS12 1 /* DOS partition, 12-bit FAT */ 850Sstevel@tonic-gate #define PCIXOS 2 /* PC/IX partition */ 860Sstevel@tonic-gate #define DOSOS16 4 /* DOS partition, 16-bit FAT */ 870Sstevel@tonic-gate #define EXTDOS 5 /* EXT-DOS partition */ 880Sstevel@tonic-gate #define DOSHUGE 6 /* Huge DOS partition > 32MB */ 890Sstevel@tonic-gate #define FDISK_IFS 7 /* Installable File System (IFS): HPFS & NTFS */ 900Sstevel@tonic-gate #define FDISK_AIXBOOT 8 /* AIX Boot */ 910Sstevel@tonic-gate #define FDISK_AIXDATA 9 /* AIX Data */ 920Sstevel@tonic-gate #define FDISK_OS2BOOT 10 /* OS/2 Boot Manager */ 930Sstevel@tonic-gate #define FDISK_WINDOWS 11 /* Windows 95 FAT32 (up to 2047GB) */ 940Sstevel@tonic-gate #define FDISK_EXT_WIN 12 /* Windows 95 FAT32 (extended-INT13) */ 950Sstevel@tonic-gate #define FDISK_FAT95 14 /* DOS 16-bit FAT, LBA-mapped */ 960Sstevel@tonic-gate #define FDISK_EXTLBA 15 /* Extended partition, LBA-mapped */ 970Sstevel@tonic-gate #define DIAGPART 18 /* Diagnostic boot partition (OS independent) */ 980Sstevel@tonic-gate #define FDISK_LINUX 65 /* Linux */ 990Sstevel@tonic-gate #define FDISK_LINUXDSWAP 66 /* Linux swap (sharing disk w/ DRDOS) */ 1000Sstevel@tonic-gate #define FDISK_LINUXDNAT 67 /* Linux native (sharing disk with DRDOS) */ 1010Sstevel@tonic-gate #define FDISK_CPM 82 /* CP/M */ 1020Sstevel@tonic-gate #define DOSDATA 86 /* DOS data partition */ 1030Sstevel@tonic-gate #define OTHEROS 98 /* part. type for appl. (DB?) needs */ 1040Sstevel@tonic-gate /* raw partition. ID was 0 but conflicted */ 1050Sstevel@tonic-gate /* with DOS 3.3 fdisk */ 1060Sstevel@tonic-gate #define UNIXOS 99 /* UNIX V.x partition */ 1070Sstevel@tonic-gate #define UNUSED 100 /* unassigned partition */ 1080Sstevel@tonic-gate #define FDISK_NOVELL3 101 /* Novell Netware 3.x and later */ 1090Sstevel@tonic-gate #define FDISK_QNX4 119 /* QNX 4.x */ 1100Sstevel@tonic-gate #define FDISK_QNX42 120 /* QNX 4.x 2nd part */ 1110Sstevel@tonic-gate #define FDISK_QNX43 121 /* QNX 4.x 3rd part */ 1120Sstevel@tonic-gate #define SUNIXOS 130 /* Solaris UNIX partition */ 1130Sstevel@tonic-gate #define FDISK_LINUXNAT 131 /* Linux native */ 1140Sstevel@tonic-gate #define FDISK_NTFSVOL1 134 /* NTFS volume set 1 */ 1150Sstevel@tonic-gate #define FDISK_NTFSVOL2 135 /* NTFS volume set 2 */ 1160Sstevel@tonic-gate #define FDISK_BSD 165 /* BSD/386, 386BSD, NetBSD, FreeBSD, OpenBSD */ 1170Sstevel@tonic-gate #define FDISK_NEXTSTEP 167 /* NeXTSTEP */ 1180Sstevel@tonic-gate #define FDISK_BSDIFS 183 /* BSDI file system */ 1190Sstevel@tonic-gate #define FDISK_BSDISWAP 184 /* BSDI swap */ 1200Sstevel@tonic-gate #define X86BOOT 190 /* x86 Solaris boot partition */ 1210Sstevel@tonic-gate #define SUNIXOS2 191 /* Solaris UNIX partition */ 1220Sstevel@tonic-gate #define EFI_PMBR 238 /* EFI PMBR */ 1230Sstevel@tonic-gate #define EFI_FS 239 /* EFI File System (System Partition) */ 1240Sstevel@tonic-gate #define MAXDOS 65535L /* max size (sectors) for DOS partition */ 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate /* 1270Sstevel@tonic-gate * structure to hold master boot block in physical sector 0 of the disk. 1280Sstevel@tonic-gate * Note that partitions stuff can't be directly included in the structure 1290Sstevel@tonic-gate * because of lameo '386 compiler alignment design. 1300Sstevel@tonic-gate */ 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate struct mboot { /* master boot block */ 133*4658Smg147109 char bootinst[BOOTSZ]; 134*4658Smg147109 uint32_t win_volserno; 135*4658Smg147109 uint16_t reserved; 136*4658Smg147109 char parts[FD_NUMPART * sizeof (struct ipart)]; 1370Sstevel@tonic-gate ushort_t signature; 1380Sstevel@tonic-gate }; 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate #ifdef __cplusplus 1410Sstevel@tonic-gate } 1420Sstevel@tonic-gate #endif 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate #endif /* _SYS_DKTP_FDISK_H */ 145