EXCP I/O – Introduction

EXCP is the facility that allows us the ability to perform device-level I/O without having to the heavy lifting.  It handles the details like pagefixing buffers, scheduling an I/O request, and processing interrupts so we don’t have to worry about these things.  We can focus on building our channel programs that instruct the device.

To use EXCP we need an open DCB.  The DCB is the connection between our program and the actual device we are communicating with.  There is very little useful information in a EXCP DCB except that it points to a Data Extent Block (DEB).  The DEB is created as part of the open process and it authorizes our access to the device.  For example the DEB indicates if we can write to the device or if our access is read-only.  For DASD devices it also indicates which tracks we have access to.  The DEB also points to the UCB providing the link to the physical device.

+-----+     +-----+     +-----+     +-----+     +-----+
| UCB |<====| DEB |<====| DCB |<====| IOB |====>| CCW |
+-----+     +-----+     +-----+     +-----+     +-----+

An EXCP request is defined by an Input/Output Block (IOB).  The IOB points to the DCB as well as the Channel Command Word (CCW) chain.  A CCW is an instruction to an I/O device (Channel, Control Unit, or Device).  CCWs may be chained so that as soon as execution of a CCW has successfully completed anohter CCW will be processed.  If a CCW fails then no further CCWs in the chain are executed. Information about the success or failure of a CCW program is returned in the IOB.  This includes status information from the Channel Status Word (CSW).  The CSW is the communication area between the CPU and the I/O subsystem (Channels, Control Units, and Devices).

Most of the interesting part of EXCP programming centers around building the CCW chains.  We will start with looking at the CCW.

CCW

A CWW is 64 bits (8 bytes) in length.  Here is the layout of the CCW

 0        8        16       24       32       40       48       56
+--------+--------+--------+--------+--------+--------+--------+--------+
|  CMD   |    Data Addr (24 bits)   | FLAGS  |00000000|    Length       |
+--------+--------+--------+--------+--------+--------+--------+--------+

Command Code (Bits 0-7) Specifies the I/O operation to be performed.

Data Address (Bits 8-31) Specifies the location in main storage for the data associated with the I/O operation.

Chain Data Flag (CD) (Bit 32) When set to one indicates the chaining of data. It causes the storage area of the next CCW to be used with the current I/O operation. The use of data chaining allows data to be transferred to or from noncontiguous areas of storage in a single I/O operation.

Command Chain (CC) (Bit 33) When set to one, and when the CD flag is set to zero, indicates the chaining of commands. When the operation of the current CCW is complete and Command Chaining is active, the next CCW will become the new current I/O operation.

Suppress Length Indication (SLI) (Bit 34) When set to one and the CD flag is set to zero, the incorrect length indication is suppressed.

Skip (SKIP) (Bit 35) When set to one the transfer of information is suppressed for read and sense operations.

Program Controlled Interrupt (PCI) (Bit 36) When set to one the channel will generate an interruption condition when the CCW begins execution in the channel.

Indirect Data Address (IDA) (Bit 37) When set to one indicates indirect addressing. The data address of the CCW points to an Indirect Address List instead of directly to the data.

Count (Bits 48-63) Specifies the number of bytes to be used for the I/O operation.

Bits 38-47 should always be set to zeros.

Channel command codes are specific to each individual device but fall into general categories: Write, Read, Read Backward, Control and Sense. Write transfers data from the processor storage to the device, read and read backward transfer data from the device to processor storage. Control operations are specific to each device and generally do not involve data transfer but the data address in the CCW may point to an area in storage related to the control operation.