FreeBSD/Linux Kernel Cross Reference
sys/i386at/disk.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: disk.h,v $
29 * Revision 2.11 93/08/10 15:57:47 mrt
30 * Deal with bsd labels
31 * [93/07/09 rvb]
32 *
33 * Revision 2.10 93/03/11 13:57:56 danner
34 * u_long -> u_int.
35 * [93/03/09 danner]
36 *
37 * Revision 2.9 91/10/07 17:25:18 af
38 * From 2.5:
39 * p_flag & p_tag -> p_flag
40 * [91/09/09 rvb]
41 *
42 * Revision 2.8 91/05/14 16:22:27 mrt
43 * Correcting copyright
44 *
45 * Revision 2.7 91/03/16 14:45:57 rpd
46 * Fixed ioctl definitions for ANSI C.
47 * [91/02/20 rpd]
48 *
49 * Revision 2.6 91/02/05 17:16:54 mrt
50 * Changed to new Mach copyright
51 * [91/02/01 17:42:52 mrt]
52 *
53 * Revision 2.5 91/01/08 17:32:46 rpd
54 * Add V_ABS to log absolute address for 3.0 get/set stat version
55 * of V_RDABS AND V_WRABS
56 * [91/01/04 12:18:16 rvb]
57 *
58 * Revision 2.4 90/11/26 14:49:32 rvb
59 * jsb bet me to XMK34, sigh ...
60 * [90/11/26 rvb]
61 * Synched 2.5 & 3.0 at I386q (r2.2.1.9) & XMK35 (r2.4)
62 * Minor syntax cleanup
63 * [90/11/15 rvb]
64 *
65 * Revision 2.2.1.8 90/09/18 08:38:34 rvb
66 * Move setparams here and get IOC correct.
67 * [90/09/08 rvb]
68 *
69 * Revision 2.2.1.7 90/07/27 11:25:51 rvb
70 * Fix Intel Copyright as per B. Davies authorization.
71 * [90/07/27 rvb]
72 *
73 * Revision 2.2 90/05/03 15:42:03 dbg
74 * First checkin.
75 *
76 * Revision 2.2.1.6 90/02/28 15:49:27 rvb
77 * Make DISK_PART value conditional on OLD_PARTITIONS.
78 * [90/02/28 rvb]
79 *
80 * Revision 2.2.1.5 90/01/16 15:54:26 rvb
81 * FLush pdinfo/vtoc -> evtoc
82 * [90/01/16 rvb]
83 *
84 * Revision 2.2.1.4 90/01/08 13:31:52 rvb
85 * Add Intel copyright.
86 * [90/01/08 rvb]
87 *
88 * Revision 2.2.1.3 90/01/02 13:50:46 rvb
89 * Add evtoc definition.
90 *
91 * Revision 2.2.1.2 89/12/21 17:59:52 rvb
92 * Changes from Eugene:
93 * typedef of altinfo_t & partition_t
94 * [89/12/07 rvb]
95 *
96 * Revision 2.2.1.1 89/10/22 11:33:54 rvb
97 * Add PART_DISK to indicate the "c" slice.
98 * [89/10/21 rvb]
99 *
100 * Revision 2.2 89/09/25 12:32:57 rvb
101 * File was provided by Intel 9/18/89.
102 * [89/09/23 rvb]
103 *
104 */
105
106 /*
107 Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
108
109 All Rights Reserved
110
111 Permission to use, copy, modify, and distribute this software and
112 its documentation for any purpose and without fee is hereby
113 granted, provided that the above copyright notice appears in all
114 copies and that both the copyright notice and this permission notice
115 appear in supporting documentation, and that the name of Intel
116 not be used in advertising or publicity pertaining to distribution
117 of the software without specific, written prior permission.
118
119 INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
120 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
121 IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
122 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
123 LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
124 NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
125 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
126 */
127
128 /*
129 * disk.h
130 */
131
132 #define PART_DISK 2 /* partition number for entire disk */
133
134 #define MAX_ALTENTS 253 /* Maximum # of slots for alts */
135 /* allowed for in the table. */
136
137 #define ALT_SANITY 0xdeadbeef /* magic # to validate alt table */
138
139 struct alt_table {
140 u_short alt_used; /* # of alternates already assigned */
141 u_short alt_reserved; /* # of alternates reserved on disk */
142 long alt_base; /* 1st sector (abs) of the alt area */
143 long alt_bad[MAX_ALTENTS]; /* list of bad sectors/tracks */
144 };
145
146 struct alt_info { /* table length should be multiple of 512 */
147 long alt_sanity; /* to validate correctness */
148 u_short alt_version; /* to corroborate vintage */
149 u_short alt_pad; /* padding for alignment */
150 struct alt_table alt_trk; /* bad track table */
151 struct alt_table alt_sec; /* bad sector table */
152 };
153 typedef struct alt_info altinfo_t;
154
155 #define V_NUMPAR 16 /* maximum number of partitions */
156
157 #define VTOC_SANE 0x600DDEEE /* Indicates a sane VTOC */
158
159 #define HDPDLOC 29 /* location of pdinfo/vtoc */
160 #define LBLLOC 1 /* label block for xxxbsd */
161
162 /* Partition permission flags */
163 #define V_OPEN 0x100 /* Partition open (for driver use) */
164 #define V_VALID 0x200 /* Partition is valid to use */
165
166 /* driver ioctl() commands */
167 #define V_CONFIG _IOW('v',1,union io_arg)/* Configure Drive */
168 #define V_REMOUNT _IO('v',2) /* Remount Drive */
169 #define V_ADDBAD _IOW('v',3,union io_arg)/* Add Bad Sector */
170 #define V_GETPARMS _IOR('v',4,struct disk_parms) /* Get drive/partition parameters */
171 #define V_FORMAT _IOW('v',5,union io_arg)/* Format track(s) */
172 #define V_PDLOC _IOR('v',6,int) /* Ask driver where pdinfo is on disk */
173
174 #define V_ABS _IOW('v',9,int) /* set a sector for an absolute addr */
175 #define V_RDABS _IOW('v',10,struct absio)/* Read a sector at an absolute addr */
176 #define V_WRABS _IOW('v',11,struct absio)/* Write a sector to absolute addr */
177 #define V_VERIFY _IOWR('v',12,union vfy_io)/* Read verify sector(s) */
178 #define V_XFORMAT _IO('v',13) /* Selectively mark sectors as bad */
179 #define V_SETPARMS _IOW('v',14,int) /* Set drivers parameters */
180
181
182
183 /* Sanity word for the physical description area */
184 #define VALID_PD 0xCA5E600D
185
186 struct localpartition {
187 u_int p_flag; /*permision flags*/
188 long p_start; /*physical start sector no of partition*/
189 long p_size; /*# of physical sectors in partition*/
190 };
191 typedef struct localpartition localpartition_t;
192
193 struct evtoc {
194 u_int fill0[6];
195 u_int cyls; /*number of cylinders per drive*/
196 u_int tracks; /*number tracks per cylinder*/
197 u_int sectors; /*number sectors per track*/
198 u_int fill1[13];
199 u_int version; /*layout version*/
200 u_int alt_ptr; /*byte offset of alternates table*/
201 u_short alt_len; /*byte length of alternates table*/
202 u_int sanity; /*to verify vtoc sanity*/
203 u_int xcyls; /*number of cylinders per drive*/
204 u_int xtracks; /*number tracks per cylinder*/
205 u_int xsectors; /*number sectors per track*/
206 u_short nparts; /*number of partitions*/
207 u_short fill2; /*pad for 286 compiler*/
208 char label[40];
209 struct localpartition part[V_NUMPAR];/*partition headers*/
210 char fill[512-352];
211 };
212
213 union io_arg {
214 struct {
215 u_short ncyl; /* number of cylinders on drive */
216 u_char nhead; /* number of heads/cyl */
217 u_char nsec; /* number of sectors/track */
218 u_short secsiz; /* number of bytes/sector */
219 } ia_cd; /* used for Configure Drive cmd */
220 struct {
221 u_short flags; /* flags (see below) */
222 long bad_sector; /* absolute sector number */
223 long new_sector; /* RETURNED alternate sect assigned */
224 } ia_abs; /* used for Add Bad Sector cmd */
225 struct {
226 u_short start_trk; /* first track # */
227 u_short num_trks; /* number of tracks to format */
228 u_short intlv; /* interleave factor */
229 } ia_fmt; /* used for Format Tracks cmd */
230 struct {
231 u_short start_trk; /* first track */
232 char *intlv_tbl; /* interleave table */
233 } ia_xfmt; /* used for the V_XFORMAT ioctl */
234 };
235
236 /*
237 * Data structure for the V_VERIFY ioctl
238 */
239 union vfy_io {
240 struct {
241 long abs_sec; /* absolute sector number */
242 u_short num_sec; /* number of sectors to verify */
243 u_short time_flg; /* flag to indicate time the ops */
244 }vfy_in;
245 struct {
246 long deltatime; /* duration of operation */
247 u_short err_code; /* reason for failure */
248 }vfy_out;
249 };
250
251
252 /* data structure returned by the Get Parameters ioctl: */
253 struct disk_parms {
254 /*00*/ char dp_type; /* Disk type (see below) */
255 u_char dp_heads; /* Number of heads */
256 u_short dp_cyls; /* Number of cylinders */
257 /*04*/ u_char dp_sectors; /* Number of sectors/track */
258 u_short dp_secsiz; /* Number of bytes/sector */
259 /* for this partition: */
260 /*08*/ u_short dp_ptag; /* Partition tag */
261 u_short dp_pflag; /* Partition flag */
262 /*0c*/ long dp_pstartsec; /* Starting absolute sector number */
263 /*10*/ long dp_pnumsec; /* Number of sectors */
264 /*14*/ u_char dp_dosheads; /* Number of heads */
265 u_short dp_doscyls; /* Number of cylinders */
266 /*18*/ u_char dp_dossectors; /* Number of sectors/track */
267 };
268
269 /* Disk types for disk_parms.dp_type: */
270 #define DPT_WINI 1 /* Winchester disk */
271 #define DPT_FLOPPY 2 /* Floppy */
272 #define DPT_OTHER 3 /* Other type of disk */
273 #define DPT_NOTDISK 0 /* Not a disk device */
274
275 /* Data structure for V_RDABS/V_WRABS ioctl's */
276 struct absio {
277 long abs_sec; /* Absolute sector number (from 0) */
278 char *abs_buf; /* Sector buffer */
279 };
280
281
282 #define BOOTSZ 446 /* size of boot code in master boot block */
283 #define FD_NUMPART 4 /* number of 'partitions' in fdisk table */
284 #define ACTIVE 128 /* indicator of active partition */
285 #define BOOT_MAGIC 0xAA55 /* signature of the boot record */
286 #define UNIXOS 99 /* UNIX partition */
287 #define BSDOS 165
288 extern int OS; /* what partition we came from */
289
290 /*
291 * structure to hold the fdisk partition table
292 */
293 struct ipart {
294 u_char bootid; /* bootable or not */
295 u_char beghead; /* beginning head, sector, cylinder */
296 u_char begsect; /* begcyl is a 10-bit number. High 2 bits */
297 u_char begcyl; /* are in begsect. */
298 u_char systid; /* OS type */
299 u_char endhead; /* ending head, sector, cylinder */
300 u_char endsect; /* endcyl is a 10-bit number. High 2 bits */
301 u_char endcyl; /* are in endsect. */
302 long relsect; /* first sector relative to start of disk */
303 long numsect; /* number of sectors in partition */
304 };
305
306 /*
307 * structure to hold master boot block in physical sector 0 of the disk.
308 * Note that partitions stuff can't be directly included in the structure
309 * because of lameo '386 compiler alignment design.
310 */
311 struct mboot { /* master boot block */
312 char bootinst[BOOTSZ];
313 char parts[FD_NUMPART * sizeof(struct ipart)];
314 u_short signature;
315 };
Cache object: 50fa85a71438c1eb1c0d3708c42f5b03
|