xref: /netbsd/sys/arch/amigappc/include/disklabel.h (revision bf9ec67e)
1 /*	$NetBSD: disklabel.h,v 1.1 2000/05/25 22:11:59 is 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 #ifndef _MACHINE_DISKLABEL_H_
33 #define _MACHINE_DISKLABEL_H_
34 
35 #define	LABELSECTOR	0			/* sector containing label */
36 #define	LABELOFFSET	64			/* offset of label in sector */
37 #define	MAXPARTITIONS	16			/* number of partitions */
38 #define	RAW_PART	2			/* raw partition: xx?c */
39 
40 /*
41  * describes ados Rigid Disk Blocks
42  * which are used to partition a drive
43  */
44 #define RDBNULL ((u_long)0xffffffff)
45 
46 /*
47  * you will find rdblock somewhere in [0, RDBMAXBLOCKS)
48  */
49 #define RDB_MAXBLOCKS	16
50 
51 struct rdblock {
52 	u_long id;		/* 'RDSK' */
53 	u_long nsumlong;	/* number of longs in check sum */
54 	u_long chksum;		/* simple additive with wrap checksum */
55 	u_long hostid;		/* scsi target of host */
56 	u_long nbytes;		/* size of disk blocks */
57 	u_long flags;
58 	u_long badbhead;	/* linked list of badblocks */
59 	u_long partbhead;	/* linked list of partblocks */
60 	u_long fsbhead;		/*   "     "   of fsblocks */
61 	u_long driveinit;
62 	u_long resv1[6];	/* RDBNULL */
63 	u_long ncylinders;	/* number of cylinders on drive */
64 	u_long nsectors;	/* number of sectors per track */
65 	u_long nheads;		/* number of tracks per cylinder */
66 	u_long interleave;
67 	u_long park;		/* only used with st506 i.e. not */
68 	u_long resv2[3];
69 	u_long wprecomp;	/* start cyl for write precomp */
70 	u_long reducedwrite;	/* start cyl for reduced write current */
71 	u_long steprate;	/* driver step rate in ?s */
72 	u_long resv3[5];
73 	u_long rdblowb;		/* lowblock of range for rdb's */
74 	u_long rdbhighb;	/* high block of range for rdb's */
75 	u_long lowcyl;		/* low cylinder of partition area */
76 	u_long highcyl;		/* upper cylinder of partition area */
77 	u_long secpercyl;	/* number of sectors per cylinder */
78 	u_long parkseconds;	/* zero if no park needed */
79 	u_long resv4[2];
80 	char   diskvendor[8];	/* inquiry stuff */
81 	char   diskproduct[16];	/* inquiry stuff */
82 	char   diskrevision[4];	/* inquiry stuff */
83 	char   contvendor[8];	/* inquiry stuff */
84 	char   contproduct[16];	/* inquiry stuff */
85 	char   contrevision[4];	/* inquiry stuff */
86 #if never_use_secsize
87 	u_long resv5[0];
88 #endif
89 };
90 
91 
92 #define RDBF_LAST	0x1	/* last drive available */
93 #define RDBF_LASTLUN	0x2	/* last LUN available */
94 #define RDBF_LASTUNIT	0x4	/* last target available */
95 #define RDBF_NORESELECT	0x8	/* do not use reselect */
96 #define RDBF_DISKID	0x10	/* disk id is valid ?? */
97 #define RDBF_CTRLID	0x20	/* ctrl id is valid ?? */
98 #define RDBF_SYNC	0x40	/* drive supports SCSI synchronous mode */
99 
100 struct ados_environ {
101 	u_long tabsize;		/* 0: environ table size */
102 	u_long sizeblock;	/* 1: n long words in a block */
103 	u_long secorg;		/* 2: not used must be zero */
104 	u_long numheads;	/* 3: number of surfaces */
105 	u_long secperblk;	/* 4: must be 1 */
106 	u_long secpertrk;	/* 5: blocks per track */
107 	u_long resvblocks;	/* 6: reserved blocks at start */
108 	u_long prefac;		/* 7: must be 0 */
109 	u_long interleave;	/* 8: normally 1 */
110 	u_long lowcyl;		/* 9: low cylinder of partition */
111 	u_long highcyl;		/* 10: upper cylinder of partition */
112 	u_long numbufs;		/* 11: ados: number of buffers */
113 	u_long membuftype;	/* 12: ados: type of bufmem */
114 	u_long maxtrans;	/* 13: maxtrans the ctrlr supports */
115 	u_long mask;		/* 14: mask for valid address */
116 	u_long bootpri;		/* 15: boot priority for autoboot */
117 	u_long dostype;		/* 16: filesystem type */
118 	u_long baud;		/* 17: serial handler baud rate */
119 	u_long control;		/* 18: control word for fs */
120 	u_long bootblocks;	/* 19: blocks containing boot code */
121 	u_long fsize;		/* 20: file system block size */
122 	u_long frag;		/* 21: allowable frags per block */
123 	u_long cpg;		/* 22: cylinders per group */
124 };
125 
126 struct partblock {
127 	u_long id;		/* 'PART' */
128 	u_long nsumlong;	/* number of longs in check sum */
129 	u_long chksum;		/* simple additive with wrap checksum */
130 	u_long hostid;		/* scsi target of host */
131 	u_long next;		/* next in chain */
132 	u_long flags;		/* see below */
133 	u_long resv1[3];
134 	u_char partname[32];	/* (BCPL) part name (may not be unique) */
135 	u_long resv2[15];
136 	struct ados_environ e;
137 #if never_use_secsize
138 	u_long extra[9];	/* 8 for extra added to environ */
139 #endif
140 };
141 
142 #define PBF_BOOTABLE	0x1	/* partition is bootable */
143 #define PBF_NOMOUNT	0x2	/* partition should be mounted */
144 
145 struct badblock {
146 	u_long id;		/* 'BADB' */
147 	u_long nsumlong;	/* number of longs in check sum */
148 	u_long chksum;		/* simple additive with wrap checksum */
149 	u_long hostid;		/* scsi target of host */
150 	u_long next;		/* next in chain */
151 	u_long resv;
152 	struct badblockent {
153 		u_long badblock;
154 		u_long goodblock;
155 	} badtab[0];		/* 61 for secsize == 512 */
156 };
157 
158 struct fsblock {
159 	u_long id;		/* 'FSHD' */
160 	u_long nsumlong;	/* number of longs in check sum */
161 	u_long chksum;		/* simple additive with wrap checksum */
162 	u_long hostid;		/* scsi target of host */
163 	u_long next;		/* next in chain */
164 	u_long flags;
165 	u_long resv1[2];
166 	u_long dostype;		/* this is a file system for this type */
167 	u_long version;		/* version of this fs */
168 	u_long patchflags;	/* describes which functions to replace */
169 	u_long type;		/* zero */
170 	u_long task;		/* zero */
171 	u_long lock;		/* zero */
172 	u_long handler;		/* zero */
173 	u_long stacksize;	/* to use when loading handler */
174 	u_long priority;	/* to run the fs at. */
175 	u_long startup;		/* zero */
176 	u_long lsegblocks;	/* linked list of lsegblocks of fs code */
177 	u_long globalvec;	/* bcpl vector not used mostly */
178 #if never_use_secsize
179 	u_long resv2[44];
180 #endif
181 };
182 
183 struct lsegblock {
184 	u_long id;		/* 'LSEG' */
185 	u_long nsumlong;	/* number of longs in check sum */
186 	u_long chksum;		/* simple additive with wrap checksum */
187 	u_long hostid;		/* scsi target of host */
188 	u_long next;		/* next in chain */
189 	u_long loaddata[0];	/* load segment data, 123 for secsize == 512 */
190 };
191 
192 #define RDBLOCK_ID	0x5244534b	/* 'RDSK' */
193 #define PARTBLOCK_ID	0x50415254	/* 'PART' */
194 #define BADBLOCK_ID	0x42414442	/* 'BADB' */
195 #define FSBLOCK_ID	0x46534844	/* 'FSHD' */
196 #define LSEGBLOCK_ID	0x4c534547	/* 'LSEG' */
197 
198 struct cpu_disklabel {
199 	u_long rdblock;			/* may be RDBNULL which invalidates */
200 	u_long pblist[MAXPARTITIONS];	/* partblock number (RDB list order) */
201 	int pbindex[MAXPARTITIONS];	/* index of pblock (partition order) */
202 	int  valid;			/* essential that this is valid */
203 };
204 
205 #endif /* _MACHINE_DISKLABEL_H_ */
206