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 54658Smg147109 * Common Development and Distribution License (the "License"). 64658Smg147109 * 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 */ 217563SPrasad.Singamsetty@Sun.COM 220Sstevel@tonic-gate /* 23*10021SSheshadri.Vasudevan@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _SYS_DKTP_FDISK_H 310Sstevel@tonic-gate #define _SYS_DKTP_FDISK_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate #ifdef __cplusplus 340Sstevel@tonic-gate extern "C" { 350Sstevel@tonic-gate #endif 360Sstevel@tonic-gate 370Sstevel@tonic-gate /* 380Sstevel@tonic-gate * fdisk.h 390Sstevel@tonic-gate * This file defines the structure of physical disk sector 0 for use on 400Sstevel@tonic-gate * AT386 systems. The format of this sector is constrained by the ROM 410Sstevel@tonic-gate * BIOS and MS-DOS conventions. 420Sstevel@tonic-gate * Note that this block does not define the partitions used by the unix 430Sstevel@tonic-gate * driver. The unix partitions are obtained from the VTOC. 440Sstevel@tonic-gate */ 450Sstevel@tonic-gate 464658Smg147109 /* 47*10021SSheshadri.Vasudevan@Sun.COM * the MAX values are the maximum usable values for BIOS chs values 48*10021SSheshadri.Vasudevan@Sun.COM * The MAX_CYL value of 1022 is the maximum usable value 49*10021SSheshadri.Vasudevan@Sun.COM * the value of 1023 is a fence value, 50*10021SSheshadri.Vasudevan@Sun.COM * indicating no CHS geometry exists for the corresponding LBA value. 51*10021SSheshadri.Vasudevan@Sun.COM * HEAD range [ 0 .. MAX_HEAD ], so number of heads is (MAX_HEAD + 1) 52*10021SSheshadri.Vasudevan@Sun.COM * SECT range [ 1 .. MAX_SECT ], so number of sectors is (MAX_SECT) 53*10021SSheshadri.Vasudevan@Sun.COM */ 54*10021SSheshadri.Vasudevan@Sun.COM #define MAX_SECT (63) 55*10021SSheshadri.Vasudevan@Sun.COM #define MAX_CYL (1022) 56*10021SSheshadri.Vasudevan@Sun.COM #define MAX_HEAD (254) 57*10021SSheshadri.Vasudevan@Sun.COM 58*10021SSheshadri.Vasudevan@Sun.COM /* 594658Smg147109 * BOOTSZ was reduced from 446 to 440 bytes to NOT overwrite the Windows 604658Smg147109 * Vista DISKID. Otherwise Vista won't boot from Solaris GRUB in a dual-boot 614658Smg147109 * setup. 624658Smg147109 * The actual size of mboot code is 425 bytes while that of GRUB stage1 is 634658Smg147109 * 423 bytes. So this changes does not harm them. 644658Smg147109 */ 654658Smg147109 #define BOOTSZ 440 /* size of boot code in master boot block */ 660Sstevel@tonic-gate #define FD_NUMPART 4 /* number of 'partitions' in fdisk table */ 670Sstevel@tonic-gate #define MBB_MAGIC 0xAA55 /* magic number for mboot.signature */ 680Sstevel@tonic-gate #define DEFAULT_INTLV 4 /* default interleave for testing tracks */ 690Sstevel@tonic-gate #define MINPSIZE 4 /* minimum number of cylinders in a partition */ 700Sstevel@tonic-gate #define TSTPAT 0xE5 /* test pattern for verifying disk */ 710Sstevel@tonic-gate 720Sstevel@tonic-gate /* 730Sstevel@tonic-gate * structure to hold the fdisk partition table 740Sstevel@tonic-gate */ 750Sstevel@tonic-gate struct ipart { 760Sstevel@tonic-gate unsigned char bootid; /* bootable or not */ 770Sstevel@tonic-gate unsigned char beghead; /* beginning head, sector, cylinder */ 780Sstevel@tonic-gate unsigned char begsect; /* begcyl is a 10-bit number. High 2 bits */ 790Sstevel@tonic-gate unsigned char begcyl; /* are in begsect. */ 800Sstevel@tonic-gate unsigned char systid; /* OS type */ 810Sstevel@tonic-gate unsigned char endhead; /* ending head, sector, cylinder */ 820Sstevel@tonic-gate unsigned char endsect; /* endcyl is a 10-bit number. High 2 bits */ 830Sstevel@tonic-gate unsigned char endcyl; /* are in endsect. */ 847563SPrasad.Singamsetty@Sun.COM uint32_t relsect; /* first sector relative to start of disk */ 857563SPrasad.Singamsetty@Sun.COM uint32_t numsect; /* number of sectors in partition */ 860Sstevel@tonic-gate }; 870Sstevel@tonic-gate /* 880Sstevel@tonic-gate * Values for bootid. 890Sstevel@tonic-gate */ 900Sstevel@tonic-gate #define NOTACTIVE 0 910Sstevel@tonic-gate #define ACTIVE 128 920Sstevel@tonic-gate /* 930Sstevel@tonic-gate * Values for systid. 940Sstevel@tonic-gate */ 95*10021SSheshadri.Vasudevan@Sun.COM #define UNUSED 0 /* Empty Partition */ 960Sstevel@tonic-gate #define DOSOS12 1 /* DOS partition, 12-bit FAT */ 970Sstevel@tonic-gate #define PCIXOS 2 /* PC/IX partition */ 980Sstevel@tonic-gate #define DOSOS16 4 /* DOS partition, 16-bit FAT */ 990Sstevel@tonic-gate #define EXTDOS 5 /* EXT-DOS partition */ 1000Sstevel@tonic-gate #define DOSHUGE 6 /* Huge DOS partition > 32MB */ 1010Sstevel@tonic-gate #define FDISK_IFS 7 /* Installable File System (IFS): HPFS & NTFS */ 1020Sstevel@tonic-gate #define FDISK_AIXBOOT 8 /* AIX Boot */ 1030Sstevel@tonic-gate #define FDISK_AIXDATA 9 /* AIX Data */ 1040Sstevel@tonic-gate #define FDISK_OS2BOOT 10 /* OS/2 Boot Manager */ 1050Sstevel@tonic-gate #define FDISK_WINDOWS 11 /* Windows 95 FAT32 (up to 2047GB) */ 1060Sstevel@tonic-gate #define FDISK_EXT_WIN 12 /* Windows 95 FAT32 (extended-INT13) */ 1070Sstevel@tonic-gate #define FDISK_FAT95 14 /* DOS 16-bit FAT, LBA-mapped */ 1080Sstevel@tonic-gate #define FDISK_EXTLBA 15 /* Extended partition, LBA-mapped */ 1090Sstevel@tonic-gate #define DIAGPART 18 /* Diagnostic boot partition (OS independent) */ 1100Sstevel@tonic-gate #define FDISK_LINUX 65 /* Linux */ 1110Sstevel@tonic-gate #define FDISK_LINUXDSWAP 66 /* Linux swap (sharing disk w/ DRDOS) */ 1120Sstevel@tonic-gate #define FDISK_LINUXDNAT 67 /* Linux native (sharing disk with DRDOS) */ 1130Sstevel@tonic-gate #define FDISK_CPM 82 /* CP/M */ 1140Sstevel@tonic-gate #define DOSDATA 86 /* DOS data partition */ 1150Sstevel@tonic-gate #define OTHEROS 98 /* part. type for appl. (DB?) needs */ 1160Sstevel@tonic-gate /* raw partition. ID was 0 but conflicted */ 1170Sstevel@tonic-gate /* with DOS 3.3 fdisk */ 1180Sstevel@tonic-gate #define UNIXOS 99 /* UNIX V.x partition */ 119*10021SSheshadri.Vasudevan@Sun.COM #define FDISK_NOVELL2 100 /* Novell Netware 286 */ 1200Sstevel@tonic-gate #define FDISK_NOVELL3 101 /* Novell Netware 3.x and later */ 1210Sstevel@tonic-gate #define FDISK_QNX4 119 /* QNX 4.x */ 1220Sstevel@tonic-gate #define FDISK_QNX42 120 /* QNX 4.x 2nd part */ 1230Sstevel@tonic-gate #define FDISK_QNX43 121 /* QNX 4.x 3rd part */ 1240Sstevel@tonic-gate #define SUNIXOS 130 /* Solaris UNIX partition */ 1250Sstevel@tonic-gate #define FDISK_LINUXNAT 131 /* Linux native */ 1260Sstevel@tonic-gate #define FDISK_NTFSVOL1 134 /* NTFS volume set 1 */ 1270Sstevel@tonic-gate #define FDISK_NTFSVOL2 135 /* NTFS volume set 2 */ 1280Sstevel@tonic-gate #define FDISK_BSD 165 /* BSD/386, 386BSD, NetBSD, FreeBSD, OpenBSD */ 1290Sstevel@tonic-gate #define FDISK_NEXTSTEP 167 /* NeXTSTEP */ 1300Sstevel@tonic-gate #define FDISK_BSDIFS 183 /* BSDI file system */ 1310Sstevel@tonic-gate #define FDISK_BSDISWAP 184 /* BSDI swap */ 1320Sstevel@tonic-gate #define X86BOOT 190 /* x86 Solaris boot partition */ 1330Sstevel@tonic-gate #define SUNIXOS2 191 /* Solaris UNIX partition */ 1340Sstevel@tonic-gate #define EFI_PMBR 238 /* EFI PMBR */ 1350Sstevel@tonic-gate #define EFI_FS 239 /* EFI File System (System Partition) */ 1360Sstevel@tonic-gate #define MAXDOS 65535L /* max size (sectors) for DOS partition */ 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate /* 1390Sstevel@tonic-gate * structure to hold master boot block in physical sector 0 of the disk. 1400Sstevel@tonic-gate * Note that partitions stuff can't be directly included in the structure 1410Sstevel@tonic-gate * because of lameo '386 compiler alignment design. 1424661Smg147109 * Alignment issues also force us to have 2 16bit entities for a single 1434661Smg147109 * 32bit win_volserno. It is not used anywhere anyway. 1440Sstevel@tonic-gate */ 1450Sstevel@tonic-gate 1460Sstevel@tonic-gate struct mboot { /* master boot block */ 1474661Smg147109 char bootinst[BOOTSZ]; 1484661Smg147109 uint16_t win_volserno_lo; 1494661Smg147109 uint16_t win_volserno_hi; 1504658Smg147109 uint16_t reserved; 1514661Smg147109 char parts[FD_NUMPART * sizeof (struct ipart)]; 1520Sstevel@tonic-gate ushort_t signature; 1530Sstevel@tonic-gate }; 1540Sstevel@tonic-gate 155*10021SSheshadri.Vasudevan@Sun.COM #if defined(__i386) || defined(__amd64) 156*10021SSheshadri.Vasudevan@Sun.COM 157*10021SSheshadri.Vasudevan@Sun.COM /* Byte offset of the start of the partition table within the sector */ 158*10021SSheshadri.Vasudevan@Sun.COM #define FDISK_PART_TABLE_START 446 159*10021SSheshadri.Vasudevan@Sun.COM 160*10021SSheshadri.Vasudevan@Sun.COM /* Maximum number of valid partitions assumed as 32 */ 161*10021SSheshadri.Vasudevan@Sun.COM #define MAX_EXT_PARTS 32 162*10021SSheshadri.Vasudevan@Sun.COM 163*10021SSheshadri.Vasudevan@Sun.COM #else 164*10021SSheshadri.Vasudevan@Sun.COM 165*10021SSheshadri.Vasudevan@Sun.COM #define MAX_EXT_PARTS 0 166*10021SSheshadri.Vasudevan@Sun.COM 167*10021SSheshadri.Vasudevan@Sun.COM #endif /* if defined(__i386) || defined(__amd64) */ 168*10021SSheshadri.Vasudevan@Sun.COM 1690Sstevel@tonic-gate #ifdef __cplusplus 1700Sstevel@tonic-gate } 1710Sstevel@tonic-gate #endif 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate #endif /* _SYS_DKTP_FDISK_H */ 174