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