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 >
C/C++ Source or Header  |  1990-12-28  |  5KB  |  131 lines

  1. /*
  2. **      Partition End Record
  3. **  The *real* drive table and the slice table are found here.
  4. **  The drive info found in the mbb, pbb, and cmos are only used by
  5. **  other OSs, format(1), fdisk(1), and divvy(1).  The kernel uses
  6. **  the info stored here.
  7. **
  8. **  The Boot Sequence is as follows:
  9. **      ROM Code at 0xFF:0000   gains control at power on, performs POST,
  10. **                              reads in the boot code from the Master Boot
  11. **                              Block, and then executes it.
  12. **      The MBB code is read from Hard disk Unit 0, Cyl 0, Head 0, sector 1
  13. **                              (The first physical sector on the disk)
  14. **                              This code scans the partition table and
  15. **                              loads the Partition Boot Block code from the
  16. **                              active partition.  This code is the Unix
  17. **                              pre-boot code - it's job is to load the kernel
  18. **                              into memory and start it running...
  19. **      The Partition End Record holds info that the kernel and the hard disk
  20. **                              driver need in managing the drives:
  21. **      The Disk geometry stored here is that which is used by the hard disk
  22. **                              driver itself - the copies in the MBB and the
  23. **                              PBB are only used by the boot code to load and
  24. **                              initialize the kernel (and its drivers)
  25. **          The slice table tells unix where and how big your filesystems are.
  26. **          The minor device table on the FIRST hard disk holds the info for
  27. **                              BOTH the hard disks.  The minor device table on
  28. **                              the second hard disk is NOT USED.
  29. **                              (I don't really know what this table is for)
  30. **      The Bad Track Table is read in at boot time by the hard disk driver and
  31. **                              is used to map out bad tracks on the drive.
  32. **
  33. **  $Header: per.h,v 1.2 87/09/16 02:12:58 root Exp $
  34. */
  35.  
  36. #ifndef PER_H
  37. #define PER_H
  38.  
  39. #define SLICES 16
  40. #define MINORS 21   /* entries in minor device table */
  41. #define NUNITS 2    /* # of disk drives */
  42.  
  43. /* 
  44. ** The last sector in the active partition on each drive contains
  45. ** the following structure:
  46. */
  47.  
  48. typedef struct {
  49.     struct i1010drtab drtab;            /* drive geometry           */
  50.     struct i1010slice slice[SLICES];    /* slice table              */
  51.     unsigned int      miner[MINORS];    /* minor devices            */
  52.     unsigned char     dummy[ 512 - (    /* padding to block boundry */
  53.                                      sizeof(struct i1010drtab) +
  54.                                     (sizeof(struct i1010slice) * SLICES) +
  55.                                     (sizeof(unsigned int)      * MINORS)
  56.                                    ) ];
  57. } per_t;
  58.  
  59. #define DRTOFFSET   0     /* drive table offset from start of PER */
  60. #define SLTOFFSET   DRTOFFSET + sizeof(struct i1010drtab)
  61.  
  62. /*
  63.  * The minor device number is used as index into the i1010minor array.
  64.  * This array is defined in hd.conf.c. The defines below are to help
  65.  * understand the encoding, but it is still confusing.
  66.  */
  67.  
  68. #ifdef MP386
  69. #define USRDEV 3
  70. #define TMPDEV -1
  71. #define ROOTDEV 1
  72. #define SWAPDEV 2
  73. #else
  74. #define USRDEV 2
  75. #define TMPDEV 3
  76. #define ROOTDEV 0
  77. #define SWAPDEV 1
  78. #endif
  79.  
  80. /* THESE DEFS HAVE BEEN KLUDGED TO ALLOW THE DRIVE TABLE TO GROW > 16
  81.    The BOARD field has been shortened by two bits; DRTAB extended two */
  82.  
  83. #define BOARD(dev)      ((i1010minor[minor(dev)] >> 14 ) & 0x03)
  84. #define UNIT(dev)       ((i1010minor[minor(dev)] >> 10 ) & 0x0f)
  85. #define DRTAB(dev)      ((i1010minor[minor(dev)] >>  4 ) & 0x3f)
  86. #define SLICE(dev)      ((i1010minor[minor(dev)]       ) & 0x0f)
  87.  
  88. #define i1010MINOR(board,unit,drtab,slice) \
  89.         ((board<<14)|(unit<<10)|(drtab<<4)|slice)
  90.  
  91. /*
  92.  * Slice structure.  One per drtab[] entry.
  93.  */
  94.  
  95. struct  i1010slice {
  96.         daddr_t p_fsec;                 /* first sector */
  97.         daddr_t p_nsec;                 /* number sectors */
  98. };
  99.  
  100. /*
  101.  * this is the drive table for the WD1010 devices
  102.  */
  103.  
  104. struct  i1010drtab {    /* note that since the V/AT cc does not        */
  105.                         /* pack structures, this is not going to       */
  106.                         /* match the DOS ROM anyways...  SO why bother */
  107.                         /* putting in these stupid nulls?      -John P */
  108.         unsigned short  dr_ncyl;        /* # cylinders            */
  109.         unsigned char   dr_nfhead;      /* # of fixed heads       */
  110.         unsigned short  dr_null0;       /* dos compatable null    */
  111.         unsigned short  dr_precomp;     /* cylinder for precomp   */
  112.         unsigned char   dr_null1;       /*      dos null          */
  113.         unsigned char   dr_control;     /* dos disk control byte  */
  114.         unsigned char   dr_null2;       /*      dos null          */
  115.         unsigned char   dr_null3;       /*      dos null          */
  116.         unsigned char   dr_null4;       /*      dos null          */
  117.         unsigned short  dr_lzone;       /* landing zone for close */
  118.         unsigned char   dr_nsec;        /* # sectors per track    */
  119.         unsigned char   dr_null5;       /*      dos null          */
  120.  
  121.     /* Extensions from the DOS ROM type follow */
  122.  
  123.         unsigned short  dr_secsiz;      /* sector size */
  124.         unsigned char   dr_nalt;        /* # of alternate cylinders */
  125.         unsigned short  dr_spc;         /* actual sectors/cylinder */
  126.  
  127.         struct i1010slice *dr_slice;    /* slice table pointer */
  128. };
  129. #endif /* PER_H */
  130.  
  131.