disklabel.h revision 1.1
11.1Sis/*	$NetBSD: disklabel.h,v 1.1 2000/05/25 22:11:59 is Exp $	*/
21.1Sis
31.1Sis/*
41.1Sis * Copyright (c) 1994 Christian E. Hopps
51.1Sis * All rights reserved.
61.1Sis *
71.1Sis * Redistribution and use in source and binary forms, with or without
81.1Sis * modification, are permitted provided that the following conditions
91.1Sis * are met:
101.1Sis * 1. Redistributions of source code must retain the above copyright
111.1Sis *    notice, this list of conditions and the following disclaimer.
121.1Sis * 2. Redistributions in binary form must reproduce the above copyright
131.1Sis *    notice, this list of conditions and the following disclaimer in the
141.1Sis *    documentation and/or other materials provided with the distribution.
151.1Sis * 3. All advertising materials mentioning features or use of this software
161.1Sis *    must display the following acknowledgement:
171.1Sis *      This product includes software developed by Christian E. Hopps.
181.1Sis * 4. The name of the author may not be used to endorse or promote products
191.1Sis *    derived from this software without specific prior written permission
201.1Sis *
211.1Sis * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
221.1Sis * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
231.1Sis * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
241.1Sis * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
251.1Sis * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
261.1Sis * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
271.1Sis * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
281.1Sis * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
291.1Sis * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
301.1Sis * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311.1Sis */
321.1Sis#ifndef _MACHINE_DISKLABEL_H_
331.1Sis#define _MACHINE_DISKLABEL_H_
341.1Sis
351.1Sis#define	LABELSECTOR	0			/* sector containing label */
361.1Sis#define	LABELOFFSET	64			/* offset of label in sector */
371.1Sis#define	MAXPARTITIONS	16			/* number of partitions */
381.1Sis#define	RAW_PART	2			/* raw partition: xx?c */
391.1Sis
401.1Sis/*
411.1Sis * describes ados Rigid Disk Blocks
421.1Sis * which are used to partition a drive
431.1Sis */
441.1Sis#define RDBNULL ((u_long)0xffffffff)
451.1Sis
461.1Sis/*
471.1Sis * you will find rdblock somewhere in [0, RDBMAXBLOCKS)
481.1Sis */
491.1Sis#define RDB_MAXBLOCKS	16
501.1Sis
511.1Sisstruct rdblock {
521.1Sis	u_long id;		/* 'RDSK' */
531.1Sis	u_long nsumlong;	/* number of longs in check sum */
541.1Sis	u_long chksum;		/* simple additive with wrap checksum */
551.1Sis	u_long hostid;		/* scsi target of host */
561.1Sis	u_long nbytes;		/* size of disk blocks */
571.1Sis	u_long flags;
581.1Sis	u_long badbhead;	/* linked list of badblocks */
591.1Sis	u_long partbhead;	/* linked list of partblocks */
601.1Sis	u_long fsbhead;		/*   "     "   of fsblocks */
611.1Sis	u_long driveinit;
621.1Sis	u_long resv1[6];	/* RDBNULL */
631.1Sis	u_long ncylinders;	/* number of cylinders on drive */
641.1Sis	u_long nsectors;	/* number of sectors per track */
651.1Sis	u_long nheads;		/* number of tracks per cylinder */
661.1Sis	u_long interleave;
671.1Sis	u_long park;		/* only used with st506 i.e. not */
681.1Sis	u_long resv2[3];
691.1Sis	u_long wprecomp;	/* start cyl for write precomp */
701.1Sis	u_long reducedwrite;	/* start cyl for reduced write current */
711.1Sis	u_long steprate;	/* driver step rate in ?s */
721.1Sis	u_long resv3[5];
731.1Sis	u_long rdblowb;		/* lowblock of range for rdb's */
741.1Sis	u_long rdbhighb;	/* high block of range for rdb's */
751.1Sis	u_long lowcyl;		/* low cylinder of partition area */
761.1Sis	u_long highcyl;		/* upper cylinder of partition area */
771.1Sis	u_long secpercyl;	/* number of sectors per cylinder */
781.1Sis	u_long parkseconds;	/* zero if no park needed */
791.1Sis	u_long resv4[2];
801.1Sis	char   diskvendor[8];	/* inquiry stuff */
811.1Sis	char   diskproduct[16];	/* inquiry stuff */
821.1Sis	char   diskrevision[4];	/* inquiry stuff */
831.1Sis	char   contvendor[8];	/* inquiry stuff */
841.1Sis	char   contproduct[16];	/* inquiry stuff */
851.1Sis	char   contrevision[4];	/* inquiry stuff */
861.1Sis#if never_use_secsize
871.1Sis	u_long resv5[0];
881.1Sis#endif
891.1Sis};
901.1Sis
911.1Sis
921.1Sis#define RDBF_LAST	0x1	/* last drive available */
931.1Sis#define RDBF_LASTLUN	0x2	/* last LUN available */
941.1Sis#define RDBF_LASTUNIT	0x4	/* last target available */
951.1Sis#define RDBF_NORESELECT	0x8	/* do not use reselect */
961.1Sis#define RDBF_DISKID	0x10	/* disk id is valid ?? */
971.1Sis#define RDBF_CTRLID	0x20	/* ctrl id is valid ?? */
981.1Sis#define RDBF_SYNC	0x40	/* drive supports SCSI synchronous mode */
991.1Sis
1001.1Sisstruct ados_environ {
1011.1Sis	u_long tabsize;		/* 0: environ table size */
1021.1Sis	u_long sizeblock;	/* 1: n long words in a block */
1031.1Sis	u_long secorg;		/* 2: not used must be zero */
1041.1Sis	u_long numheads;	/* 3: number of surfaces */
1051.1Sis	u_long secperblk;	/* 4: must be 1 */
1061.1Sis	u_long secpertrk;	/* 5: blocks per track */
1071.1Sis	u_long resvblocks;	/* 6: reserved blocks at start */
1081.1Sis	u_long prefac;		/* 7: must be 0 */
1091.1Sis	u_long interleave;	/* 8: normally 1 */
1101.1Sis	u_long lowcyl;		/* 9: low cylinder of partition */
1111.1Sis	u_long highcyl;		/* 10: upper cylinder of partition */
1121.1Sis	u_long numbufs;		/* 11: ados: number of buffers */
1131.1Sis	u_long membuftype;	/* 12: ados: type of bufmem */
1141.1Sis	u_long maxtrans;	/* 13: maxtrans the ctrlr supports */
1151.1Sis	u_long mask;		/* 14: mask for valid address */
1161.1Sis	u_long bootpri;		/* 15: boot priority for autoboot */
1171.1Sis	u_long dostype;		/* 16: filesystem type */
1181.1Sis	u_long baud;		/* 17: serial handler baud rate */
1191.1Sis	u_long control;		/* 18: control word for fs */
1201.1Sis	u_long bootblocks;	/* 19: blocks containing boot code */
1211.1Sis	u_long fsize;		/* 20: file system block size */
1221.1Sis	u_long frag;		/* 21: allowable frags per block */
1231.1Sis	u_long cpg;		/* 22: cylinders per group */
1241.1Sis};
1251.1Sis
1261.1Sisstruct partblock {
1271.1Sis	u_long id;		/* 'PART' */
1281.1Sis	u_long nsumlong;	/* number of longs in check sum */
1291.1Sis	u_long chksum;		/* simple additive with wrap checksum */
1301.1Sis	u_long hostid;		/* scsi target of host */
1311.1Sis	u_long next;		/* next in chain */
1321.1Sis	u_long flags;		/* see below */
1331.1Sis	u_long resv1[3];
1341.1Sis	u_char partname[32];	/* (BCPL) part name (may not be unique) */
1351.1Sis	u_long resv2[15];
1361.1Sis	struct ados_environ e;
1371.1Sis#if never_use_secsize
1381.1Sis	u_long extra[9];	/* 8 for extra added to environ */
1391.1Sis#endif
1401.1Sis};
1411.1Sis
1421.1Sis#define PBF_BOOTABLE	0x1	/* partition is bootable */
1431.1Sis#define PBF_NOMOUNT	0x2	/* partition should be mounted */
1441.1Sis
1451.1Sisstruct badblock {
1461.1Sis	u_long id;		/* 'BADB' */
1471.1Sis	u_long nsumlong;	/* number of longs in check sum */
1481.1Sis	u_long chksum;		/* simple additive with wrap checksum */
1491.1Sis	u_long hostid;		/* scsi target of host */
1501.1Sis	u_long next;		/* next in chain */
1511.1Sis	u_long resv;
1521.1Sis	struct badblockent {
1531.1Sis		u_long badblock;
1541.1Sis		u_long goodblock;
1551.1Sis	} badtab[0];		/* 61 for secsize == 512 */
1561.1Sis};
1571.1Sis
1581.1Sisstruct fsblock {
1591.1Sis	u_long id;		/* 'FSHD' */
1601.1Sis	u_long nsumlong;	/* number of longs in check sum */
1611.1Sis	u_long chksum;		/* simple additive with wrap checksum */
1621.1Sis	u_long hostid;		/* scsi target of host */
1631.1Sis	u_long next;		/* next in chain */
1641.1Sis	u_long flags;
1651.1Sis	u_long resv1[2];
1661.1Sis	u_long dostype;		/* this is a file system for this type */
1671.1Sis	u_long version;		/* version of this fs */
1681.1Sis	u_long patchflags;	/* describes which functions to replace */
1691.1Sis	u_long type;		/* zero */
1701.1Sis	u_long task;		/* zero */
1711.1Sis	u_long lock;		/* zero */
1721.1Sis	u_long handler;		/* zero */
1731.1Sis	u_long stacksize;	/* to use when loading handler */
1741.1Sis	u_long priority;	/* to run the fs at. */
1751.1Sis	u_long startup;		/* zero */
1761.1Sis	u_long lsegblocks;	/* linked list of lsegblocks of fs code */
1771.1Sis	u_long globalvec;	/* bcpl vector not used mostly */
1781.1Sis#if never_use_secsize
1791.1Sis	u_long resv2[44];
1801.1Sis#endif
1811.1Sis};
1821.1Sis
1831.1Sisstruct lsegblock {
1841.1Sis	u_long id;		/* 'LSEG' */
1851.1Sis	u_long nsumlong;	/* number of longs in check sum */
1861.1Sis	u_long chksum;		/* simple additive with wrap checksum */
1871.1Sis	u_long hostid;		/* scsi target of host */
1881.1Sis	u_long next;		/* next in chain */
1891.1Sis	u_long loaddata[0];	/* load segment data, 123 for secsize == 512 */
1901.1Sis};
1911.1Sis
1921.1Sis#define RDBLOCK_ID	0x5244534b	/* 'RDSK' */
1931.1Sis#define PARTBLOCK_ID	0x50415254	/* 'PART' */
1941.1Sis#define BADBLOCK_ID	0x42414442	/* 'BADB' */
1951.1Sis#define FSBLOCK_ID	0x46534844	/* 'FSHD' */
1961.1Sis#define LSEGBLOCK_ID	0x4c534547	/* 'LSEG' */
1971.1Sis
1981.1Sisstruct cpu_disklabel {
1991.1Sis	u_long rdblock;			/* may be RDBNULL which invalidates */
2001.1Sis	u_long pblist[MAXPARTITIONS];	/* partblock number (RDB list order) */
2011.1Sis	int pbindex[MAXPARTITIONS];	/* index of pblock (partition order) */
2021.1Sis	int  valid;			/* essential that this is valid */
2031.1Sis};
2041.1Sis
2051.1Sis#endif /* _MACHINE_DISKLABEL_H_ */
206