1 /*  START OF:       tape_ioi_workspace.incl.pl1               *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
  2 
  3 
  4 
  5 /****^  HISTORY COMMENTS:
  6   1) change(87-07-06,Hartogs), approve(87-07-06,MCR7726),
  7      audit(87-08-27,GWMay), install(87-08-27,MR12.1-1094):
  8      A) Added variable at_bot to structure tai.
  9      B) Added density_command to tai structure for use by error_retry.
 10                                                    END HISTORY COMMENTS */
 11 
 12 
 13 /*
 14    *           This include file describes the workspace maintained by tape_ioi_.
 15    *      No programs other than tape_ioi_ programs should need to use this include file.
 16    *
 17    *      This workspace is the ioi_ workspace.
 18 */
 19 /* Written 8/78 by R.J.C. Kissel. */
 20 /* Modified April-May 1982 by Chris Jones for installation. */
 21 /* Modified 2/4/83 by Chris Jones to add last_terminate_time */
 22 
 23 /* format: style4,delnl,insnl,indattr,ifthen,declareind10,dclind10 */
 24 
 25 dcl       wksp                   ptr;
 26 
 27 dcl       1 tai                  based (wksp) aligned,      /* Activation info and order buffer. */
 28             2 ioi_index          fixed bin,                 /* For communication with ioi. */
 29             2 tioi_id            unal,                      /* 36 bit activation identifier. */
 30               3 segno            bit (18),                  /* Segment number of the workspace. */
 31               3 actid            fixed bin (18) unsigned,   /* Per process, per activation number. */
 32             2 event_id           fixed bin (71),            /* All ipc done on this channel. */
 33             2 max_timeout        fixed bin (71),            /* maximum timeout value */
 34             2 cur_timeout        fixed bin (71),            /* current timeout value */
 35             2 last_terminate_time
 36                                  fixed bin (71),            /* when the last terminate interrupt was received */
 37             (
 38             2 workspace_max      fixed bin (18) unsigned,   /* max_len-1 to fit in 18 bits. */
 39             2 workspace_len      fixed bin (18) unsigned,   /* len-1 to fit in 18 bits. */
 40             2 buffer_list_offset fixed bin (18) unsigned,   /* to list of all buffers */
 41             2 free_list_offset   fixed bin (18) unsigned,   /* to list of free buffers */
 42             2 queue_list_offset  fixed bin (18) unsigned,   /* to list of buffers which are queued */
 43             2 susp_list_offset   fixed bin (18) unsigned,   /* to list of suspended buffers */
 44             2 retry_count        fixed bin (9) unsigned,    /* number of times we've retried this operation */
 45             2 buffer_count       fixed bin (9) unsigned,    /* Number of I/O buffers allocated. */
 46             2 status_entry_count fixed bin (9) unsigned,    /* Number of status queue entries. */
 47             2 status_entry_idx   fixed bin (9) unsigned,    /* index of next status entry to be used */
 48             2 status_queue_offset
 49                                  fixed bin (18) unsigned,   /* Status queue offset. */
 50             2 pad1               bit (12),
 51             2 density_command    bit (6),                   /* density of data on storage */
 52             2 workarea_len       fixed bin (18) unsigned,   /* len-1 to fit in 18 bits. */
 53             2 workarea_offset    fixed bin (18) unsigned    /* Workarea offset. */
 54             )                    unal,
 55             2 modes              unal,                      /* tape_ioi_ modes settings. */
 56               3 data_code        bit (6),                   /* Encoded representation of data mode. */
 57               3 cif_code         bit (6),                   /* CIF field for channel instructions. */
 58               3 align            bit (1),                   /* "0"b--left aligned, "1"b--right aligned. */
 59               3 length           bit (1),                   /* "0"b--normal, "1"b--special. */
 60               3 recovery         bit (1),                   /* "0"b--no error recovery, "1"b--error recovery. */
 61               3 wait             bit (1),                   /* "0"b--simplex, "1"b--multiplex. */
 62               3 req_len          bit (1),                   /* "0"b--don't need to know record length, "1"b--do need it */
 63             2 flags              unal,                      /* Used internally by tape_ioi_. */
 64               3 order_queued     bit (1),                   /* "0"b--no order queued, "1"b--order queued. */
 65               3 read_queued      bit (1),                   /* "0"b--no read queued, "1"b--read queued. */
 66               3 write_queued     bit (1),                   /* "0"b--no write queued, "1"b--write queued. */
 67               3 order_done       bit (1),                   /* "1"b--the queue_order entry finished the order */
 68               3 workarea_last    bit (1),                   /* "1"b--user workarea at end of workspace */
 69               3 special_status_expected
 70                                  bit (1),                   /* set if we're waiting for a special interrupt */
 71               3 retry_in_progress
 72                                  bit (1),
 73               3 suspect_short_record bit (1),               /* "1"b--got invalid DCW on list service last */
 74               3 at_bot           bit (1),                   /* "1"b-- tape is positioned to BOT. */
 75             2 pad2               bit (1) unal,
 76             2 order_idx          fixed bin (9) unsigned unaligned,
 77                                                             /* encoding of last order queued */
 78             2 counts             aligned,                   /* error and operation counts */
 79               3 total_reads      fixed bin (35),
 80               3 read_errors      fixed bin (35),
 81               3 total_writes     fixed bin (35),
 82               3 write_errors     fixed bin (35),
 83               3 total_orders     fixed bin (35),
 84               3 order_errors     fixed bin (35),
 85               3 times_status_lost
 86                                  fixed bin (35),
 87               3 extra_statuses   fixed bin (35),
 88               3 times_tape_stopped
 89                                  fixed bin (35),
 90               3 recovery_succeeded
 91                                  (7) fixed bin (35),        /* meters which kind of recovery worked */
 92             2 order_count_requested
 93                                  fixed bin (18) unsigned unaligned,
 94             2 order_count_done   fixed bin (18) unsigned unaligned,
 95             2 saved_special_status
 96                                  bit (36),
 97             2 order_data_ptr     ptr,
 98             2 order_idcw         bit (36) aligned,
 99             2 order_dcw          bit (36) aligned,
100             2 order_data         (1:8) bit (36) aligned;
101 /**** The buffers go here, followed by the status queue entries.  There are min (1, tai.nbufs) status queue entries. */
102 /**** It is considered a good idea to have the length of the previous structure b an even number of words long.  This
103       is accomplished by the aligned pointer "order_data_ptr" being followed by an even number of words. */
104 %page;
105 /* Tape buffer overlay.  Each tape buffer consists of a variable length header followed by the data area.
106    Whenever a buffer pointer is returned to a caller of tape_ioi_, it points to the data area. */
107 
108 dcl       1 tbi                  based aligned,             /* I/O buffer overlay. */
109           ( 2 data_offset        fixed bin (18) unsigned,   /* to the data portion of the buffer */
110             2 next_buf_offset    fixed bin (18) unsigned,   /* to the next buffer in list of all buffers */
111             2 next_state_offset  fixed bin (18) unsigned,   /* to the next buffer in the same state */
112             2 state              fixed bin (9) unsigned,    /* buffer state */
113             2 ndcws              fixed bin (9) unsigned     /* number of DCWs necessary to fill buffer */
114             )                    unal,
115             2 modes              unal like tai.modes,       /* mode settings when buffer was queued */
116             2 reserved           bit (1) unal,              /* "1"b=>won't be used for reads unless explicitly asked */
117             2 buffer_len         fixed bin (21),            /* length of buffer in 9-bit bytes */
118             2 data_len           fixed bin (21),            /* length of data in buffer in 9-bit bytes */
119             2 bit_len            fixed bin (24),            /* length of data in buffer in bits */
120             2 idcw_word          bit (36),                  /* holds IDCW */
121             2 dcw_words          (1 refer (tbi.ndcws)) bit (36),
122                                                             /* data DCWs */
123             2 tdcw_word          bit (36);                  /* transfer to the next buffer */
124                                                             /* This header is followed by the actual buffer area. */
125 %page;
126 /*
127    *      N^H__^Ho_^Ht_^He_^Hs
128    *
129    *           Both structures are carefully packed into words, so care should be
130    *      taken when modifying them.
131    *
132    *           The workspace_max, workspace_len, and workarea_len must be at least one long.
133    *      This allows us to store the value-1 and thus fit into 18 bits.
134    *
135    *           None of the offsets (first_buf_off, statq_off, etc.) can be zero since the first
136    *      word in the workspace contains the ioi_index.  This allows a zero offset
137    *      to be used as a null offset indication.
138    *
139    *           The data_code, cif_code, and tbi.state are encoded as follows:
140    *
141    *      data mode |                                                     buffer |
142    *      setting   | data_code     cif_code |    Meaning                 state  | Meaning
143    *      __________|__________     _________|_______________________     _______|________
144    *        bin     |   05            20     | no retry, high                1   | ready
145    *        bcd     |   04            21     | no retry, low                 2   | busy
146    *        tap9    |   03            22     | no retry, high, deskew        3   | suspended
147    *        asc     |   27            23     | no retry, low, deskew
148    *        ebc     |   24            30     | retry, high
149    *        a/e     |   25            31     | retry, low
150    *                                  32     | retry, high, deskew
151    *                                  33     | retry, low, deskew
152    *
153    *
154    *           Before data_code can be used for the command field in the IDCW the fourth
155    *      bit (from the right) must be set to "0"b for read commands and to "1"b for write commands.
156    *
157    *           The general layout of the workspace maintained by tape_ioi_ is as follows:
158    *
159    *                          _________________________
160    *                          |                       |
161    *                          |  General Information  |
162    *                          |       (see tai)       |
163    *                          |_______________________|
164    *                          |______O^H_^H__^H_^Hr_^H_^Hd_^H_^He_^H_^Hr_I^H_D^H_C^H_W^H________|
165    *                          |______O^H_^H__^H_^Hr_^H_^Hd_^H_^He_^H_^Hr_D^H_C^H_W^H_________|
166    *                          |                       |
167    *                          |   Order data buffer   |
168    *                          |       (8 words)       |
169    *                          |_______________________|
170    *                          |                       |
171    *                          |   Optional workarea   |
172    *                          |      (unlimited)      |
173    *                          |_______________________|
174    *                          |________I^H_^H_O^H_^H__I^H_D^H_C^H_W^H_________|
175    *                          |                       |
176    *                          |      IO DCW list      |
177    *                          |_______________________|
178    *                          |________I^H_^H_O^H_^H__T^H_D^H_C^H_W^H_________|
179    *                          |                       |
180    *                          |       IO buffer       |
181    *                          |   (user specified)    |
182    *                          |_______________________|
183    *                                      .
184    *                                      .
185    *                                      .
186    *                          _________________________
187    *                          |________I^H_^H_O^H_^H__I^H_D^H_C^H_W^H_________|
188    *                          |                       |
189    *                          |      IO DCW list      |
190    *                          |_______________________|
191    *                          |__________^Hz_^He_^Hr_^Ho_^Hs_________|
192    *                          |                       |
193    *                          |       IO buffer       |
194    *                          |    (user specified)   |
195    *                          |_______________________|
196    *                          |                       |
197    *                          |     Status queue      |
198    *                          | (at least one entry)  |
199    *                          |_______________________|
200    *                          |                       |
201    *                          |   Optional workarea   |
202    *                          |       (limited)       |
203    *                          |_______________________|
204 */
205 
206 /*  END OF:         tape_ioi_workspace.incl.pl1               *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */