Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / macppc / include / disklabel.h
blobe1c89872596b1cc0e79b70a1a67ace5c6ac94961
1 /* $NetBSD: disklabel.h,v 1.11.2.1 2004/11/14 08:15:16 skrll Exp $ */
3 /*-
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by TooLs GmbH.
19 * 4. The name of TooLs GmbH may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 * Copyright (c) 1994 Christopher G. Demetriou
35 * All rights reserved.
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
39 * are met:
40 * 1. Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * 2. Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in the
44 * documentation and/or other materials provided with the distribution.
45 * 3. All advertising materials mentioning features or use of this software
46 * must display the following acknowledgement:
47 * This product includes software developed by Christopher G. Demetriou.
48 * 4. The name of the author may not be used to endorse or promote products
49 * derived from this software without specific prior written permission
51 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
52 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
55 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 /*-
63 * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
64 * Michael L. Finch, Bradley A. Grantham, and
65 * Lawrence A. Kesteloot
66 * All rights reserved.
68 * Redistribution and use in source and binary forms, with or without
69 * modification, are permitted provided that the following conditions
70 * are met:
71 * 1. Redistributions of source code must retain the above copyright
72 * notice, this list of conditions and the following disclaimer.
73 * 2. Redistributions in binary form must reproduce the above copyright
74 * notice, this list of conditions and the following disclaimer in the
75 * documentation and/or other materials provided with the distribution.
76 * 3. All advertising materials mentioning features or use of this software
77 * must display the following acknowledgement:
78 * This product includes software developed by the Alice Group.
79 * 4. The names of the Alice Group or any of its members may not be used
80 * to endorse or promote products derived from this software without
81 * specific prior written permission.
83 * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
84 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
85 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
86 * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
87 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
88 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
89 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
90 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
91 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
92 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
96 #ifndef _MACHINE_DISKLABEL_H_
97 #define _MACHINE_DISKLABEL_H_
99 #define LABELSECTOR 0 /* sector containing label */
100 #define LABELOFFSET 64 /* offset of label in sector */
101 #define MBR_LABELSECTOR 1 /* sector containing label - in MBR */
102 #define MBR_LABELOFFSET 0 /* offset of label in sector - in MBR */
103 #define MAXPARTITIONS 16 /* number of partitions */
104 #define RAW_PART 2 /* raw partition: XX?c */
106 struct cpu_disklabel {
107 daddr_t cd_start; /* Offset to NetBSD partition in blocks */
108 daddr_t cd_labelsector; /* label sector offset from cd_start */
109 int cd_labeloffset; /* label byte offset within label sector */
113 * Driver Descriptor Map, from Inside Macintosh: Devices, SCSI Manager
114 * pp 12-13. The driver descriptor map always resides on physical block 0.
116 struct drvr_descriptor {
117 u_int32_t descBlock; /* first block of driver */
118 u_int16_t descSize; /* driver size in blocks */
119 u_int16_t descType; /* system type */
122 /* system types; Apple reserves 0-15 */
123 #define DRVR_TYPE_MACINTOSH 1
125 struct drvr_map {
126 #define DRIVER_MAP_MAGIC 0x4552
127 u_int16_t sbSig; /* map signature */
128 u_int16_t sbBlockSize; /* block size of device */
129 u_int32_t sbBlkCount; /* number of blocks on device */
130 u_int16_t sbDevType; /* (used internally by ROM) */
131 u_int16_t sbDevID; /* (used internally by ROM) */
132 u_int32_t sbData; /* (used internally by ROM) */
133 u_int16_t sbDrvrCount; /* number of driver descriptors */
134 #define DRVR_MAX_DESCRIPTORS 61
135 struct drvr_descriptor sb_dd[DRVR_MAX_DESCRIPTORS];
136 u_int16_t pad[3];
137 } __attribute__ ((packed));
139 #define ddBlock(N) sb_dd[(N)].descBlock
140 #define ddSize(N) sb_dd[(N)].descSize
141 #define ddType(N) sb_dd[(N)].descType
144 * Partition map structure from Inside Macintosh: Devices, SCSI Manager
145 * pp. 13-14. The partition map always begins on physical block 1.
147 * With the exception of block 0, all blocks on the disk must belong to
148 * exactly one partition. The partition map itself belongs to a partition
149 * of type `APPLE_PARTITION_MAP', and is not limited in size by anything
150 * other than available disk space. The partition map is not necessarily
151 * the first partition listed.
153 struct part_map_entry {
154 #define PART_ENTRY_MAGIC 0x504d
155 u_int16_t pmSig; /* partition signature */
156 u_int16_t pmSigPad; /* (reserved) */
157 u_int32_t pmMapBlkCnt; /* number of blocks in partition map */
158 u_int32_t pmPyPartStart; /* first physical block of partition */
159 u_int32_t pmPartBlkCnt; /* number of blocks in partition */
160 char pmPartName[32]; /* partition name */
161 char pmPartType[32]; /* partition type */
162 u_int32_t pmLgDataStart; /* first logical block of data area */
163 u_int32_t pmDataCnt; /* number of blocks in data area */
164 u_int32_t pmPartStatus; /* partition status information */
165 u_int32_t pmLgBootStart; /* first logical block of boot code */
166 u_int32_t pmBootSize; /* size of boot code, in bytes */
167 u_int32_t pmBootLoad; /* boot code load address */
168 u_int32_t pmBootLoad2; /* (reserved) */
169 u_int32_t pmBootEntry; /* boot code entry point */
170 u_int32_t pmBootEntry2; /* (reserved) */
171 u_int32_t pmBootCksum; /* boot code checksum */
172 char pmProcessor[16]; /* processor type (e.g. "68020") */
173 u_int8_t pmBootArgs[128]; /* A/UX boot arguments */
174 u_int8_t pad[248]; /* pad to end of block */
177 #define PART_TYPE_DRIVER "APPLE_DRIVER"
178 #define PART_TYPE_DRIVER43 "APPLE_DRIVER43"
179 #define PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA"
180 #define PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT"
181 #define PART_TYPE_FWDRIVER "APPLE_FWDRIVER"
182 #define PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS"
183 #define PART_TYPE_FREE "APPLE_FREE"
184 #define PART_TYPE_MAC "APPLE_HFS"
185 #define PART_TYPE_APPLEUFS "APPLE_UFS"
186 #define PART_TYPE_NETBSD "NETBSD"
187 #define PART_TYPE_NBSD_PPCBOOT "NETBSD/MACPPC"
188 #define PART_TYPE_NBSD_68KBOOT "NETBSD/MAC68K"
189 #define PART_TYPE_PATCHES "APPLE_PATCHES"
190 #define PART_TYPE_PARTMAP "APPLE_PARTITION_MAP"
191 #define PART_TYPE_SCRATCH "APPLE_SCRATCH"
192 #define PART_TYPE_BOOT "APPLE_BOOT"
193 #define PART_TYPE_LOADER "APPLE_LOADER"
194 #define PART_TYPE_UNIX "APPLE_UNIX_SVR2"
195 #define PART_TYPE_LINUX "LINUX"
196 #define PART_TYPE_LINUX_SWAP "LINUX_SWAP"
199 * "pmBootArgs" for APPLE_UNIX_SVR2 partition.
200 * NetBSD/mac68k only uses Magic, Cluster, Type, and Flags.
202 struct blockzeroblock {
203 u_int32_t bzbMagic;
204 u_int8_t bzbCluster;
205 u_int8_t bzbType;
206 u_int16_t bzbBadBlockInode;
207 u_int16_t bzbFlags;
208 u_int16_t bzbReserved;
209 u_int32_t bzbCreationTime;
210 u_int32_t bzbMountTime;
211 u_int32_t bzbUMountTime;
213 #define bzbFSType bzbType
214 #define bzbFrag bzbCluster
215 #define bzbCPG bzbBadBlockInode /* Also sgs for LFS */
216 #define bzbFSize bzbCreationTime
218 /* Apple occasionally changes these */
219 #define BZB_MAGIC 0xABADBABE
220 #define BZB_TYPEFS 1
221 #define BZB_TYPESWAP 3
222 #define BZB_ROOTFS 0x8000
223 #define BZB_USRFS 0x4000
224 #define BZB_USRFS_NEW 0x0004
226 #endif /* _MACHINE_DISKLABEL_H_ */