FormatDisk.mesa
Interface to device-dependent disk formatting and initialization. This interface is similar to a "face", with machine- and device-dependent implementations; but it exists at a higher logical level in the system (specifically, above the Disk interface). Synchronization with other disk activity is taken care of by the implementation; but of course the client is responsible for higher-level consistency issues such as arise when formatting the system volume.
Last Edited by: Taft, December 14, 1983 10:14 am
DIRECTORY
BasicTime USING [GMT],
Disk USING [Channel, Label, PageCount, PageNumber, Status],
Rope USING [ROPE];
FormatDisk: DEFINITIONS =
BEGIN
Disk formatting and checking
Raw disk formatting and scanning are implemented in terms of the single primitive Sweep. The reason Sweep is special (rather than constructed from ordinary Disk operations) is that certain aspects of it are machine dependent, particularly the writing of headers and recovery from errors. The intended applications are:
Formatting and surface testing: perform one format, one verify, and then any number of passes of a write followed by a verify.
Non-destructive scanning: any number of passes of read operations.
Operation: TYPE = {format, write, read, verify};
BadPage: SIGNAL [page: Disk.PageNumber, correctable: BOOLEAN];
Error: ERROR [page: Disk.PageNumber, status: Disk.Status];
Sweep: PROC [channel: Disk.Channel, operation: Operation, firstPage: Disk.PageNumber, pageCount: Disk.PageCount, label: LONG POINTER TO Disk.Label, data: LONG POINTER];
Sweeps pageCount pages starting at the specified virtual disk address, applying the specified operation to each. Format means write headers, labels, and data (which may require multiple passes in some implementations). Write means verify headers and write labels and data. Read means verify headers and read labels and data. Verify means verify headers, labels, and data.
The label argument points to a client-provided label record and the data argument points to a one-page page-aligned buffer; both must be resident. The operations format, write, and verify use the contents of these buffers as arguments, while read clobbers them. Note that the operations have their normal side-effects on labels, meaning that during all operations except read the page number is incremented for each page, and during all operations except format the boot chain link is read from the disk label.
Raises the resumable signal BadPage for each page at which a disk error (hard or soft) occurred. The correctable argument indicates whether the error was correctable when the normal retry algorithm was applied.
Raises Error if the disk goes offline or an uncorrectable error occurs that is not related to imperfections of the disk surface.
?? Something needs to be said here about formatting extents ??
Initial microcode
Initial microcode installation is special because the exact conventions for the format of the initial microcode file are machine-dependent. In particular, in some implementations the initial microcode is not a well-formed file, but is optimized for easy readability by boot microcode.
FailureType: TYPE = {emptyFile, firstPageBad, flakeyPageFound, microcodeTooBig, other};
MicrocodeInstallFailure: ERROR [why: FailureType];
InstallInitialMicrocode: PROC [channel: Disk.Channel, getPage: PROC [ptr: LONG POINTER] RETURNS [ok: BOOLEAN]];
Installs microcode on reserved Initial region of the disk, and verifies that it is readable. Repeatedly calls getPage until FALSE is returned. The getPage procedure should either copy the next page of data into the supplied (one-page) buffer and return TRUE, or it should return FALSE to indicate end-of-file.
IdentifyInitialMicrocode: PROC [channel: Disk.Channel] RETURNS [microcodeInstalled: BOOLEAN, time: BasicTime.GMT, name: Rope.ROPE];
Reserved disk areas
Note: initial microcode may overlap with an Alto region
hardUCodeStart: Disk.PageNumber; -- first page reserved for initial microcode
hardUCodeSize: Disk.PageCount; -- number of pages reserved for initial microcode
altoRegionJargon: Rope.ROPE; -- human-sensible name for reservable Alto disk areas
altoRegionsMax: INT; -- largest possible number of Alto regions
altoRegionsStart: Disk.PageNumber; -- first page usable for Alto regions
altoRegionsSize: Disk.PageCount; -- size of each Alto region
altoRegionsBottomUp: BOOL; -- whether preferred layout for Alto starts at beginning of disk
Initialization
This is needed because of difficulties specifying the appropriate control list for Nucleus start-up, because the implementation of this interface is by a machine-dependent module name.
Start: PROC; -- call before accessing exported variables
END.