Home | History | Annotate | Line # | Download | only in include
disklabel.h revision 1.7.6.2
      1  1.7.6.2  simonb /*	$NetBSD: disklabel.h,v 1.7.6.2 2001/08/31 04:44:57 simonb Exp $	*/
      2  1.7.6.2  simonb 
      3  1.7.6.2  simonb /*
      4  1.7.6.2  simonb  * Copyright (c) 1995 Dale Rahn.
      5  1.7.6.2  simonb  * All rights reserved.
      6  1.7.6.2  simonb  *
      7  1.7.6.2  simonb  * Redistribution and use in source and binary forms, with or without
      8  1.7.6.2  simonb  * modification, are permitted provided that the following conditions
      9  1.7.6.2  simonb  * are met:
     10  1.7.6.2  simonb  * 1. Redistributions of source code must retain the above copyright
     11  1.7.6.2  simonb  *    notice, this list of conditions and the following disclaimer.
     12  1.7.6.2  simonb  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.7.6.2  simonb  *    notice, this list of conditions and the following disclaimer in the
     14  1.7.6.2  simonb  *    documentation and/or other materials provided with the distribution.
     15  1.7.6.2  simonb  * 3. All advertising materials mentioning features or use of this software
     16  1.7.6.2  simonb  *    must display the following acknowledgement:
     17  1.7.6.2  simonb  *   This product includes software developed by Dale Rahn.
     18  1.7.6.2  simonb  * 4. The name of the author may not be used to endorse or promote products
     19  1.7.6.2  simonb  *    derived from this software without specific prior written permission.
     20  1.7.6.2  simonb  *
     21  1.7.6.2  simonb  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.7.6.2  simonb  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.7.6.2  simonb  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.7.6.2  simonb  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.7.6.2  simonb  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.7.6.2  simonb  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.7.6.2  simonb  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.7.6.2  simonb  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.7.6.2  simonb  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.7.6.2  simonb  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.7.6.2  simonb  */
     32  1.7.6.2  simonb 
     33  1.7.6.2  simonb #ifndef _MACHINE_DISKLABEL_H_
     34  1.7.6.2  simonb #define _MACHINE_DISKLABEL_H_
     35  1.7.6.2  simonb 
     36  1.7.6.2  simonb /* number of boot pieces , ie xxboot bootxx */
     37  1.7.6.2  simonb #define NUMBOOT		0
     38  1.7.6.2  simonb 
     39  1.7.6.2  simonb #define	PARTITIONSHIFT	3 /* could also be 4 if you need 16 partitions */
     40  1.7.6.2  simonb 
     41  1.7.6.2  simonb #define LABELSECTOR     0                       /* sector containing label */
     42  1.7.6.2  simonb #define LABELOFFSET	0			/* offset of label in sector */
     43  1.7.6.2  simonb #define MAXPARTITIONS	(1 << PARTITIONSHIFT)	/* number of partitions */
     44  1.7.6.2  simonb #define RAW_PART	2			/* raw partition: xx?c */
     45  1.7.6.2  simonb 
     46  1.7.6.2  simonb /*
     47  1.7.6.2  simonb  * a cpu_disklabel is a disklabel that the bug (prom) can understand
     48  1.7.6.2  simonb  * and live with.   the bug works in terms of 256 byte blocks.   in our
     49  1.7.6.2  simonb  * case the first two bug blocks make up the cpu_disklabel (which is 512
     50  1.7.6.2  simonb  * bytes [i.e. one sector] in length).
     51  1.7.6.2  simonb  *
     52  1.7.6.2  simonb  * we use a fixed layout the BSD disk structure (in 256 byte blocks):
     53  1.7.6.2  simonb  *   block 0  = the volume ID block  (part of cpu_disklabel)
     54  1.7.6.2  simonb  *   block 1  = media configuration area (part of cpu_disklabel)
     55  1.7.6.2  simonb  *   block 2  = start of first level OS bootstrap (continues ...)
     56  1.7.6.2  simonb  *   block 31 = end of OS bootstrap
     57  1.7.6.2  simonb  *   block 32 = BSD filesystem superblock
     58  1.7.6.2  simonb  *
     59  1.7.6.2  simonb  * this gives us 30 blocks (30*256 = 7680 bytes) for the bootstrap's text+data
     60  1.7.6.2  simonb  *
     61  1.7.6.2  simonb  * disksubr.c translates between cpu_disklabel and BSD disklabel.
     62  1.7.6.2  simonb  *
     63  1.7.6.2  simonb  */
     64  1.7.6.2  simonb 
     65  1.7.6.2  simonb struct cpu_disklabel {
     66  1.7.6.2  simonb 	/* VID */
     67  1.7.6.2  simonb 	u_char  vid_id[4];	/* volume ID */
     68  1.7.6.2  simonb #define VID_ID		"NBSD"
     69  1.7.6.2  simonb 	u_char  vid_0[16];
     70  1.7.6.2  simonb 	u_int   vid_oss;	/* starting block # of bootstrap */
     71  1.7.6.2  simonb #define VID_OSS		2
     72  1.7.6.2  simonb 	u_short	vid_osl;	/* bootstrap length (30 blocks) */
     73  1.7.6.2  simonb #define VID_OSL		30
     74  1.7.6.2  simonb 	u_char	vid_1[4];
     75  1.7.6.2  simonb 	u_short	vid_osa_u;	/* bootstrap start address (upper) */
     76  1.7.6.2  simonb 	u_short	vid_osa_l;	/* bootstrap start address (lower) */
     77  1.7.6.2  simonb #define VID_OSA		0x3f0000	/* MUST match bootstrap code */
     78  1.7.6.2  simonb #define VID_OSAU	((VID_OSA >> 16) & 0xffff)
     79  1.7.6.2  simonb #define VID_OSAL	(VID_OSA & 0xffff)
     80  1.7.6.2  simonb 	u_char	vid_2[2];
     81  1.7.6.2  simonb 	u_short	partitions;
     82  1.7.6.2  simonb 	u_char	vid_vd[16];
     83  1.7.6.2  simonb 	u_long	bbsize;
     84  1.7.6.2  simonb 	u_long	magic1;		/* 4 */
     85  1.7.6.2  simonb 	u_short	type;		/* 2 */
     86  1.7.6.2  simonb 	u_short	subtype;	/* 2 */
     87  1.7.6.2  simonb 	u_char	packname[16];	/* 16 */
     88  1.7.6.2  simonb 	u_long	flags;		/* 4 */
     89  1.7.6.2  simonb 	u_long	drivedata[5];	/* 4 */
     90  1.7.6.2  simonb 	u_long	spare[5];	/* 4 */
     91  1.7.6.2  simonb 	u_short	checksum;	/* 2 */
     92  1.7.6.2  simonb 
     93  1.7.6.2  simonb 	u_long	secpercyl;	/* 4 */
     94  1.7.6.2  simonb 	u_long	secperunit;	/* 4 */
     95  1.7.6.2  simonb 	u_long	headswitch;	/* 4 */
     96  1.7.6.2  simonb 
     97  1.7.6.2  simonb 	u_char	vid_3[4];
     98  1.7.6.2  simonb 	u_int	vid_cas;	/* block # of CFG area, hardwired at 1 */
     99  1.7.6.2  simonb #define VID_CAS		1
    100  1.7.6.2  simonb 	u_char	vid_cal;	/* length of CFG area, in blocks (1) */
    101  1.7.6.2  simonb #define VID_CAL		1
    102  1.7.6.2  simonb 	u_char	vid_4_0[3];
    103  1.7.6.2  simonb 	u_char	vid_4[64];
    104  1.7.6.2  simonb 	u_char	vid_4_1[28];
    105  1.7.6.2  simonb 	u_long	sbsize;
    106  1.7.6.2  simonb 	u_char	vid_mot[8];	/* must contain "MOTOROLA" */
    107  1.7.6.2  simonb #define VID_MOT		"MOTOROLA"
    108  1.7.6.2  simonb 
    109  1.7.6.2  simonb 	/* CFG */
    110  1.7.6.2  simonb 	u_char	cfg_0[4];
    111  1.7.6.2  simonb 	u_short	cfg_atm;
    112  1.7.6.2  simonb 	u_short	cfg_prm;
    113  1.7.6.2  simonb 	u_short	cfg_atw;
    114  1.7.6.2  simonb 	u_short	cfg_rec;	/* block size (256) */
    115  1.7.6.2  simonb #define	CFG_REC		256
    116  1.7.6.2  simonb 
    117  1.7.6.2  simonb 	u_short	sparespertrack;
    118  1.7.6.2  simonb 	u_short	sparespercyl;
    119  1.7.6.2  simonb 	u_long	acylinders;
    120  1.7.6.2  simonb 	u_short	rpm;
    121  1.7.6.2  simonb 	u_short	cylskew;
    122  1.7.6.2  simonb 
    123  1.7.6.2  simonb 	u_char	cfg_spt;
    124  1.7.6.2  simonb 	u_char	cfg_hds;
    125  1.7.6.2  simonb 	u_short	cfg_trk;
    126  1.7.6.2  simonb 	u_char	cfg_ilv;
    127  1.7.6.2  simonb 	u_char	cfg_sof;
    128  1.7.6.2  simonb 	u_short	cfg_psm;	/* physical sector size (512) */
    129  1.7.6.2  simonb #define CFG_PSM		512
    130  1.7.6.2  simonb 	u_short	cfg_shd;
    131  1.7.6.2  simonb 	u_char	cfg_2[2];
    132  1.7.6.2  simonb 	u_short	cfg_pcom;
    133  1.7.6.2  simonb 	u_char	cfg_3;
    134  1.7.6.2  simonb 	u_char	cfg_ssr;
    135  1.7.6.2  simonb 	u_short	cfg_rwcc;
    136  1.7.6.2  simonb 	u_short	cfg_ecc;
    137  1.7.6.2  simonb 	u_short	cfg_eatm;
    138  1.7.6.2  simonb 	u_short	cfg_eprm;
    139  1.7.6.2  simonb 	u_short	cfg_eatw;
    140  1.7.6.2  simonb 	u_char	cfg_gpb1;
    141  1.7.6.2  simonb 	u_char	cfg_gpb2;
    142  1.7.6.2  simonb 	u_char	cfg_gpb3;
    143  1.7.6.2  simonb 	u_char	cfg_gpb4;
    144  1.7.6.2  simonb 	u_char	cfg_ssc;
    145  1.7.6.2  simonb 	u_char	cfg_runit;
    146  1.7.6.2  simonb 	u_short	cfg_rsvc1;
    147  1.7.6.2  simonb 	u_short	cfg_rsvc2;
    148  1.7.6.2  simonb 	u_long	magic2;
    149  1.7.6.2  simonb 	u_char	cfg_4[192];
    150  1.7.6.2  simonb } __attribute__((__packed__));
    151  1.7.6.2  simonb #endif /* _MACHINE_DISKLABEL_H_ */
    152