]>
Commit | Line | Data |
---|---|---|
f937adac | 1 | /* |
0d3e0b37 | 2 | * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. |
f937adac NS |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | |
5 | * under the terms of version 2 of the GNU General Public License as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it would be useful, but | |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
11 | * | |
12 | * Further, this software is distributed without any warranty that it is | |
13 | * free of the rightful claim of any third person regarding infringement | |
14 | * or the like. Any license provided herein, whether implied or | |
15 | * otherwise, applies only to this software file. Patent licenses, if | |
16 | * any, provided herein do not apply to combinations of this program with | |
17 | * other software, or any other product whatsoever. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License along | |
20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | |
21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | |
22 | * | |
23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | |
24 | * Mountain View, CA 94043, or: | |
25 | * | |
26 | * http://www.sgi.com | |
27 | * | |
28 | * For further information regarding this notice, see: | |
29 | * | |
30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | |
31 | */ | |
32 | #ifndef __DVH_H__ | |
33 | #define __DVH_H__ | |
34 | ||
35 | /* | |
36 | * Format for volume header information | |
37 | * | |
38 | * The volume header is a block located at the beginning of all disk | |
39 | * media (sector 0). It contains information pertaining to physical | |
40 | * device parameters and logical partition information. | |
41 | * | |
42 | * The volume header is manipulated by disk formatters/verifiers, | |
43 | * partition builders (e.g. fx, dvhtool, and mkfs), and disk drivers. | |
44 | * | |
45 | * Previous versions of IRIX wrote a copy of the volume header is | |
46 | * located at sector 0 of each track of cylinder 0. These copies were | |
47 | * never used, and reduced the capacity of the volume header to hold large | |
48 | * files, so this practice was discontinued. | |
49 | * The volume header is constrained to be less than or equal to 512 | |
50 | * bytes long. A particular copy is assumed valid if no drive errors | |
51 | * are detected, the magic number is correct, and the 32 bit 2's complement | |
52 | * of the volume header is correct. The checksum is calculated by initially | |
53 | * zeroing vh_csum, summing the entire structure and then storing the | |
54 | * 2's complement of the sum. Thus a checksum to verify the volume header | |
55 | * should be 0. | |
56 | * | |
57 | * The error summary table, bad sector replacement table, and boot blocks are | |
58 | * located by searching the volume directory within the volume header. | |
59 | * | |
60 | * Tables are sized simply by the integral number of table records that | |
61 | * will fit in the space indicated by the directory entry. | |
62 | * | |
63 | * The amount of space allocated to the volume header, replacement blocks, | |
64 | * and other tables is user defined when the device is formatted. | |
65 | */ | |
66 | ||
67 | /* | |
68 | * device parameters are in the volume header to determine mapping | |
69 | * from logical block numbers to physical device addresses | |
70 | * | |
71 | * Linux doesn't care ... | |
72 | */ | |
73 | struct device_parameters { | |
74 | unsigned char dp_skew; /* spiral addressing skew */ | |
75 | unsigned char dp_gap1; /* words of 0 before header */ | |
76 | unsigned char dp_gap2; /* words of 0 between hdr and data */ | |
77 | unsigned char dp_spares_cyl; /* This is for drives (such as SCSI | |
78 | that support zone oriented sparing, where the zone is larger | |
79 | than one track. It gets subracteded from the cylinder size | |
80 | ( dp_trks0 * dp_sec) when doing partition size calculations */ | |
81 | unsigned short dp_cyls; /* number of usable cylinders (i.e., | |
82 | doesn't include cylinders reserved by the drive for badblocks, | |
83 | etc.). For drives with variable geometry, this number may be | |
84 | decreased so that: | |
85 | dp_cyls * ((dp_heads * dp_trks0) - dp_spares_cyl) <= actualcapacity | |
86 | This happens on SCSI drives such as the Wren IV and Toshiba 156 | |
87 | Also see dp_cylshi below */ | |
88 | unsigned short dp_shd0; /* starting head vol 0 */ | |
89 | unsigned short dp_trks0; /* number of tracks / cylinder vol 0*/ | |
90 | unsigned char dp_ctq_depth; /* Depth of CTQ queue */ | |
91 | unsigned char dp_cylshi; /* high byte of 24 bits of cylinder count */ | |
92 | unsigned short dp_unused; /* not used */ | |
93 | unsigned short dp_secs; /* number of sectors/track */ | |
94 | unsigned short dp_secbytes; /* length of sector in bytes */ | |
95 | unsigned short dp_interleave; /* sector interleave */ | |
96 | int dp_flags; /* controller characteristics */ | |
97 | int dp_datarate; /* bytes/sec for kernel stats */ | |
98 | int dp_nretries; /* max num retries on data error */ | |
99 | int dp_mspw; /* ms per word to xfer, for iostat */ | |
100 | unsigned short dp_xgap1; /* Gap 1 for xylogics controllers */ | |
101 | unsigned short dp_xsync; /* sync delay for xylogics controllers */ | |
102 | unsigned short dp_xrdly; /* read delay for xylogics controllers */ | |
103 | unsigned short dp_xgap2; /* gap 2 for xylogics controllers */ | |
104 | unsigned short dp_xrgate; /* read gate for xylogics controllers */ | |
105 | unsigned short dp_xwcont; /* write continuation for xylogics */ | |
106 | }; | |
107 | ||
108 | /* | |
109 | * Device characterization flags | |
110 | * (dp_flags) | |
111 | */ | |
112 | #define DP_SECTSLIP 0x00000001 /* sector slip to spare sector */ | |
113 | #define DP_SECTFWD 0x00000002 /* forward to replacement sector */ | |
114 | #define DP_TRKFWD 0x00000004 /* forward to replacement track */ | |
115 | #define DP_MULTIVOL 0x00000008 /* multiple volumes per spindle */ | |
116 | #define DP_IGNOREERRORS 0x00000010 /* transfer data regardless of errors */ | |
117 | #define DP_RESEEK 0x00000020 /* recalibrate as last resort */ | |
118 | #define DP_CTQ_EN 0x00000040 /* enable command tag queueing */ | |
119 | ||
120 | /* | |
121 | * Boot blocks, bad sector tables, and the error summary table, are located | |
122 | * via the volume_directory. | |
123 | */ | |
124 | #define VDNAMESIZE 8 | |
125 | ||
126 | struct volume_directory { | |
127 | char vd_name[VDNAMESIZE]; /* name */ | |
128 | int vd_lbn; /* logical block number */ | |
129 | int vd_nbytes; /* file length in bytes */ | |
130 | }; | |
131 | ||
132 | /* | |
133 | * partition table describes logical device partitions | |
134 | * (device drivers examine this to determine mapping from logical units | |
135 | * to cylinder groups, device formatters/verifiers examine this to determine | |
136 | * location of replacement tracks/sectors, etc) | |
137 | * | |
138 | * NOTE: pt_firstlbn SHOULD BE CYLINDER ALIGNED | |
139 | */ | |
140 | struct partition_table { /* one per logical partition */ | |
141 | int pt_nblks; /* # of logical blks in partition */ | |
142 | int pt_firstlbn; /* first lbn of partition */ | |
143 | int pt_type; /* use of partition */ | |
144 | }; | |
145 | ||
146 | #define PTYPE_VOLHDR 0 /* partition is volume header */ | |
147 | #define PTYPE_TRKREPL 1 /* partition is used for repl trks */ | |
148 | #define PTYPE_SECREPL 2 /* partition is used for repl secs */ | |
149 | #define PTYPE_RAW 3 /* partition is used for data */ | |
150 | #define PTYPE_BSD42 4 /* partition is 4.2BSD file system */ | |
151 | #define PTYPE_BSD 4 /* partition is 4.2BSD file system */ | |
152 | #define PTYPE_SYSV 5 /* partition is SysV file system */ | |
153 | #define PTYPE_VOLUME 6 /* partition is entire volume */ | |
154 | #define PTYPE_EFS 7 /* partition is sgi EFS */ | |
155 | #define PTYPE_LVOL 8 /* partition is part of a logical vol */ | |
156 | #define PTYPE_RLVOL 9 /* part of a "raw" logical vol */ | |
157 | #define PTYPE_XFS 10 /* partition is sgi XFS */ | |
158 | #define PTYPE_XFSLOG 11 /* partition is sgi XFS log */ | |
159 | #define PTYPE_XLV 12 /* partition is part of an XLV vol */ | |
160 | #define PTYPE_XVM 13 /* partition is sgi XVM */ | |
161 | #define NPTYPES 16 | |
162 | ||
163 | #define VHMAGIC 0xbe5a941 /* randomly chosen value */ | |
164 | #define NPARTAB 16 /* 16 unix partitions */ | |
165 | #define NVDIR 15 /* max of 15 directory entries */ | |
166 | #define BFNAMESIZE 16 /* max 16 chars in boot file name */ | |
167 | ||
168 | /* Partition types for ARCS */ | |
169 | #define NOT_USED 0 /* Not used */ | |
170 | #define FAT_SHORT 1 /* FAT filesystem, 12-bit FAT entries */ | |
171 | #define FAT_LONG 4 /* FAT filesystem, 16-bit FAT entries */ | |
172 | #define EXTENDED 5 /* extended partition */ | |
173 | #define HUGE 6 /* huge partition- MS/DOS 4.0 and later */ | |
174 | ||
175 | /* Active flags for ARCS */ | |
176 | #define BOOTABLE 0x00; | |
177 | #define NOT_BOOTABLE 0x80; | |
178 | ||
179 | struct volume_header { | |
180 | int vh_magic; /* identifies volume header */ | |
181 | short vh_rootpt; /* root partition number */ | |
182 | short vh_swappt; /* swap partition number */ | |
183 | char vh_bootfile[BFNAMESIZE]; /* name of file to boot */ | |
184 | struct device_parameters vh_dp; /* device parameters */ | |
185 | struct volume_directory vh_vd[NVDIR]; /* other vol hdr contents */ | |
186 | struct partition_table vh_pt[NPARTAB]; /* device partition layout */ | |
187 | int vh_csum; /* volume header checksum */ | |
188 | int vh_fill; /* fill out to 512 bytes */ | |
189 | }; | |
190 | ||
191 | #endif /* __DVH_H__ */ |