-- FormatTrident.mesa
-- Last Edited by: Taft, May 22, 1983 12:47 pm

DIRECTORY
  PhysicalVolume USING [Handle, PageNumber],
  System USING [GreenwichMeanTime];

FormatTrident: DEFINITIONS =
BEGIN

DiskPageNumber: TYPE = PhysicalVolume.PageNumber;
FailureType: TYPE = {
  emptyFile, firstPageBad, flakeyPageFound, microcodeTooBig, other};

BadPage: SIGNAL [p: DiskPageNumber];
PassStarting: SIGNAL [pass: CARDINAL, operation: Operation];
Operation: TYPE = {write, read};

MicrocodeInstallFailure: SIGNAL [m: FailureType];
-- Generated upon install error.  If resumed, InstallBootMicrocode will "eat" the
-- remaining input (until NIL) and then return.
NotTrident: ERROR;

Format, Scan: PROC [
  h: PhysicalVolume.Handle, firstPage: DiskPageNumber,
  count: LONG CARDINAL, passes: CARDINAL];
  -- Format disk (write headers, labels and data, verify all)
  -- or Scan (verify headers, read all labels and Data).  Do
  -- [firstPage..firstPage+count).  Raises BadPage[pageNumber] for each bad page found;
  -- raises PassStarting[passNumber] at the beginning of each pass.

IdentifyInitialMicrocode: PROCEDURE [h: PhysicalVolume.Handle, s: STRING]
  RETURNS [microcodeInstalled: BOOLEAN, time: System.GreenwichMeanTime];

InstallBootMicrocode: PROC [
  h: PhysicalVolume.Handle, getPage: PROC RETURNS [LONG POINTER]];
  -- Install microcode on reserved Initial region of the disk.  Repeatedly calls NextPage
  -- until NIL is returned.  Copies the information out of the page and does
  -- the magic.  Returned pointer must be page-aligned and point to a resident page.

-- Layout of disk partitions, and Pilot volumes within partitions, etc.
Partition: TYPE = [1..5];
pagesInPartition: DiskPageNumber = 815*28; -- one surface of the disk
pagesReservedInPartition1: DiskPageNumber = 3*28; -- 3 cylinders physical volume overhead
firstHardUCodePage: DiskPageNumber = 4;  -- start of reserved Initial microcode region
hardUCodeSerial: LONG CARDINAL = 064732B*200000B + 064732B;  -- fixed FileID

END.


LOG
Time: May 30, 1980  6:41 PM	By: Forrest	Action: Eliminated Dependence on DiskChannel.  Added layout fake Alto volume info.Trimmed log to Amargosa.
Time: June 28, 1980  1:40 PM	By: Forrest	Action: Changed to use PhysicalVolume.Handle; Add SA1000.
Time: December 11, 1980  11:43 AM	By: Taft	Action: Create for Dorado from FormatSA1000andSA4000.mesa
Time: January 25, 1981  2:43 PM	By: Taft	Action: Multi-partition Pilot volumes
12-Jun-81 16:48:36  Taft  Mods for new Othello organization
17-Jun-82 10:37:01  Taft  Put back InstallBootMicrocode; add firstHardUCodePage, hardUCodeSerial
20-Jun-82 16:16:43  Taft  Add IdentifyInitialMicrocode
May 22, 1983 12:26 pm  Taft  Add passes arg to Format, PassStarting signal.