disklabel.h revision 1.2
1/*
2 * Copyright (c) 1994 Christian E. Hopps
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *      This product includes software developed by Christian E. Hopps.
16 * 4. The name of the author may not be used to endorse or promote products
17 *    derived from this software without specific prior written permission
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 *	$Id: disklabel.h,v 1.2 1994/07/04 19:39:59 chopps Exp $
31 */
32#ifndef _MACHINE_DISKLABEL_H_
33#define _MACHINE_DISKLABEL_H_
34
35#ifndef MAXPARTITIONS
36#define MAXPARTITIONS	16
37#endif
38
39#define RAW_PART	2		/* Xd0c is raw part. */
40
41/*
42 * used to encode disk minor numbers
43 * this should probably be moved to sys/disklabel.h
44 */
45#define DISKUNIT(dev)	(minor(dev) / MAXPARTITIONS)
46#define DISKPART(dev)	(minor(dev) % MAXPARTITIONS)
47#define MAKEDISKDEV(maj, unit, part) \
48    (makedev((maj), ((unit) * MAXPARTITIONS) + (part)))
49
50/*
51 * describes ados Rigid Disk Blocks
52 * which are used to partition a drive
53 */
54#define RDBNULL ((u_long)0xffffffff)
55
56/*
57 * you will find rdblock somewhere in [0, RDBMAXBLOCKS)
58 */
59#define RDB_MAXBLOCKS	16
60
61struct rdblock {
62	u_long id;		/* 'RDSK' */
63	u_long nsumlong;	/* number of longs in check sum */
64	u_long chksum;		/* simple additive with wrap checksum */
65	u_long hostid;		/* scsi target of host */
66	u_long nbytes;		/* size of disk blocks */
67	u_long flags;
68	u_long badbhead;	/* linked list of badblocks */
69	u_long partbhead;	/* linked list of partblocks */
70	u_long fsbhead;		/*   "     "   of fsblocks */
71	u_long driveinit;
72	u_long resv1[6];	/* RDBNULL */
73	u_long ncylinders;	/* number of cylinders on drive */
74	u_long nsectors;	/* number of sectors per track */
75	u_long nheads;		/* number of tracks per cylinder */
76	u_long interleave;
77	u_long park;		/* only used with st506 i.e. not */
78	u_long resv2[3];
79	u_long wprecomp;	/* start cyl for write precomp */
80	u_long reducedwrite;	/* start cyl for reduced write current */
81	u_long steprate;	/* driver step rate in ?s */
82	u_long resv3[5];
83	u_long rdblowb;		/* lowblock of range for rdb's */
84	u_long rdbhighb;	/* high block of range for rdb's */
85	u_long lowcyl;		/* low cylinder of partition area */
86	u_long highcyl;		/* upper cylinder of partition area */
87	u_long secpercyl;	/* number of sectors per cylinder */
88	u_long parkseconds;	/* zero if no park needed */
89	u_long resv4[2];
90	char   diskvendor[8];	/* inquiry stuff */
91	char   diskproduct[16];	/* inquiry stuff */
92	char   diskrevision[4];	/* inquiry stuff */
93	char   contvendor[8];	/* inquiry stuff */
94	char   contproduct[16];	/* inquiry stuff */
95	char   contrevision[4];	/* inquiry stuff */
96#if never_use_secsize
97	u_long resv5[0];
98#endif
99};
100
101
102#define RDBF_LAST	0x1	/* last drive available */
103#define RDBF_LASTLUN	0x2	/* last LUN available */
104#define RDBF_LASTUNIT	0x4	/* last target available */
105#define RDBF_NORESELECT	0x8	/* do not use reselect */
106#define RDBF_DISKID	0x10	/* disk id is valid ?? */
107#define RDBF_CTRLID	0x20	/* ctrl id is valid ?? */
108
109struct ados_environ {
110	u_long tabsize;		/* 0: environ table size */
111	u_long sizeblock;	/* 1: n long words in a block */
112	u_long secorg;		/* 2: not used must be zero */
113	u_long numheads;	/* 3: number of surfaces */
114	u_long secperblk;	/* 4: must be 1 */
115	u_long secpertrk;	/* 5: blocks per track */
116	u_long resvblocks;	/* 6: reserved blocks at start */
117	u_long prefac;		/* 7: must be 0 */
118	u_long interleave;	/* 8: normally 1 */
119	u_long lowcyl;		/* 9: low cylinder of partition */
120	u_long highcyl;		/* 10: upper cylinder of partition */
121	u_long numbufs;		/* 11: ados: number of buffers */
122	u_long membuftype;	/* 12: ados: type of bufmem */
123	u_long maxtrans;	/* 13: maxtrans the ctrlr supports */
124	u_long mask;		/* 14: mask for valid address */
125	u_long bootpri;		/* 15: boot priority for autoboot */
126	u_long dostype;		/* 16: filesystem type */
127	u_long baud;		/* 17: serial handler baud rate */
128	u_long control;		/* 18: control word for fs */
129	u_long bootblocks;	/* 19: blocks containing boot code */
130	u_long fsize;		/* 20: file system block size */
131	u_long frag;		/* 21: allowable frags per block */
132	u_long cpg;		/* 22: cylinders per group */
133};
134
135struct partblock {
136	u_long id;		/* 'PART' */
137	u_long nsumlong;	/* number of longs in check sum */
138	u_long chksum;		/* simple additive with wrap checksum */
139	u_long hostid;		/* scsi target of host */
140	u_long next;		/* next in chain */
141	u_long flags;		/* see below */
142	u_long resv1[3];
143	u_char partname[32];	/* (BCPL) part name (may not be unique) */
144	u_long resv2[15];
145	struct ados_environ e;
146#if never_use_secsize
147	u_long extra[9];	/* 8 for extra added to environ */
148#endif
149};
150
151#define PBF_BOOTABLE	0x1	/* partition is bootable */
152#define PBF_NOMOUNT	0x2	/* partition should be mounted */
153
154struct badblock {
155	u_long id;		/* 'BADB' */
156	u_long nsumlong;	/* number of longs in check sum */
157	u_long chksum;		/* simple additive with wrap checksum */
158	u_long hostid;		/* scsi target of host */
159	u_long next;		/* next in chain */
160	u_long resv;
161	struct badblockent {
162		u_long badblock;
163		u_long goodblock;
164	} badtab[0];		/* 61 for secsize == 512 */
165};
166
167struct fsblock {
168	u_long id;		/* 'FSHD' */
169	u_long nsumlong;	/* number of longs in check sum */
170	u_long chksum;		/* simple additive with wrap checksum */
171	u_long hostid;		/* scsi target of host */
172	u_long next;		/* next in chain */
173	u_long flags;
174	u_long resv1[2];
175	u_long dostype;		/* this is a file system for this type */
176	u_long version;		/* version of this fs */
177	u_long patchflags;	/* describes which functions to replace */
178	u_long type;		/* zero */
179	u_long task;		/* zero */
180	u_long lock;		/* zero */
181	u_long handler;		/* zero */
182	u_long stacksize;	/* to use when loading handler */
183	u_long priority;	/* to run the fs at. */
184	u_long startup;		/* zero */
185	u_long lsegblocks;	/* linked list of lsegblocks of fs code */
186	u_long globalvec;	/* bcpl vector not used mostly */
187#if never_use_secsize
188	u_long resv2[44];
189#endif
190};
191
192struct lsegblock {
193	u_long id;		/* 'LSEG' */
194	u_long nsumlong;	/* number of longs in check sum */
195	u_long chksum;		/* simple additive with wrap checksum */
196	u_long hostid;		/* scsi target of host */
197	u_long next;		/* next in chain */
198	u_long loaddata[0];	/* load segment data, 123 for secsize == 512 */
199};
200
201#define RDBLOCK_ID	0x5244534b	/* 'RDSK' */
202#define PARTBLOCK_ID	0x50415254	/* 'PART' */
203#define BADBLOCK_ID	0x42414442	/* 'BADB' */
204#define FSBLOCK_ID	0x46534844	/* 'FSHD' */
205#define LSEGBLOCK_ID	0x4c534547	/* 'LSEG' */
206
207struct cpu_disklabel {
208	u_long rdblock;			/* may be RDBNULL which invalidates */
209	u_long pblist[MAXPARTITIONS];	/* partblock number (RDB list order) */
210	char pbindex[MAXPARTITIONS];	/* index of pblock (partition order) */
211	int  valid;			/* essential that this is valid */
212};
213
214#endif /* _MACHINE_DISKLABEL_H_ */
215