home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / cbm / os-include.lha / os-include / devices / hardblocks.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  9KB  |  205 lines

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