home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / cbm / nduk-v37.lha / V37 / include / devices / hardblocks.h < prev    next >
C/C++ Source or Header  |  1991-11-27  |  9KB  |  207 lines

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