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