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