Table of Contents

DMTIOM Source

References

Source Listing

DMTIOM.ASSEMBLE.txt
  1. IOM TITLE 'DMTIOM (RSCS) VM/370 - RELEASE 6' 00001000
  2. *. 00002000
  3. * MODULE NAME - 00003000
  4. * 00004000
  5. * DMTIOM 00005000
  6. * 00006000
  7. * FUNCTION - 00007000
  8. * 00008000
  9. * THE DMTIOM MODULE CONTAINS BOTH THE MSUP I/O 00009000
  10. * INTERRUPT HANDLER AND THE TASK I/O SERVICE 00010000
  11. * ROUTINE. THE I/O SERVICE PROVIDED BY DMTIOM TO THE 00011000
  12. * TASK PROGRAMS INCLUDES SEQUENTIAL SUBCHANNEL 00012000
  13. * SCHEDULING, CHANNEL PROGRAM EXECUTION, AUTOMATIC 00013000
  14. * SENSE EXECUTION ON UNIT CHECK WHEN REQUESTED, 00014000
  15. * RETURN OF ALL PERTINENT INFORMATION REGARDING THE 00015000
  16. * EXECUTION OF THE CHANNEL PROGRAM, AND NOTIFICATION 00016000
  17. * VIA POST ON COMPLETION OF CHANNEL PROGRAM 00017000
  18. * EXECUTION. 00018000
  19. * 00019000
  20. * ATTRIBUTES - 00020000
  21. * 00021000
  22. * REUSABLE 00022000
  23. * 00023000
  24. * INTERRUPT ENTRY EXECUTABLE DISABLED ONLY 00024000
  25. * 00025000
  26. * ENTRY POINTS - 00026000
  27. * 00027000
  28. * DMTIOMIN - DIRECTLY ON I/O INTERRUPT 00028000
  29. * DMTIOMRQ - ON I/O SERVICE REQUEST FROM DISPATCHED PROGRAM 00029000
  30. * 00030000
  31. * 00031000
  32. * ENTRY CONDITIONS - 00032000
  33. * 00033000
  34. * ON INTERRUPT ENTRY, THE I/O STATUS INFORMATION IS STORED 00034000
  35. * IN THE I/O OLD PSW AND THE CSW. ENTRY MAY OCCUR AT ANY 00035000
  36. * TIME AN I/O SYSTEM MASK IS ON. 00036000
  37. * 00037000
  38. * ON TASK SERVICE CALL ENTRY, GREG 1 POINTS TO THE TASK'S 00038000
  39. * I/O REQUEST TABLE. 00039000
  40. * 00040000
  41. * 00041000
  42. * EXIT CONDITIONS - 00042000
  43. * 00043000
  44. * NORMAL - 00044000
  45. * 00045000
  46. * UNDISPATCHED, TO THE DISPATCHER TO RESUME PROCESSING. 00046000
  47. * 00047000
  48. * ERROR POST CODES - 00048000
  49. * 00049000
  50. * 2,3 = SIO CONDITION CODES 00050000
  51. * 8 = AUTO SENSE FAILED - NO FREE SUP QUEUE ELEMENT 00051000
  52. * 12 = AUTO SENSE FAILED - I/O ERROR 00052000
  53. * 16 = I/O REQ FAILED - NO FREE SUP QUEUE ELEMENT 00053000
  54. * 00054000
  55. * 00055000
  56. EJECT 00056000
  57. * 00057000
  58. * CALLS TO OTHER ROUTINES - 00058000
  59. * 00059000
  60. * DMTQRQ - TO RESERVE OR RELEASE SUPERVISOR QUEUE ELEMENTS 00060000
  61. * DMTDSP - TO RESUME DISPATCHED PROCESSING 00061000
  62. * 00062000
  63. * 00063000
  64. * EXTERNAL REFERENCES - 00064000
  65. * 00065000
  66. * NONE 00066000
  67. * 00067000
  68. * 00068000
  69. * TABLES / WORKAREAS - 00069000
  70. * 00070000
  71. * TAREA - TASK SAVE AREA 00071000
  72. * TASKE - TASK SUPERVISOR QUEUE ELEMENT 00072000
  73. * IOE - I/O REQUEST SUPERVISOR QUEUE ELEMENT 00073000
  74. * ASYNE - ASYNCH I. 00074000
  75. * ASYNE - ASYN I/O IRRPT EXIT REQ SUP QUEUE ELEMENT 00075000
  76. * IOTABLE - TASK I/O REQUEST TABLE 00076000
  77. * 00077000
  78. * 00078000
  79. * 00079000
  80. * REGISTER USAGE - 00080000
  81. * 00081000
  82. * GPR0 = RETURN POST CODE ON ENTRY TO DISMISS 00082000
  83. * GPR1 = PARAMETER PASSING REGISTER 00083000
  84. * GPR2 = I/O REQUEST ELEMENT BASE 00084000
  85. * GPR3 = I/O TABLE BASE, OR AUTO SENSE ELEMENT BASE 00085000
  86. * GPR4 = ADDR OF PREDECESSOR ELEM OF GPR2 I/O ELEM 00086000
  87. * GPR5 = I/O QUEUE SCAN ELEMENT POINTER REGISTER 00087000
  88. * GPR12 = DMTIOM BASE REGISTER 00088000
  89. * GPR14 = TASK AREA BASE REG; LINKAGE RETURN REG 00089000
  90. * GPR15 = LINKAGE ENTRY REG 00090000
  91. * 00091000
  92. * NOTES - 00092000
  93. * 00093000
  94. * ASSUMPTIONS USED BY DMTIOM LOGIC: 00094000
  95. * 00095000
  96. * 1. FOLLOWING SIO, CC=0, FOR A CERTAIN DEVICE ADDRESS, 00096000
  97. * THE FIRST I/O INTERRUPT SPECIFYING THAT DEVICE ADDRESS, 00097000
  98. * AND SPECIFYING STATUS OTHER THAN STANDALONE PCI, 00098000
  99. * SIGNALS CHANNEL TERMINATION AND THE PRESENCE OF VALID 00099000
  100. * ENDING CCW ADDRESS AND RESIDUAL COUNT. 00100000
  101. * 00101000
  102. * 2. FOR THE PURPOSES OF MULTIPLEXOR CHANNEL SCHEDULING, 00102000
  103. * DEVICE ADDRESSES X'000' TO X'0BF' ARE EACH ON NON- 00103000
  104. * SHARED SUBCHANNELS; DEVICE ADDRESSES X'0C0' TO X'0CF', 00104000
  105. * X'0D0' TO X'0DF', X'0E0' TO X'0EF', AND X'0F0' TO 00105000
  106. * X'0FF' ARE ON SUBCHANNELS SHARED WITHIN THE GROUP 00106000
  107. * OF ADDRESSES IN WHICH THE DEVICE ADDRESS RESIDES. 00107000
  108. * 00108000
  109. EJECT 00109000
  110. * 00110000
  111. * OPERATION - 00111000
  112. * 00112000
  113. * 00113000
  114. * THE I/O SERVICE ROUTINE IS ENTERED VIA A BRANCH 00114000
  115. * AND LINK FROM TASK PROGRAMS. EXECUTION OF THE 00115000
  116. * CALLING TASK IS IMMEDIATELY SUSPENDED BY MEANS OF 00116000
  117. * THE FREEZE SVC. A SUPERVISOR QUEUE ELEMENT IS 00117000
  118. * GOTTEN BY MEANS OF A CALL TO DMTQRQ, AND THE 00118000
  119. * APPROPRIATE I/O ELEMENT IS BUILT USING THE 00119000
  120. * INFORMATION SPECIFIED IN THE I/O REQUEST TABLE 00120000
  121. * SUPPLIED BY THE CALLER. THE APPROPRIATE (SELECTOR 00121000
  122. * OR MULTIPLEXOR) CHANNEL QUEUE IS SCANNED TO LOCATE 00122000
  123. * THE POSITION OF THE SUBQUEUE FOR THE SUBCHANNEL ON 00123000
  124. * WHICH THE I/O IS TO BE EXECUTED. IF A SUBQUEUE 00124000
  125. * ALREADY EXISTS FOR THE SUBCHANNEL, THE IMPLICATION 00125000
  126. * IS THAT THE SUBCHANNEL IS BUSY WITH ANOTHER I/O 00126000
  127. * REQUEST EXECUTION. IN THIS CASE, THE NEW REQUEST 00127000
  128. * ELEMENT IS ENQUEUED AT THE END OF THE SUBQUEUE FOR 00128000
  129. * LATER EXECUTION, AND CONTROL IS PASSED TO THE 00129000
  130. * DISPATCHER. IF NO SUBQUEUE EXISTS, THE NEW ELEMENT 00130000
  131. * BECOMES THE FIRST ENTRY IN THE SUBQUEUE AND 00131000
  132. * CONTROL IS PASSED TO THE ROUTINE WHICH STARTS I/O 00132000
  133. * REQUEST ELEMENTS. 00133000
  134. * 00134000
  135. * ON ENTRY FROM AN I/O INTERRUPT, DMTIOMIN SAVES THE 00135000
  136. * EXECUTION STATUS IF NECESSARY AND SEARCHES THE 00136000
  137. * APPROPRIATE I/O QUEUE TO FIND AN ACTIVE I/O 00137000
  138. * REQUEST ELEMENT ON THE INTERRUPTING DEVICE. IF NO 00138000
  139. * SUCH ELEMENT IS FOUND, THE ASYNCHRONOUS I/O EXIT 00139000
  140. * QUEUE IS SCANNED FOR A MATCHING DEVICE ADDRESS, 00140000
  141. * AND AN ASYNCHRONOUS EXIT IS TAKEN IF A MATCH IS 00141000
  142. * FOUND. IF NEITHER AN ACTIVE I/O REQUEST ELEMENT 00142000
  143. * NOR AN ASYNCHRONOUS EXIT REQUEST ELEMENT IS 00143000
  144. * LOCATED FOR THE INTERRUPTING DEVICE, THE INTERRUPT 00144000
  145. * IS IGNORED AND CONTROL IS PASSED TO THE 00145000
  146. * DISPATCHER. 00146000
  147. * 00147000
  148. * IF AN ACTIVE I/O ELEMENT IS FOUND, THE ELEMENT AND 00148000
  149. * THE ASSOCIATED I/O REQUEST TABLE IN TASK STORAGE 00149000
  150. * ARE UPDATED TO REFLECT THE NEW STATUS OF THE I/O 00150000
  151. * REQUEST EXECUTION. IF THE INTERRUPT IS A STAND 00151000
  152. * ALONE PCI, THE ASYNCHRONOUS EXIT REQUEST QUEUE IS 00152000
  153. * SCANNED FOR A MATCHING DEVICE ADDRESS, AND THE 00153000
  154. * EXIT IS TAKEN IF ONE IS FOUND. THE UPDATED ACTIVE 00154000
  155. * I/O REQUEST TABLE IS INSPECTED TO SEE IF THE 00155000
  156. * REQUESTED I/O PROCESSING HAS COMPLETED. IF IT HAS 00156000
  157. * NOT, CONTROL IS IMMEDIATELY RETURNED TO THE 00157000
  158. * DISPATCHER. OTHERWISE, THE I/O REQUEST TABLE IS 00158000
  159. * INSPECTED TO SEE IF UNIT CHECK HAS BEEN SET AND 00159000
  160. * AUTOMATIC SENSE HAS BEEN REQUESTED. IF THIS IS THE 00160000
  161. * CASE, ANOTHER SUPERVISOR QUEUE ELEMENT IS GOTTEN 00161000
  162. * BY MEANS OF A CALL TO DMTQRQ, THE SENSE CHANNEL 00162000
  163. * PROGRAM IS BUILT IN THE NEW ELEMENT, THE NEW 00163000
  164. * ELEMENT IS CHAINED TO THE REQUEST ELEMENT, AND THE 00164000
  165. * SENSE OPERATION IS STARTED. IF THE SENSE OPERATION 00165000
  166. * DOES NOT IMMEDIATELY COMPLETE, CONTROL IS PASSED 00166000
  167. * TO THE DISPATCHER. 00167000
  168. * 00168000
  169. * WHEN SERVICE FOR A REQUEST IS COMPLETELY FINISHED, 00169000
  170. * THE ASSOCIATED I/O ELEMENT (AND SENSE ELEMENT, IF 00170000
  171. * PRESENT) ARE DEQUEUED AND FREED BY MEANS OF A CALL 00171000
  172. * TO DMTQRQ, AND THE REQUESTING TASK'S I/O REQUEST 00172000
  173. * TABLE IS POSTED BY MEANS OF A CALL TO DMTPST. IF 00173000
  174. * ANOTHER I/O REQUEST ELEMENT IS PENDING ON THE 00174000
  175. * SUBQUEUE FOR THE SUBCHANNEL WHICH HAS JUST 00175000
  176. * COMPLETED THE PREVIOUS REQUEST EXECUTION, CONTROL 00176000
  177. * IS PASSED TO THE ROUTINE WHICH STARTS I/O REQUEST 00177000
  178. * ELEMENTS. OTHERWISE, CONTROL IS PASSED TO THE 00178000
  179. * DISPATCHER. 00179000
  180. * 00180000
  181. * THE ROUTINE WHICH STARTS I/O REQUEST ELEMENTS MAY 00181000
  182. * BE ENTERED EITHER FROM I/O INTERRUPT PROCESSING OR 00182000
  183. * I/O REQUEST SERVICE. ITS FUNCTION IS SIMPLY TO 00183000
  184. * MOVE THE STARTING CCW ADDRESS FROM THE TASK'S I/O 00184000
  185. * REQUEST TABLE TO THE LOW STORAGE CAW, AND START 00185000
  186. * THE I/O CHANNEL PROGRAM ON THE APPROPRIATE DEVICE. 00186000
  187. * IF THE I/O COMPLETES IMMEDIATELY, CONTROL IS 00187000
  188. * PASSED DIRECTLY TO THE ROUTINE WHICH COMPLETES I/O 00188000
  189. * REQUEST PROCESSING AND SELECTS A NEW REQUEST ON 00189000
  190. * THE SUBCHANNEL FOR PROCESSING. IF A PENDING 00190000
  191. * ASYNCHRONOUS INTERRUPT FOR THE DEVICE IS CLEARED 00191000
  192. * BY THE SIO, THE ROUTINE SETS A REGISTER WHICH 00192000
  193. * CAUSES THE INTERRUPT TO BE FAKED PRIOR TO RETURN 00193000
  194. * TO THE DISPATCHER. 00194000
  195. * 00195000
  196. * 00196000
  197. *. 00197000
  198. EJECT 00198000
  199. DMTIOM CSECT 00199000
  200. ENTRY DMTIOMIN,DMTIOMRQ 00200000
  201. SPACE 00201000
  202. *---------------------------------------------------------------------* 00202000
  203. * * 00203000
  204. * NOTE - THIS ROUTINE EMPLOYS THE FOLLOWING REGISTER USAGE: * 00204000
  205. * * 00205000
  206. * REG 2 = ADDRESS OF THE I/O REQUEST ELEMENT BEING PROCESSED * 00206000
  207. * REG 3 = ADDRESS OF THE I/O TABLE ASSOCIATED WITH THAT ELEMENT* 00207000
  208. * (OR, WHEN A SENSE ELEMENT IS PRESENT, THE ADDRESS OF * 00208000
  209. * THAT SENSE ELEMENT) * 00209000
  210. * REG 4 = ADDRESS OF THE I/O REQUEST ELEMENT WHICH POINTS TO * 00210000
  211. * THE ELEMENT BEING PROCESSED (THE "LAST" ELEMENT) * 00211000
  212. * * 00212000
  213. * MODIFICATIONS WHICH WOULD USE THESE REGISTERS FOR OTHER * 00213000
  214. * PURPOSES OUGHT TO BE MADE WITH A GREAT DEAL OF CAUTION * 00214000
  215. * A WORD TO THE WISE .... * 00215000
  216. * * 00216000
  217. *---------------------------------------------------------------------* 00217000
  218. SPACE 2 00218000
  219. * I/O INTERRUPT ENTRY POINT 00219000
  220. DMTIOMIN EQU * 00220000
  221. SPACE 00221000
  222. USING SVECTORS,0 GET SVECTORS ADDRESSABILITY 00222000
  223. STM R14,R15,SSAVE SAVE WORK REGISTERS IN TEMPORARY SAVE AREA 00223000
  224. L R15,NEWIO+4 REG 15 = ADDRESS OF I/O INTERRUPT ENTRY POIN 00224000
  225. USING DMTIOMIN,R15 DEFINE TEMPORARY I/O SUPERVISOR ADDR 00225000
  226. CLI ACTIVE,X'00' WAS THE DISPATCHER WAITING? 00226000
  227. BE IONOSAVE YEP - SKIP SAVING REGISTERS 00227000
  228. SPACE 00228000
  229. L R14,ACTIVE REG.14 = ADDRESS OF ACTIVE TASK ELEMENT 00229000
  230. L R14,TASKSAVE-TASKE(R14) REG 14 = ACTIVE TASK'S SUP SAVE 00230000
  231. USING TAREA,R14 DEFINE TASK SAVE AREA DSECT ADDRESSA 00231000
  232. SPACE 00232000
  233. MVC TPSW(8),OLDIO SAVE INTERRUPTED PSW FOR RESUME 00233000
  234. STM R0,R13,TGREG0 SAVE TASK'S GENERAL REGS 0->13 00234000
  235. MVC TGREG14(8),SSAVE AND MOVE IN SAVED REGS 14 & 15 00235000
  236. MVI ACTIVE,X'00' INDICATE DISPATCHER WAIT 00236000
  237. SPACE 00237000
  238. DROP R14 00238000
  239. SPACE 00239000
  240. IONOSAVE EQU * 00240000
  241. LR R12,R15 REG.12 = PERMANENT BASE REGISTER 00241000
  242. DROP R15 REG.15 MUST BE USED FOR CALLS LATER 00242000
  243. USING DMTIOM,R12 DEFINE PERMANENT I/O SUP ADDRESSABIL 00243000
  244. SPACE 00244000
  245. CLI OLDIO+2,X'00' IS IT A SELECTOR CHANNEL INTERRUPT? 00245000
  246. BNE IOSELCTR ABSOLUTELY - LOOK ON THE SELECTOR QUEUE 00246000
  247. TM OLDIO+3,X'C0' IS IT MAYBE A SELECTOR SUBCHANNEL INTRPT? 00247000
  248. BO IOSELCTR YEP - LOOK ON THE SELECTOR QUEUE FOR IT 00248000
  249. L R2,MPXIOQ OTHERWISE REG.2 = START OF MULTIPLEXOR QUEUE 00249000
  250. LA R4,MPXIOQ-(IONEXT-IOE) TRICKY START FOR QUEUE SEARCH LOO 00250000
  251. B IOSEARCH GO LOOK FOR A MATCHING ACTIVE ELEMENT 00251000
  252. EJECT 00252000
  253. IOSELCTR EQU * 00253000
  254. USING IOE,R2 GET I/O ELEMENT ADDRESSABILITY 00254000
  255. USING IOTABLE,R3 GET IOTABLE ADDRESSABILITY 00255000
  256. L R2,SELIOQ REG 2 = STARTING ADDRESS OF THE SELECTOR QUEUE 00256000
  257. LA R4,SELIOQ-(IONEXT-IOE) INITIALIZE THE LAST ELEMENT POINT 00257000
  258. IOSEARCH EQU * 00258000
  259. LTR R2,R2 HAVE WE REACHED THE END OF THE ACTIVE QUEUE? 00259000
  260. BZ IOASYNCH YEP - ACTIVE ELEMENT NOT FOUND 00260000
  261. CLC OLDIO+2(2),IOADDR IS THIS THE APPROPRIATE ELEMENT? 00261000
  262. BE IOFOUND YES - GO CHECK IT OUT 00262000
  263. LR R4,R2 OTHERWISE SAVE ADDRESS OF THIS ELEMENT 00263000
  264. L R2,IONEXT AND GET THE ADDRESS OF THE NEXT ELEMENT 00264000
  265. B IOSEARCH AND KEEP LOOKING FOR ASSOCIATED ACTIVE ELEMENT 00265000
  266. IOFOUND EQU * 00266000
  267. L R3,IOTABLEA REG.3 = I/O TABLE ADDR (OR SENSE ELEMENT 00267000
  268. SR R0,R0 CLEAR POST CODE 00268000
  269. TM IOSTAT,SENSING IS AUTO SENSE ACTIVE FOR THIS ELEMENT 00269000
  270. BNO IONOSENS NO - TASK'S I/O IS STILL ACTIVE 00270000
  271. TM CSW+4,DE IS SENSE OPERATION ALL DONE? 00271000
  272. BO IODISMIS YEP - POST THE REQUESTOR AND FREE EVERYTHING 00272000
  273. B IODISPCH OTHERWISE JUST WAIT AROUND FOR A WHILE... 00273000
  274. EJECT 00274000
  275. IONOSENS EQU * 00275000
  276. OC ENDCSW+4(2),CSW+4 OR NEW STATUS INTO TASK'S TABLE 00276000
  277. CLC CSW+4(2),=AL1(0,PCI) IS IT PCI ALONE? 00277000
  278. BE IOASYNCH YEP - PASS CONTROL TO TASK'S EXIT IF REQUESTED 00278000
  279. TM IOSTAT,CHANDONE DID THE CHANNEL PREVIOUSLY TERMINATE? 00279000
  280. BO IOCHKDEV YES - SEE IF DEVICE IS STILL ACTIVE 00280000
  281. * 00281000
  282. * ASSUMPTION: FIRST IRPT FROM ACTIVE WHICH IS 00282000
  283. * NOT STANDALONE PCI SIGNALS 00283000
  284. * CHANNEL TERMINATION 00284000
  285. * 00285000
  286. OI IOSTAT,CHANDONE SET FLAG TO INDICATE CHANNEL TERM 00286000
  287. MVC ENDCSW+1(3),CSW+1 MOVE FINAL CSW ADDR TO I/O TABLE 00287000
  288. MVC ENDCSW+6(2),CSW+6 MOVE IN FINAL CSW RESIDUAL COUNT 00288000
  289. IOCHKDEV EQU * 00289000
  290. TM ENDCSW+4,CE+DE IS CHANNEL END SET WITHOUT DEVICE END 00290000
  291. BM IODISPCH IF SO, DEVICE END SHOULD BE COMING... (?) 00291000
  292. TM ENDCSW+4,UC DEVICE IS DONE - IS UNIT CHECK SET? 00292000
  293. BO IOUNITCK GO INVESTIGATE AUTO SENSE IF IT IS 00293000
  294. EJECT 00294000
  295. IODISMIS EQU * 00295000
  296. TM IOSTAT,SENSING DOES FINISHED ELEMENT HAVE AUTO SENSE 00296000
  297. BNO IONORMAL NOPE - DON'T NEED TO FREE SENSE ELEMENT 00297000
  298. LR R1,R3 SET SENSE ELEMENT ADDRESS FOR QUEUE FREE 00298000
  299. L R3,IOTABLEA-IOE(R3) REG 3 = ADDRESS OF TASK I/O TABLE 00299000
  300. L R15,QREQ REG.15 = ENTRY ADDRESS FOR SUP QUEUE REQUESTS 00300000
  301. BALR R14,R15 CALL DMTQRQ TO FREE THE OLD SENSE ELEMENT 00301000
  302. IONORMAL EQU * 00302000
  303. LA R1,IOSYNCH REG.1 = ADDRESS OF I/O REQUEST'S SYNCH LO 00303000
  304. * REG.0 POST CODE SET ON ENTRY 00304000
  305. L R15,POSTREQ REG.15 = ENTRY ADDRESS FOR POST ROUTINE 00305000
  306. BALR R14,R15 CALL SYNCH ROUTINE TO POST TASK'S SYNCH LOCK 00306000
  307. LR R1,R2 REG.1 = ADDRESS OF OLD TASK ELEMENT 00307000
  308. L R5,IONEXT SAVE ADDRESS OF NEXT ELEMENT IN REG.5 00308000
  309. L R2,IOSUBQ REG.2 = ADDRESS OF INACTIVE SUBQ ELEMENT 00309000
  310. L R15,QREQ REG 15 = ADDRESS OF ENTRY FOR SUP QUEUE REQUEST 00310000
  311. BALR R14,R15 FREE THE COMPLETED I/O REQUEST ELEMENT 00311000
  312. LTR R2,R2 IS THERE AN INACTIVE ELEMENT FOR THIS SUB-CHANNEL? 00312000
  313. BNZ IORSTART YES - GO RESTART THE CHANNEL 00313000
  314. ST R5,0(R4) OTHERWISE CHAIN LAST ELEMENT TO NEXT 00314000
  315. IOGO EQU * 00315000
  316. CLI IOFAKE,X'00' ARE WE SET UP TO FAKE AN ASYNCH INTERRUPT? 00316000
  317. BNE IOFAKEON YEP - GOTTA GO DO IT 00317000
  318. IODISPCH EQU * 00318000
  319. L R15,DISPATCH REG.15 = ENTRY POINT FOR NEXT DISPATCH 00319000
  320. BALR R14,R15 EXIT TO SOME TASK THROUGH THE DISPATCHER 00320000
  321. EJECT 00321000
  322. IORSTART EQU * 00322000
  323. ST R2,0(R4) CHAIN LAST ACTIVE ELEMENT TO THE NEW ONE 00323000
  324. ST R5,IONEXT AND CHAIN THE NEW ELEMENT TO THE NEXT 00324000
  325. L R3,IOTABLEA REG.3 = ADDRESS OF NEW TASK I/O TABLE 00325000
  326. SPACE 00326000
  327. IOSTART EQU * 00327000
  328. XC CSW(8),CSW CLEAR THE CSW IN LOW CORE 00328000
  329. MVI CAW,X'00' SET PROTECTION KEY TO ZERO IN THE CAW 00329000
  330. MVC CAW+1(3),PROGADDR+1 SET CHAN PROG ADDR FROM I/O TABL 00330000
  331. LH R1,IOADDR REG.1 = DEVICE ADDRESS FOR SIO 00331000
  332. IOSIO EQU * 00332000
  333. MVI SIOCOND,X'00' CLEAR I/O TABLE SIO COND CODE FIELD 00333000
  334. SIO 0(R1) START UP THE I/O AND SEE WHAT HAPPENS... 00334000
  335. BC 8,IOGO ALL DONE IF CHANNEL IS RUNNING 00335000
  336. BALR R0,0 REG.0 = RIGHT HALF OF RUNNING PSW 00336000
  337. SLL R0,2 SHIFT OFF THE INSTRUCTION LENGTH CODE 00337000
  338. SRL R0,30 RIGHT JUSTIFY THE CONDITION CODE 00338000
  339. STC R0,SIOCOND STORE THE SIO COND CODE IN IO TABLE 00339000
  340. * POST CODE SAME AS CONDITION CODE FOR CC=2,3 00340000
  341. BC 3,IONORMAL IF COND CODE = 2 OR 3, CONSIDER I/O FINISHED 00341000
  342. TM CSW+4,SM+BUSY OTHERWISE COND CODE = 1 -- IS BUSY STAT SE 00342000
  343. BNM IOFINIS NOPE - MUST BE IMMEDIATE OP OR ERROR(S) 00343000
  344. TM CSW+4,X'AF' ANYTHING ELSE SET (BESIDES STATUS MODIFIER)? 00344000
  345. BNZ IOFAKSET IF SO, WE HAVE CLOBBERED AN ASYNCHRONOUS INTRPT 00345000
  346. IOFINIS EQU * 00346000
  347. OI IOSTAT,CHANDONE SET CHANNEL TERMINATE FLAG 00347000
  348. MVC ENDCSW+4(2),CSW+4 I/O COMPLETE - MOVE STAT TO I/O TAB 00348000
  349. TM CSW+4,CE+DE IS CHANNEL END SET WITHOUT DEVICE END? 00349000
  350. BM IOGO DON'T DISMISS THE ELEMENT IF DEVICE END IS COMING 00350000
  351. SR R0,R0 CLEAR OUT R0 00351000
  352. TM CSW+4,UC IS UNIT CHECK STATUS SET? 00352000
  353. BNO IONORMAL ALL FINISHED WITH ELEMENT IF NOT 00353000
  354. EJECT 00354000
  355. IOUNITCK EQU * 00355000
  356. SR R0,R0 CLEAR FOR EXIT TO IONORMAL 00356000
  357. CLI SENSREQ,X'00' IS THERE A REQUEST FOR AUTO SENSE? 00357000
  358. BE IONORMAL ALL DONE WITH ELEMENT IF NOT 00358000
  359. SR R1,R1 CLEAR REG.1 FOR QUEUE GET REQUEST 00359000
  360. L R15,QREQ REG.15 = ADDRESS OF QUEUE MANAGER CALL ENTRY 00360000
  361. BALR R14,R15 GET A FREE ELEMENT TO SET UP SENSE OPERATION 00361000
  362. LTR R15,R15 DID IT WORK? 00362000
  363. LA R0,8 ERROR CODE IN CASE 00363000
  364. BNZ IONORMAL NOPE - DMTIOM FLAGS IT 00364000
  365. MVI IOSTAT-IOE(R1),X'00' CLEAR STATUS BYTE IN THE NEW ELEMEN 00365000
  366. MVC IOTABLEA-IOE+1(3,R1),IOTABLEA+1 SET NEW ELEMNT I/O TAB 00366000
  367. OI IOSTAT,SENSING SET SENSE FLAG IN ACTIVE ELEMENT 00367000
  368. IC R0,IOSTAT SAVE THE REMAINING STATUS FOR THAT ELEMEN 00368000
  369. ST R1,IOTABLEA SET ADDR OF SENSE ELEMENT IN ACTIVE ELEME 00369000
  370. STC R0,IOSTAT AND RESTORE THE ACTIVE ELEMENT STATU 00370000
  371. LA R0,ENDSENSE REG.0 = ADDR OF SENSE BUFFER IN I/O TABL 00371000
  372. ST R0,0(R1) STORE BUFFER ADDRESS IN CCW AREA 00372000
  373. MVI 0(R1),X'04' SET SENSE OP CODE IN NEW CCW 00373000
  374. XC 4(3,R1),4(R1) CLEAR BYTES 4 -> 6 OF THE SENSE CCW 00374000
  375. MVC 7(1,R1),SENSREQ MOVE REQUESTED SENSE BYTE COUNT TO C 00375000
  376. LA R1,0(R1) CLEAR HIGH ORDER BYTE OF SENSE ELEMENT ADDR 00376000
  377. ST R1,CAW AND SET THE ADDRESS IN THE CAW 00377000
  378. LR R3,R1 REG 3 = SENSE ELEMENT ADDR FOR POSSIBLE FAST DISMI 00378000
  379. LH R1,IOADDR REG.1 = DEVICE ADDRESS FOR SENSE SIO 00379000
  380. IOSENSIO EQU * 00380000
  381. SR R0,R0 CLEAR RETURN 00381000
  382. SIO 0(R1) START THE SENSE OPERATION RUNNING 00382000
  383. BC 8,IOSENTIO GO CHECK FOR FAST FINISH IF RUNNING 00383000
  384. BC 3,IODISMIS FORGET IT IF NOT OPERATIONAL OR SUB-CHAN BUSY 00384000
  385. CLI CSW+5,X'00' WERE THERE ANY ERRORS ON THE SENSE? 00385000
  386. LA R0,12 ERROR POST CODE 00386000
  387. BNE IODISMIS YEP - BAD NEWS 00387000
  388. SR R0,R0 CLEAR OUT R0 00388000
  389. CLI IOFAKE,X'00' HAVE WE ALREADY SET UP A FAKE INTERRUPT? 00389000
  390. BNE IODISMIS YEP - BEST JUST TO QUIT NOW 00390000
  391. MVC IOFAKE(R1),CSW+4 OTHERWISE ASSUME WE CLOBBERED AN INTRPT 00391000
  392. B IOSENSIO AND TRY TO START THE SENSE AGAIN 00392000
  393. IOSENTIO EQU * 00393000
  394. TIO 0(R1) IS THE SENSE OPERATION DONE ALREADY? 00394000
  395. BC 2,IOGO WAIT FOR INTERRUPT IF CHANNEL IS STILL BUSY 00395000
  396. LA R0,12 ERROR POST CODE 00396000
  397. BC 9,IODISMIS GIVE UP IF WEIRD THINGS ARE HAPPENING 00397000
  398. TM CSW+4,X'0C' IS THE SENSE ALL DONE? 00398000
  399. BM IOGO WAIT FOR DEVICE END INTERRUPT IF IT IS COMING 00399000
  400. SR R0,R0 CLEAR RETURN 00400000
  401. B IODISMIS OTHERWISE FREE, POST, AND RESTART SUB-CHANNEL 00401000
  402. DROP R2 00402000
  403. EJECT 00403000
  404. IOFAKSET EQU * 00404000
  405. CLI IOFAKE,X'00' HAS A FAKE INTERRUPT ALREADY BEEN SET UP? 00405000
  406. MVI IOFAKE,X'00' CLEAR IT IN CASE IT HAS 00406000
  407. BNE IOFINIS LOOPING - RETURN STATUS WITH NO FAKE INTERRUPT 00407000
  408. MVC IOFAKE(1),CSW+4 MOVE STAT TO FAKE SAVE AREA @VM01107 00408010
  409. CLI CSW+5,X'00' WERE ANY ERRORS ASSOCIATED WITH THE SIO? 00409000
  410. BE IOSIO NOPE - GO BACK AND TRY IT AGAIN 00410000
  411. MVI CSW+4,X'00' OTHERWISE CLEAR IRRELEVANT DEVICE STATUS 00411000
  412. B IOFINIS AND LET THE I/O REQUEST TERMINATE WITH ERROR 00412000
  413. SPACE 00413000
  414. IOFAKEON EQU * 00414000
  415. * BUSY STATUS BIT MUST BE ON HERE 00415000
  416. XC CSW+1(7),CSW+1 CLEAR THE LOW ORDER SEVEN CSW BYTES 00416000
  417. MVI CSW,X'0F' SET ILLEGAL BITS TO INDICATE FAKED INTERRUPT 00417000
  418. MVC CSW+4(1),IOFAKE MOVE FAKED INTERRUPT DEVICE STAT TO CSW 00418000
  419. NI CSW+4,X'EF' TURN OFF THE BUSY BIT 00419000
  420. MVI IOFAKE,X'00' CLEAR THE INTERRUPT DEVICE STATUS SAVE AREA 00420000
  421. SPACE 00421000
  422. IOASYNCH EQU * 00422000
  423. USING ASYNE,R2 GET ASYN ELEMENT ADDRESSABILITY 00423000
  424. L R2,IOEXITQ REG 2 = ADDR OF START OF ASYNCH REQUEST QUEUE 00424000
  425. IOASCAN EQU * 00425000
  426. LTR R2,R2 ARE WE AT THE END OF THE QUEUE? 00426000
  427. BZ IODISPCH IGNORE THE INTERRUPT IF NO REQUEST IS FOUND 00427000
  428. CLC ASYNCODE(2),OLDIO+2 IS THIS A MATCHING DEVICE ADDR 00428000
  429. BE IOASYNGO GO EXIT TO THE TASK'S ROUTINE IF SO 00429000
  430. L R2,ASYNNEXT OTHERWISE REG.2 = ADDRESS OF NEXT ELEME 00430000
  431. B IOASCAN AND LOOP AGAIN TO SNIFF AT THIS ONE 00431000
  432. IOASYNGO EQU * 00432000
  433. L R13,ASYNTASK PASS REQUESTOR'S TASK TAB ADDR TO HANDL 00433000
  434. L R15,ASYNEXIT REG.15 = ADDRESS OF TASK'S REQUESTED EX 00434000
  435. LA R14,IODISPCH SET RETURN REG FOR DIRECT RETURN TO DISPATC 00435000
  436. BR R15 EXIT TO REQUESTED ASYNCHRONOUS ROUTINE ENTRY POINT 00436000
  437. SPACE 00437000
  438. IOFAKE DC H'0' FAKE STATUS SAVE AREA - PRESERVE ALIGNMENT 00438000
  439. DROP R2 00439000
  440. EJECT 00440000
  441. DMTIOMRQ EQU * 00441000
  442. SPACE 00442000
  443. * I/O REQUEST ENTRY POINT FOR CALLS FROM TASKS 00443000
  444. SPACE 00444000
  445. FREEZE 00445000
  446. SPACE 00446000
  447. USING IOE,R2 GET I/O ELEMENT ADDRESSABILITY 00447000
  448. L R12,NEWIO+4 REG.12 = A(DMTIOM) (BASE REG.) 00448000
  449. LA R3,0(R1) REG.3 = ADDR OF CALLER'S I/O TABLE (TOP BYTE = 00449000
  450. SR R1,R1 CLEAR REG.1 FOR SUP QUEUE GET REQUEST 00450000
  451. L R15,QREQ REG.15 = SUP QUEUE MANAGER REQUEST ENTRY ADDR 00451000
  452. BALR R14,R15 GET A FREE ELEMENT TO BUILD AN I/O ELEMENT 00452000
  453. LTR R15,R15 DID IT WORK? 00453000
  454. BNZ IOPUNT NO - QUIT FAST. 00454000
  455. LR R2,R1 REG.2 = ADDR OF NEW I/O REQUEST ELEMENT 00455000
  456. XC IONEXT(8),IONEXT CLEAR BOTH CHAINING FIELDS 00456000
  457. XC SIOCOND(8),SIOCOND CLEAR FIXED RETURN INFO FIELDS 00457000
  458. ST R3,IOTABLEA SET ADDRESS OF I/O TABLE IN QUEUE ELEMEN 00458000
  459. MVC IOADDR(2),DEVCUU SET REQUESTED I/O DEVICE ADDR 00459000
  460. L R1,ACTIVE GET THE ACTIVE TASK ELEMENT 00460000
  461. MVC IOID(1),TASKID-TASKE(R1) SET REQUESTOR'S ID IN THE NEW E 00461000
  462. CLI IOADDR,X'00' IS THE REQUEST FOR MULTIPLEXOR I/O? 00462000
  463. BE IOMPXREQ YEP - GO DO MULTIPLEXOR REQUEST SETUP 00463000
  464. MVC IOSBCHAN(1),IOADDR OTHERWISE CHANNEL ADDR = SUBCH 00464000
  465. IOSETSEL EQU * 00465000
  466. L R5,SELIOQ REG.5 = ADDRESS OF START OF SELECTOR QUEUE 00466000
  467. LA R4,SELIOQ-(IONEXT-IOE) INITIALIZE LAST ELEMENT POINTER 00467000
  468. SPACE 00468000
  469. IORQSCAN EQU * 00469000
  470. LTR R5,R5 IS THIS THE END OF THE QUEUE? 00470000
  471. BZ IORQEND YES - ENQUEUE THE NEW ELEMENT AT THE END 00471000
  472. CLC IOSBCHAN-IOE(1,R5),IOSBCHAN-IOE(R2) IS THIS THE SPOT TO 00472000
  473. BNL IORQHIT YES - GO FIND OUT HOW TO DO IT 00473000
  474. LR R4,R5 OTHERWISE SET THIS ELEMENT TO "LAST" ELEMENT 00474000
  475. L R5,IONEXT-IOE(R5) AND CHAIN TO THE NEXT ELEMENT 00475000
  476. B IORQSCAN CHECK THIS ELEMENT FOR HIT OR END 00476000
  477. SPACE 00477000
  478. IORQHIT EQU * 00478000
  479. BE IORQBUSY SUB-CHANNEL IS BUSY IF EQUAL MATCH 00479000
  480. ST R5,IONEXT OTHERWISE CHAIN NEW ELEMENT TO NEXT 00480000
  481. IORQEND EQU * 00481000
  482. ST R2,IONEXT-IOE(R4) CHAIN THE NEW ELEMENT TO THE LAST 00482000
  483. B IOSTART AND GO DIRECTLY TO START THE I/O REQUEST 00483000
  484. EJECT 00484000
  485. IOMPXREQ EQU * 00485000
  486. MVC IOSBCHAN(1),IOADDR+1 SUB-CHANNEL ADDR = UNIT ADDR 00486000
  487. SPACE 00487000
  488. SPACE 00498000
  489. L R5,MPXIOQ OTHERWISE SET TO START MULTIPLEXOR QUEUE SCAN 00499000
  490. LA R4,MPXIOQ-(IONEXT-IOE) INITIALIZE LAST ELEMENT POINTER 00500000
  491. B IORQSCAN AND GO HUNT FOR A SPOT TO PUT THE NEW ELEMENT 00501000
  492. EJECT 00505000
  493. IORQBUSY EQU * 00506000
  494. LR R6,R5 INITIALIZE NEXT ELEMENT POINTER FOR DMTQRQ SCAN 00507000
  495. IORQDIVE EQU * 00508000
  496. LR R5,R6 REG.5 = ADDRESS OF LAST SUBQUEUE ELEMENT 00509000
  497. ICM R6,B'1111',IOSUBQ-IOE(R5) REG 6 = ADDRESS OF NEXT SUBQUE 00510000
  498. BNZ IORQDIVE NOPE - KEEP TRUCKIN' ON DOWN THE LINE 00511000
  499. ST R2,IOSUBQ-IOE(R5) YES - ENQUEUE THE NEW ELEMENT AT THE B 00512000
  500. B IODISPCH AND GO BACK TO TASK EXECUTION 00513000
  501. SPACE 00514000
  502. IOPUNT EQU * 00515000
  503. LA R1,IOSYNCH GET SYNCH LOCK ADDR 00516000
  504. LA R0,16 SET RETURN CODE 00517000
  505. L R15,POSTREQ GET SYSTEM POST ROUTINE 00518000
  506. BALR R14,R15 GO POST IT 00519000
  507. B IODISPCH AND CONTINUE 00520000
  508. SPACE 00521000
  509. LTORG 00522000
  510. EJECT 00523000
  511. COPY RSSEQU 00524000
  512. EJECT 00525000
  513. COPY SVECTORS 00526000
  514. EJECT 00527000
  515. COPY TAREA 00528000
  516. EJECT 00529000
  517. COPY TASKE 00530000
  518. EJECT 00531000
  519. COPY IOE 00532000
  520. EJECT 00533000
  521. COPY ASYNE 00534000
  522. EJECT 00535000
  523. COPY IOTABLE 00536000
  524. END 00537000