DVH(5spp) RISC/os Reference Manual DVH(5spp)
NAME
dvh - format of MIPS disk volume header
SYNOPSIS
#include <mips/dvh.h>
DESCRIPTION
Disk volumes on MIPS computers systems contain a volume
header that describes the contents of the disk and parame-
ters of the physical disk drive. Volume headers are created
by format(8), and manipulated by dvhtool(8). The MIPS PROM
monitor reads disk volume headers to determine the appropri-
ate file to boot on autobooting.
The volume header is a block located at the beginning of all
disk media. It contains information pertaining to physical
device parameters and logical partition information. The
volume header is manipulated by disk formatters/verifiers,
partition builders (e.g., newfs/mkfs), and device drivers.
A copy of the volume header is located at sector 0 of each
track of cylinder 0. The volume header is constrained to be
less than 512 bytes long. A particular copy is assumed
valid if no drive errors are detected, the magic number is
correct, and the 32 bit 2's complement of the volume header
is correct. The checksum is calculated by initially zeroing
vh_csum, 2's complement summing the entire structure and
then storing the 2's complement of the sum. Thus resumming
a previously checksumed header should yield 0 to verify the
volume header.
SMD drives use an error summary table, bad sector replace-
ment table, and boot blocks, which are located by searching
the volume directory within the volume header. Tables are
sized simply by the integral number of table records that
will fit in the space indicated by the directory entry. The
amount of space allocated to the volume header, replacement
blocks, and other tables is user defined when the device is
formatted.
Device parameters are in the volume header to determine map-
ping from logical block numbers to physical device
addresses, allow the driver to properly configure itself and
the controller for the given disk drive, and to allow the
operating system to know various parameters (such as
transfer rate) of the disk system.
The partition table describes logical device partitions
(device drivers examine this to determine mapping from logi-
cal units to cylinder groups, device formatters/verifiers
examine this to determine location of replacement
tracks/sectors, etc.).
Printed 1/6/92 Page 1
DVH(5spp) RISC/os Reference Manual DVH(5spp)
NOTE: the field pt_firstlbn should be cylinder aligned.
The error table records media defects and allows for
"automatic" replacement of bad blocks and more informative
error logging.
The bad sector table is used to map from bad sectors/tracks
to replacement sector/tracks. To identify available
replacement sectors/tracks, allocate replacements in
increasing block number from a replacement partition. When
a new replacement sector/track is needed scan the bad sector
table to determine current highest replacement sector/track
block number and then scan the device from the next block
until a defect free replacement sector/track is found or the
end of replacement partition is reached. If bt_rpltype ==
BSTTYPE_TRKFWD, then bt_badlbn refers to the bad logical
block within the bad track, and bt_rpllbn refers to the
first sector of the replacement track. If bt_rpltype ==
BSTTYPE_SLIPSEC or bt_rpltype == BSTTYPE_SLIPBAD, then
bt_rpllbn has no meaning.
The format of the dvh disk volume header is:
struct device_parameters {
u_char dp_skew; /* spiral addressing skew */
u_char dp_gap1; /* words of 0 before header */
u_char dp_gap2; /* words of 0 between hdr and data */
u_char dp_spare0; /* spare space */
u_short dp_cyls; /* number of cylinders */
u_short dp_shd0; /* starting head vol 0 */
u_short dp_trks0; /* number of tracks vol 0 */
u_short dp_shd1; /* starting head vol 1 */
u_short dp_trks1; /* number of tracks vol 1 */
u_short dp_secs; /* number of sectors/track */
u_short dp_secbytes; /* length of sector in bytes */
u_short dp_interleave; /* sector interleave */
int dp_flags; /* controller characteristics */
int dp_datarate; /* bytes/sec for kernel stats */
int dp_nretries; /* max num retries on data error */
int dp_spare1; /* spare entries */
int dp_spare2;
int dp_spare3;
int dp_spare4;
};
/*
* Device characterization flags
* (dp_flags)
*/
#define DP_SECTSLIP 0x00000001 /* sector slip to spare sector */
#define DP_SECTFWD 0x00000002 /* forward to replacement sector */
#define DP_TRKFWD 0x00000004 /* forward to replacement track */
Page 2 Printed 1/6/92
DVH(5spp) RISC/os Reference Manual DVH(5spp)
#define DP_MULTIVOL 0x00000008 /* multiple volumes per spindle */
#define DP_IGNOREERRORS 0x00000010 /* transfer data regardless of errors */
#define DP_RESEEK 0x00000020 /* recalibrate as last resort */
#define VDNAMESIZE 8
struct volume_directory {
char vd_name[VDNAMESIZE]; /* name */
int vd_lbn; /* logical block number */
int vd_nbytes; /* file length in bytes */
};
struct partition_table { /* one per logical partition */
int pt_nblks; /* # of logical blks in partition */
int pt_firstlbn; /* first lbn of partition */
int pt_type; /* use of partition */
};
#define PTYPE_VOLHDR 0 /* partition is volume header */
#define PTYPE_TRKREPL 1 /* partition is used for repl trks */
#define PTYPE_SECREPL 2 /* partition is used for repl secs */
#define PTYPE_RAW 3 /* partition is used for data */
#define PTYPE_BSD42 4 /* partition is 4.2BSD file system */
#define PTYPE_SYSV 5 /* partition is SysV file system */
#define PTYPE_VOLUME 6 /* partition is entire volume */
#define VHMAGIC 0xbe5a941 /* randomly chosen value */
#define NPARTAB 16 /* 16 unix partitions */
#define NVDIR 15 /* max of 15 directory entries */
#define BFNAMESIZE 16 /* max 16 chars in boot file name */
struct volume_header {
int vh_magic; /* identifies volume header */
short vh_rootpt; /* root partition number */
short vh_swappt; /* swap partition number */
char vh_bootfile[BFNAMESIZE]; /* name of file to boot */
struct device_parameters vh_dp; /* device parameters */
struct volume_directory vh_vd[NVDIR]; /* other vol hdr contents */
struct partition_table vh_pt[NPARTAB]; /* device partition layout */
int vh_csum; /* volume header checksum */
};
#define ERR_SECC 0 /* soft ecc */
#define ERR_HECC 1 /* hard ecc */
#define ERR_HCSUM 2 /* header checksum */
#define ERR_SOTHER 3 /* any other soft errors */
#define ERR_HOTHER 4 /* any other hard errors */
#define NERRTYPES 5 /* Total number of error types */
struct error_table { /* one per defective logical block */
int et_lbn; /* defective block number */
Printed 1/6/92 Page 3
DVH(5spp) RISC/os Reference Manual DVH(5spp)
int et_errcount[NERRTYPES]; /* counts for each error type */
};
struct bst_table {
int bt_badlbn; /* bad logical block */
int bt_rpllbn; /* replacement logical block */
int bt_rpltype; /* replacement method */
};
/*
* replacement types
*/
#define BSTTYPE_EMPTY 0 /* slot unused */
#define BSTTYPE_SLIPSEC 1 /* sector slipped to next sector */
#define BSTTYPE_SECFWD 2 /* sector forwarded to replacement sector */
#define BSTTYPE_TRKFWD 3 /* track forwarded to replacement track */
#define BSTTYPE_SLIPBAD 4 /* sector reserved for slipping has defect */
#define BSTTYPE_RUNTBAD 5 /* run sector contains defect*/
/*
* The following structs are parameters to various driver ioctls
* for disk formatting, etc.
*/
/*
* controller information struct
* returned via DIOCGETCTLR
* mostly to determine appropriate method for bad block handling
*/
#define CITYPESIZE 32
struct ctlr_info {
int ci_flags; /* same as DP_* flags */
char ci_type[CITYPESIZE]; /* controller model and manuf. */
};
/*
* verify sectors information
* Passed to device driver via ioctl DIOCVFYSEC
*/
struct verify_info {
int vi_lbn; /* logical block number */
int vi_bcnt; /* logical block count */
};
/*
* cause controller to run diagnostics
*/
struct diag_info {
int di_errcode; /* error code */
int di_lbn; /* logical block number */
int di_bcnt; /* logical block count */
char *di_addr; /* buffer address */
Page 4 Printed 1/6/92
DVH(5spp) RISC/os Reference Manual DVH(5spp)
};
/*
* information necessary to perform one of the following actions:
* format a track
* fmi_cyl and fmi_trk identify track to format
* map a track
* fmi_cyl and fmi_trk identify defective track
* fmi_rplcyl and fmi_rpltrk identify replacement track
* map a sector
* fmi_cyl, fmi_trk, and fmi_sec identify defective sector
* fmi_rplcyl, fmi_rpltrk, and fmi_rplsec identify
* replacement sector
* slip a sector
* fmi_cyl, fmi_trk, and fmi_sec identify defective sector
*/
#define FMI_FORMAT_TRACK 1 /* format a track */
#define FMI_MAP_TRACK 2 /* map a track */
#define FMI_MAP_SECTOR 3 /* map a sector */
#define FMI_SLIP_SECTOR 4 /* slip a sector */
struct fmt_map_info {
int fmi_action; /* action desired, see FMI_ above */
u_short fmi_cyl; /* cylinder with defect or one with */
/* track to format */
u_char fmi_trk; /* track with defect or one to format */
u_char fmi_sec; /* sector with defect */
u_short fmi_rplcyl; /* replacement cylinder */
u_char fmi_rpltrk; /* replacement track */
u_char fmi_rplsec; /* replacement sector */
};
RESTRICTIONS
SEE ALSO
dvhtool(8)
format(8)
MIPS PROM MONITOR manual
Printed 1/6/92 Page 5