Home | History | Annotate | Line # | Download | only in include
      1  1.8  christos /*	$NetBSD: disklabel.h,v 1.8 2019/04/03 22:10:49 christos Exp $	*/
      2  1.1       cgd 
      3  1.1       cgd /*
      4  1.1       cgd  * Copyright (c) 1994 Christopher G. Demetriou
      5  1.1       cgd  * All rights reserved.
      6  1.1       cgd  *
      7  1.1       cgd  * Redistribution and use in source and binary forms, with or without
      8  1.1       cgd  * modification, are permitted provided that the following conditions
      9  1.1       cgd  * are met:
     10  1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     11  1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     12  1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     14  1.1       cgd  *    documentation and/or other materials provided with the distribution.
     15  1.1       cgd  * 3. All advertising materials mentioning features or use of this software
     16  1.1       cgd  *    must display the following acknowledgement:
     17  1.1       cgd  *      This product includes software developed by Christopher G. Demetriou.
     18  1.1       cgd  * 4. The name of the author may not be used to endorse or promote products
     19  1.1       cgd  *    derived from this software without specific prior written permission
     20  1.1       cgd  *
     21  1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.1       cgd  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.1       cgd  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.1       cgd  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.1       cgd  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.1       cgd  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.1       cgd  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.1       cgd  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.1       cgd  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.1       cgd  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.1       cgd  */
     32  1.3    scottr /*-
     33  1.3    scottr  * Copyright (C) 1993	Allen K. Briggs, Chris P. Caputo,
     34  1.3    scottr  *			Michael L. Finch, Bradley A. Grantham, and
     35  1.3    scottr  *			Lawrence A. Kesteloot
     36  1.3    scottr  * All rights reserved.
     37  1.3    scottr  *
     38  1.3    scottr  * Redistribution and use in source and binary forms, with or without
     39  1.3    scottr  * modification, are permitted provided that the following conditions
     40  1.3    scottr  * are met:
     41  1.3    scottr  * 1. Redistributions of source code must retain the above copyright
     42  1.3    scottr  *    notice, this list of conditions and the following disclaimer.
     43  1.3    scottr  * 2. Redistributions in binary form must reproduce the above copyright
     44  1.3    scottr  *    notice, this list of conditions and the following disclaimer in the
     45  1.3    scottr  *    documentation and/or other materials provided with the distribution.
     46  1.3    scottr  * 3. All advertising materials mentioning features or use of this software
     47  1.3    scottr  *    must display the following acknowledgement:
     48  1.3    scottr  *	This product includes software developed by the Alice Group.
     49  1.3    scottr  * 4. The names of the Alice Group or any of its members may not be used
     50  1.3    scottr  *    to endorse or promote products derived from this software without
     51  1.3    scottr  *    specific prior written permission.
     52  1.3    scottr  *
     53  1.3    scottr  * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
     54  1.3    scottr  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     55  1.3    scottr  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     56  1.3    scottr  * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
     57  1.3    scottr  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     58  1.3    scottr  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     59  1.3    scottr  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     60  1.3    scottr  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     61  1.3    scottr  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     62  1.3    scottr  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     63  1.3    scottr  *
     64  1.3    scottr  */
     65  1.1       cgd 
     66  1.3    scottr #ifndef _MACHINE_DISKLABEL_H_
     67  1.3    scottr #define _MACHINE_DISKLABEL_H_
     68  1.1       cgd 
     69  1.7    bouyer #define LABELUSESMBR	0			/* no MBR partitionning */
     70  1.1       cgd #define	LABELSECTOR	0			/* sector containing label */
     71  1.1       cgd #define	LABELOFFSET	64			/* offset of label in sector */
     72  1.1       cgd #define	MAXPARTITIONS	8			/* number of partitions */
     73  1.1       cgd #define	RAW_PART	2			/* raw partition: xx?c */
     74  1.1       cgd 
     75  1.1       cgd /* Just a dummy */
     76  1.1       cgd struct cpu_disklabel {
     77  1.1       cgd 	int	cd_dummy;			/* must have one element. */
     78  1.1       cgd };
     79  1.1       cgd 
     80  1.3    scottr /*
     81  1.3    scottr  * Driver Descriptor Map, from Inside Macintosh: Devices, SCSI Manager
     82  1.3    scottr  * pp 12-13.  The driver descriptor map always resides on physical block 0.
     83  1.3    scottr  */
     84  1.3    scottr struct drvr_descriptor {
     85  1.3    scottr 	u_int32_t	descBlock;	/* first block of driver */
     86  1.3    scottr 	u_int16_t	descSize;	/* driver size in blocks */
     87  1.3    scottr 	u_int16_t	descType;	/* system type */
     88  1.3    scottr };
     89  1.3    scottr 
     90  1.3    scottr /* system types; Apple reserves 0-15 */
     91  1.3    scottr #define	DRVR_TYPE_MACINTOSH	1
     92  1.3    scottr 
     93  1.3    scottr struct drvr_map {
     94  1.4    scottr #define DRIVER_MAP_MAGIC	0x4552
     95  1.3    scottr 	u_int16_t	sbSig;		/* map signature */
     96  1.3    scottr 	u_int16_t	sbBlockSize;	/* block size of device */
     97  1.3    scottr 	u_int32_t	sbBlkCount;	/* number of blocks on device */
     98  1.3    scottr 	u_int16_t	sbDevType;	/* (used internally by ROM) */
     99  1.3    scottr 	u_int16_t	sbDevID;	/* (used internally by ROM) */
    100  1.3    scottr 	u_int32_t	sbData;		/* (used internally by ROM) */
    101  1.3    scottr 	u_int16_t	sbDrvrCount;	/* number of driver descriptors */
    102  1.3    scottr #define	DRVR_MAX_DESCRIPTORS	61
    103  1.3    scottr 	struct drvr_descriptor sb_dd[DRVR_MAX_DESCRIPTORS];
    104  1.3    scottr 	u_int16_t	pad[3];
    105  1.3    scottr } __attribute__ ((packed));
    106  1.3    scottr 
    107  1.3    scottr #define	ddBlock(N)	sb_dd[(N)].descBlock
    108  1.3    scottr #define	ddSize(N)	sb_dd[(N)].descSize
    109  1.3    scottr #define	ddType(N)	sb_dd[(N)].descType
    110  1.3    scottr 
    111  1.3    scottr /*
    112  1.3    scottr  * Partition map structure from Inside Macintosh: Devices, SCSI Manager
    113  1.3    scottr  * pp. 13-14.  The partition map always begins on physical block 1.
    114  1.3    scottr  *
    115  1.3    scottr  * With the exception of block 0, all blocks on the disk must belong to
    116  1.3    scottr  * exactly one partition.  The partition map itself belongs to a partition
    117  1.3    scottr  * of type `APPLE_PARTITION_MAP', and is not limited in size by anything
    118  1.3    scottr  * other than available disk space.  The partition map is not necessarily
    119  1.3    scottr  * the first partition listed.
    120  1.3    scottr  */
    121  1.3    scottr struct part_map_entry {
    122  1.3    scottr #define PART_ENTRY_MAGIC	0x504d
    123  1.3    scottr 	u_int16_t	pmSig;		/* partition signature */
    124  1.3    scottr 	u_int16_t	pmSigPad;	/* (reserved) */
    125  1.3    scottr 	u_int32_t	pmMapBlkCnt;	/* number of blocks in partition map */
    126  1.3    scottr 	u_int32_t	pmPyPartStart;	/* first physical block of partition */
    127  1.3    scottr 	u_int32_t	pmPartBlkCnt;	/* number of blocks in partition */
    128  1.3    scottr 	char		pmPartName[32];	/* partition name */
    129  1.3    scottr 	char		pmPartType[32];	/* partition type */
    130  1.3    scottr 	u_int32_t	pmLgDataStart;	/* first logical block of data area */
    131  1.3    scottr 	u_int32_t	pmDataCnt;	/* number of blocks in data area */
    132  1.3    scottr 	u_int32_t	pmPartStatus;	/* partition status information */
    133  1.3    scottr 	u_int32_t	pmLgBootStart;	/* first logical block of boot code */
    134  1.3    scottr 	u_int32_t	pmBootSize;	/* size of boot code, in bytes */
    135  1.3    scottr 	u_int32_t	pmBootLoad;	/* boot code load address */
    136  1.3    scottr 	u_int32_t	pmBootLoad2;	/* (reserved) */
    137  1.3    scottr 	u_int32_t	pmBootEntry;	/* boot code entry point */
    138  1.3    scottr 	u_int32_t	pmBootEntry2;	/* (reserved) */
    139  1.3    scottr 	u_int32_t	pmBootCksum;	/* boot code checksum */
    140  1.3    scottr 	char		pmProcessor[16]; /* processor type (e.g. "68020") */
    141  1.3    scottr 	u_int8_t	pmBootArgs[128]; /* A/UX boot arguments */
    142  1.3    scottr 	u_int8_t	pad[248];	/* pad to end of block */
    143  1.3    scottr };
    144  1.3    scottr 
    145  1.3    scottr #define PART_TYPE_DRIVER	"APPLE_DRIVER"
    146  1.3    scottr #define PART_TYPE_DRIVER43	"APPLE_DRIVER43"
    147  1.3    scottr #define PART_TYPE_DRIVERATA	"APPLE_DRIVER_ATA"
    148  1.3    scottr #define PART_TYPE_FWB_COMPONENT	"FWB DRIVER COMPONENTS"
    149  1.3    scottr #define PART_TYPE_MAC		"APPLE_HFS"
    150  1.3    scottr #define PART_TYPE_NETBSD	"NETBSD"
    151  1.3    scottr #define PART_TYPE_PARTMAP	"APPLE_PARTITION_MAP"
    152  1.3    scottr #define PART_TYPE_SCRATCH	"APPLE_SCRATCH"
    153  1.3    scottr #define PART_TYPE_UNIX		"APPLE_UNIX_SVR2"
    154  1.3    scottr 
    155  1.3    scottr /*
    156  1.3    scottr  * "pmBootArgs" for APPLE_UNIX_SVR2 partition.
    157  1.4    scottr  * NetBSD/mac68k only uses Magic, Cluster, Type, and Flags.
    158  1.3    scottr  */
    159  1.3    scottr struct blockzeroblock {
    160  1.3    scottr 	u_int32_t       bzbMagic;
    161  1.3    scottr 	u_int8_t        bzbCluster;
    162  1.3    scottr 	u_int8_t        bzbType;
    163  1.3    scottr 	u_int16_t       bzbBadBlockInode;
    164  1.3    scottr 	u_int16_t       bzbFlags;
    165  1.3    scottr 	u_int16_t       bzbReserved;
    166  1.3    scottr 	u_int32_t       bzbCreationTime;
    167  1.3    scottr 	u_int32_t       bzbMountTime;
    168  1.3    scottr 	u_int32_t       bzbUMountTime;
    169  1.3    scottr };
    170  1.3    scottr 
    171  1.3    scottr #define BZB_MAGIC	0xABADBABE
    172  1.3    scottr #define BZB_TYPEFS	1
    173  1.3    scottr #define BZB_TYPESWAP	3
    174  1.3    scottr #define BZB_ROOTFS	0x8000
    175  1.3    scottr #define BZB_USRFS	0x4000
    176  1.3    scottr 
    177  1.8  christos #define __HAVE_SETDISKLABEL
    178  1.8  christos 
    179  1.3    scottr #endif /* _MACHINE_DISKLABEL_H_ */
    180