Home | History | Annotate | Line # | Download | only in aptck
ahdilbl.h revision 1.1
      1 /*	$NetBSD: ahdilbl.h,v 1.1 1996/01/16 15:15:06 leo Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1995 Leo Weppelman.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *      This product includes software developed by Leo Weppelman.
     18  * 4. The name of the author may not be used to endorse or promote products
     19  *    derived from this software without specific prior written permission
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 
     33 #ifndef AHDILABEL_H
     34 #define AHDILABEL_H
     35 
     36 /***** from src/sys/arch/atari/include/disklabel.h *************************/
     37 
     38 /*
     39  * On a volume, exclusively used by NetBSD, the boot block starts at
     40  * sector 0. To allow shared use of a volume between two or more OS's
     41  * the vendor specific AHDI format is supported. In this case the boot
     42  * block is located at the start of an AHDI partition. In any case the
     43  * size of the boot block must be at least 8KB.
     44  */
     45 #define	BBMINSIZE	8192		/* minimum size of boot block      */
     46 #define	LABELSECTOR	0		/* `natural' start of boot block   */
     47 #define	LABELOFFSET	512		/* offset of disk label in bytes,
     48 					   relative to start of boot block */
     49 #define	LABELMAXSIZE	1024		/* maximum size of disk label      */
     50 
     51 #define	MAXPARTITIONS	16		/* max. # of NetBSD partitions     */
     52 #define	RAW_PART	2		/* xx?c is raw partition	   */
     53 
     54 #define	NO_BOOT_BLOCK	((u_int)-1)
     55 #define	MAXAUXROOTS	29		/* max. # of auxilary root sectors */
     56 
     57 struct bootblock {
     58 	u_int8_t	bb_xxboot[LABELOFFSET];	/* first-stage boot loader */
     59 	u_int8_t	bb_dlabel[LABELMAXSIZE];/* disk pack label         */
     60 	u_int8_t	bb_bootxx[BBMINSIZE - (LABELOFFSET + LABELMAXSIZE)];
     61 						/* second-stage boot loader*/
     62 };
     63 
     64 #define	BBGETLABEL(bb, dl)	*(dl) = *((struct disklabel *)(bb)->bb_dlabel)
     65 #define	BBSETLABEL(bb, dl)	*((struct disklabel *)(bb)->bb_dlabel) = *(dl)
     66 
     67 /***** from src/sys/arch/atari/include/ahdilabel.h *************************/
     68 
     69 #define	AHDI_BSIZE	512		/* AHDI blocksize		*/
     70 #define	AHDI_BBLOCK	0		/* AHDI bootblock (root sector)	*/
     71 #define	AHDI_MAXROOTS	(MAXAUXROOTS)	/* max. # of AHDI rootsectors	*/
     72 #define	AHDI_MAXPARTS	(AHDI_MAXROOTS+3) /* max. # of AHDI partitions	*/
     73 
     74 /*
     75  * Various `well known' AHDI partition identifiers.
     76  */
     77 #define	AHDI_MKPID(x,y,z)	(   ((u_int32_t)(x) << 16)	\
     78 				  | ((u_int32_t)(y) << 8)	\
     79 				  | ((u_int32_t)(z))		\
     80 				)
     81 #define	AHDI_PID_XGM	AHDI_MKPID('X','G','M')
     82 #define	AHDI_PID_GEM	AHDI_MKPID('G','E','M')
     83 #define	AHDI_PID_BGM	AHDI_MKPID('B','G','M')
     84 #define	AHDI_PID_RAW	AHDI_MKPID('R','A','W')
     85 #define	AHDI_PID_SWP	AHDI_MKPID('S','W','P')
     86 #define	AHDI_PID_NBD	AHDI_MKPID('N','B','D')
     87 #define	AHDI_PID_NBR	AHDI_MKPID('N','B','R')
     88 #define	AHDI_PID_NBS	AHDI_MKPID('N','B','S')
     89 #define	AHDI_PID_NBU	AHDI_MKPID('N','B','U')
     90 
     91 /*
     92  * Format of AHDI boot block.
     93  */
     94 #define	AHDI_MAXRPD	4		/* max. # of partition descriptors */
     95 					/* in the AHDI bootblock (aka root)*/
     96 #define	AHDI_MAXARPD	2		/* max. # of partition descriptors */
     97 					/* in an AHDI auxilary root sector */
     98 
     99 struct ahdi_part {
    100 	u_int8_t	ap_flg;		/* bit 0 is in-use flag            */
    101 	u_int8_t	ap_id[3];	/* id: GEM, BGM, XGM, UNX, MIX     */
    102 	u_int32_t	ap_offs;	/* block where partition starts    */
    103 	u_int32_t	ap_size;	/* partition size in blocks        */
    104 #define	ap_end	ap_size /* in the in-core copy, store end instead of size  */
    105 };
    106 
    107 struct ahdi_root {
    108 	u_int8_t	 ar_fill[0x1c2];/* filler, can be boot code        */
    109 	u_int32_t	 ar_hdsize;	/* size of entire volume in blocks */
    110 	struct ahdi_part ar_parts[AHDI_MAXRPD]; /* root partition table    */
    111 	u_int32_t	 ar_bslst;	/* start of bad-sector list        */
    112 	u_int32_t	 ar_bslsize;	/* # of blocks in bad-sector list  */
    113 	u_int16_t	 ar_cksum;
    114 };
    115 
    116 #endif /* AHDILABEL_H */
    117