home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / oberon-a-1.4ß.lha / Oberon-A / source / amiga / HardBlocks.mod < prev    next >
Text File  |  1994-08-08  |  12KB  |  260 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: HardBlocks.mod $
  4.   Description: File system identifier blocks for hard disks
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.2 $
  8.       $Author: fjc $
  9.         $Date: 1994/08/08 00:46:36 $
  10.  
  11.   $VER: hardblocks.h 36.3 (23.8.91)
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A interface Copyright © 1994, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. ***************************************************************************)
  22.  
  23. MODULE HardBlocks;
  24.  
  25. (*
  26. ** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
  27. ** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
  28. ** $V- OvflChk       $Z- ZeroVars
  29. *)
  30.  
  31. IMPORT E := Exec;
  32.  
  33.  
  34. (*
  35. **      File System identifier blocks for hard disks
  36. *)
  37.  
  38.  
  39. (* --------------------------------------------------------------------
  40.  *
  41.  *      This file describes blocks of data that exist on a hard disk
  42.  *      to describe that disk.  They are not generically accessable to
  43.  *      the user as they do not appear on any DOS drive.  The blocks
  44.  *      are tagged with a unique identifier, checksummed, and linked
  45.  *      together.  The root of these blocks is the RigidDiskBlock.
  46.  *
  47.  *      The RigidDiskBlock must exist on the disk within the first
  48.  *      rdbLocationLIMIT blocks.  This inhibits the use of the zero
  49.  *      cylinder in an AmigaDOS partition: although it is strictly
  50.  *      possible to store the RigidDiskBlock data in the reserved
  51.  *      area of a partition, this practice is discouraged since the
  52.  *      reserved blocks of a partition are overwritten by "Format",
  53.  *      "Install", "DiskCopy", etc.  The recommended disk layout,
  54.  *      then, is to use the first cylinder(s) to store all the drive
  55.  *      data specified by these blocks: i.e. partition descriptions,
  56.  *      file system load images, drive bad block maps, spare blocks,
  57.  *      etc.
  58.  *
  59.  *      Though only 512 byte blocks are currently supported by the
  60.  *      file system, this proposal tries to be forward-looking by
  61.  *      making the block size explicit, and by using only the first
  62.  *      256 bytes for all blocks but the LoadSeg data.
  63.  *
  64.  *------------------------------------------------------------------*)
  65.  
  66. (*
  67.  *  NOTE
  68.  *      optional block addresses below contain $ffffffff to indicate
  69.  *      a NULL address, as zero is a valid address
  70.  *)
  71.  
  72. TYPE
  73.  
  74.   RigidDiskBlockPtr * = CPOINTER TO RigidDiskBlock;
  75.   RigidDiskBlock * = RECORD
  76.     id *                : E.ULONG; (* 4 character identifier *)
  77.     summedLongs *       : E.ULONG; (* size of this checksummed $tructure *)
  78.     chkSum *            : LONGINT; (* block checksum (longword sum to zero) *)
  79.     hostID *            : E.ULONG; (* SCSI Target ID of host *)
  80.     blockBytes *        : E.ULONG; (* size of disk blocks *)
  81.     flags *             : E.ULONG; (* see below for defines *)
  82.     (* block list heads *)
  83.     badBlockList *      : E.ULONG; (* optional bad block list *)
  84.     partitionList *     : E.ULONG; (* optional first partition block *)
  85.     fileSysHeaderList * : E.ULONG; (* optional file system header block *)
  86.     driveInit *         : E.ULONG; (* optional drive-specific init code *)
  87.                                       (* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 *)
  88.     reserved1 *         : ARRAY 6 OF E.ULONG;
  89.                                       (* set to $ffffffff *)
  90.     (* physical drive characteristics *)
  91.     cylinders *         : E.ULONG; (* number of drive cylinders *)
  92.     sectors *           : E.ULONG; (* sectors per track *)
  93.     heads *             : E.ULONG; (* number of drive heads *)
  94.     interleave *        : E.ULONG; (* interleave *)
  95.     park *              : E.ULONG; (* landing zone cylinder *)
  96.     reserved2 *         : ARRAY 3 OF E.ULONG;
  97.     writePreComp *      : E.ULONG; (* starting cylinder: write precompensation *)
  98.     reducedWrite *      : E.ULONG; (* starting cylinder: reduced write current *)
  99.     stepRate *          : E.ULONG; (* drive step rate *)
  100.     reserved3 *         : ARRAY 5 OF E.ULONG;
  101.     (* logical drive characteristics *)
  102.     rdbBlocksLo *       : E.ULONG; (* low block of range reserved for hardblocks *)
  103.     rdbBlocksHi *       : E.ULONG; (* high block of range for these hardblocks *)
  104.     loCylinder *        : E.ULONG; (* low cylinder of partitionable disk area *)
  105.     hiCylinder *        : E.ULONG; (* high cylinder of partitionable data area *)
  106.     cylBlocks *         : E.ULONG; (* number of blocks available per cylinder *)
  107.     autoParkSeconds *   : E.ULONG; (* zero for no auto park *)
  108.     highRDSKBlock *     : E.ULONG; (* highest block used by RDSK *)
  109.                                       (* (not including replacement bad blocks) *)
  110.     reserved4 *         : E.ULONG;
  111.     (* drive identification *)
  112.     diskVendor *        : ARRAY 8 OF CHAR;
  113.     diskProduct *       : ARRAY 16 OF CHAR;
  114.     diskRevision *      : ARRAY 4 OF CHAR;
  115.     controllerVendor *  : ARRAY 8 OF CHAR;
  116.     controllerProduct * : ARRAY 16 OF CHAR;
  117.     controllerRevision * : ARRAY 4 OF CHAR;
  118.     reserved5 *         : ARRAY 10 OF E.ULONG;
  119.   END; (* RigidDiskBlock *)
  120.  
  121. CONST
  122.  
  123.   idNameRigidDisk        * = 5244534BH;      (* 'RDSK' *)
  124.  
  125.   rdbLocationLimit      * = 16;
  126.  
  127.   rdbLast      * = 0;        (* no disks exist to be configured after *)
  128.                              (*   this one on this controller *)
  129.   rdbLastLun   * = 1;        (* no LUNs exist to be configured greater *)
  130.                              (*   than this one at this SCSI Target ID *)
  131.   rdbLastTID   * = 2;        (* no Target IDs exist to be configured *)
  132.                              (*   greater than this one on this SCSI bus *)
  133.   rdbLsatTID   * = rdbLastTID; (* typo *)
  134.   rdbNoReselect * = 3;       (* don't bother trying to perform reselection *)
  135.                              (*   when talking to this drive *)
  136.   rdbDiskID    * = 4;        (* rdbDisk... identification valid *)
  137.   rdbCtrlrID   * = 5;        (* rdbController... identification valid *)
  138.  
  139.                              (* added 7/20/89 by commodore: *)
  140.   rdbSynch     * = 6;        (* drive supports scsi synchronous mode *)
  141.                              (* CAN BE DANGEROUS TO USE IF IT DOESN'T! *)
  142.  
  143. (* ------------------------------------------------------------------*)
  144.  
  145. TYPE
  146.  
  147.   BadBlockEntryPtr * = CPOINTER TO BadBlockEntry;
  148.   BadBlockEntry * = RECORD
  149.     badBlock *  : E.ULONG;      (* block number of bad block *)
  150.     goodBlock * : E.ULONG;      (* block number of replacement block *)
  151.   END; (* BadBlockEntry *)
  152.  
  153.   BadBlockBlockPtr * = CPOINTER TO BadBlockBlock;
  154.   BadBlockBlock * = RECORD
  155.     id *          : E.ULONG; (* 4 character identifier *)
  156.     summedLongs * : E.ULONG; (* size of this checksummed $tructure *)
  157.     chkSum *      : LONGINT; (* block checksum (longword sum to zero) *)
  158.     hostID *      : E.ULONG; (* SCSI Target ID of host *)
  159.     next *        : E.ULONG; (* block number of the next BadBlockBlock *)
  160.     reserved *    : E.ULONG;
  161.     blockPairs *  : ARRAY 61 OF BadBlockEntry;
  162.                                 (* bad block entry pairs *)
  163.     (* note [61] assumes 512 byte blocks *)
  164.   END; (* BadBlockBlock *)
  165.  
  166. CONST
  167.  
  168.   idNameBadBlock         * = 42414442H;      (* 'BADB' *)
  169.  
  170. (* ------------------------------------------------------------------*)
  171.  
  172. TYPE
  173.  
  174.   PartitionBlockPtr * = CPOINTER TO PartitionBlock;
  175.   PartitionBlock * = RECORD
  176.     id *          : E.ULONG;             (* 4 character identifier *)
  177.     summedLongs * : E.ULONG;             (* size of this checksummed $tructure *)
  178.     chkSum *      : LONGINT;             (* block checksum (longword sum to zero) *)
  179.     hostID *      : E.ULONG;             (* SCSI Target ID of host *)
  180.     next *        : E.ULONG;             (* block number of the next PartitionBlock *)
  181.     flags *       : E.ULONG;             (* see below for defines *)
  182.     reserved1 *   : ARRAY 2 OF E.ULONG;
  183.     devFlags *    : E.ULONG;             (* preferred flags for OpenDevice *)
  184.     driveName *   : ARRAY 32 OF CHAR;    (* preferred DOS device name: BSTR form *)
  185.                                            (* (not used if t