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