1 /* Begin include file ...... dskdcl.incl.pl1 */
  2 
  3 /****^  HISTORY COMMENTS:
  4   1) change(85-09-09,Fawcett), approve(85-09-09,MCR6979),
  5      audit(86-01-17,CLJones), install(86-03-21,MR12.0-1033):
  6      Support for FIPS dev 0.
  7   2) change(88-05-10,Farley), approve(88-06-03,MCR7906),
  8      audit(88-08-03,Fawcett), install(88-08-08,MR12.2-1080):
  9      Added reconnect_announce_time to chantab to allow announcement of
 10      reconnects at a throttled rate.  Otherwise only report them in the syserr
 11      log.  Also added IO_TYPE constant array for displaying I/O type.
 12                                                    END HISTORY COMMENTS */
 13 
 14 /* Structures used by the Disk DIM */
 15 
 16 /* Modified 84-03-21 by T. Oke for system wide free queue. */
 17 /* Modified 84-04-24 by T. Oke for dynamic channel table. */
 18 /* Modified 84-05-03 by T. Oke to hold sx for azm analysis. */
 19 /* Modified 84-05-14 by T. Oke for larger quentry and adaptive optimization. */
 20 /* Modifies 84-11-26 by R. A. Fawcett for device 0 (fips) */
 21 
 22 /* format: style4,delnl,insnl,tree,ifthenstmt,indnoniterend */
 23 
 24 dcl  disk_seg$ ext;                                         /* disk data segment */
 25 
 26 dcl  disksp ptr,                                            /* pointer to disk subsystem info */
 27      diskp ptr,                                             /* pointer to disk DIM info structure */
 28      optp ptr,                                              /* pointer to opt_info */
 29      sysp ptr;                                              /* pointer to sys_info */
 30 
 31 dcl  1 disk_data based (disksp) aligned,                    /* disk subsystem information */
 32        2 subsystems fixed bin,                              /* number of subsystems */
 33        2 free_offset bit (18),                              /* offset of first unused location in segment */
 34        2 status_mask bit (36),                              /* mask for checking for disk error */
 35        2 lock bit (36) unal,                                /* disk_data lock */
 36        2 free_q like qht,                                   /* head/tail offsets */
 37        2 free_q_size fixed bin,                             /* length of queue */
 38        2 array (32),                                        /* per subsystem info */
 39          (
 40          3 offset bit (18),                                 /* location of data for this subsystem */
 41          3 mbz bit (18),                                    /* low 18 of old  style indirect word */
 42          3 name char (4)
 43          ) unal,                                            /* name of subsystem */
 44        2 stagnate_time fixed bin (35),                      /* stagnatation period */
 45        2 bail_outs fixed bin (35),                          /* times ALM called PL1 */
 46        2 pad bit (36),                                      /* double word align */
 47        2 max_depth_reset_time fixed bin (71),               /* time max_reset done */
 48                                                             /* Upper bound is MAX_IO_TYPE, hard coded to avoid dynamic calculation */
 49        2 sys_info (0:6) like sys_info,                      /* MUST BE DOUBLE WORD ALIGNED */
 50        2 free_q_entries (2 refer (disk_data.free_q_size)) like quentry;
 51 
 52 
 53 /* The following system table is used to hold the maximum queue loading
 54    permitted system-wide for each IO type.  From the current loading and
 55    the maximum loading a multiplier fraction is calculated.  These combine
 56    to produce the final optimization multiplier to derive a Logcial Seek
 57    from a Physical Seek. */
 58 
 59 dcl  1 sys_info aligned based (sysp),
 60        3 depth float bin (27),                              /* current load */
 61        3 max_depth float bin (27),                          /* max permissible */
 62        3 fraction float bin (27),                           /* load fraction */
 63        3 depth_map bit (18) unaligned,                      /* which depth counter */
 64        3 pad bit (18) unaligned;
 65 %page;
 66 /* Maximum number of channels per sub-system.  Must be a power of two.  It must
 67    be at or below the size of disk_init's chan_array size.  Shift factor is for
 68    dctl's use. */
 69 
 70 dcl  dskdcl_chans_per_subsys fixed bin static options (constant) initial (32);
 71 dcl  dskdcl_chans_per_subsys_shift fixed bin static options (constant) initial (5);
 72 
 73 
 74 dcl  1 disktab based (diskp) aligned,                       /* control structure for DIM's */
 75        2 lock bit (36) unal,                                /* data base lock */
 76        2 nchan fixed bin,                                   /* number of disk channels */
 77        2 first_dev fixed bin unal,                          /* frist device number  0 or 1 */
 78        2 last_dev fixed bin unal,                           /* highest disk drive number */
 79        2 channels_online fixed bin,                         /* number of disk channels actually in use */
 80        2 dev_busy bit (72),                                 /* busy bit for each device (only 0-63 used) */
 81        2 dev_queued bit (72),                               /* requests queued bit for each device (only 0-63 used) */
 82        2 abs_mem_addr fixed bin (26) unsigned,              /* absolute memory address of this structure */
 83        2 channels bit (18) unal,                            /* location of chantab for this subsystem */
 84        2 dev_index fixed bin (17) unal,                     /* current device to check */
 85        2 errors fixed bin,                                  /* error count */
 86        2 ferrors fixed bin,                                 /* fatal error count */
 87        2 edac_errors fixed bin,                             /* count of EDAC correctable errors */
 88        2 call_lock_meters like disk_lock_meters,            /* lock meters for call side of DIM */
 89        2 int_lock_meters like disk_lock_meters,             /* lock meters for interrupt side of DIM */
 90        2 alloc_wait_meters like disk_lock_meters,           /* meters for queue entry allocations */
 91        2 run_lock_meters like disk_lock_meters,             /* lock meters for run calls */
 92        2 devtab (0:0 refer (disktab.last_dev)) like devtab; /* device information table */
 93 
 94 dcl  1 disk_channel_table (1 refer (disktab.nchan)) like chantab based aligned;
 95 
 96 
 97 dcl  qp ptr,                                                /* pointer to queue entry */
 98      cp ptr;                                                /* pointer to channel information table */
 99 %page;
100 
101 /* Queue entry, 6 words.  Cylinder and sector variables are over-size for
102    expansion space.  They will always be positive and upper bits can be
103    stolen for other fields.
104 
105    Entries are forward and back linked to permit easy chasing and removal. */
106 
107 dcl  1 quentry based (qp) aligned,                          /* queue entry */
108                                                             /* WORD 1 */
109        2 next bit (18) unaligned,                           /* forward link */
110        2 prev bit (18) unaligned,                           /* back link */
111                                                             /* WORD 2 */
112        2 intrpt bit (1) unaligned,                          /* completion interrupt desired */
113        2 used bit (1) unaligned,                            /* entry in use */
114        2 type fixed bin (4) unsigned unaligned,             /* IO type */
115        2 pad bit (6) unaligned,                             /* future expansion */
116        2 coreadd bit (24) unaligned,                        /* main memory address */
117                                                             /* WORD 3 */
118        2 pvtx fixed bin (8) unsigned unaligned,             /* for AZM/ol_dump */
119        2 pdi fixed bin (6) unsigned unaligned,              /* physical device */
120        2 dev fixed bin (6) unsigned unaligned,              /* device in sub-sys */
121        2 pad2 bit (5) unaligned,
122        2 cylinder fixed bin (11) unsigned unaligned,        /* cylinder of request */
123                                                             /* WORD 4 */
124        2 n_sectors fixed bin (6) unsigned unaligned,        /* # sectors of IO */
125        2 pad3 bit (9) unaligned,
126        2 sector bit (21) unaligned,                         /* device sector desired */
127                                                             /* WORDS 5&6 */
128        2 time fixed bin (71);                               /* clock at queue */
129 
130 
131 
132 dcl  1 chantab based (cp) aligned,                          /* channel information table */
133        2 chx fixed bin (35),                                /* io_manager channel index */
134        2 ioi_ctx fixed bin (35),                            /* ioi channel table index */
135        2 statusp ptr,                                       /* pointer to hardware status word */
136        2 chanid char (8),                                   /* channel name */
137        (
138        2 pad0 bit (18),
139        2 in_use bit (1),                                    /* non-zero if channel being used */
140        2 active bit (1),                                    /* non-zero if channel active */
141        2 rsr bit (1),                                       /* non-zero if RSR in progress */
142        2 ioi_use bit (1),                                   /* non-zero if channel usurped by IOI */
143        2 inop bit (1),                                      /* non-zero if channel inoperative */
144        2 broken bit (1),                                    /* non-zero if channel broken */
145        2 action_code bit (2),                               /* saved from status */
146        2 pad1 bit (10)
147        ) unal,
148        (
149        2 qrp bit (18),                                      /* rel ptr to queue entry */
150        2 pad2 bit (3),
151        2 command bit (6),                                   /* peripheral command */
152        2 erct fixed bin (8)
153        ) unal,                                              /* error retry count */
154        2 select_data,                                       /* data passed to IOM on select */
155          (
156          3 limit bit (12),                                  /* limit on number of sectors */
157          3 mbz bit (3),
158          3 sector bit (21)
159          ) unaligned,                                       /* sector address */
160        2 reconnect_announce_time fixed bin (52),            /* reconnect announcement throttle */
161        2 connect_time fixed bin (52),                       /* time of last connect */
162        2 connects fixed bin,                                /* count of connects performed */
163        2 detailed_status (0:17) bit (8) unal,               /* detailed status bytes */
164        2 rstdcw bit (36),                                   /* restore command */
165        2 scdcw bit (36),                                    /* select command */
166        2 sddcw bit (36),                                    /* select data xfer */
167        2 dcdcw bit (36),                                    /* command to read or write */
168        2 dddcw bit (36),                                    /* data xfer DCW */
169        2 dscdcw bit (36),                                   /* RSR command */
170        2 dsddcw bit (36),                                   /* RSR data xfer */
171        2 rssdcw bit (36),                                   /* RSS command */
172        2 status bit (36) aligned,                           /* saved status */
173                                                             /* Lossage counters for interrupt loss. */
174        2 no_io_terminate fixed bin (35),                    /* no t bit from io_manager$get_status */
175        2 terminate_not_active fixed bin (35),               /* terminate, but not active */
176        2 no_status_terminate fixed bin (35),                /* interrupt with no terminate */
177        2 status_from_run fixed bin (35);                    /* status missed til run called */
178 %page;
179 dcl  1 qht aligned based,                                   /* queue head/tail structure */
180        2 sum fixed bin (35),                                /* sum of depths */
181        2 count fixed bin (35),                              /* allocs */
182        2 max_depth fixed bin (17) unaligned,                /* high water mark */
183        2 depth fixed bin (17) unaligned,                    /* current depth */
184        2 head bit (18) unaligned,                           /* queue head */
185        2 tail bit (18) unaligned;                           /* queue tail */
186 
187 dcl  dp ptr,                                                /* pointer to device information table */
188      pvtdip ptr;                                            /* pointer to dim_info in PVT entry */
189 
190 dcl  1 devtab based (dp) aligned,                           /* device information table */
191        (
192        2 pvtx fixed bin (8),                                /* index of PVT entry for device */
193        2 inop bit (1),                                      /* device inoperative */
194        2 was_broken bit (1),                                /* device previously broken */
195        2 broken bit (1),                                    /* device down */
196        2 abandoned bit (1),                                 /* device lost and gone forever */
197        2 forward bit (1),                                   /* moving low->high */
198        2 pad bit (10),
199        2 buddy unsigned fixed bin (6),                      /* other device on this spindle or 0 */
200        2 pdi unsigned fixed bin (6)
201        ) unal,                                              /* primary device index */
202        2 cylinder fixed bin (35),                           /* current cylinder position */
203        2 comb fixed bin (35),                               /* number of combs */
204        2 pad1 fixed bin (35),
205        2 time_inop fixed bin (52),                          /* time drive became inoperative */
206        2 wq like qht,                                       /* work queue */
207                                                             /* Upper bound must be MAX_IO_TYPE, constant to avoid dynamic calculation. */
208        2 opt_info (0:6) like opt_info;                      /* optimizer */
209 
210 
211 /* Optimizing table for device. Must be even multiple words long. */
212 /* Slope and intercept define a straight line of y = intercept - slope*x
213    Multiplier is calculated from this and current system loading.
214 
215    sys_info is the offset to the relevant system queue loading fraction. */
216 
217 dcl  1 opt_info aligned based (optp),
218        3 multiplier float bin (27),                         /* depth mult */
219        3 slope float bin (27),                              /* slope of line */
220        3 intercept float bin (27),                          /* Y intercept */
221        3 sys_info bit (18) unaligned,                       /* offset to sys_info */
222        3 depth fixed bin (17) unaligned,                    /* elements in queue */
223        3 channel_wait fixed bin (52),                       /* total channel time waiting */
224        3 queue_wait fixed bin (52),                         /* total queue time waiting */
225        3 seek_sum fixed bin (35) unaligned,                 /* sum of seeks */
226        3 seek_count fixed bin (35) unaligned;               /* number of seeks */
227 
228 
229 dcl  1 pvtdi based (pvtdip) aligned,                        /* disk DIM info in PVT entry */
230        (
231        2 sx fixed bin (11),                                 /* structure index */
232        2 usable_sect_per_cyl fixed bin (11),                /* # of usable sectors on disk cylinder */
233        2 unused_sect_per_cyl fixed bin (11)
234        ) unal;                                              /* # of unused sectors at end of cylinder */
235 
236 dcl  1 disk_lock_meters based aligned,                      /* lock meters for disk DIM */
237        2 count fixed bin,                                   /* total number of attempts */
238        2 waits fixed bin,                                   /* number of attempts which required waiting */
239        2 wait_time fixed bin (52);                          /* total time spent waiting */
240 
241 dcl  (
242      RST_LISTX init (1),                                    /* listx for restore */
243      SC_LISTX init (2),                                     /* listx for select */
244      DSC_LISTX init (6),                                    /* listx for RSR */
245      RSS_LISTX init (8)
246      ) fixed bin (12) static options (constant);            /* listx for RSS */
247 
248 /* IO types defined.  Value is also index of write_map to determine if
249    the IO type is a read or a write. */
250 
251 dcl  (
252      PAGE_READ init (0),
253      PAGE_WRITE init (1),
254      VTOC_READ init (2),
255      VTOC_WRITE init (3),
256      TEST init (4),
257      BOOTLOAD_READ init (5),
258      BOOTLOAD_WRITE init (6),
259      MAX_IO_TYPE init (6)
260      ) fixed bin (4) static options (constant);
261 
262 dcl  IO_TYPE (0:6) char (16)
263           initial ("Page Read", "Page Write", "VTOC Read", "VTOC Write", "Test", "Bootload Read", "Bootload Write")
264           static options (constant);
265 
266 /* Map indexed by IO type to determine if operation is a read or write. */
267 
268 dcl  write_mapping bit (7) initial ("0101001"b) static options (constant);
269 dcl  write_map (0:6) bit (1) defined (write_mapping);
270 
271 /* Map indexed by IO type to determine if operation is a sector IO. */
272 
273 dcl  sector_mapping bit (7) initial ("0011111"b) static options (constant);
274 dcl  sector_map (0:6) bit (1) defined (sector_mapping);
275 
276 /* Map indexed by IO type to determine if operation is done on behalf of bce */
277 
278 dcl  bootload_mapping bit (7) initial ("0000011"b) static options (constant);
279 dcl  bootload_map (0:6) bit (1) defined (bootload_mapping);
280 
281 /* End of include file ...... dskdcl.incl.pl1 */