xref: /netbsd-src/sys/arch/mvme68k/include/disklabel.h (revision 1b9578b8c2c1f848eeb16dabbfd7d1f0d9fdefbd)
1 /*	$NetBSD: disklabel.h,v 1.10 2009/10/23 03:25:36 snj Exp $	*/
2 
3 /*
4  * Copyright (c) 1995 Dale Rahn.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  *    derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef _MACHINE_DISKLABEL_H_
31 #define _MACHINE_DISKLABEL_H_
32 
33 /* number of boot pieces , ie xxboot bootxx */
34 #define NUMBOOT		0
35 
36 #define LABELSECTOR     0                       /* sector containing label */
37 #define LABELOFFSET	0			/* offset of label in sector */
38 #define MAXPARTITIONS	8			/* number of partitions */
39 #define RAW_PART	2			/* raw partition: xx?c */
40 
41 /*
42  * a cpu_disklabel is a disklabel that the bug (prom) can understand
43  * and live with.   the bug works in terms of 256 byte blocks.   in our
44  * case the first two bug blocks make up the cpu_disklabel (which is 512
45  * bytes [i.e. one sector] in length).
46  *
47  * we use a fixed layout the BSD disk structure (in 256 byte blocks):
48  *   block 0  = the volume ID block  (part of cpu_disklabel)
49  *   block 1  = media configuration area (part of cpu_disklabel)
50  *   block 2  = start of first level OS bootstrap (continues ...)
51  *   block 31 = end of OS bootstrap
52  *   block 32 = BSD filesystem superblock
53  *
54  * this gives us 30 blocks (30*256 = 7680 bytes) for the bootstrap's text+data
55  *
56  * disksubr.c translates between cpu_disklabel and BSD disklabel.
57  *
58  */
59 
60 struct cpu_disklabel {
61 	/* VID */
62 	u_char  vid_id[4];	/* volume ID */
63 #define VID_ID		"NBSD"
64 	u_char  vid_0[16];
65 	u_int   vid_oss;	/* starting block # of bootstrap */
66 #define VID_OSS		2
67 	u_short	vid_osl;	/* bootstrap length (30 blocks) */
68 #define VID_OSL		30
69 	u_char	vid_1[4];
70 	u_short	vid_osa_u;	/* bootstrap start address (upper) */
71 	u_short	vid_osa_l;	/* bootstrap start address (lower) */
72 #define VID_OSA		0x3f0000	/* MUST match bootstrap code */
73 #define VID_OSAU	((VID_OSA >> 16) & 0xffff)
74 #define VID_OSAL	(VID_OSA & 0xffff)
75 	u_char	vid_2[2];
76 	u_short	partitions;
77 	u_char	vid_vd[16];
78 	u_long	bbsize;
79 	u_long	magic1;		/* 4 */
80 	u_short	type;		/* 2 */
81 	u_short	subtype;	/* 2 */
82 	u_char	packname[16];	/* 16 */
83 	u_long	flags;		/* 4 */
84 	u_long	drivedata[5];	/* 4 */
85 	u_long	spare[5];	/* 4 */
86 	u_short	checksum;	/* 2 */
87 
88 	u_long	secpercyl;	/* 4 */
89 	u_long	secperunit;	/* 4 */
90 	u_long	headswitch;	/* 4 */
91 
92 	u_char	vid_3[4];
93 	u_int	vid_cas;	/* block # of CFG area, hardwired at 1 */
94 #define VID_CAS		1
95 	u_char	vid_cal;	/* length of CFG area, in blocks (1) */
96 #define VID_CAL		1
97 	u_char	vid_4_0[3];
98 	u_char	vid_4[64];
99 	u_char	vid_4_1[28];
100 	u_long	sbsize;
101 	u_char	vid_mot[8];	/* must contain "MOTOROLA" */
102 #define VID_MOT		"MOTOROLA"
103 
104 	/* CFG */
105 	u_char	cfg_0[4];
106 	u_short	cfg_atm;
107 	u_short	cfg_prm;
108 	u_short	cfg_atw;
109 	u_short	cfg_rec;	/* block size (256) */
110 #define	CFG_REC		256
111 
112 	u_short	sparespertrack;
113 	u_short	sparespercyl;
114 	u_long	acylinders;
115 	u_short	rpm;
116 	u_short	cylskew;
117 
118 	u_char	cfg_spt;
119 	u_char	cfg_hds;
120 	u_short	cfg_trk;
121 	u_char	cfg_ilv;
122 	u_char	cfg_sof;
123 	u_short	cfg_psm;	/* physical sector size (512) */
124 #define CFG_PSM		512
125 	u_short	cfg_shd;
126 	u_char	cfg_2[2];
127 	u_short	cfg_pcom;
128 	u_char	cfg_3;
129 	u_char	cfg_ssr;
130 	u_short	cfg_rwcc;
131 	u_short	cfg_ecc;
132 	u_short	cfg_eatm;
133 	u_short	cfg_eprm;
134 	u_short	cfg_eatw;
135 	u_char	cfg_gpb1;
136 	u_char	cfg_gpb2;
137 	u_char	cfg_gpb3;
138 	u_char	cfg_gpb4;
139 	u_char	cfg_ssc;
140 	u_char	cfg_runit;
141 	u_short	cfg_rsvc1;
142 	u_short	cfg_rsvc2;
143 	u_long	magic2;
144 	u_char	cfg_4[192];
145 } __attribute__((__packed__));
146 #endif /* _MACHINE_DISKLABEL_H_ */
147