disklabel.h revision 1.2 1 1.2 wdk /* $NetBSD: disklabel.h,v 1.2 2000/08/22 11:59:34 wdk Exp $ */
2 1.1 wdk
3 1.1 wdk /*
4 1.1 wdk * Copyright (c) 2000 Wayne Knowles. All rights reserved.
5 1.1 wdk *
6 1.1 wdk * Redistribution and use in source and binary forms, with or without
7 1.1 wdk * modification, are permitted provided that the following conditions
8 1.1 wdk * are met:
9 1.1 wdk * 1. Redistributions of source code must retain the above copyright
10 1.1 wdk * notice, this list of conditions and the following disclaimer.
11 1.1 wdk * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 wdk * notice, this list of conditions and the following disclaimer in the
13 1.1 wdk * documentation and/or other materials provided with the distribution.
14 1.1 wdk * 3. All advertising materials mentioning features or use of this software
15 1.1 wdk * must display the following acknowledgement:
16 1.1 wdk * This product includes software developed by Christopher G. Demetriou.
17 1.1 wdk * 4. The name of the author may not be used to endorse or promote products
18 1.1 wdk * derived from this software without specific prior written permission
19 1.1 wdk *
20 1.1 wdk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 wdk * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 wdk * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 wdk * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 wdk * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 wdk * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 wdk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 wdk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 wdk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 wdk * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 wdk */
31 1.1 wdk
32 1.1 wdk #ifndef _MACHINE_DISKLABEL_H_
33 1.1 wdk #define _MACHINE_DISKLABEL_H_
34 1.1 wdk
35 1.1 wdk /*
36 1.1 wdk * MIPS partition conventions:
37 1.1 wdk *
38 1.1 wdk * Partition 0 - root
39 1.1 wdk * Partition 1 - swap
40 1.1 wdk * Partition 6 - usr
41 1.1 wdk * Partition 7 - volume body
42 1.1 wdk * Partition 8 - volume header
43 1.1 wdk * Partition 10 - whole disk
44 1.1 wdk */
45 1.1 wdk
46 1.2 wdk #define MAXPARTITIONS 8 /* XXX - NetBSD Compatability */
47 1.1 wdk #define RAW_PART 2
48 1.1 wdk #define LABELSECTOR 0
49 1.1 wdk #define LABELOFFSET 128
50 1.1 wdk
51 1.2 wdk #define MIPS_PARTITIONS 16 /* Number or partitions for Mips */
52 1.2 wdk #define MIPS_NVOLDIR 15 /* Number of volume directory files */
53 1.2 wdk #define MIPS_VDIRSZ 8 /* File name size in volume directory */
54 1.2 wdk #define MIPS_BFSIZE 16 /* Boot filename size */
55 1.2 wdk
56 1.2 wdk /*
57 1.2 wdk * Devices parameters that RISC/os uses for mapping logical block numbers
58 1.2 wdk * to physical device addresses.
59 1.2 wdk */
60 1.2 wdk struct mips_devparams {
61 1.2 wdk u_int8_t dp_skew; /* spiral addressing skew */
62 1.2 wdk u_int8_t dp_gap1; /* words of 0 before header */
63 1.2 wdk u_int8_t dp_gap2; /* words of 0 between hdr and data */
64 1.2 wdk u_int8_t dp_spare0; /* spare space */
65 1.2 wdk u_int16_t dp_cyls; /* number of cylinders */
66 1.2 wdk u_int16_t dp_shd0; /* starting head vol 0 */
67 1.2 wdk u_int16_t dp_trks0; /* number of tracks vol 0 */
68 1.2 wdk u_int16_t dp_shd1; /* starting head vol 1 */
69 1.2 wdk u_int16_t dp_trks1; /* number of tracks vol 1 */
70 1.2 wdk u_int16_t dp_secs; /* number of sectors/track */
71 1.2 wdk u_int16_t dp_secbytes; /* length of sector in bytes */
72 1.2 wdk u_int16_t dp_interleave; /* sector interleave */
73 1.2 wdk int32_t dp_flags; /* controller characteristics */
74 1.2 wdk int32_t dp_datarate; /* bytes/sec for kernel stats */
75 1.2 wdk int32_t dp_nretries; /* max num retries on data error */
76 1.2 wdk int32_t dp_spare1; /* spare entries */
77 1.2 wdk int32_t dp_spare2;
78 1.2 wdk int32_t dp_spare3;
79 1.2 wdk int32_t dp_spare4;
80 1.2 wdk } __attribute__((__packed__));
81 1.2 wdk
82 1.2 wdk /*
83 1.2 wdk * Volume directory is used as a shortcut to find bootstraps etc
84 1.2 wdk */
85 1.2 wdk struct mips_voldir { /* Disk volume directory */
86 1.2 wdk char vd_name[MIPS_VDIRSZ];
87 1.2 wdk int32_t vd_lba;
88 1.2 wdk int32_t vd_len;
89 1.2 wdk };
90 1.2 wdk
91 1.2 wdk struct mips_partitions {
92 1.2 wdk int32_t pt_size; /* # of logical blocks in partition */
93 1.2 wdk int32_t pt_offset; /* first logical block of partiton */
94 1.2 wdk int32_t pt_fstype;
95 1.1 wdk };
96 1.1 wdk
97 1.2 wdk /*
98 1.2 wdk * Mips RISC/os compatible volume header and partition table
99 1.2 wdk *
100 1.2 wdk * 1 sector (512 bytes) in size, and normally copied to the first sector
101 1.2 wdk * and cylinder of every track on a disk.
102 1.2 wdk */
103 1.1 wdk struct mips_volheader {
104 1.1 wdk u_int32_t vh_magic;
105 1.2 wdk #define MIPS_VHMAGIC 0xbe5a941
106 1.2 wdk int16_t vh_root; /* Root partition number */
107 1.2 wdk int16_t vh_swap; /* Swap partition number */
108 1.2 wdk char bootfile[MIPS_BFSIZE]; /* default file to boot */
109 1.2 wdk struct mips_devparams vh_dp; /* disk device parameters */
110 1.2 wdk struct mips_voldir vh_voldir[MIPS_NVOLDIR];
111 1.2 wdk struct mips_partitions vh_part[MIPS_PARTITIONS];
112 1.2 wdk int32_t vh_cksum;
113 1.2 wdk int32_t vh_pad;
114 1.1 wdk } __attribute__((__packed__));
115 1.1 wdk
116 1.2 wdk #define MIPS_FS_VOLHDR 0
117 1.2 wdk #define MIPS_FS_TRKREPL 1
118 1.2 wdk #define MIPS_FS_SECREPL 2
119 1.2 wdk #define MIPS_FS_RAW 3
120 1.2 wdk #define MIPS_FS_BSD 4
121 1.2 wdk #define MIPS_FS_BSD42 4
122 1.2 wdk #define MIPS_FS_SYSV 5
123 1.2 wdk #define MIPS_FS_VOLUME 6 /* Entire volume */
124 1.2 wdk
125 1.2 wdk struct cpu_disklabel {
126 1.2 wdk struct mips_volheader cd_volhdr;
127 1.2 wdk };
128 1.1 wdk
129 1.1 wdk #endif /* _MACHINE_DISKLABEL_H_ */
130