sun_disklabel.h revision 113817
196267Sobrien/*
296267Sobrien * Copyright (c) 1992, 1993
396267Sobrien *	The Regents of the University of California.  All rights reserved.
496267Sobrien *
596267Sobrien * This software was developed by the Computer Systems Engineering group
696267Sobrien * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
796267Sobrien * contributed to Berkeley.
896267Sobrien *
996267Sobrien * All advertising materials mentioning features or use of this software
1096267Sobrien * must display the following acknowledgement:
1196267Sobrien *	This product includes software developed by the University of
1296267Sobrien *	California, Lawrence Berkeley Laboratory.
1396267Sobrien *
1496267Sobrien * Redistribution and use in source and binary forms, with or without
1596267Sobrien * modification, are permitted provided that the following conditions
1696267Sobrien * are met:
1796267Sobrien * 1. Redistributions of source code must retain the above copyright
1896267Sobrien *    notice, this list of conditions and the following disclaimer.
1996267Sobrien * 2. Redistributions in binary form must reproduce the above copyright
2096267Sobrien *    notice, this list of conditions and the following disclaimer in the
2196267Sobrien *    documentation and/or other materials provided with the distribution.
2296267Sobrien * 3. All advertising materials mentioning features or use of this software
2396267Sobrien *    must display the following acknowledgement:
2496267Sobrien *	This product includes software developed by the University of
2596267Sobrien *	California, Berkeley and its contributors.
2696267Sobrien * 4. Neither the name of the University nor the names of its contributors
2796267Sobrien *    may be used to endorse or promote products derived from this software
2896267Sobrien *    without specific prior written permission.
2996267Sobrien *
3096267Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
3196267Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3296267Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3396267Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3496267Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3596267Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3696267Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3796267Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3896267Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3996267Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4096267Sobrien * SUCH DAMAGE.
4196267Sobrien *
4296267Sobrien *	@(#)sun_disklabel.h	8.1 (Berkeley) 6/11/93
4396267Sobrien *	$NetBSD: disklabel.h,v 1.2 1998/08/22 14:55:28 mrg Exp $
4496267Sobrien *
4596267Sobrien * $FreeBSD: head/sys/sys/sun_disklabel.h 113817 2003-04-21 19:38:33Z phk $
4696267Sobrien */
4796267Sobrien
4896267Sobrien/*
4996267Sobrien * SunOS disk label layout (only relevant portions discovered here).
5096267Sobrien */
5196267Sobrien
5296267Sobrien#define	SUN_DKMAGIC	55998
53113817Sphk#define	SUN_NPART	8
54113817Sphk#define	SUN_RAWPART	2
55113817Sphk#define	SUN_SIZE	512
5696267Sobrien
5796267Sobrien/* geometry info */
5896267Sobrienstruct sun_dkgeom {
5996267Sobrien	u_short	sdkc_ncylinders;	/* data cylinders */
6096267Sobrien	u_short	sdkc_acylinders;	/* alternate cylinders */
6196267Sobrien	u_short	sdkc_xxx1;
6296267Sobrien	u_short	sdkc_ntracks;		/* tracks per cylinder */
6396267Sobrien	u_short	sdkc_xxx2;
6496267Sobrien	u_short	sdkc_nsectors;		/* sectors per track */
6596267Sobrien	u_short	sdkc_interleave;	/* interleave factor */
6696267Sobrien	u_short	sdkc_xxx3;
6796267Sobrien	u_short	sdkc_xxx4;
6896267Sobrien	u_short	sdkc_sparespercyl;	/* spare sectors per cylinder */
6996267Sobrien	u_short	sdkc_rpm;		/* rotational speed */
7096267Sobrien	u_short	sdkc_pcylinders;	/* physical cylinders */
7196267Sobrien	u_short	sdkc_xxx5[7];
7296267Sobrien};
7396267Sobrien
7496267Sobrien/* controller info */
7596267Sobrienstruct sun_dkctlr {
7696267Sobrien	int	sdkc_addr;		/* controller address */
7796267Sobrien	short	sdkc_unit;		/* unit (slave) address */
7896267Sobrien	short	sdkc_type;		/* controller type */
7996267Sobrien	short	sdkc_flags;		/* flags */
8096267Sobrien};
8196267Sobrien
8296267Sobrien/* partition info */
8396267Sobrienstruct sun_dkpart {
8496267Sobrien	u_int32_t	sdkp_cyloffset;		/* starting cylinder */
8596267Sobrien	u_int32_t	sdkp_nsectors;		/* number of sectors */
8696267Sobrien};
8796267Sobrien
8896267Sobrienstruct sun_disklabel {			/* total size = 512 bytes */
8996267Sobrien	char		sl_text[128];
9096267Sobrien	char		sl_xxx1[292];
9196267Sobrien	u_int16_t	sl_rpm;		/* rotational speed */
9296267Sobrien	u_int16_t	sl_pcylinders;		/* number of physical cyls */
9396267Sobrien	u_int16_t	sl_sparespercyl;	/* spare sectors per cylinder */
9496267Sobrien	char		sl_xxx3[4];
9596267Sobrien	u_int16_t	sl_interleave;		/* interleave factor */
9696267Sobrien	u_int16_t	sl_ncylinders;		/* data cylinders */
9796267Sobrien	u_int16_t	sl_acylinders;		/* alternate cylinders */
9896267Sobrien	u_int16_t	sl_ntracks;		/* tracks per cylinder */
9996267Sobrien	u_int16_t	sl_nsectors;		/* sectors per track */
10096267Sobrien	char		sl_xxx4[4];
101113817Sphk	struct sun_dkpart sl_part[SUN_NPART];	/* partition layout */
10296267Sobrien	u_int16_t	sl_magic;		/* == SUN_DKMAGIC */
10396267Sobrien	u_int16_t	sl_cksum;		/* xor checksum of all shorts */
10496267Sobrien};
105106105Sphk
106106112Sphk#ifdef CTASSERT
107106105SphkCTASSERT(sizeof (struct sun_disklabel) == 512);
108106112Sphk#endif
109113816Sphk
110113816Sphkint sunlabel_dec(void const *pp, struct sun_disklabel *sl);
111113816Sphkvoid sunlabel_enc(void *pp, struct sun_disklabel *sl);
112