home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1035
/
per.h
< prev
next >
Wrap
C/C++ Source or Header
|
1990-12-28
|
5KB
|
131 lines
/*
** Partition End Record
** The *real* drive table and the slice table are found here.
** The drive info found in the mbb, pbb, and cmos are only used by
** other OSs, format(1), fdisk(1), and divvy(1). The kernel uses
** the info stored here.
**
** The Boot Sequence is as follows:
** ROM Code at 0xFF:0000 gains control at power on, performs POST,
** reads in the boot code from the Master Boot
** Block, and then executes it.
** The MBB code is read from Hard disk Unit 0, Cyl 0, Head 0, sector 1
** (The first physical sector on the disk)
** This code scans the partition table and
** loads the Partition Boot Block code from the
** active partition. This code is the Unix
** pre-boot code - it's job is to load the kernel
** into memory and start it running...
** The Partition End Record holds info that the kernel and the hard disk
** driver need in managing the drives:
** The Disk geometry stored here is that which is used by the hard disk
** driver itself - the copies in the MBB and the
** PBB are only used by the boot code to load and
** initialize the kernel (and its drivers)
** The slice table tells unix where and how big your filesystems are.
** The minor device table on the FIRST hard disk holds the info for
** BOTH the hard disks. The minor device table on
** the second hard disk is NOT USED.
** (I don't really know what this table is for)
** The Bad Track Table is read in at boot time by the hard disk driver and
** is used to map out bad tracks on the drive.
**
** $Header: per.h,v 1.2 87/09/16 02:12:58 root Exp $
*/
#ifndef PER_H
#define PER_H
#define SLICES 16
#define MINORS 21 /* entries in minor device table */
#define NUNITS 2 /* # of disk drives */
/*
** The last sector in the active partition on each drive contains
** the following structure:
*/
typedef struct {
struct i1010drtab drtab; /* drive geometry */
struct i1010slice slice[SLICES]; /* slice table */
unsigned int miner[MINORS]; /* minor devices */
unsigned char dummy[ 512 - ( /* padding to block boundry */
sizeof(struct i1010drtab) +
(sizeof(struct i1010slice) * SLICES) +
(sizeof(unsigned int) * MINORS)
) ];
} per_t;
#define DRTOFFSET 0 /* drive table offset from start of PER */
#define SLTOFFSET DRTOFFSET + sizeof(struct i1010drtab)
/*
* The minor device number is used as index into the i1010minor array.
* This array is defined in hd.conf.c. The defines below are to help
* understand the encoding, but it is still confusing.
*/
#ifdef MP386
#define USRDEV 3
#define TMPDEV -1
#define ROOTDEV 1
#define SWAPDEV 2
#else
#define USRDEV 2
#define TMPDEV 3
#define ROOTDEV 0
#define SWAPDEV 1
#endif
/* THESE DEFS HAVE BEEN KLUDGED TO ALLOW THE DRIVE TABLE TO GROW > 16
The BOARD field has been shortened by two bits; DRTAB extended two */
#define BOARD(dev) ((i1010minor[minor(dev)] >> 14 ) & 0x03)
#define UNIT(dev) ((i1010minor[minor(dev)] >> 10 ) & 0x0f)
#define DRTAB(dev) ((i1010minor[minor(dev)] >> 4 ) & 0x3f)
#define SLICE(dev) ((i1010minor[minor(dev)] ) & 0x0f)
#define i1010MINOR(board,unit,drtab,slice) \
((board<<14)|(unit<<10)|(drtab<<4)|slice)
/*
* Slice structure. One per drtab[] entry.
*/
struct i1010slice {
daddr_t p_fsec; /* first sector */
daddr_t p_nsec; /* number sectors */
};
/*
* this is the drive table for the WD1010 devices
*/
struct i1010drtab { /* note that since the V/AT cc does not */
/* pack structures, this is not going to */
/* match the DOS ROM anyways... SO why bother */
/* putting in these stupid nulls? -John P */
unsigned short dr_ncyl; /* # cylinders */
unsigned char dr_nfhead; /* # of fixed heads */
unsigned short dr_null0; /* dos compatable null */
unsigned short dr_precomp; /* cylinder for precomp */
unsigned char dr_null1; /* dos null */
unsigned char dr_control; /* dos disk control byte */
unsigned char dr_null2; /* dos null */
unsigned char dr_null3; /* dos null */
unsigned char dr_null4; /* dos null */
unsigned short dr_lzone; /* landing zone for close */
unsigned char dr_nsec; /* # sectors per track */
unsigned char dr_null5; /* dos null */
/* Extensions from the DOS ROM type follow */
unsigned short dr_secsiz; /* sector size */
unsigned char dr_nalt; /* # of alternate cylinders */
unsigned short dr_spc; /* actual sectors/cylinder */
struct i1010slice *dr_slice; /* slice table pointer */
};
#endif /* PER_H */