home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D3.DMS / in.adf / Interfaces / HardBlocks.mod < prev    next >
Encoding:
Text File  |  1992-11-02  |  10.6 KB  |  226 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Interface Module:                    Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 by Fridtjof Siebert                                            *)
  6. (*                                                                         *)
  7. (*-------------------------------------------------------------------------*)
  8.  
  9. MODULE HardBlocks;
  10.  
  11. IMPORT e   * := Exec,
  12.        sys * := SYSTEM;
  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. TYPE
  42.  
  43. (*
  44.  *  NOTE
  45.  *      optional block addresses below contain -1 to indicate
  46.  *      a NULL address, as zero is a valid address
  47.  *)
  48.  
  49.   RigidDiskBlockPtr * = UNTRACED POINTER TO RigidDiskBlock;
  50.   RigidDiskBlock * = STRUCT
  51.     id * : LONGINT;             (* 4 character identifier *)
  52.     summedLongs * : LONGINT;    (* size of this checksummed structure *)
  53.     chkSum * : LONGINT;         (* block checksum (longword sum to zero) *)
  54.     hostID * : LONGINT;         (* SCSI Target ID of host *)
  55.     blockBytes * : LONGINT;     (* size of disk blocks *)
  56.     flags * : LONGSET;          (* see below for defines *)
  57.   (* block list heads *)
  58.     badBlockList * : LONGINT;   (* optional bad block list *)
  59.     partitionList * : LONGINT;  (* optional first partition block *)
  60.     fileSysHeaderList * : LONGINT; (* optional file system header block *)
  61.     driveInit * : LONGINT;      (* optional drive-specific init code *)
  62.                         (* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 *)
  63.     reserved1 * : ARRAY 6 OF LONGINT;   (* set to -1 *)
  64.   (* physical drive characteristics *)
  65.     cylinders * : LONGINT;      (* number of drive cylinders *)
  66.     sectors * : LONGINT;        (* sectors per track *)
  67.     heads * : LONGINT;          (* number of drive heads *)
  68.     interleave * : LONGINT;     (* interleave *)
  69.     park * : LONGINT;           (* landing zone cylinder *)
  70.     reserved2 * : ARRAY 3 OF LONGINT;
  71.     writePreComp * : LONGINT;   (* starting cylinder: write precompensation *)
  72.     reducedWrite * : LONGINT;   (* starting cylinder: reduced write current *)
  73.     stepRate * : LONGINT;       (* drive step rate *)
  74.     reserved3 * : ARRAY 5 OF LONGINT;
  75.   (* logical drive characteristics *)
  76.     rdbBlocksLo * : LONGINT;    (* low block of range reserved for hardblocks *)
  77.     rdbBlocksHi * : LONGINT;    (* high block of range for these hardblocks *)
  78.     loCylinder * : LONGINT;     (* low cylinder of partitionable disk area *)
  79.     hiCylinder * : LONGINT;     (* high cylinder of partitionable data area *)
  80.     cylBlocks * : LONGINT;      (* number of blocks available per cylinder *)
  81.     autoParkSeconds * : LONGINT; (* zero for no auto park *)
  82.     reserved4 * : ARRAY 2 OF LONGINT;
  83.   (* drive identification *)
  84.     diskVendor * : ARRAY 8 OF CHAR;
  85.     diskProduct * : ARRAY 16 OF CHAR;
  86.     diskRevision * : ARRAY 4 OF CHAR;
  87.     controllerVendor * : ARRAY 8 OF CHAR;
  88.     controllerProduct * : ARRAY 16 OF CHAR;
  89.     controllerRevision * : ARRAY 4 OF CHAR;
  90.     reserved5 * : ARRAY 10 OF LONGINT;
  91.   END;
  92.  
  93. CONST
  94.  
  95.   idNameRigidDisk * = sys.VAL(LONGINT,"RDSK");
  96.  
  97.   locationLimit * = 16;
  98.  
  99.   last       * = 0;       (* no disks exist to be configured after *)
  100.                           (*   this one on this controller *)
  101.   lastLun    * = 1;       (* no LUNs exist to be configured greater *)
  102.                           (*   than this one at this SCSI Target ID *)
  103.   lsatTID    * = 2;       (* no Target IDs exist to be configured *)
  104.                           (*   greater than this one on this SCSI bus *)
  105.   noReselect * = 3;       (* don't bother trying to perform reselection *)
  106.                           (*   when talking to this drive *)
  107.   diskID     * = 4;       (* rdb_Disk... identification valid *)
  108.   ctrlrID    * = 5;       (* rdb_Controller... identification valid *)
  109.  
  110. TYPE
  111.  
  112. (*------------------------------------------------------------------*)
  113.   BadBlockEntryPtr * = UNTRACED POINTER TO BadBlockEntry;
  114.   BadBlockEntry * = STRUCT
  115.     badBlock * : LONGINT;       (* block number of bad block *)
  116.     goodBlock * : LONGINT;      (* block number of replacement block *)
  117.   END;
  118.  
  119.   BadBlockBlockPtr * = UNTRACED POINTER TO BadBlockBlock;
  120.   BadBlockBlock * = STRUCT
  121.     id * : LONGINT;             (* 4 character identifier *)
  122.     summedLongs * : LONGINT;    (* size of this checksummed structure *)
  123.     chkSum * : LONGINT;         (* block checksum (longword sum to zero) *)
  124.     hostID * : LONGINT;         (* SCSI Target ID of host *)
  125.     next * : LONGINT;           (* block number of the next BadBlockBlock *)
  126.     reserved * : LONGINT;
  127.     blockPairs * : ARRAY 61 OF BadBlockEntry; (* bad block entry pairs *)
  128.     (* note [61] assumes 512 byte blocks *)
  129.   END;
  130.  
  131. CONST
  132.  
  133.   idNameBadBlock * = sys.VAL(LONGINT,"BADB");
  134.  
  135. TYPE
  136.  
  137. (*------------------------------------------------------------------*)
  138.  
  139.   PartitionBlockPtr * = UNTRACED POINTER TO PartitionBlock;
  140.   PartitionBlock * = STRUCT
  141.     id * : LONGINT;                      (* 4 character identifier *)
  142.     summedLongs * : LONGINT;             (* size of this checksummed structure *)
  143.     chkSum * : LONGINT;                  (* block checksum (longword sum to zero) *)
  144.     hostID * : LONGINT;                  (* SCSI Target ID of host *)
  145.     next * : LONGINT;                    (* block number of the next PartitionBlock *)
  146.     flags * : LONGSET;                   (* see below for defines *)
  147.     reserved1 * : ARRAY 2 OF LONGINT;
  148.     devFlags * : LONGINT;                (* preferred flags for OpenDevice *)
  149.     driveName * : ARRAY 32 OF CHAR;      (* preferred DOS device name: BSTR form *)
  150.                                          (* (not used if this name is in use) *)
  151.     reserved2 * : ARRAY 15 OF LONGINT;   (* filler to 32 longwords *)
  152.     environment * : ARRAY 17 OF LONGINT; (* environment vector for this partition *)
  153.     eReserved * : ARRAY 15 OF LONGINT;   (* reserved for future environment vector *)
  154.   END;
  155.  
  156. CONST
  157.  
  158.   idNamePartition * = sys.VAL(LONGINT,"PART");
  159.  
  160.   bootable  * = 0;      (* this partition is intended to be bootable *)
  161.                         (*   (expected directories and files exist) *)
  162.   noMount   * = 1;      (* do not mount this partition (e.g. manually *)
  163.                         (*   mounted, but space reserved here) *)
  164.  
  165. TYPE
  166.  
  167. (*------------------------------------------------------------------*)
  168.  
  169.   FileSysHeaderBlockPtr * = UNTRACED POINTER TO FileSysHeaderBlock;
  170.   FileSysHeaderBlock * = STRUCT
  171.     id * : LONGINT;                     (* 4 character identifier *)
  172.     summedLongs * : LONGINT;            (* size of this checksummed structure *)
  173.     chkSum * : LONGINT;                (* block checksum (longword sum to zero) *)
  174.     hostID * : LONGINT;                 (* SCSI Target ID of host *)
  175.     next * : LONGINT;                   (* block number of next FileSysHeaderBlock *)
  176.     flags * : LONGSET;                  (* see below for defines *)
  177.     reserved1 * : ARRAY 2 OF LONGINT;
  178.     dosType * : LONGINT;                (* file system description: match this with *)
  179.                                         (* partition environment's DE_DOSTYPE entry *)
  180.     version * : LONGINT;                (* release version of this code *)
  181.     patchFlags * : LONGSET;             (* bits set for those of the following that *)
  182.                                         (*   need to be substituted into a standard *)
  183.                                         (*   device node for this file system: e.g. *)
  184.                                         (*   0x180 to substitute SegList & GlobalVec *)
  185.     type * : LONGINT;                   (* device node type: zero *)
  186.     task * : LONGINT;                   (* standard dos "task" field: zero *)
  187.     lock * : LONGINT;                   (* not used for devices: zero *)
  188.     handler * : LONGINT;                (* filename to loadseg: zero placeholder *)
  189.     stackSize * : LONGINT;              (* stacksize to use when starting task *)
  190.     priority * : LONGINT;               (* task priority when starting task *)
  191.     startup * : LONGINT;                (* startup msg: zero placeholder *)
  192.     segListBlocks * : LONGINT;          (* first of linked list of LoadSegBlocks: *)
  193.                                         (*   note that this entry requires some *)
  194.                                         (*   processing before substitution *)
  195.     globalVec * : LONGINT;              (* BCPL global vector when starting task *)
  196.     reserved2 * : ARRAY 23 OF LONGINT;  (* (those reserved by PatchFlags) *)
  197.     reserved3 * : ARRAY 21 OF LONGINT;
  198.   END;
  199.  
  200. CONST
  201.  
  202.   idNameFileSysHeader * = sys.VAL(LONGINT,"FSHD");
  203.  
  204. TYPE
  205.  
  206. (*------------------------------------------------------------------*)
  207.  
  208.   LoadSegBlockPtr * = UNTRACED POINTER TO LoadSegBlock;
  209.   LoadSegBlock * = STRUCT
  210.     id * : LONGINT;                     (* 4 character identifier *)
  211.     summedLongs * : LONGINT;            (* size of this checksummed structure *)
  212.     chkSum * : LONGINT;                 (* block checksum (longword sum to zero) *)
  213.     hostID * : LONGINT;                 (* SCSI Target ID of host *)
  214.     next * : LONGINT;                   (* block number of the next LoadSegBlock *)
  215.     loadData * : ARRAY 123 OF LONGINT;  (* data for "loadseg" *)
  216.     (* note [123] assumes 512 byte blocks *)
  217.   END;
  218.  
  219. CONST
  220.  
  221.   idNameLoadSeg * = sys.VAL(LONGINT,'LSEG');
  222.  
  223. END HardBlocks.
  224.  
  225.  
  226.