-- DiskChannel.mesa (last edited by: McJones on: January 28, 1981 12:46 PM)
DIRECTORY
Environment USING [PageNumber],
Device USING [Type],
PilotDisk USING [Handle, Label];
DiskChannel: DEFINITIONS =
BEGIN
-- Drives
DiskPageCount: TYPE = LONG CARDINAL;
DiskPageNumber: TYPE = LONG CARDINAL;
Drive: TYPE = LONG POINTER TO DriveObject;
DriveObject: TYPE;
PVHandle: TYPE = RECORD [drive: Drive, changeCount: CARDINAL]; -- denotes a drive instance - the combination of a drive and the physical volume, whether Pilot or non-Pilot, if any, on that drive.
DriveState: TYPE = {inactive, channel, pilot};
DriveStatus: TYPE = {alreadyAsserted, badDisk, hardwareError, invalidDrive, notReady, ok, writeProtected, wrongFormat};
nullDrive: Drive = NIL;
AwaitStateChange: PROCEDURE [count: CARDINAL, type: Device.Type, index: CARDINAL] RETURNS [currentChangeCount: CARDINAL];
GetNextDrive: PROCEDURE [prev: Drive] RETURNS [Drive];
-- Stateless enumeration of drives, beginning and ending with nullDrive. Drives of given type are grouped together, in increasing GetDriveAttrubites[].deviceOrdinal order.
-- NOTE: a new drive may appear after an enumeration has been started
GetDriveAttributes: PROCEDURE [drive: Drive]
RETURNS [deviceType: Device.Type, deviceHandle: PilotDisk.Handle, deviceOrdinal: CARDINAL, nPages: DiskPageCount, ready: BOOLEAN, state: DriveState, changeCount: CARDINAL];
-- See DeviceTypes.mesa for possible values of deviceType.
-- deviceOrdinal gives the position of this drive within all devices of same type.
GetDriveTag: PROCEDURE [drive: Drive] RETURNS [tag: CARDINAL];
SetDriveState: PROCEDURE [drive: Drive, changeCount: CARDINAL, state: DriveState] RETURNS [s: DriveStatus];
-- A tag may be associated with each drive as a convenience to the client.
SetDriveTag: PROCEDURE [drive: Drive, tag: CARDINAL];
-- Completion objects
CompletionHandle: TYPE = PRIVATE RECORD [LONG UNSPECIFIED];
CreateCompletionObject: PROCEDURE RETURNS [CompletionHandle];
-- Channels
Handle: TYPE = PRIVATE RECORD [UNSPECIFIED];
nullHandle: Handle = [0];
Create: PROCEDURE [drive: Drive, completion: CompletionHandle] RETURNS [Handle];
-- It is permissable to create more than one channel per drive.
Delete: PROCEDURE [channel: Handle];
GetAttributes: PROCEDURE [channel: Handle] RETURNS [drive: Drive];
Suspend: PROCEDURE [channel: Handle];
-- Cause any further I/O transactions to wait until the channel is restarted.
Idle: PROCEDURE [channel: Handle];
-- Suspend channel and wait until I/O transactions already in progress have completed.
Restart: PROCEDURE [channel: Handle];
-- Allow I/O transactions to proceed.
IORequestHandle: TYPE = LONG POINTER TO IORequest;
IORequest: TYPE = RECORD [ -- provided by client, lifetime = duration of I/O operation
-- fields defining the IO Request
command: Command,
channel: Handle,
diskPage: DiskPageNumber,
memoryPage: Environment.PageNumber,
dontIncrement: BOOLEAN ← FALSE, -- TRUE means use same memory page for all disk pages
count: DiskPageCount,
countDone: DiskPageCount,
label: PLabel,
tag: CARDINAL,
-- returned status of IO Request
status: CompletionStatus,
-- private for use by the DiskChannel implementation
next: IORequestHandle, -- this pointer is smashed by the driver during an IO transaction
-- private for use by the drivers
retryCount: PRIVATE INTEGER,
drive: PRIVATE DriveNumber,
address: PRIVATE Address
];
Address: TYPE = PRIVATE MACHINE DEPENDENT RECORD [
cylinder: Cylinder,
head: Head,
sector: Sector];
Command: TYPE = {vvr, vvw, vrr, vww};
-- Specifies actions for header, label, data (read/verify/write). Label verification is defined by PilotDisk.MatchLabels. For IORequest’s with count>1, the label is automatically updated after each sector using PilotDisk.NextLabel.
Cylinder: TYPE = CARDINAL;
Head: TYPE = [0..256);
Sector: TYPE = [0..256);
DriveNumber: TYPE = CARDINAL;
PLabel: TYPE = LONG POINTER TO Label;
Label: TYPE = PilotDisk.Label; -- labels should be quadword aligned
Direction: TYPE = {put, get};
CompletionStatus: TYPE = {goodCompletion, noSuchPage, labelDoesNotMatch, seekFailed, checkError, dataError, hardwareError, notReady, notPilotVolume, invalidChannel, labelError};
InitiateIO: PROCEDURE [req: IORequestHandle];
-- Initiate a new I/O transaction, waiting if necessary until the channel is not suspended.
WaitAny: PROCEDURE [completion: CompletionHandle] RETURNS [IORequestHandle];
-- Wait for the next I/O transaction to complete.
GetPageAddress: PROCEDURE [channel: Handle, page: DiskPageNumber] RETURNS [Address];
-- Perform seek address calculation.
GetPageNumber: PROCEDURE [drive: Drive, page: Address] RETURNS [DiskPageNumber];
-- Perform inverse of seek address calculation.
END.
LOG
(For earlier log entries see Pilot 5.0 archive version.)
Time: January 28, 1981 12:46 PMBy: McJonesAction: CompletionStatus checksumError => dataError, labelError