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