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