1 /* $NetBSD: ahdilbl.h,v 1.3 2001/07/26 23:07:57 wiz 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 516 /* offset of disk label in bytes, 48 relative to start of boot block */ 49 #define LABELMAXSIZE 1020 /* 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 auxiliary root sectors */ 56 57 struct bootblock { 58 u_int8_t bb_xxboot[LABELOFFSET - sizeof(u_int32_t)]; 59 /* first-stage boot loader */ 60 u_int32_t bb_magic; /* boot block magic number */ 61 #define NBDAMAGIC 0x4e424441 62 #define AHDIMAGIC 0x41484449 63 u_int8_t bb_label[LABELMAXSIZE]; /* disk pack label */ 64 u_int8_t bb_bootxx[BBMINSIZE - (LABELOFFSET + LABELMAXSIZE)]; 65 /* second-stage boot loader*/ 66 }; 67 68 #define BBGETLABEL(bb, dl) *(dl) = *((struct disklabel *)(bb)->bb_label) 69 #define BBSETLABEL(bb, dl) *((struct disklabel *)(bb)->bb_label) = *(dl) 70 71 /***** from src/sys/arch/atari/include/ahdilabel.h *************************/ 72 73 #define AHDI_BSIZE 512 /* AHDI blocksize */ 74 #define AHDI_BBLOCK 0 /* AHDI bootblock (root sector) */ 75 #define AHDI_MAXROOTS (MAXAUXROOTS) /* max. # of AHDI rootsectors */ 76 #define AHDI_MAXPARTS (AHDI_MAXROOTS+3) /* max. # of AHDI partitions */ 77 78 /* 79 * Various `well known' AHDI partition identifiers. 80 */ 81 #define AHDI_MKPID(x,y,z) ( ((u_int32_t)(x) << 16) \ 82 | ((u_int32_t)(y) << 8) \ 83 | ((u_int32_t)(z)) \ 84 ) 85 #define AHDI_PID_XGM AHDI_MKPID('X','G','M') 86 #define AHDI_PID_GEM AHDI_MKPID('G','E','M') 87 #define AHDI_PID_BGM AHDI_MKPID('B','G','M') 88 #define AHDI_PID_RAW AHDI_MKPID('R','A','W') 89 #define AHDI_PID_SWP AHDI_MKPID('S','W','P') 90 #define AHDI_PID_NBD AHDI_MKPID('N','B','D') 91 #define AHDI_PID_NBR AHDI_MKPID('N','B','R') 92 #define AHDI_PID_NBS AHDI_MKPID('N','B','S') 93 #define AHDI_PID_NBU AHDI_MKPID('N','B','U') 94 95 /* 96 * Format of AHDI boot block. 97 */ 98 #define AHDI_MAXRPD 4 /* max. # of partition descriptors */ 99 /* in the AHDI bootblock (aka root)*/ 100 #define AHDI_MAXARPD 2 /* max. # of partition descriptors */ 101 /* in an AHDI auxiliary root sector */ 102 103 struct ahdi_part { 104 u_int8_t ap_flg; /* bit 0 is in-use flag */ 105 u_int8_t ap_id[3]; /* id: GEM, BGM, XGM, UNX, MIX */ 106 u_int32_t ap_offs; /* block where partition starts */ 107 u_int32_t ap_size; /* partition size in blocks */ 108 #define ap_end ap_size /* in the in-core copy, store end instead of size */ 109 }; 110 111 struct ahdi_root { 112 u_int8_t ar_fill[0x1c2];/* filler, can be boot code */ 113 u_int32_t ar_hdsize; /* size of entire volume in blocks */ 114 struct ahdi_part ar_parts[AHDI_MAXRPD]; /* root partition table */ 115 u_int32_t ar_bslst; /* start of bad-sector list */ 116 u_int32_t ar_bslsize; /* # of blocks in bad-sector list */ 117 u_int16_t ar_cksum; 118 }; 119 120 #endif /* AHDILABEL_H */ 121