xref: /minix/sys/sys/disklabel_acorn.h (revision 00b67f09)
1 /*	$NetBSD: disklabel_acorn.h,v 1.6 2005/12/11 12:25:20 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 1994 Mark Brinicombe.
5  * Copyright (c) 1994 Brini.
6  * All rights reserved.
7  *
8  * This code is derived from software written for Brini by Mark Brinicombe
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by Brini.
21  * 4. The name of the company nor the name of the author may be used to
22  *    endorse or promote products derived from this software without specific
23  *    prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
26  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28  * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  */
37 
38 #ifndef _SYS_DISKLABEL_ACORN_H_
39 #define _SYS_DISKLABEL_ACORN_H_
40 
41 #define PARTITION_TYPE_UNUSED  0
42 #define PARTITION_TYPE_ADFS    1
43 #define PARTITION_TYPE_RISCIX  2
44 
45 #define PARTITION_FORMAT_RISCIX  2
46 #define PARTITION_FORMAT_RISCBSD 0x42
47 
48 #define FILECORE_BOOT_SECTOR 6
49 
50 /* Stuff to deal with RISCiX partitions */
51 
52 #define NRISCIX_PARTITIONS 8
53 #define RISCIX_PARTITION_OFFSET 8
54 
55 struct riscix_partition {
56 	uint32_t	rp_start;
57 	uint32_t	rp_length;
58 	uint32_t	rp_type;
59 	int8_t		rp_name[16];
60 };
61 
62 struct riscix_partition_table {
63 	uint32_t	pad0;
64 	uint32_t	pad1;
65 	struct riscix_partition partitions[NRISCIX_PARTITIONS];
66 };
67 
68 struct filecore_bootblock {
69 	uint8_t		padding0[0x1c0];
70 	uint8_t		log2secsize;
71 	uint8_t		secspertrack;
72 	uint8_t		heads;
73 	uint8_t		density;
74 	uint8_t		idlen;
75 	uint8_t		log2bpmb;
76 	uint8_t		skew;
77 	uint8_t		bootoption;
78 	uint8_t		lowsector;
79 	uint8_t		nzones;
80 	uint16_t	zone_spare;
81 	uint32_t	root;
82 	uint32_t	disc_size;
83 	uint16_t	disc_id;
84 	uint8_t		disc_name[10];
85 	uint32_t	disc_type;
86 
87 	uint8_t		padding1[24];
88 
89 	uint8_t		partition_type;
90 	uint8_t		partition_cyl_low;
91 	uint8_t		partition_cyl_high;
92 	uint8_t		checksum;
93 };
94 
95 #if defined(_KERNEL) && !defined(__ASSEMBLER__)
96 struct buf;
97 struct cpu_disklabel;
98 struct disklabel;
99 
100 /* for readdisklabel.  rv != 0 -> matches, msg == NULL -> success */
101 int filecore_label_read(dev_t, void (*)(struct buf *),
102 	struct disklabel *, struct cpu_disklabel *, const char **, int *,
103 	int *);
104 
105 /* for writedisklabel.  rv == 0 -> dosen't match, rv > 0 -> success */
106 int filecore_label_locate(dev_t, void (*)(struct buf *),
107 	struct disklabel *, struct cpu_disklabel *, int *, int *);
108 #endif
109 #endif /* _SYS_DISKLABEL_ACORN_H_ */
110