xref: /netbsd-src/sys/arch/next68k/include/disklabel.h (revision 08c81a9c2dc8c7300e893321eb65c0925d60871c)
1 /*	$NetBSD: disklabel.h,v 1.2 2002/07/11 16:03:14 christos Exp $	*/
2 /*
3  * Copyright (c) 1994 Rolf Grossmann
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *      This product includes software developed by Rolf Grossmann.
17  * 4. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _MACHINE_DISKLABEL_H_
33 #define _MACHINE_DISKLABEL_H_
34 
35 #define	LABELSECTOR	0	/* sector containing label */
36 #define	LABELOFFSET	0	/* offset of label in sector */
37 #define LABELSIZE	8192	/* size of label */
38 #define	MAXPARTITIONS	8	/* number of partitions */
39 #define	RAW_PART	2	/* raw partition: xx?c */
40 
41 #define	CPUMAXPARTITIONS	8	/* number of partitions in cpu_disklabel */
42 #define CD_V1	0x4e655854	/* version #1: "NeXT" */
43 #define CD_V2	0x646c5632	/* version #2: "dlV2" */
44 #define CD_V3	0x646c5633	/* version #3: "dlV3" */
45 #define IS_DISKLABEL(l) ((l)->cd_version == CD_V1 || (l)->cd_version == CD_V2 \
46                          || (l)->cd_version == CD_V3)
47 
48 /* XXX should we really size all this stuff this way ? */
49 #define CPULBLLEN	24
50 #define MAXDNMLEN	24
51 #define MAXTYPLEN       24
52 #define MAXBFLEN	24
53 #define MAXHNLEN	32
54 #define MAXMPTLEN       16
55 #define MAXFSTLEN       8
56 
57 #define DEFAULTFRONTPORCH (160 * 2)
58 #define DEFAULTBOOT0_1 (32 * 2)
59 #define DEFAULTBOOT0_2 (96 * 2)
60 
61 struct  cpu_partition {
62 	int cp_offset;		/* starting sector */
63 	int cp_size;		/* number of sectors in partition */
64 	short cp_bsize;		/* block size in bytes */
65 	short cp_fsize;		/* filesystem basic fragment size */
66 	char cp_opt;		/* optimization type: 's'pace/'t'ime */
67 	char cp_pad1;
68 	short cp_cpg;		/* filesystem cylinders per group */
69 	short cp_density;	/* bytes per inode density */
70 	char cp_minfree;	/* minfree (%) */
71 	char cp_newfs;		/* run newfs during init */
72 	char cp_mountpt[MAXMPTLEN];/* default/standard mount point */
73 	char cp_automnt;	/* auto-mount when inserted */
74 	char cp_type[MAXFSTLEN]; /* file system type name */
75 	char cp_pad2;
76 } __attribute__ ((packed));
77 
78 /* The disklabel the way it is on the disk */
79 struct nextstep_disklabel {
80     int cd_version;		/* label version */
81     int cd_label_blkno;         /* block # of this label */
82     int cd_size;                /* size of media area (sectors) */
83     char cd_label[CPULBLLEN];	/* disk name (label) */
84     u_int cd_flags;		/* flags */
85 #define CD_UNINIT	0x80000000 /* label is uninitialized */
86     u_int cd_tag;		/* volume tag */
87     char cd_name[MAXDNMLEN];	/* drive (hardware) name */
88     char cd_type[MAXTYPLEN];	/* drive type */
89     int cd_secsize;		/* # of bytes per sector */
90     int cd_ntracks;		/* # of tracks per cylinder */
91     int cd_nsectors;		/* # of data sectors per track */
92     int cd_ncylinders;          /* # of data cylinders per unit */
93     int cd_rpm;                 /* rotational speed */
94     short cd_front;		/* # of sectors in "front porch" */
95     short cd_back;		/* # of sectors in "back porch" */
96     short cd_ngroups;		/* # of alt groups */
97     short cd_ag_size;		/* alt group size (sectors) */
98     short cd_ag_alts;		/* alternate sectors / alt group */
99     short cd_ag_off;		/* sector offset to first alternate */
100     int cd_boot_blkno[2];	/* boot program locations */
101     char cd_kernel[MAXBFLEN];	/* default kernel name */
102     char cd_hostname[MAXHNLEN];	/* host name (usu. where disk was labeled) */
103     char cd_rootpartition;	/* root partition letter e.g. 'a' */
104     char cd_rwpartition;	/* r/w partition letter e.g. 'b' */
105     struct cpu_partition cd_partitions[CPUMAXPARTITIONS];
106 
107     union {
108 	u_short CD_v3_checksum;	/* label version 3 checksum */
109 #define NBAD	1670		/* sized to make label ~= 8KB */
110 	int CD_bad[NBAD];   /* block number that is bad */
111     } cd_un;
112 #define cd_v3_checksum  cd_un.CD_v3_checksum
113 #define cd_bad          cd_un.CD_bad
114     u_short cd_checksum;	/* label version 1 or 2 checksum */
115 } __attribute__ ((packed));
116 
117 struct cpu_disklabel {
118 	int od_version;
119 };
120 
121 #endif /* _MACHINE_DISKLABEL_H_ */
122