FreeBSD/Linux Kernel Cross Reference
sys/scsi/rz_labels.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: rz_labels.h,v $
29 * Revision 2.11 93/01/14 17:55:34 danner
30 * Alpha labels.
31 * [92/12/01 af]
32 *
33 * Revision 2.10 92/02/23 22:44:34 elf
34 * The vendor-label-searching function is now fixed.
35 * [92/02/22 19:03:13 af]
36 *
37 * Revision 2.9 91/08/24 12:28:10 af
38 * More vendor's labels.
39 * [91/08/02 03:50:34 af]
40 *
41 * Revision 2.8 91/07/09 23:22:43 danner
42 * Support for DEC, BSD, Omron labels.
43 * [91/07/09 11:15:23 danner]
44 *
45 * Revision 2.7 91/06/19 11:57:09 rvb
46 * File moved here from mips/PMAX since it is now "MI" code, also
47 * used by Vax3100 and soon -- the omron luna88k.
48 * [91/06/04 rvb]
49 *
50 * Revision 2.6 91/05/14 17:26:52 mrt
51 * Correcting copyright
52 *
53 * Revision 2.5 91/05/13 06:04:35 af
54 * Moved BSD/OSF1 stuff elsewhere, and the copyright that goes with
55 * it.
56 * [91/05/03 af]
57 *
58 * Revision 2.4 91/02/05 17:43:56 mrt
59 * Added author notices
60 * [91/02/04 11:17:04 mrt]
61 *
62 * Changed to use new Mach copyright
63 * [91/02/02 12:15:43 mrt]
64 *
65 * Revision 2.3 90/12/05 23:34:02 af
66 * Added BSD/OSF1 labels and the copyright that goes with it.
67 * [90/11/26 af]
68 *
69 * Revision 2.1.1.1 90/11/01 03:44:04 af
70 * Created.
71 * [90/10/22 af]
72 */
73 /*
74 * File: rz_labels.h
75 * Author: Alessandro Forin, Carnegie Mellon University
76 * Date: 10/90
77 *
78 * Definitions of various vendor's disk label formats.
79 */
80
81 #ifndef _SCSI_RZ_LABELS_H_
82 #define _SCSI_RZ_LABELS_H_
83
84 /*
85 * This function looks for, and converts to BSD format
86 * a vendor's label. It is only called if we did not
87 * find a standard BSD label on the disk pack.
88 */
89 extern boolean_t rz_vendor_label();
90
91 /*
92 * Definition of the DEC disk label,
93 * which is located (you guessed it)
94 * at the end of the 4.3 superblock.
95 */
96
97 struct dec_partition_info {
98 unsigned int n_sectors; /* how big the partition is */
99 unsigned int offset; /* sector no. of start of part. */
100 };
101
102 typedef struct {
103 int magic;
104 # define DEC_LABEL_MAGIC 0x032957
105 int in_use;
106 struct dec_partition_info partitions[8];
107 } scsi_dec_label_t;
108
109 /*
110 * Physical location on disk.
111 * This is independent of the filesystem we use,
112 * although of course we'll be in trouble if we
113 * screwup the 4.3 SBLOCK..
114 */
115
116 #define DEC_LABEL_BYTE_OFFSET ((2*8192)-sizeof(scsi_dec_label_t))
117
118
119 /*
120 * Definitions for the primary boot information
121 * This is common, cuz the prom knows it.
122 */
123
124 typedef struct {
125 int pad[2];
126 unsigned int magic;
127 # define DEC_BOOT0_MAGIC 0x2757a
128 int mode;
129 unsigned int phys_base;
130 unsigned int virt_base;
131 unsigned int n_sectors;
132 unsigned int start_sector;
133 } scsi_dec_boot0_t;
134
135 typedef struct {
136 scsi_dec_boot0_t vax_boot;
137 /* BSD label still fits in pad */
138 char pad[0x1e0-sizeof(scsi_dec_boot0_t)];
139 unsigned long block_count;
140 unsigned long starting_lbn;
141 unsigned long flags;
142 unsigned long checksum; /* add cmpl-2 all but here */
143 } scsi_alpha_boot0_t;
144
145 /*
146 * Definition of the Omron disk label,
147 * which is located at sector 0. It
148 * _is_ sector 0, actually.
149 */
150 struct omron_partition_info {
151 unsigned long offset;
152 unsigned long n_sectors;
153 };
154
155 typedef struct {
156 char packname[128]; /* in ascii */
157
158 char pad[512-(128+8*8+11*2+4)];
159
160 unsigned short badchk; /* checksum of bad track */
161 unsigned long maxblk; /* # of total logical blocks */
162 unsigned short dtype; /* disk drive type */
163 unsigned short ndisk; /* # of disk drives */
164 unsigned short ncyl; /* # of data cylinders */
165 unsigned short acyl; /* # of alternate cylinders */
166 unsigned short nhead; /* # of heads in this partition */
167 unsigned short nsect; /* # of 512 byte sectors per track */
168 unsigned short bhead; /* identifies proper label locations */
169 unsigned short ppart; /* physical partition # */
170 struct omron_partition_info
171 partitions[8];
172
173 unsigned short magic; /* identifies this label format */
174 # define OMRON_LABEL_MAGIC 0xdabe
175
176 unsigned short cksum; /* xor checksum of sector */
177
178 } scsi_omron_label_t;
179
180 /*
181 * Physical location on disk.
182 */
183
184 #define OMRON_LABEL_BYTE_OFFSET 0
185
186
187 /*
188 * Definition of the i386AT disk label, which lives inside sector 0.
189 * This is the info the BIOS knows about, which we use for bootstrapping.
190 * It is common across all disks known to BIOS, not just SCSI.
191 */
192
193 struct bios_partition_info {
194
195 unsigned char bootid; /* bootable or not */
196 # define BIOS_BOOTABLE 128
197
198 unsigned char beghead;/* beginning head, sector, cylinder */
199 unsigned char begsect;/* begcyl is a 10-bit number. High 2 bits */
200 unsigned char begcyl; /* are in begsect. */
201
202 unsigned char systid; /* filesystem type */
203 # define UNIXOS 99
204
205 unsigned char endhead;/* ending head, sector, cylinder */
206 unsigned char endsect;/* endcyl is a 10-bit number. High 2 bits */
207 unsigned char endcyl; /* are in endsect. */
208
209 unsigned long offset;
210 unsigned long n_sectors;
211 };
212
213 typedef struct {
214 /* struct bios_partition_info bogus compiler alignes wrong
215 partitions[4];
216 */
217 char partitions[4*sizeof(struct bios_partition_info)];
218 unsigned short magic;
219 # define BIOS_LABEL_MAGIC 0xaa55
220 } scsi_bios_label_t;
221
222 /*
223 * Physical location on disk.
224 */
225
226 #define BIOS_LABEL_BYTE_OFFSET 446
227
228 /*
229 * Definitions for the primary boot information
230 * This _is_ block 0
231 */
232
233 #define BIOS_BOOT0_SIZE BIOS_LABEL_BYTE_OFFSET
234
235 typedef struct {
236 char boot0[BIOS_BOOT0_SIZE]; /* boot code */
237 /* scsi_bios_label_t label; bogus compiler alignes wrong */
238 char label[sizeof(scsi_bios_label_t)];
239 } scsi_bios_boot0_t;
240
241
242 #endif _SCSI_RZ_LABELS_H_
243
Cache object: ca17c33b79ec4a8e34805cc7439023ce
|