xref: /netbsd-src/sys/arch/hpcmips/include/disklabel.h (revision 2ec4fd84baea86ae2980e4abc96d967a585dafb7)
1*2ec4fd84Schristos /*	$NetBSD: disklabel.h,v 1.11 2013/05/16 19:06:44 christos Exp $	*/
2db2b0adeStakemura 
3db2b0adeStakemura /*
4db2b0adeStakemura  * Copyright (c) 1994 Christopher G. Demetriou
5db2b0adeStakemura  * All rights reserved.
6db2b0adeStakemura  *
7db2b0adeStakemura  * Redistribution and use in source and binary forms, with or without
8db2b0adeStakemura  * modification, are permitted provided that the following conditions
9db2b0adeStakemura  * are met:
10db2b0adeStakemura  * 1. Redistributions of source code must retain the above copyright
11db2b0adeStakemura  *    notice, this list of conditions and the following disclaimer.
12db2b0adeStakemura  * 2. Redistributions in binary form must reproduce the above copyright
13db2b0adeStakemura  *    notice, this list of conditions and the following disclaimer in the
14db2b0adeStakemura  *    documentation and/or other materials provided with the distribution.
15db2b0adeStakemura  * 3. All advertising materials mentioning features or use of this software
16db2b0adeStakemura  *    must display the following acknowledgement:
17db2b0adeStakemura  *      This product includes software developed by Christopher G. Demetriou.
18db2b0adeStakemura  * 4. The name of the author may not be used to endorse or promote products
19db2b0adeStakemura  *    derived from this software without specific prior written permission
20db2b0adeStakemura  *
21db2b0adeStakemura  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22db2b0adeStakemura  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23db2b0adeStakemura  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24db2b0adeStakemura  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25db2b0adeStakemura  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26db2b0adeStakemura  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27db2b0adeStakemura  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28db2b0adeStakemura  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29db2b0adeStakemura  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30db2b0adeStakemura  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31db2b0adeStakemura  */
32db2b0adeStakemura 
33db2b0adeStakemura #ifndef _MACHINE_DISKLABEL_H_
34db2b0adeStakemura #define _MACHINE_DISKLABEL_H_
35db2b0adeStakemura 
36a47e2eb7Sbouyer #define LABELUSESMBR		1	/* use MBR partitionning */
37db2b0adeStakemura #define	LABELSECTOR		1	/* sector containing label */
38db2b0adeStakemura #define	LABELOFFSET		0	/* offset of label in sector */
39f8fe1d3fSshin #define	MAXPARTITIONS		16	/* number of partitions */
40f8fe1d3fSshin #define	OLDMAXPARTITIONS 	8	/* number of partitions before 1.6 */
41db2b0adeStakemura #define	RAW_PART		3	/* raw partition: XX?d (XXX) */
42db2b0adeStakemura 
43f8fe1d3fSshin /*
44f8fe1d3fSshin  * We use the highest bit of the minor number for the partition number.
45f8fe1d3fSshin  * This maintains backward compatibility with device nodes created before
46f8fe1d3fSshin  * MAXPARTITIONS was increased.
47f8fe1d3fSshin  */
48f8fe1d3fSshin #define __HPCMIPS_MAXDISKS	((1 << 20) / MAXPARTITIONS)
49f8fe1d3fSshin #define DISKUNIT(dev)	((minor(dev) / OLDMAXPARTITIONS) % __HPCMIPS_MAXDISKS)
50f8fe1d3fSshin #define DISKPART(dev)	((minor(dev) % OLDMAXPARTITIONS) + \
51f8fe1d3fSshin     ((minor(dev) / (__HPCMIPS_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
52f8fe1d3fSshin #define	DISKMINOR(unit, part) \
53f8fe1d3fSshin     (((unit) * OLDMAXPARTITIONS) + ((part) % OLDMAXPARTITIONS) + \
54f8fe1d3fSshin      ((part) / OLDMAXPARTITIONS) * (__HPCMIPS_MAXDISKS * OLDMAXPARTITIONS))
55f8fe1d3fSshin 
565bad90bbSshin /* Pull in MBR partition definitions. */
57a37289dbSdyoung #if HAVE_NBTOOL_CONFIG_H
58a37289dbSdyoung #include <nbinclude/sys/bootblock.h>
59a37289dbSdyoung #else
601c33b4e6Slukem #include <sys/bootblock.h>
61a37289dbSdyoung #endif /* HAVE_NBTOOL_CONFIG_H */
62db2b0adeStakemura 
63db2b0adeStakemura #ifndef __ASSEMBLER__
64a37289dbSdyoung #if HAVE_NBTOOL_CONFIG_H
65a37289dbSdyoung #include <nbinclude/sys/dkbad.h>
66a37289dbSdyoung #else
67db2b0adeStakemura #include <sys/dkbad.h>
68a37289dbSdyoung #endif /* HAVE_NBTOOL_CONFIG_H */
69db2b0adeStakemura struct cpu_disklabel {
70*2ec4fd84Schristos 	struct mbr_partition mbrparts[MBR_PART_COUNT];
7109dbb89bSpooka #define __HAVE_DISKLABEL_DKBAD
72db2b0adeStakemura 	struct dkbad bad;
73db2b0adeStakemura };
74db2b0adeStakemura #endif
75db2b0adeStakemura 
76db2b0adeStakemura #endif /* _MACHINE_DISKLABEL_H_ */
77