No empty .Rs/.Re
[netbsd-mini2440.git] / distrib / utils / sysinst / arch / mac68k / md.h
blob79c102499d04675c12de29838e0e06c2a1583518
1 /* $NetBSD: md.h,v 1.22 2006/02/26 10:25:53 dsl Exp $ */
3 /*
4 * Copyright 1997 Piermont Information Systems Inc.
5 * All rights reserved.
7 * Written by Philip A. Nelson for Piermont Information Systems Inc.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed for the NetBSD Project by
20 * Piermont Information Systems Inc.
21 * 4. The name of Piermont Information Systems Inc. may not be used to endorse
22 * or promote products derived from this software without specific prior
23 * written permission.
25 * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
35 * THE POSSIBILITY OF SUCH DAMAGE.
39 #include <sys/disklabel.h>
40 #include <sys/bootblock.h>
42 /* md.h -- Machine specific definitions for the mac68k */
45 * Apple Partition Map Types
46 * Reserved - Entry hidden by sysinst from user
47 * NetBSD - Entry used for NetBSD
48 * MacOS - Entry used for MacOS and mapped to NetBSD
49 * Other - Entry use unknown, mapped for scratch. This may
50 * include partitions used by other systems (Linux).
51 */
52 #define MAP_EOL 0
53 #define MAP_RESERVED 1
54 #define MAP_NETBSD 2
55 #define MAP_MACOS 3
56 #define MAP_OTHER 4
58 typedef struct {
59 int type; /* Entry type from above */
60 const char *name; /* Partition Type string */
61 } MAP_TYPE;
64 * Define Apple Partition Map types typically seen on 68k Macs
65 * This should match the definitions in include/machine/disklabel.h
66 * and must conform to the matching rules in arch/mac68k/mac68k/disksubr.c
68 extern MAP_TYPE map_types[];
71 * Define NetBSD partition types
73 #define ROOT_PART 1
74 #define UFS_PART 2
75 #define SWAP_PART 3
76 #define HFS_PART 4
77 #define SCRATCH_PART 5
79 int usefull; /* on install, clobber entire disk */
81 typedef struct {
82 int size; /* number of blocks in map for I/O */
83 int in_use_cnt; /* number of block in current use in map */
84 int usable_cnt; /* number of partitions usable by NetBSD */
85 int hfs_cnt; /* number of MacOS partitions found */
86 int root_cnt; /* number of root partitions in map */
87 int swap_cnt; /* number of swap partitions in map */
88 int usr_cnt; /* number of usr partitions in map */
89 int selected; /* current partition selection in mblk */
90 int mblk[MAXPARTITIONS];/* map block number of usable partition */
91 struct apple_part_map_entry *blk;
92 } MAP;
95 * Define the default size for the Disk Partition Map if we have to
96 * write one to the disk. It should be a power of two minus one for
97 * the Block0 block, i.e. 7, 15, 31, 63.
99 #define NEW_MAP_SIZE 15
101 MAP map;
103 /* constants and defines */
106 * The Block Zero Block is stored in the Partition Map Entry in the
107 * pmPad (or pmBootArgs) area. The current NetBSD definition of this
108 * area is incomplete, so we have our own local definition here.
110 typedef struct {
111 u_int32_t magic; /* magic number that identifes Block Zero Block */
112 u_int8_t cluster; /* Autorecovery cluster grouping */
113 u_int8_t type; /* 1=>Std FS, 2=>Autorecovery FS, 3=>SWAP FS */
114 u_int16_t inode; /* bad block inode number */
115 struct {
116 unsigned int root : 1; /* FS contains a Root FS */
117 unsigned int usr : 1; /* FS contains a Usr FS */
118 unsigned int crit : 1; /* FS contains a "Critical"? FS */
119 unsigned int used : 1; /* FS in use */
120 unsigned int : 7;
121 unsigned int slice : 5; /* Slice number to assocate with plus one */
122 unsigned int part : 16; /* reserved, but we'll hide disk part here */
123 } flags;
124 u_int32_t tmade; /* time FS was created */
125 u_int32_t tmount; /* time of last mount */
126 u_int32_t tumount; /* time of last umount */
127 struct {
128 u_int32_t size; /* size of map in bytes */
129 u_int32_t ents; /* number of used entries */
130 u_int32_t start; /* start of cltblk map */
131 } abm; /* altblk map */
132 u_int32_t filler[7]; /* reserved for abm expansion */
133 u_int8_t mount_point[64]; /* mount point for the FS */
134 } EBZB;
137 * Also define Block 0 on the device. We only use this when we have to
138 * initialize the entire disk and then we really only care about the
139 * Signature word, but someday someone might want to fill in other
140 * parts.
142 typedef struct {
143 unsigned short sbSig; /* unique value for SCSI block 0 */
144 unsigned short sbBlkSize; /* block size of device */
145 unsigned long sbBlkCount; /* number of blocks on device */
146 unsigned short sbDevType; /* device type */
147 unsigned short sbDevId; /* device id */
148 unsigned long sbData; /* not used */
149 unsigned short sbDrvrCount; /* driver descriptor count */
150 unsigned long ddBlock; /* 1st driver's starting block */
151 unsigned short ddSize; /* size of 1st driver (512-byte blks) */
152 unsigned short ddType; /* system type (1 for Mac+) */
153 unsigned short ddPad[243]; /* ARRAY[0..242] OF INTEGER; not used */
154 } Block0;
157 * Default Disk Partition Map used for an uninitilized disk.
158 * Has minimal entry for an old Apple SCSI driver, a newer 43 SCSI
159 * driver and an IDE driver (for those Macs with IDE).
161 extern struct apple_part_map_entry new_map[];
163 /* Megs required for a full X installation. */
164 #define XNEEDMB 50
167 * Machine-specific command to write a new label to a disk.
168 * For example, i386 uses "/sbin/disklabel -w -r", just like i386
169 * miniroot scripts, though this may leave a bogus incore label.
170 * Sun ports should probably use DISKLABEL_CMD "/sbin/disklabel -w"
171 * to get incore to ondisk inode translation for the Sun proms.
172 * If not defined, we assume the port does not support disklabels and
173 * hand-edited disklabel will NOT be written by MI code.
175 * The mac68k port doesn't support real disklabels so we don't define the
176 * command string. The Apple Disk Partition Map gets written in the
177 * md_pre_disklabel() routine, which also forces the incore copy to be
178 * updated. If native disklabels are supported or if disklabel() is
179 * fixed to work for writing labels, this command should be defined
180 * to a value that will force the writing of the label. In that case,
181 * the code in md_pre_disklabel() which forces the incore update can be
182 * removed, though its presence won't hurt.
184 * #define DISKLABEL_CMD
187 /* Definition of files to retrieve from ftp. */
188 #define SET_KERNEL_1_NAME "kern-GENERIC"
189 #define SET_KERNEL_2_NAME "kern-GENERICSBC"
191 extern void sortmerge(void);
192 extern void disp_selected_part(int);
193 extern void reset_part_flags(struct apple_part_map_entry *);
194 extern int whichType(struct apple_part_map_entry *);
195 extern void report_errors(void);