1 /* $NetBSD: disklabel_rdb.h,v 1.5 2021/02/20 09:51:20 rin Exp $ */
2
3 /*
4 * Copyright (c) 1994 Christian E. Hopps
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. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Christian E. Hopps.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef _SYS_DISKLABEL_RDB_H_
34 #define _SYS_DISKLABEL_RDB_H_
35
36 #include <sys/types.h>
37
38 /*
39 * describes ados Rigid Disk Blocks
40 * which are used to partition a drive
41 */
42 #define RDBNULL ((uint32_t)0xffffffff)
43
44 /*
45 * you will find rdblock somewhere in [0, RDBMAXBLOCKS)
46 */
47 #define RDB_MAXBLOCKS 16
48
49 struct rdblock {
50 uint32_t id; /* 'RDSK' */
51 uint32_t nsumlong; /* number of long words in check sum */
52 uint32_t chksum; /* simple additive with wrap checksum */
53 uint32_t hostid; /* scsi target of host */
54 uint32_t nbytes; /* size of disk blocks */
55 uint32_t flags;
56 uint32_t badbhead; /* linked list of badblocks */
57 uint32_t partbhead; /* linked list of partblocks */
58 uint32_t fsbhead; /* " " of fsblocks */
59 uint32_t driveinit;
60 uint32_t resv1[6]; /* RDBNULL */
61 uint32_t ncylinders; /* number of cylinders on drive */
62 uint32_t nsectors; /* number of sectors per track */
63 uint32_t nheads; /* number of tracks per cylinder */
64 uint32_t interleave;
65 uint32_t park; /* only used with st506 i.e. not */
66 uint32_t resv2[3];
67 uint32_t wprecomp; /* start cyl for write precomp */
68 uint32_t reducedwrite; /* start cyl for reduced write current */
69 uint32_t steprate; /* driver step rate in ?s */
70 uint32_t resv3[5];
71 uint32_t rdblowb; /* lowblock of range for rdb's */
72 uint32_t rdbhighb; /* high block of range for rdb's */
73 uint32_t lowcyl; /* low cylinder of partition area */
74 uint32_t highcyl; /* upper cylinder of partition area */
75 uint32_t secpercyl; /* number of sectors per cylinder */
76 uint32_t parkseconds; /* zero if no park needed */
77 uint32_t resv4[2];
78 char diskvendor[8]; /* inquiry stuff */
79 char diskproduct[16]; /* inquiry stuff */
80 char diskrevision[4]; /* inquiry stuff */
81 char contvendor[8]; /* inquiry stuff */
82 char contproduct[16]; /* inquiry stuff */
83 char contrevision[4]; /* inquiry stuff */
84 #if never_use_secsize
85 uint32_t resv5[0];
86 #endif
87 };
88
89
90 #define RDBF_LAST 0x1 /* last drive available */
91 #define RDBF_LASTLUN 0x2 /* last LUN available */
92 #define RDBF_LASTUNIT 0x4 /* last target available */
93 #define RDBF_NORESELECT 0x8 /* do not use reselect */
94 #define RDBF_DISKID 0x10 /* disk id is valid ?? */
95 #define RDBF_CTRLID 0x20 /* ctrl id is valid ?? */
96 #define RDBF_SYNC 0x40 /* drive supports SCSI synchronous mode */
97
98 struct ados_environ {
99 uint32_t tabsize; /* 0: environ table size */
100 uint32_t sizeblock; /* 1: n long words in a block */
101 uint32_t secorg; /* 2: not used must be zero */
102 uint32_t numheads; /* 3: number of surfaces */
103 uint32_t secperblk; /* 4: must be 1 */
104 uint32_t secpertrk; /* 5: blocks per track */
105 uint32_t resvblocks; /* 6: reserved blocks at start */
106 uint32_t prefac; /* 7: must be 0 */
107 uint32_t interleave; /* 8: normally 1 */
108 uint32_t lowcyl; /* 9: low cylinder of partition */
109 uint32_t highcyl; /* 10: upper cylinder of partition */
110 uint32_t numbufs; /* 11: ados: number of buffers */
111 uint32_t membuftype; /* 12: ados: type of bufmem */
112 uint32_t maxtrans; /* 13: maxtrans the ctrlr supports */
113 uint32_t mask; /* 14: mask for valid address */
114 uint32_t bootpri; /* 15: boot priority for autoboot */
115 uint32_t dostype; /* 16: filesystem type */
116 uint32_t baud; /* 17: serial handler baud rate */
117 uint32_t control; /* 18: control word for fs */
118 uint32_t bootblocks; /* 19: blocks containing boot code */
119 uint32_t fsize; /* 20: file system block size */
120 uint32_t frag; /* 21: allowable frags per block */
121 uint32_t cpg; /* 22: cylinders per group */
122 };
123
124 struct partblock {
125 uint32_t id; /* 'PART' */
126 uint32_t nsumlong; /* number of long words in check sum */
127 uint32_t chksum; /* simple additive with wrap checksum */
128 uint32_t hostid; /* scsi target of host */
129 uint32_t next; /* next in chain */
130 uint32_t flags; /* see below */
131 uint32_t resv1[3];
132 unsigned char partname[32]; /* (BCPL) part name (may not be unique) */
133 uint32_t resv2[15];
134 struct ados_environ e;
135 #if never_use_secsize
136 uint32_t extra[9]; /* 8 for extra added to environ */
137 #endif
138 };
139
140 #define PBF_BOOTABLE 0x1 /* partition is bootable */
141 #define PBF_NOMOUNT 0x2 /* partition should be mounted */
142
143 struct badblock {
144 uint32_t id; /* 'BADB' */
145 uint32_t nsumlong; /* number of long words in check sum */
146 uint32_t chksum; /* simple additive with wrap checksum */
147 uint32_t hostid; /* scsi target of host */
148 uint32_t next; /* next in chain */
149 uint32_t resv;
150 struct badblockent {
151 uint32_t badblock;
152 uint32_t goodblock;
153 } badtab[0]; /* 61 for secsize == 512 */
154 };
155
156 struct fsblock {
157 uint32_t id; /* 'FSHD' */
158 uint32_t nsumlong; /* number of long words in check sum */
159 uint32_t chksum; /* simple additive with wrap checksum */
160 uint32_t hostid; /* scsi target of host */
161 uint32_t next; /* next in chain */
162 uint32_t flags;
163 uint32_t resv1[2];
164 uint32_t dostype; /* this is a file system for this type */
165 uint32_t version; /* version of this fs */
166 uint32_t patchflags; /* describes which functions to replace */
167 uint32_t type; /* zero */
168 uint32_t task; /* zero */
169 uint32_t lock; /* zero */
170 uint32_t handler; /* zero */
171 uint32_t stacksize; /* to use when loading handler */
172 uint32_t priority; /* to run the fs at. */
173 uint32_t startup; /* zero */
174 uint32_t lsegblocks; /* linked list of lsegblocks of fs code */
175 uint32_t globalvec; /* bcpl vector not used mostly */
176 #if never_use_secsize
177 uint32_t resv2[44];
178 #endif
179 };
180
181 struct lsegblock {
182 uint32_t id; /* 'LSEG' */
183 uint32_t nsumlong; /* number of long words in check sum */
184 uint32_t chksum; /* simple additive with wrap checksum */
185 uint32_t hostid; /* scsi target of host */
186 uint32_t next; /* next in chain */
187 uint32_t loaddata[0]; /* load segment data, 123 for secsize == 512 */
188 };
189
190 #define RDBLOCK_ID 0x5244534b /* 'RDSK' */
191 #define PARTBLOCK_ID 0x50415254 /* 'PART' */
192 #define BADBLOCK_ID 0x42414442 /* 'BADB' */
193 #define FSBLOCK_ID 0x46534844 /* 'FSHD' */
194 #define LSEGBLOCK_ID 0x4c534547 /* 'LSEG' */
195
196 /*
197 * Dos types for identifying file systems
198 * bsd file systems will be 'N','B',x,y where y is the fstype found in
199 * disklabel.h (for DOST_DOS it will be the version number)
200 */
201 #define DOST_XXXBSD 0x42534400 /* Old type back compat*/
202 #define DOST_NBR 0x4e425200 /* 'NBRx' NetBSD root partition */
203 #define DOST_NBS 0x4e425300 /* 'NBS0' NetBSD swap partition */
204 #define DOST_NBU 0x4e425500 /* 'NBUx' NetBSD user partition */
205 #define DOST_DOS 0x444f5300 /* 'DOSx' AmigaDos partition */
206 #define DOST_AMIX 0x554e4900 /* 'UNIx' AmigaDos partition */
207 #define DOST_MUFS 0x6d754600 /* 'muFx' AmigaDos partition (muFS) */
208 #define DOST_EXT2 0x4c4e5800 /* 'LNX0' Linux fs partition (ext2fs) */
209 #define DOST_LNXSWP 0x53575000 /* 'SWP0' Linux swap partition */
210 #define DOST_RAID 0x52414900 /* 'RAID' Raidframe partition */
211 #define DOST_MSD 0x4d534400 /* 'MSDx' MSDOS partition */
212 #define DOST_SFS 0x53465300 /* 'SFSx' Smart fs partition */
213
214 struct adostype {
215 uint8_t archtype; /* see ADT_xxx below */
216 uint8_t fstype; /* byte 3 from amiga dostype */
217 };
218
219 /* archtypes */
220 #define ADT_UNKNOWN 0
221 #define ADT_AMIGADOS 1
222 #define ADT_NETBSDROOT 2
223 #define ADT_NETBSDSWAP 3
224 #define ADT_NETBSDUSER 4
225 #define ADT_AMIX 5
226 #define ADT_EXT2 6
227 #define ADT_RAID 7
228 #define ADT_MSD 8
229 #define ADT_SFS 9
230
231 #define ISFSARCH_NETBSD(adt) \
232 ((adt).archtype >= ADT_NETBSDROOT && (adt).archtype <= ADT_NETBSDUSER)
233
234 #endif /* _SYS_DISKLABEL_RDB_H_ */
Cache object: 5d4ffc3c987b8cdcc00ab6c2ce392a72
|