home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / devcon / washington_1988 / devcon88.3 / autoboot / hardblocks.h < prev    next >
C/C++ Source or Header  |  1992-08-27  |  9KB  |  196 lines

  1. #ifndef    DEVICES_HARDBLOCKS_H
  2. #define    DEVICES_HARDBLOCKS_H
  3. /*
  4. **    $Filename: devices/hardblocks.h $
  5. **    $Revision: 1.0 $
  6. **    $Date: 88/07/11 15:32:49 $
  7. **
  8. **    File System identifier blocks for hard disks
  9. **
  10. **    (C) Copyright 1988 Commodore-Amiga, Inc.
  11. **        All Rights Reserved
  12. */
  13.  
  14. /*--------------------------------------------------------------------
  15.  *
  16.  *    This file describes blocks of data that exist on a hard disk
  17.  *    to describe that disk.  They are not generically accessable to
  18.  *    the user as they do not appear on any DOS drive.  The blocks
  19.  *    are tagged with a unique identifier, checksummed, and linked
  20.  *    together.  The root of these blocks is the RigidDiskBlock.
  21.  *
  22.  *    The RigidDiskBlock must exist on the disk within the first
  23.  *    RDB_LOCATION_LIMIT blocks.  This inhibits the use of the zero
  24.  *    cylinder in an AmigaDOS partition: although it is strictly
  25.  *    possible to store the RigidDiskBlock data in the reserved
  26.  *    area of a partition, this practice is discouraged since the
  27.  *    reserved blocks of a partition are overwritten by "Format",
  28.  *    "Install", "DiskCopy", etc.  The recommended disk layout,
  29.  *    then, is to use the first cylinder(s) to store all the drive
  30.  *    data specified by these blocks: i.e. partition descriptions,
  31.  *    file system load images, drive bad block maps, spare blocks,
  32.  *    etc.
  33.  *
  34.  *    Though only 512 byte blocks are currently supported by the
  35.  *    file system, this proposal tries to be forward-looking by
  36.  *    making the block size explicit, and by using only the first
  37.  *    256 bytes for all blocks but the LoadSeg data.
  38.  *
  39.  *------------------------------------------------------------------*/
  40.  
  41. /*
  42.  *  NOTE
  43.  *    optional block addresses below contain $ffffffff to indicate
  44.  *    a NULL address, as zero is a valid address
  45.  */
  46. struct RigidDiskBlock {
  47.     ULONG   rdb_ID;        /* 4 character identifier */
  48.     ULONG   rdb_SummedLongs;    /* size of this checksummed structure */
  49.     LONG    rdb_ChkSum;        /* block checksum (longword sum to zero) */
  50.     ULONG   rdb_HostID;        /* SCSI Target ID of host */
  51.     ULONG   rdb_BlockBytes;    /* size of disk blocks */
  52.     ULONG   rdb_Flags;        /* see below for defines */
  53.     /* block list heads */
  54.     ULONG   rdb_BadBlockList;    /* optional bad block list */
  55.     ULONG   rdb_PartitionList;    /* optional first partition block */
  56.     ULONG   rdb_FileSysHeaderList; /* optional file system header block */
  57.     ULONG   rdb_DriveInit;    /* optional drive-specific init code */
  58.                 /* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 */
  59.     ULONG   rdb_Reserved1[6];    /* set to $ffffffff */
  60.     /* physical drive characteristics */
  61.     ULONG   rdb_Cylinders;    /* number of drive cylinders */
  62.     ULONG   rdb_Sectors;    /* sectors per track */
  63.     ULONG   rdb_Heads;        /* number of drive heads */
  64.     ULONG   rdb_Interleave;    /* interleave */
  65.     ULONG   rdb_Park;        /* landing zone cylinder */
  66.     ULONG   rdb_Reserved2[3];
  67.     ULONG   rdb_WritePreComp;    /* starting cylinder: write precompensation */
  68.     ULONG   rdb_ReducedWrite;    /* starting cylinder: reduced write current */
  69.     ULONG   rdb_StepRate;    /* drive step rate */
  70.     ULONG   rdb_Reserved3[5];
  71.     /* logical drive characteristics */
  72.     ULONG   rdb_RDBBlocksLo;    /* low block of range reserved for hardblocks */
  73.     ULONG   rdb_RDBBlocksHi;    /* high block of range for these hardblocks */
  74.     ULONG   rdb_LoCylinder;    /* low cylinder of partitionable disk area */
  75.     ULONG   rdb_HiCylinder;    /* high cylinder of partitionable data area */
  76.     ULONG   rdb_CylBlocks;    /* number of blocks available per cylinder */
  77.     ULONG   rdb_AutoParkSeconds; /* zero for no auto park */
  78.     ULONG   rdb_Reserved4[2];
  79.     /* drive identification */
  80.     char    rdb_DiskVendor[8];
  81.     char    rdb_DiskProduct[16];
  82.     char    rdb_DiskRevision[4];
  83.     char    rdb_ControllerVendor[8];
  84.     char    rdb_ControllerProduct[16];
  85.     char    rdb_ControllerRevision[4];
  86.     ULONG   rdb_Reserved5[10];
  87. };
  88.  
  89. #define    IDNAME_RIGIDDISK    (('R'<<24)|('D'<<16)|('S'<<8)|('K'))
  90.  
  91. #define    RDB_LOCATION_LIMIT    16
  92.  
  93. #define    RDBFB_LAST    0    /* no disks exist to be configured after */
  94. #define    RDBFF_LAST    0x01L    /*   this one on this controller */
  95. #define    RDBFB_LASTLUN    1    /* no LUNs exist to be configured greater */
  96. #define    RDBFF_LASTLUN    0x02L    /*   than this one at this SCSI Target ID */
  97. #define    RDBFB_LASTTID    2    /* no Target IDs exist to be configured */
  98. #define    RDBFF_LASTTID    0x04L    /*   greater than this one on this SCSI bus */
  99. #define    RDBFB_NORESELECT 3    /* don't bother trying to perform reselection */
  100. #define    RDBFF_NORESELECT 0x08L    /*   when talking to this drive */
  101. #define    RDBFB_DISKID    4    /* rdb_Disk... identification valid */
  102. #define    RDBFF_DISKID    0x10L
  103. #define    RDBFB_CTRLRID    5    /* rdb_Controller... identification valid */
  104. #define    RDBFF_CTRLRID    0x20L
  105.  
  106. /*------------------------------------------------------------------*/
  107. struct BadBlockEntry {
  108.     ULONG   bbe_BadBlock;    /* block number of bad block */
  109.     ULONG   bbe_GoodBlock;    /* block number of replacement block */
  110. };
  111.  
  112. struct BadBlockBlock {
  113.     ULONG   bbb_ID;        /* 4 character identifier */
  114.     ULONG   bbb_SummedLongs;    /* size of this checksummed structure */
  115.     LONG    bbb_ChkSum;        /* block checksum (longword sum to zero) */
  116.     ULONG   bbb_HostID;        /* SCSI Target ID of host */
  117.     ULONG   bbb_Next;        /* block number of the next BadBlockBlock */
  118.     ULONG   bbb_Reserved;
  119.     struct BadBlockEntry bbb_BlockPairs[61]; /* bad block entry pairs */
  120.     /* note [61] assumes 512 byte blocks */
  121. };
  122.  
  123. #define    IDNAME_BADBLOCK        (('B'<<24)|('A'<<16)|('D'<<8)|('B'))
  124.  
  125. /*------------------------------------------------------------------*/
  126. struct PartitionBlock {
  127.     ULONG   pb_ID;        /* 4 character identifier */
  128.     ULONG   pb_SummedLongs;    /* size of this checksummed structure */
  129.     LONG    pb_ChkSum;        /* block checksum (longword sum to zero) */
  130.     ULONG   pb_HostID;        /* SCSI Target ID of host */
  131.     ULONG   pb_Next;        /* block number of the next PartitionBlock */
  132.     ULONG   pb_Flags;        /* see below for defines */
  133.     ULONG   pb_Reserved1[2];
  134.     ULONG   pb_DevFlags;    /* preferred flags for OpenDevice */
  135.     UBYTE   pb_DriveName[32];    /* preferred DOS device name: BSTR form */
  136.                 /* (not used if this name is in use) */
  137.     ULONG   pb_Reserved2[15];    /* filler to 32 longwords */
  138.     ULONG   pb_Environment[17];    /* environment vector for this partition */
  139.     ULONG   pb_EReserved[15];    /* reserved for future environment vector */
  140. };
  141.  
  142. #define    IDNAME_PARTITION    (('P'<<24)|('A'<<16)|('R'<<8)|('T'))
  143.  
  144. #define    PBFB_BOOTABLE    0    /* this partition is intended to be bootable */
  145. #define    PBFF_BOOTABLE    1L    /*   (expected directories and files exist) */
  146. #define    PBFB_NOMOUNT    1    /* do not mount this partition (e.g. manually */
  147. #define    PBFF_NOMOUNT    2L    /*   mounted, but space reserved here) */
  148.  
  149. /*------------------------------------------------------------------*/
  150. struct FileSysHeaderBlock {
  151.     ULONG   fhb_ID;        /* 4 character identifier */
  152.     ULONG   fhb_SummedLongs;    /* size of this checksummed structure */
  153.     LONG    fhb_ChkSum;        /* block checksum (longword sum to zero) */
  154.     ULONG   fhb_HostID;        /* SCSI Target ID of host */
  155.     ULONG   fhb_Next;        /* block number of next FileSysHeaderBlock */
  156.     ULONG   fhb_Flags;        /* see below for defines */
  157.     ULONG   fhb_Reserved1[2];
  158.     ULONG   fhb_DosType;    /* file system description: match this with */
  159.                 /* partition environment's DE_DOSTYPE entry */
  160.     ULONG   fhb_Version;    /* release version of this code */
  161.     ULONG   fhb_PatchFlags;    /* bits set for those of the following that */
  162.                 /*   need to be substituted into a standard */
  163.                 /*   device node for this file system: e.g. */
  164.                 /*   0x180 to substitute SegList & GlobalVec */
  165.     ULONG   fhb_Type;        /* device node type: zero */
  166.     ULONG   fhb_Task;        /* standard dos "task" field: zero */
  167.     ULONG   fhb_Lock;        /* not used for devices: zero */
  168.     ULONG   fhb_Handler;    /* filename to loadseg: zero placeholder */
  169.     ULONG   fhb_StackSize;    /* stacksize to use when starting task */
  170.     LONG    fhb_Priority;    /* task priority when starting task */
  171.     LONG    fhb_Startup;    /* startup msg: zero placeholder */
  172.     LONG    fhb_SegListBlocks;    /* first of linked list of LoadSegBlocks: */
  173.                 /*   note that this entry requires some */
  174.                 /*   processing before substitution */
  175.     LONG    fhb_GlobalVec;    /* BCPL global vector when starting task */
  176.     ULONG   fhb_Reserved2[23];    /* (those reserved by PatchFlags) */
  177.     ULONG   fhb_Reserved3[21];
  178. };
  179.  
  180. #define    IDNAME_FILESYSHEADER    (('F'<<24)|('S'<<16)|('H'<<8)|('D'))
  181.  
  182. /*------------------------------------------------------------------*/
  183. struct LoadSegBlock {
  184.     ULONG   lsb_ID;        /* 4 character identifier */
  185.     ULONG   lsb_SummedLongs;    /* size of this checksummed structure */
  186.     LONG    lsb_ChkSum;        /* block checksum (longword sum to zero) */
  187.     ULONG   lsb_HostID;        /* SCSI Target ID of host */
  188.     ULONG   lsb_Next;        /* block number of the next LoadSegBlock */
  189.     ULONG   lsb_LoadData[123];    /* data for "loadseg" */
  190.     /* note [123] assumes 512 byte blocks */
  191. };
  192.  
  193. #define    IDNAME_LOADSEG        (('L'<<24)|('S'<<16)|('E'<<8)|('G'))
  194.  
  195. #endif    /* DEVICES_HARDBLOCKS_H */
  196.