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