1 /* 2 * Copyright (c) 1992 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Ralph Campbell. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)dec_boot.h 7.1 (Berkeley) 01/07/92 11 * 12 * devDiskLabel.h -- 13 * 14 * This defines the disk label that Sun writes on the 0'th sector of 15 * the 0'th cylinder of its SMD disks. The disk label contains some 16 * geometry information and also the division of the disk into a 17 * number of partitions. Each partition is identified to the drive 18 * by a different unit number. 19 * 20 * from: $Header: /sprite/src/kernel/dev/RCS/devDiskLabel.h, 21 * v 9.4 90/03/01 12:22:36 jhh Exp $ SPRITE (Berkeley) 22 */ 23 24 #ifndef _DEVDISKLABEL 25 #define _DEVDISKLABEL 26 27 /* 28 * SUN_NUM_DISK_PARTS is the number of partitions that are recorded in 29 * the label information. The size of the padding in the Sun_DiskLabel 30 * type is dependend on this number... 31 */ 32 #define SUN_NUM_DISK_PARTS 8 33 34 /* 35 * A disk is divided into partitions and this type specifies where a 36 * partition starts and how many blocks (sectors) it contains. 37 */ 38 typedef struct Sun_DiskMap { 39 int cylinder; 40 int numBlocks; 41 } Sun_DiskMap; 42 43 /* 44 * Label information on the zero'th sector. The partition map and the 45 * number of heads, sectors, and cylinders are used by the disk driver to 46 * map from a block number in a disk partion to a block number on the raw 47 * disk. The gap and interleaving information are used by the block 48 * allocation routines. 49 */ 50 typedef struct Sun_DiskLabel { 51 char asciiLabel[128]; /* For compatibility with other systems 52 * that write an ascii label on a disk*/ 53 char pad[512-(128+8*8+11*2)]; /* The sector size is 512 bytes, and 54 * padding puts our label info at the 55 * end of the sector. */ 56 unsigned short gap1; /* size of gap 1 */ 57 unsigned short gap2; /* size of gap 2 */ 58 unsigned short interleave; /* interleave factor */ 59 unsigned short numCylinders; /* # of data cylinders */ 60 unsigned short numAltCylinders; /* # of alternate cylinders */ 61 unsigned short numHeads; /* # of heads in this partition */ 62 unsigned short numSectors; /* # of 512 byte sectors per track */ 63 unsigned short bhead; /* ?? Head number under which this 64 * label is found, consistency chk */ 65 unsigned short partitionID; /* physical partition # */ 66 Sun_DiskMap map[SUN_NUM_DISK_PARTS]; /* Indicates the size and starting 67 * cylinder of the disk partitions */ 68 unsigned short magic; /* Identifies this label format */ 69 unsigned short checkSum; /* XOR checksum of sector */ 70 } Sun_DiskLabel; 71 72 #define SUN_DISK_MAGIC 0xDABE 73 74 /* 75 * The sun label does not describe the location of the filesystem header 76 * information that comes after the zero'th label sector. (The sprite label 77 * will, but is never used.) Instead, the following constants are used. 78 * SUN_SUMMARY_SECTOR one sector of summary info 79 * SUN_DOMAIN_SECTOR the first sector of the static domain header 80 */ 81 #define SUN_SUMMARY_SECTOR 17 82 #define SUN_DOMAIN_SECTOR 18 83 84 /* 85 * SUN_LABEL_SECTOR -- sector holding the disk label 86 * SUN_BOOT_SECTOR -- first sector of the boot program 87 */ 88 #define SUN_LABEL_SECTOR 0 89 #define SUN_BOOT_SECTOR 1 90 91 /* 92 * DEC_NUM_DISK_PARTS is the number of partitions that are recorded in 93 * the label information. The size of the padding in the Dec_DiskLabel 94 * type is dependend on this number... 95 */ 96 #define DEC_NUM_DISK_PARTS 8 97 98 /* 99 * A disk is divided into partitions and this type specifies where a 100 * partition starts and how many bytes it contains. 101 */ 102 typedef struct Dec_DiskMap { 103 int numBlocks; /* Number of 512 byte blocks in partition. */ 104 int startBlock; /* Start of partition in blocks. */ 105 } Dec_DiskMap; 106 107 typedef struct Dec_BootMap { 108 int numBlocks; /* Number of blocks to read. */ 109 int startBlock; /* Starting block on disk. */ 110 } Dec_BootMap; 111 112 /* 113 * Label information on the 31st (DEC_LABEL_SECTOR) sector. 114 */ 115 typedef struct Dec_DiskLabel { 116 char pad0[440]; /* DIFFERENT from sprite!!! */ 117 int magic; /* DEC_LABEL_MAGIC */ 118 int isPartitioned; /* 1 if disk is partitioned. */ 119 Dec_DiskMap map[DEC_NUM_DISK_PARTS]; /* Indicates disk partitions. */ 120 } Dec_DiskLabel; 121 122 /* 123 * Boot block information on the 0th sector. 124 * The boot program is stored in sequences of contiguous blocks. 125 * If mode is 0, there is just one sequence of blocks and one Dec_BootMap 126 * is used. If mode is 1, there are multiple sequences of blocks 127 * and multiple Dec_BootMaps are used, the last with numBlocks = 0. 128 */ 129 typedef struct Dec_DiskBoot { 130 char pad[8]; 131 int magic; /* DEC_BOOT_MAGIC */ 132 int mode; /* Mode for boot info. */ 133 int loadAddr; /* Address to start loading. */ 134 int execAddr; /* Address to start execing. */ 135 Dec_BootMap map[61]; /* Position of boot program. */ 136 } Dec_DiskBoot; 137 138 #define DEC_BOOT_MAGIC 0x02757a 139 #define DEC_LABEL_MAGIC 0x032957 140 141 /* 142 * The following default values are used: 143 * DEC_BOOT_SECTOR The sector holding the boot information. 144 * DEC_SUMMARY_SECTOR one sector of summary info 145 * DEC_DOMAIN_SECTOR the first sector of the static domain header 146 * DEC_LABEL_SECTOR The sector holding the disk label. 147 */ 148 #define DEC_BOOT_SECTOR 0 149 #define DEC_SUMMARY_SECTOR 17 150 #define DEC_DOMAIN_SECTOR 18 151 #define DEC_LABEL_SECTOR 31 152 153 /* 154 * There are generally 8 disk partitions defined for a disk. 155 */ 156 #define DEV_NUM_DISK_PARTS 8 157 158 #endif /* _DEVDISKLABEL */ 159