xref: /titanic_52/usr/src/uts/common/sys/dktp/fdisk.h (revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /*	Copyright (c) 1984, 1986, 1987, 1988 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 
30 #ifndef _SYS_DKTP_FDISK_H
31 #define	_SYS_DKTP_FDISK_H
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 /*
40  * fdisk.h
41  * This file defines the structure of physical disk sector 0 for use on
42  * AT386 systems.  The format of this sector is constrained by the ROM
43  * BIOS and MS-DOS conventions.
44  * Note that this block does not define the partitions used by the unix
45  * driver.  The unix partitions are obtained from the VTOC.
46  */
47 
48 #define	BOOTSZ		446	/* size of boot code in master boot block */
49 #define	FD_NUMPART	4	/* number of 'partitions' in fdisk table */
50 #define	MBB_MAGIC	0xAA55	/* magic number for mboot.signature */
51 #define	DEFAULT_INTLV	4	/* default interleave for testing tracks */
52 #define	MINPSIZE	4	/* minimum number of cylinders in a partition */
53 #define	TSTPAT		0xE5	/* test pattern for verifying disk */
54 
55 /*
56  * structure to hold the fdisk partition table
57  */
58 struct ipart {
59 	unsigned char bootid;	/* bootable or not */
60 	unsigned char beghead;	/* beginning head, sector, cylinder */
61 	unsigned char begsect;	/* begcyl is a 10-bit number. High 2 bits */
62 	unsigned char begcyl;	/*	are in begsect. */
63 	unsigned char systid;	/* OS type */
64 	unsigned char endhead;	/* ending head, sector, cylinder */
65 	unsigned char endsect;	/* endcyl is a 10-bit number.  High 2 bits */
66 	unsigned char endcyl;	/*	are in endsect. */
67 	int	relsect;	/* first sector relative to start of disk */
68 	int	numsect;	/* number of sectors in partition */
69 };
70 /*
71  * Values for bootid.
72  */
73 #define	NOTACTIVE	0
74 #define	ACTIVE		128
75 /*
76  * Values for systid.
77  */
78 #define	DOSOS12		1	/* DOS partition, 12-bit FAT */
79 #define	PCIXOS		2	/* PC/IX partition */
80 #define	DOSOS16		4	/* DOS partition, 16-bit FAT */
81 #define	EXTDOS		5	/* EXT-DOS partition */
82 #define	DOSHUGE		6	/* Huge DOS partition  > 32MB */
83 #define	FDISK_IFS	7	/* Installable File System (IFS): HPFS & NTFS */
84 #define	FDISK_AIXBOOT	8	/* AIX Boot */
85 #define	FDISK_AIXDATA	9	/* AIX Data */
86 #define	FDISK_OS2BOOT	10	/* OS/2 Boot Manager */
87 #define	FDISK_WINDOWS	11	/* Windows 95 FAT32 (up to 2047GB) */
88 #define	FDISK_EXT_WIN	12	/* Windows 95 FAT32 (extended-INT13) */
89 #define	FDISK_FAT95	14	/* DOS 16-bit FAT, LBA-mapped */
90 #define	FDISK_EXTLBA	15	/* Extended partition, LBA-mapped */
91 #define	DIAGPART	18	/* Diagnostic boot partition (OS independent) */
92 #define	FDISK_LINUX	65	/* Linux */
93 #define	FDISK_LINUXDSWAP	66	/* Linux swap (sharing disk w/ DRDOS) */
94 #define	FDISK_LINUXDNAT	67	/* Linux native (sharing disk with DRDOS) */
95 #define	FDISK_CPM	82	/* CP/M */
96 #define	DOSDATA		86	/* DOS data partition */
97 #define	OTHEROS		98	/* part. type for appl. (DB?) needs */
98 				/* raw partition.  ID was 0 but conflicted */
99 				/* with DOS 3.3 fdisk    */
100 #define	UNIXOS		99	/* UNIX V.x partition */
101 #define	UNUSED		100	/* unassigned partition */
102 #define	FDISK_NOVELL3	101	/* Novell Netware 3.x and later */
103 #define	FDISK_QNX4	119	/* QNX 4.x */
104 #define	FDISK_QNX42	120	/* QNX 4.x 2nd part */
105 #define	FDISK_QNX43	121	/* QNX 4.x 3rd part */
106 #define	SUNIXOS		130	/* Solaris UNIX partition */
107 #define	FDISK_LINUXNAT	131	/* Linux native */
108 #define	FDISK_NTFSVOL1	134	/* NTFS volume set 1 */
109 #define	FDISK_NTFSVOL2	135	/* NTFS volume set 2 */
110 #define	FDISK_BSD	165	/* BSD/386, 386BSD, NetBSD, FreeBSD, OpenBSD */
111 #define	FDISK_NEXTSTEP	167	/* NeXTSTEP */
112 #define	FDISK_BSDIFS	183	/* BSDI file system */
113 #define	FDISK_BSDISWAP	184	/* BSDI swap */
114 #define	X86BOOT		190	/* x86 Solaris boot partition */
115 #define	SUNIXOS2	191	/* Solaris UNIX partition */
116 #define	EFI_PMBR	238	/* EFI PMBR */
117 #define	EFI_FS		239	/* EFI File System (System Partition) */
118 #define	MAXDOS		65535L	/* max size (sectors) for DOS partition */
119 
120 /*
121  * structure to hold master boot block in physical sector 0 of the disk.
122  * Note that partitions stuff can't be directly included in the structure
123  * because of lameo '386 compiler alignment design.
124  */
125 
126 struct mboot {	/* master boot block */
127 	char    bootinst[BOOTSZ];
128 	char    parts[FD_NUMPART * sizeof (struct ipart)];
129 	ushort_t signature;
130 };
131 
132 #ifdef	__cplusplus
133 }
134 #endif
135 
136 #endif	/* _SYS_DKTP_FDISK_H */
137