17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  *  GRUB  --  GRand Unified Bootloader
37c478bd9Sstevel@tonic-gate  *  Copyright (C) 1999,2000,2001,2003   Free Software Foundation, Inc.
47c478bd9Sstevel@tonic-gate  *
57c478bd9Sstevel@tonic-gate  *  This program is free software; you can redistribute it and/or modify
67c478bd9Sstevel@tonic-gate  *  it under the terms of the GNU General Public License as published by
77c478bd9Sstevel@tonic-gate  *  the Free Software Foundation; either version 2 of the License, or
87c478bd9Sstevel@tonic-gate  *  (at your option) any later version.
97c478bd9Sstevel@tonic-gate  *
107c478bd9Sstevel@tonic-gate  *  This program is distributed in the hope that it will be useful,
117c478bd9Sstevel@tonic-gate  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
127c478bd9Sstevel@tonic-gate  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
137c478bd9Sstevel@tonic-gate  *  GNU General Public License for more details.
147c478bd9Sstevel@tonic-gate  *
157c478bd9Sstevel@tonic-gate  *  You should have received a copy of the GNU General Public License
167c478bd9Sstevel@tonic-gate  *  along with this program; if not, write to the Free Software
177c478bd9Sstevel@tonic-gate  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
187c478bd9Sstevel@tonic-gate  */
197c478bd9Sstevel@tonic-gate 
207c478bd9Sstevel@tonic-gate #ifndef _PC_SLICE_H
217c478bd9Sstevel@tonic-gate #define _PC_SLICE_H
227c478bd9Sstevel@tonic-gate 
237c478bd9Sstevel@tonic-gate /*
247c478bd9Sstevel@tonic-gate  *  These define the basic PC MBR sector characteristics
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #define PC_MBR_SECTOR  0
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #define PC_MBR_SIG_OFFSET  510
307c478bd9Sstevel@tonic-gate #define PC_MBR_SIGNATURE   0xaa55
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #define PC_SLICE_OFFSET 446
337c478bd9Sstevel@tonic-gate #define PC_SLICE_MAX    4
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  *  Defines to guarantee structural alignment.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #define PC_MBR_CHECK_SIG(mbr_ptr) \
417c478bd9Sstevel@tonic-gate   ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) \
427c478bd9Sstevel@tonic-gate    == PC_MBR_SIGNATURE )
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #define PC_MBR_SIG(mbr_ptr) \
457c478bd9Sstevel@tonic-gate   ( *( (unsigned short *) (((int) mbr_ptr) + PC_MBR_SIG_OFFSET) ) )
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate #define PC_SLICE_FLAG(mbr_ptr, part) \
487c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET \
497c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define PC_SLICE_HEAD(mbr_ptr, part) \
527c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 1 \
537c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #define PC_SLICE_SEC(mbr_ptr, part) \
567c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 2 \
577c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #define PC_SLICE_CYL(mbr_ptr, part) \
607c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 3 \
617c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE(mbr_ptr, part) \
647c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 4 \
657c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #define PC_SLICE_EHEAD(mbr_ptr, part) \
687c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 5 \
697c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define PC_SLICE_ESEC(mbr_ptr, part) \
727c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 6 \
737c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate #define PC_SLICE_ECYL(mbr_ptr, part) \
767c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 7 \
777c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #define PC_SLICE_START(mbr_ptr, part) \
807c478bd9Sstevel@tonic-gate   ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 8 \
817c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #define PC_SLICE_LENGTH(mbr_ptr, part) \
847c478bd9Sstevel@tonic-gate   ( *( (unsigned long *) (((int) mbr_ptr) + PC_SLICE_OFFSET + 12 \
857c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /*
897c478bd9Sstevel@tonic-gate  *  PC flag types are defined here.
907c478bd9Sstevel@tonic-gate  */
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #define PC_SLICE_FLAG_NONE      0
937c478bd9Sstevel@tonic-gate #define PC_SLICE_FLAG_BOOTABLE  0x80
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate /*
967c478bd9Sstevel@tonic-gate  *  Known PC partition types are defined here.
977c478bd9Sstevel@tonic-gate  */
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate /* This is not a flag actually, but used as if it were a flag.  */
1007c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_HIDDEN_FLAG	0x10
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_NONE         	0
1037c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_FAT12        	1
1047c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_FAT16_LT32M  	4
1057c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_EXTENDED     	5
1067c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_FAT16_GT32M  	6
1077c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_FAT32		0xb
1087c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_FAT32_LBA		0xc
1097c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_FAT16_LBA		0xe
1107c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_WIN95_EXTENDED	0xf
1117c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_EZD        	0x55
1127c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_MINIX		0x80
1137c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_LINUX_MINIX	0x81
1147c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_SOLARIS		0x82	/* also Linux swap! */
1157c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_EXT2FS       	0x83
1167c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_LINUX_EXTENDED	0x85
1177c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_VSTAFS		0x9e
1187c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_SOLARIS_BOOT	0xbe	/* Solaris boot (fat) */
1197c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_SOLARIS2		0xbf	/* new Solaris type */
1207c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_DELL_UTIL		0xde
121*44bc9120SRichard Yao #define PC_SLICE_TYPE_GPT              0xee
1227c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_LINUX_RAID	0xfd
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate /* For convinience.  */
1267c478bd9Sstevel@tonic-gate /* Check if TYPE is a FAT partition type. Clear the hidden flag before
1277c478bd9Sstevel@tonic-gate    the check, to allow the user to mount a hidden partition in GRUB.  */
1287c478bd9Sstevel@tonic-gate #define IS_PC_SLICE_TYPE_FAT(type)	\
1297c478bd9Sstevel@tonic-gate   ({ int _type = (type) & ~PC_SLICE_TYPE_HIDDEN_FLAG; \
1307c478bd9Sstevel@tonic-gate      _type == PC_SLICE_TYPE_FAT12 \
1317c478bd9Sstevel@tonic-gate      || _type == PC_SLICE_TYPE_FAT16_LT32M \
1327c478bd9Sstevel@tonic-gate      || _type == PC_SLICE_TYPE_FAT16_GT32M \
1337c478bd9Sstevel@tonic-gate      || _type == PC_SLICE_TYPE_FAT16_LBA \
1347c478bd9Sstevel@tonic-gate      || _type == PC_SLICE_TYPE_FAT32 \
1357c478bd9Sstevel@tonic-gate      || _type == PC_SLICE_TYPE_FAT32_LBA \
1367c478bd9Sstevel@tonic-gate      || type == PC_SLICE_TYPE_SOLARIS_BOOT \
1377c478bd9Sstevel@tonic-gate      || type == PC_SLICE_TYPE_DELL_UTIL; })
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate #define IS_PC_SLICE_TYPE_EXTENDED(type)	\
1407c478bd9Sstevel@tonic-gate   (((type) == PC_SLICE_TYPE_EXTENDED)	\
1417c478bd9Sstevel@tonic-gate    || ((type) == PC_SLICE_TYPE_WIN95_EXTENDED)	\
1427c478bd9Sstevel@tonic-gate    || ((type) == PC_SLICE_TYPE_LINUX_EXTENDED))
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate #define IS_PC_SLICE_TYPE_MINIX(type) \
1457c478bd9Sstevel@tonic-gate   (((type) == PC_SLICE_TYPE_MINIX)	\
1467c478bd9Sstevel@tonic-gate    || ((type) == PC_SLICE_TYPE_LINUX_MINIX))
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate /* these ones are special, as they use their own partitioning scheme
1497c478bd9Sstevel@tonic-gate    to subdivide the PC partitions from there.  */
1507c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_FREEBSD		0xa5
1517c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_OPENBSD		0xa6
1527c478bd9Sstevel@tonic-gate #define PC_SLICE_TYPE_NETBSD		0xa9
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate /* For convenience.  */
1557c478bd9Sstevel@tonic-gate #define IS_PC_SLICE_TYPE_BSD_WITH_FS(type,fs)	\
1567c478bd9Sstevel@tonic-gate   ((type) == (PC_SLICE_TYPE_FREEBSD | ((fs) << 8)) \
1577c478bd9Sstevel@tonic-gate    || (type) == (PC_SLICE_TYPE_OPENBSD | ((fs) << 8)) \
1587c478bd9Sstevel@tonic-gate    || (type) == (PC_SLICE_TYPE_NETBSD | (fs) << 8))
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate #define IS_PC_SLICE_TYPE_BSD(type)	IS_PC_SLICE_TYPE_BSD_WITH_FS(type,0)
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate #define IS_PC_SLICE_TYPE_SOLARIS(type)	\
1637c478bd9Sstevel@tonic-gate   (((type) == PC_SLICE_TYPE_SOLARIS) || ((type) == PC_SLICE_TYPE_SOLARIS2))
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate /*
1667c478bd9Sstevel@tonic-gate  *  *BSD-style disklabel & partition definitions.
1677c478bd9Sstevel@tonic-gate  *
1687c478bd9Sstevel@tonic-gate  *  This is a subdivided slice of type 'PC_SLICE_TYPE_BSD', so all of
1697c478bd9Sstevel@tonic-gate  *  these, except where noted, are relative to the slice in question.
1707c478bd9Sstevel@tonic-gate  */
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate #define BSD_LABEL_SECTOR 1
1737c478bd9Sstevel@tonic-gate #define BSD_LABEL_MAGIC  0x82564557
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate #define BSD_LABEL_MAG_OFFSET 0
1767c478bd9Sstevel@tonic-gate #define BSD_LABEL_MAG2_OFFSET 132
1777c478bd9Sstevel@tonic-gate #define BSD_LABEL_NPARTS_OFFSET 138
1787c478bd9Sstevel@tonic-gate #define BSD_LABEL_NPARTS_MAX 8
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate #define BSD_PART_OFFSET 148
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate /*
1847c478bd9Sstevel@tonic-gate  *  Defines to guarantee structural alignment.
1857c478bd9Sstevel@tonic-gate  */
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate #define BSD_LABEL_CHECK_MAG(l_ptr) \
1887c478bd9Sstevel@tonic-gate   ( *( (unsigned long *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET) ) \
1897c478bd9Sstevel@tonic-gate    == ( (unsigned long) BSD_LABEL_MAGIC ) )
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate #define BSD_LABEL_MAG(l_ptr) \
1927c478bd9Sstevel@tonic-gate   ( *( (unsigned long *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET) ) )
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate #define BSD_LABEL_DTYPE(l_ptr) \
1957c478bd9Sstevel@tonic-gate   ( *( (unsigned short *) (((int) l_ptr) + BSD_LABEL_MAG_OFFSET + 4) ) )
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate #define BSD_LABEL_NPARTS(l_ptr) \
1987c478bd9Sstevel@tonic-gate   ( *( (unsigned short *) (((int) l_ptr) + BSD_LABEL_NPARTS_OFFSET) ) )
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate #define BSD_PART_LENGTH(l_ptr, part) \
2017c478bd9Sstevel@tonic-gate   ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET \
2027c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate #define BSD_PART_START(l_ptr, part) \
2057c478bd9Sstevel@tonic-gate   ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET + 4 \
2067c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate #define BSD_PART_FRAG_SIZE(l_ptr, part) \
2097c478bd9Sstevel@tonic-gate   ( *( (unsigned long *) (((int) l_ptr) + BSD_PART_OFFSET + 8 \
2107c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate #define BSD_PART_TYPE(l_ptr, part) \
2137c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) l_ptr) + BSD_PART_OFFSET + 12 \
2147c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate #define BSD_PART_FRAGS_PER_BLOCK(l_ptr, part) \
2177c478bd9Sstevel@tonic-gate   ( *( (unsigned char *) (((int) l_ptr) + BSD_PART_OFFSET + 13 \
2187c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate #define BSD_PART_EXTRA(l_ptr, part) \
2217c478bd9Sstevel@tonic-gate   ( *( (unsigned short *) (((int) l_ptr) + BSD_PART_OFFSET + 14 \
2227c478bd9Sstevel@tonic-gate 			  + (part << 4)) ) )
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate /* possible values for the "DISKTYPE"... all essentially irrelevant
2267c478bd9Sstevel@tonic-gate    except for DTYPE_SCSI */
2277c478bd9Sstevel@tonic-gate #define DTYPE_SMD               1	/* SMD, XSMD; VAX hp/up */
2287c478bd9Sstevel@tonic-gate #define DTYPE_MSCP              2	/* MSCP */
2297c478bd9Sstevel@tonic-gate #define DTYPE_DEC               3	/* other DEC (rk, rl) */
2307c478bd9Sstevel@tonic-gate #define DTYPE_SCSI              4	/* SCSI */
2317c478bd9Sstevel@tonic-gate #define DTYPE_ESDI              5	/* ESDI interface */
2327c478bd9Sstevel@tonic-gate #define DTYPE_ST506             6	/* ST506 etc. */
2337c478bd9Sstevel@tonic-gate #define DTYPE_HPIB              7	/* CS/80 on HP-IB */
2347c478bd9Sstevel@tonic-gate #define DTYPE_HPFL              8	/* HP Fiber-link */
2357c478bd9Sstevel@tonic-gate #define DTYPE_FLOPPY            10	/* floppy */
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate /* possible values for the *BSD-style partition type */
2397c478bd9Sstevel@tonic-gate #define	FS_UNUSED	0	/* unused */
2407c478bd9Sstevel@tonic-gate #define	FS_SWAP		1	/* swap */
2417c478bd9Sstevel@tonic-gate #define	FS_V6		2	/* Sixth Edition */
2427c478bd9Sstevel@tonic-gate #define	FS_V7		3	/* Seventh Edition */
2437c478bd9Sstevel@tonic-gate #define	FS_SYSV		4	/* System V */
2447c478bd9Sstevel@tonic-gate #define	FS_V71K		5	/* V7 with 1K blocks (4.1, 2.9) */
2457c478bd9Sstevel@tonic-gate #define	FS_V8		6	/* Eighth Edition, 4K blocks */
2467c478bd9Sstevel@tonic-gate #define	FS_BSDFFS	7	/* 4.2BSD fast file system */
2477c478bd9Sstevel@tonic-gate #define	FS_MSDOS	8	/* MSDOS file system */
2487c478bd9Sstevel@tonic-gate #define	FS_BSDLFS	9	/* 4.4BSD log-structured file system */
2497c478bd9Sstevel@tonic-gate #define	FS_OTHER	10	/* in use, but unknown/unsupported */
2507c478bd9Sstevel@tonic-gate #define	FS_HPFS		11	/* OS/2 high-performance file system */
2517c478bd9Sstevel@tonic-gate #define	FS_ISO9660	12	/* ISO 9660, normally CD-ROM */
2527c478bd9Sstevel@tonic-gate #define	FS_BOOT		13	/* partition contains bootstrap */
2537c478bd9Sstevel@tonic-gate #define	FS_ADOS		14	/* AmigaDOS fast file system */
2547c478bd9Sstevel@tonic-gate #define	FS_HFS		15	/* Macintosh HFS */
2557c478bd9Sstevel@tonic-gate #define	FS_FILECORE	16	/* Acorn Filecore Filing System */
2567c478bd9Sstevel@tonic-gate #define	FS_EXT2FS	17	/* Linux Extended 2 file system */
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate /*
2607c478bd9Sstevel@tonic-gate  *  Solaris LABEL definitions. All definitions are relative to the
2617c478bd9Sstevel@tonic-gate  *  current PC_SLICE.
2627c478bd9Sstevel@tonic-gate  */
2637c478bd9Sstevel@tonic-gate #define SOL_LABEL_LOC	1
2647c478bd9Sstevel@tonic-gate #define SOL_LABEL_SIZE	512
2657c478bd9Sstevel@tonic-gate #define SOL_LABEL_MAGIC	0xdabe
2667c478bd9Sstevel@tonic-gate #define SOL_LABEL_MAGIC_OFFSET 0x1fc
2677c478bd9Sstevel@tonic-gate #define SOL_LABEL_NPARTS 0x10
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate #define SOL_PART_OFFSET 0x48
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate #define SOL_LABEL_CHECK_MAG(l_ptr) \
2727c478bd9Sstevel@tonic-gate   (*((unsigned short *) (((int) l_ptr) + SOL_LABEL_MAGIC_OFFSET)) \
2737c478bd9Sstevel@tonic-gate    == ((unsigned short) SOL_LABEL_MAGIC ))
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate #define SOL_PART_START(l_ptr, p) \
2767c478bd9Sstevel@tonic-gate   (*((unsigned long *) (((int) l_ptr) + SOL_PART_OFFSET + (p) * 0xc + 4)))
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate #define SOL_PART_LENGTH(l_ptr, p) \
2797c478bd9Sstevel@tonic-gate   (*((unsigned long *) (((int) l_ptr) + SOL_PART_OFFSET + (p) * 0xc + 8)))
2807c478bd9Sstevel@tonic-gate 
2817c478bd9Sstevel@tonic-gate #define SOL_PART_EXISTS(l_ptr, p) (SOL_PART_LENGTH(l_ptr, p) != 0)
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate #endif /* _PC_SLICE_H */
285