xref: /netbsd/sys/arch/atari/include/disklabel.h (revision 1b1a55d0)
1*1b1a55d0Schs /*	$NetBSD: disklabel.h,v 1.10 2011/10/01 15:59:00 chs Exp $	*/
28b0113cfSleo 
38b0113cfSleo /*
48b0113cfSleo  * Copyright (c) 1995 Leo Weppelman.
58b0113cfSleo  * All rights reserved.
68b0113cfSleo  *
78b0113cfSleo  * Redistribution and use in source and binary forms, with or without
88b0113cfSleo  * modification, are permitted provided that the following conditions
98b0113cfSleo  * are met:
108b0113cfSleo  * 1. Redistributions of source code must retain the above copyright
118b0113cfSleo  *    notice, this list of conditions and the following disclaimer.
128b0113cfSleo  * 2. Redistributions in binary form must reproduce the above copyright
138b0113cfSleo  *    notice, this list of conditions and the following disclaimer in the
148b0113cfSleo  *    documentation and/or other materials provided with the distribution.
158b0113cfSleo  *
168b0113cfSleo  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
178b0113cfSleo  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
188b0113cfSleo  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
198b0113cfSleo  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
208b0113cfSleo  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
218b0113cfSleo  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
228b0113cfSleo  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
238b0113cfSleo  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
248b0113cfSleo  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
258b0113cfSleo  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
268b0113cfSleo  */
278b0113cfSleo 
288b0113cfSleo #ifndef _MACHINE_DISKLABEL_H_
298b0113cfSleo #define _MACHINE_DISKLABEL_H_
308b0113cfSleo 
310cd79344Sjtc /*
320cd79344Sjtc  * On a volume, exclusively used by NetBSD, the boot block starts at
33dc321cadSleo  * sector 0. To allow shared use of a volume between two or more OS's,
340cd79344Sjtc  * the vendor specific AHDI format is supported. In this case the boot
350cd79344Sjtc  * block is located at the start of an AHDI partition. In any case the
36dc321cadSleo  * size of the boot block must be at least 8KB.
370cd79344Sjtc  */
38dc321cadSleo #define	BBMINSIZE	8192		/* minimum size of boot block      */
39509fd41bSbouyer #define LABELUSESMBR	0			/* no MBR partitionning */
400cd79344Sjtc #define LABELSECTOR	0		/* `natural' start of boot block   */
41dc321cadSleo #define LABELOFFSET	516		/* offset of disk label in bytes,
423f76d2e7Sleo 					   relative to start of boot block */
43dc321cadSleo #define LABELMAXSIZE	1020		/* maximum size of disk label, at
44dc321cadSleo 					   least (MAXPARTITIONS * 16 + 152)*/
45dc321cadSleo #define MAXPARTITIONS	16		/* max. # of NetBSD partitions     */
46be5d89daSjdc #define SWAP_PART	1		/* xx?b is default swap partition  */
473f76d2e7Sleo #define RAW_PART	2		/* xx?c is raw partition	   */
483f76d2e7Sleo 
4979b57114Swiz #define MAXAUXROOTS	29		/* max. # of auxiliary root sectors */
508b0113cfSleo 
518b0113cfSleo struct cpu_disklabel {
52dc321cadSleo 	u_int		cd_bblock;	/* start of NetBSD boot block      */
53dc321cadSleo #define NO_BOOT_BLOCK	((u_int)-1)
54dc321cadSleo 	u_int		cd_label;	/* offset of NetBSD disk label     */
55dc321cadSleo #ifdef DISKLABEL_AHDI
56dc321cadSleo 	u_int		cd_bslst;	/* start of AHDI bad sector list   */
57dc321cadSleo 	u_int		cd_bslend;	/* end of AHDI bad sector list     */
5879b57114Swiz 	u_int		cd_roots[MAXAUXROOTS+1]; /* auxiliary root sectors  */
59dc321cadSleo #endif /* DISKLABEL_AHDI */
608b0113cfSleo };
618b0113cfSleo 
62dc321cadSleo struct bootblock {
63dc321cadSleo 	u_int8_t	bb_xxboot[LABELOFFSET - sizeof(u_int32_t)];
64dc321cadSleo 						/* first-stage boot loader */
65dc321cadSleo 	u_int32_t	bb_magic;		/* boot block magic number */
66dc321cadSleo #define	NBDAMAGIC	0x4e424441 /* 'NBDA' */
67dc321cadSleo #define	AHDIMAGIC	0x41484449 /* 'AHDI' */
68dc321cadSleo 	u_int8_t	bb_label[LABELMAXSIZE];	/* disk pack label         */
69dc321cadSleo 	u_int8_t	bb_bootxx[BBMINSIZE - LABELOFFSET - LABELMAXSIZE];
70dc321cadSleo 						/* second-stage boot loader*/
71dc321cadSleo };
72dc321cadSleo 
73dc321cadSleo struct disklabel;
74*1b1a55d0Schs #define	BBGETLABEL(bb, dl)	memcpy((dl), (bb)->bb_label, sizeof (struct disklabel))
75*1b1a55d0Schs #define	BBSETLABEL(bb, dl)	memcpy((bb)->bb_label, (dl), sizeof (struct disklabel))
76dc321cadSleo 
778b0113cfSleo #endif /* _MACHINE_DISKLABEL_H_ */
78