1 1.9 tsutsui /* $NetBSD: disklabel.h,v 1.9 2025/04/27 04:38:43 tsutsui 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.8 bouyer #define LABELUSESMBR 0 /* no MBR partitionning */ 47 1.7 lukem #define LABELSECTOR 1 48 1.7 lukem #define LABELOFFSET 0 49 1.5 wiz #define MAXPARTITIONS 8 /* XXX - NetBSD Compatibility */ 50 1.1 wdk #define RAW_PART 2 51 1.1 wdk 52 1.2 wdk #define MIPS_PARTITIONS 16 /* Number or partitions for Mips */ 53 1.2 wdk #define MIPS_NVOLDIR 15 /* Number of volume directory files */ 54 1.2 wdk #define MIPS_VDIRSZ 8 /* File name size in volume directory */ 55 1.2 wdk #define MIPS_BFSIZE 16 /* Boot filename size */ 56 1.4 wdk #define MIPS_VHSECTOR 0 /* Sector number for MIPS volume header */ 57 1.2 wdk 58 1.2 wdk /* 59 1.2 wdk * Devices parameters that RISC/os uses for mapping logical block numbers 60 1.2 wdk * to physical device addresses. 61 1.2 wdk */ 62 1.2 wdk struct mips_devparams { 63 1.9 tsutsui uint8_t dp_skew; /* spiral addressing skew */ 64 1.9 tsutsui uint8_t dp_gap1; /* words of 0 before header */ 65 1.9 tsutsui uint8_t dp_gap2; /* words of 0 between hdr and data */ 66 1.9 tsutsui uint8_t dp_spare0; /* spare space */ 67 1.9 tsutsui uint16_t dp_cyls; /* number of cylinders */ 68 1.9 tsutsui uint16_t dp_shd0; /* starting head vol 0 */ 69 1.9 tsutsui uint16_t dp_trks0; /* number of tracks vol 0 */ 70 1.9 tsutsui uint16_t dp_shd1; /* starting head vol 1 */ 71 1.9 tsutsui uint16_t dp_trks1; /* number of tracks vol 1 */ 72 1.9 tsutsui uint16_t dp_secs; /* number of sectors/track */ 73 1.9 tsutsui uint16_t dp_secbytes; /* length of sector in bytes */ 74 1.9 tsutsui uint16_t dp_interleave; /* sector interleave */ 75 1.2 wdk int32_t dp_flags; /* controller characteristics */ 76 1.2 wdk int32_t dp_datarate; /* bytes/sec for kernel stats */ 77 1.2 wdk int32_t dp_nretries; /* max num retries on data error */ 78 1.2 wdk int32_t dp_spare1; /* spare entries */ 79 1.2 wdk int32_t dp_spare2; 80 1.2 wdk int32_t dp_spare3; 81 1.2 wdk int32_t dp_spare4; 82 1.2 wdk } __attribute__((__packed__)); 83 1.2 wdk 84 1.2 wdk /* 85 1.2 wdk * Volume directory is used as a shortcut to find bootstraps etc 86 1.2 wdk */ 87 1.2 wdk struct mips_voldir { /* Disk volume directory */ 88 1.2 wdk char vd_name[MIPS_VDIRSZ]; 89 1.2 wdk int32_t vd_lba; 90 1.2 wdk int32_t vd_len; 91 1.2 wdk }; 92 1.2 wdk 93 1.2 wdk struct mips_partitions { 94 1.2 wdk int32_t pt_size; /* # of logical blocks in partition */ 95 1.6 wiz int32_t pt_offset; /* first logical block of partition */ 96 1.2 wdk int32_t pt_fstype; 97 1.1 wdk }; 98 1.1 wdk 99 1.2 wdk /* 100 1.2 wdk * Mips RISC/os compatible volume header and partition table 101 1.2 wdk * 102 1.2 wdk * 1 sector (512 bytes) in size, and normally copied to the first sector 103 1.2 wdk * and cylinder of every track on a disk. 104 1.2 wdk */ 105 1.1 wdk struct mips_volheader { 106 1.9 tsutsui uint32_t vh_magic; 107 1.2 wdk #define MIPS_VHMAGIC 0xbe5a941 108 1.2 wdk int16_t vh_root; /* Root partition number */ 109 1.2 wdk int16_t vh_swap; /* Swap partition number */ 110 1.2 wdk char bootfile[MIPS_BFSIZE]; /* default file to boot */ 111 1.2 wdk struct mips_devparams vh_dp; /* disk device parameters */ 112 1.2 wdk struct mips_voldir vh_voldir[MIPS_NVOLDIR]; 113 1.2 wdk struct mips_partitions vh_part[MIPS_PARTITIONS]; 114 1.2 wdk int32_t vh_cksum; 115 1.2 wdk int32_t vh_pad; 116 1.1 wdk } __attribute__((__packed__)); 117 1.1 wdk 118 1.2 wdk #define MIPS_FS_VOLHDR 0 119 1.2 wdk #define MIPS_FS_TRKREPL 1 120 1.2 wdk #define MIPS_FS_SECREPL 2 121 1.2 wdk #define MIPS_FS_RAW 3 122 1.2 wdk #define MIPS_FS_BSD 4 123 1.2 wdk #define MIPS_FS_BSD42 4 124 1.2 wdk #define MIPS_FS_SYSV 5 125 1.2 wdk #define MIPS_FS_VOLUME 6 /* Entire volume */ 126 1.2 wdk 127 1.4 wdk /* Just a dummy */ 128 1.2 wdk struct cpu_disklabel { 129 1.4 wdk int cd_dummy; /* must have one element. */ 130 1.2 wdk }; 131 1.1 wdk 132 1.1 wdk #endif /* _MACHINE_DISKLABEL_H_ */ 133