xref: /netbsd-src/sys/sys/disklabel_acorn.h (revision 9fbd88883c38d0c0fbfcbe66d76fe6b0fab3f9de)
1 /*	$NetBSD: disklabel_acorn.h,v 1.2 2001/11/25 19:04:48 thorpej 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 #define PARTITION_TYPE_UNUSED  0
39 #define PARTITION_TYPE_ADFS    1
40 #define PARTITION_TYPE_RISCIX  2
41 
42 #define PARTITION_FORMAT_RISCIX  2
43 #define PARTITION_FORMAT_RISCBSD 0x42
44 
45 #define FILECORE_BOOT_SECTOR 6
46 
47 /* Stuff to deal with RISCiX partitions */
48 
49 #define NRISCIX_PARTITIONS 8
50 #define RISCIX_PARTITION_OFFSET 8
51 
52 struct riscix_partition {
53 	uint32_t	rp_start;
54 	uint32_t	rp_length;
55 	uint32_t	rp_type;
56 	int8_t		rp_name[16];
57 };
58 
59 struct riscix_partition_table {
60 	uint32_t	pad0;
61 	uint32_t	pad1;
62 	struct riscix_partition partitions[NRISCIX_PARTITIONS];
63 };
64 
65 struct filecore_bootblock {
66 	uint8_t		padding0[0x1c0];
67 	uint8_t		log2secsize;
68 	uint8_t		secspertrack;
69 	uint8_t		heads;
70 	uint8_t		density;
71 	uint8_t		idlen;
72 	uint8_t		log2bpmb;
73 	uint8_t		skew;
74 	uint8_t		bootoption;
75 	uint8_t		lowsector;
76 	uint8_t		nzones;
77 	uint16_t	zone_spare;
78 	uint32_t	root;
79 	uint32_t	disc_size;
80 	uint16_t	disc_id;
81 	uint8_t		disc_name[10];
82 	uint32_t	disc_type;
83 
84 	uint8_t		padding1[24];
85 
86 	uint8_t		partition_type;
87 	uint8_t		partition_cyl_low;
88 	uint8_t		partition_cyl_high;
89 	uint8_t		checksum;
90 };
91 
92 #if defined(_KERNEL) && !defined(__ASSEMBLER__)
93 struct buf;
94 struct cpu_disklabel;
95 struct disklabel;
96 
97 /* for readdisklabel.  rv != 0 -> matches, msg == NULL -> success */
98 int	filecore_label_read __P((dev_t, void (*)(struct buf *),
99 	    struct disklabel *, struct cpu_disklabel *, char **, int *,
100 	    int *));
101 
102 /* for writedisklabel.  rv == 0 -> dosen't match, rv > 0 -> success */
103 int	filecore_label_locate __P((dev_t, void (*)(struct buf *),
104 	    struct disklabel *, struct cpu_disklabel *, int *, int *));
105 #endif
106