Home | History | Annotate | Line # | Download | only in include
disklabel.h revision 1.7
      1  1.7  lukem /*	$NetBSD: disklabel.h,v 1.7 2002/01/28 23:09:54 lukem Exp $	*/
      2  1.1    wdk 
      3  1.1    wdk /*
      4  1.1    wdk  * Copyright (c) 2000 Wayne Knowles.     All rights reserved.
      5  1.1    wdk  *
      6  1.1    wdk  * Redistribution and use in source and binary forms, with or without
      7  1.1    wdk  * modification, are permitted provided that the following conditions
      8  1.1    wdk  * are met:
      9  1.1    wdk  * 1. Redistributions of source code must retain the above copyright
     10  1.1    wdk  *    notice, this list of conditions and the following disclaimer.
     11  1.1    wdk  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1    wdk  *    notice, this list of conditions and the following disclaimer in the
     13  1.1    wdk  *    documentation and/or other materials provided with the distribution.
     14  1.1    wdk  * 3. All advertising materials mentioning features or use of this software
     15  1.1    wdk  *    must display the following acknowledgement:
     16  1.1    wdk  *      This product includes software developed by Christopher G. Demetriou.
     17  1.1    wdk  * 4. The name of the author may not be used to endorse or promote products
     18  1.1    wdk  *    derived from this software without specific prior written permission
     19  1.1    wdk  *
     20  1.1    wdk  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  1.1    wdk  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  1.1    wdk  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  1.1    wdk  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  1.1    wdk  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  1.1    wdk  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  1.1    wdk  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  1.1    wdk  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  1.1    wdk  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  1.1    wdk  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  1.1    wdk  */
     31  1.1    wdk 
     32  1.1    wdk #ifndef _MACHINE_DISKLABEL_H_
     33  1.1    wdk #define _MACHINE_DISKLABEL_H_
     34  1.1    wdk 
     35  1.1    wdk /*
     36  1.1    wdk  * MIPS partition conventions:
     37  1.1    wdk  *
     38  1.1    wdk  * Partition 0 - root
     39  1.1    wdk  * Partition 1 - swap
     40  1.1    wdk  * Partition 6 - usr
     41  1.1    wdk  * Partition 7 - volume body
     42  1.1    wdk  * Partition 8 - volume header
     43  1.1    wdk  * Partition 10 - whole disk
     44  1.1    wdk  */
     45  1.1    wdk 
     46  1.7  lukem #define LABELSECTOR	1
     47  1.7  lukem #define LABELOFFSET	0
     48  1.5    wiz #define MAXPARTITIONS	8	/* XXX - NetBSD Compatibility */
     49  1.1    wdk #define RAW_PART	2
     50  1.1    wdk 
     51  1.2    wdk #define MIPS_PARTITIONS	16	/* Number or partitions for Mips */
     52  1.2    wdk #define MIPS_NVOLDIR	15	/* Number of volume directory files */
     53  1.2    wdk #define MIPS_VDIRSZ	8	/* File name size in volume directory */
     54  1.2    wdk #define MIPS_BFSIZE	16	/* Boot filename size */
     55  1.4    wdk #define	MIPS_VHSECTOR	0	/* Sector number for MIPS volume header */
     56  1.2    wdk 
     57  1.2    wdk /*
     58  1.2    wdk  * Devices parameters that RISC/os uses for mapping logical block numbers
     59  1.2    wdk  * to physical device addresses.
     60  1.2    wdk  */
     61  1.2    wdk struct mips_devparams {
     62  1.2    wdk 	u_int8_t	dp_skew;	/* spiral addressing skew */
     63  1.2    wdk 	u_int8_t	dp_gap1;	/* words of 0 before header */
     64  1.2    wdk 	u_int8_t	dp_gap2;	/* words of 0 between hdr and data */
     65  1.2    wdk 	u_int8_t	dp_spare0;	/* spare space */
     66  1.2    wdk 	u_int16_t	dp_cyls;	/* number of cylinders */
     67  1.2    wdk 	u_int16_t	dp_shd0;	/* starting head vol 0 */
     68  1.2    wdk 	u_int16_t	dp_trks0;	/* number of tracks vol 0 */
     69  1.2    wdk 	u_int16_t	dp_shd1;	/* starting head vol 1 */
     70  1.2    wdk 	u_int16_t	dp_trks1;	/* number of tracks vol 1 */
     71  1.2    wdk 	u_int16_t	dp_secs;	/* number of sectors/track */
     72  1.2    wdk 	u_int16_t	dp_secbytes;	/* length of sector in bytes */
     73  1.2    wdk 	u_int16_t	dp_interleave;	/* sector interleave */
     74  1.2    wdk 	int32_t		dp_flags;	/* controller characteristics */
     75  1.2    wdk 	int32_t		dp_datarate;	/* bytes/sec for kernel stats */
     76  1.2    wdk 	int32_t		dp_nretries;	/* max num retries on data error */
     77  1.2    wdk 	int32_t		dp_spare1;	/* spare entries */
     78  1.2    wdk 	int32_t		dp_spare2;
     79  1.2    wdk 	int32_t		dp_spare3;
     80  1.2    wdk 	int32_t		dp_spare4;
     81  1.2    wdk } __attribute__((__packed__));
     82  1.2    wdk 
     83  1.2    wdk /*
     84  1.2    wdk  * Volume directory is used as a shortcut to find bootstraps etc
     85  1.2    wdk  */
     86  1.2    wdk struct mips_voldir {			/* Disk volume directory */
     87  1.2    wdk 	char 		vd_name[MIPS_VDIRSZ];
     88  1.2    wdk 	int32_t		vd_lba;
     89  1.2    wdk 	int32_t		vd_len;
     90  1.2    wdk };
     91  1.2    wdk 
     92  1.2    wdk struct mips_partitions {
     93  1.2    wdk 	int32_t 	pt_size;	/* # of logical blocks in partition */
     94  1.6    wiz 	int32_t 	pt_offset;	/* first logical block of partition */
     95  1.2    wdk 	int32_t 	pt_fstype;
     96  1.1    wdk };
     97  1.1    wdk 
     98  1.2    wdk /*
     99  1.2    wdk  * Mips RISC/os compatible volume header and partition table
    100  1.2    wdk  *
    101  1.2    wdk  * 1 sector (512 bytes) in size, and normally copied to the first sector
    102  1.2    wdk  * and cylinder of every track on a disk.
    103  1.2    wdk  */
    104  1.1    wdk struct mips_volheader {
    105  1.1    wdk 	u_int32_t	vh_magic;
    106  1.2    wdk #define MIPS_VHMAGIC	0xbe5a941
    107  1.2    wdk 	int16_t		vh_root;		/* Root partition number */
    108  1.2    wdk 	int16_t		vh_swap;		/* Swap partition number */
    109  1.2    wdk 	char		bootfile[MIPS_BFSIZE];	/* default file to boot */
    110  1.2    wdk 	struct mips_devparams	vh_dp;		/* disk device parameters */
    111  1.2    wdk 	struct mips_voldir 	vh_voldir[MIPS_NVOLDIR];
    112  1.2    wdk 	struct mips_partitions	vh_part[MIPS_PARTITIONS];
    113  1.2    wdk 	int32_t		vh_cksum;
    114  1.2    wdk 	int32_t		vh_pad;
    115  1.1    wdk } __attribute__((__packed__));
    116  1.1    wdk 
    117  1.2    wdk #define MIPS_FS_VOLHDR	0
    118  1.2    wdk #define MIPS_FS_TRKREPL 1
    119  1.2    wdk #define MIPS_FS_SECREPL	2
    120  1.2    wdk #define MIPS_FS_RAW	3
    121  1.2    wdk #define MIPS_FS_BSD     4
    122  1.2    wdk #define MIPS_FS_BSD42   4
    123  1.2    wdk #define MIPS_FS_SYSV    5
    124  1.2    wdk #define MIPS_FS_VOLUME	6 /* Entire volume */
    125  1.2    wdk 
    126  1.4    wdk /* Just a dummy */
    127  1.2    wdk struct cpu_disklabel {
    128  1.4    wdk 	int	cd_dummy;			/* must have one element. */
    129  1.2    wdk };
    130  1.1    wdk 
    131  1.1    wdk #endif /* _MACHINE_DISKLABEL_H_ */
    132