TITLE 'ICATS UTS I/O ROUTINES' REA00010 *********************************************************************** REA00020 * * REA00030 * MODULE NAME = UTS I/O ROUTINES (READ REQUEST CONTROL BLOCK, * REA00040 * READ DATA, WRITE DATA, AND INTERRUPT THE UTS). * REA00050 * * REA00060 * FUNCTION = PERFORM THE REAL UTS I/O. IF THIS REQUEST GOT * REA00070 * INITIATED BY THE FAKIT COMMAND, THEN DON'T DO * REA00080 * REAL UTS I/O, RATHER FAKE IT WITH CMS FILES. * REA00090 * * REA00100 * ENTRY POINTS = READUTS, WRITEUTS, READRCB, OR INTERUTS. * REA00110 * * REA00120 * LINKAGE = TO READ A REQUEST CONTROL BLOCK FROM THE UTS * REA00130 * IDENTIFIED BY THISUTS, DO * REA00140 * LA R0,128 HOW MANY BYTES YOU WANT * REA00150 * LA R1,BUFFER WHERE YOU WANT IT * REA00160 * L R15,AREADRCB * REA00170 * BALR R14,R15 * REA00180 * * REA00190 * TO READ SOME DATA FROM THE UTS IDENTIFIED BY * REA00200 * THISUTS (FOR EXAMPLE, AS WITH A WRITE REQUEST), DO * REA00210 * LA R0,XXX HOW MANY BYTES YOU WANT * REA00220 * LA R1,BUFFER WHERE YOU WANT IT * REA00230 * L R15,AREADUTS * REA00240 * BALR R14,R15 * REA00250 * * REA00260 * TO WRITE SOME DATA TO THE UTS IDENTIFIED BY THISUTS * REA00270 * (FOR EXAMPLE, THE REPLY CONTROL BLOCK AND ACCOMPANYING * REA00280 * DATA IF ANY), DO * REA00290 * LA R0,XXX HOW MANY BYTES TO PASS * REA00300 * LA R1,BUFFER BUFFER ADDRESS * REA00310 * L R15,AWRITUTS * REA00320 * BALR R14,R15 * REA00330 * * REA00340 * TO PROVIDE AN ASYNCHRONOUS INTERRUPT TO THE UTS * REA00350 * IDENTIFIED BY THISUTS, DO * REA00360 * LA R0,XXX HOW MANY BYTES TO PASS * REA00370 * LA R1,BUFFER BUFFER ADDRESS * REA00380 * L R15,AINTUTS * REA00390 * BALR R14,R15 * REA00400 * * REA00410 * REGISTER CONTENTS UPON ENTRY = * REA00420 * R0 = HOW MANY BYTES THE CALLER WANTS FROM THE UTS. * REA00430 * R1 = THE BUFFER ADDRESS. * REA00440 * R2 = POINTS TO THE ICATS COMMON DATA AREA AS ALWAYS. * REA00450 * R4 = POINTS THIS UTS'S CONTROL BLOCK. * REA00460 * R14 = RETURN ADDRESS BACK TO THE UTS I/O ROUTINE. * REA00470 * R15 = ADDRESS OF THIS SUBROUTINE (USED FOR BASE REG). * REA00480 * * REA00490 * REGISTER USAGE: * REA00500 * R0 = FREE * REA00510 * R1 = FREE * REA00520 * R2 = ICATS COMMON DATA AREA BASE REGISTER (ICDATA) * REA00530 * R3-R7 = FREE * REA00540 * R8 = UTS VIRTUAL ADDRESS IN HEX (USED IN THE DIAGNOSE INSTR). * REA00550 * R9 = CAW (USED IN THE DIAGNOSE INSTRUCTION). * REA00560 * R10 = USED AS A BASE REGISTER UNTIL BRANCH TO SIOSUB. * REA00570 * R11 = BASE REGISTER FOR THIS ROUTINE STARTING AT SIOSUB. * REA00580 * R12 = SIO LOOP COUNTER. * REA00590 * R13 = TEMPORARY HOLD REGISTER FOR MY RETURN CODE. * REA00600 * R14 = TEMPORARY WORK REGISTER AND RETURN ADDRESS FOR WHEN * REA00610 * CALL SUBROUTINES * REA00620 * R15 = SUBROUTINE ADDRESS * REA00630 * * REA00640 * MODULE LOGIC = * REA00650 * I) FOR EACH ENTRY POINT, * REA00660 * 1) SAVE REGISTERS * REA00670 * 2) SET UP SECONDARY BASE REGISTER * REA00680 * 3) IF THIS IS TO BE A FAKE OPERATION, BRANCH TO THE * REA00690 * APPROPRIATE FAKE I/O MODULE. * REA00700 * 4) ELSE DO THE REAL I/O TO THE UTS. * REA00710 * A) SET THE CORRECT CCW OP CODE, * REA00720 * 01 = WRITE NORMAL DATA (WRITE UTS) * REA00730 * 05 = WRITE SPECIAL DATA (INTERRUPT THE UTS) * REA00740 * 02 = READ NORMAL DATA (READ UTS) * REA00750 * 06 = READ SPECIAL DATA (READ REQUEST CONTROL BLOCK)* REA00760 * B) GO TO THE COMMON REAL I/O ROUTINE. * REA00770 * - BUILD THE REST OF THE CCW. * REA00780 * - CLEAR THE CSW & THE SENSE BYTE IN THE UTSCB. * REA00790 * - DO THE DIAGNOSE X'20' TO DO THE REAL I/O. * REA00800 * - RETRY UTS BUSY 200 TIMES. * REA00810 * * REA00820 * RETURN CODES = * REA00830 * R15 = 0 = I/O OPERATION WORKED O.K. * REA00840 * R15 = 4 = UNIT CHECK. SENSE BYTE 0 (SENSE0) IN * REA00850 * ICDATA IS VALID. * REA00860 * R15 = 8 = INCORRECT LENGTH INDICATION POSTED IN CSW. * REA00870 * R15 = 12 = UNIT EXCEPTION BIT POSTED IN CSW. * REA00880 * R15 = 16 = DEVICE IS NOT ATTACHED. SHOULD NEVER HAPPEN. * REA00890 * R15 = 20 = DEVICE IS NOT SYS-GEN'ED CORRECTLY. * REA00900 * SHOULD BE DEVTYPE=TEST,CLASS=DASD. * REA00910 * R15 = 24 = DEVICE IS NOT RESPONDING. HAPPENS WHEN THE UTS * REA00920 * WENT DOWN AND ISN'T COMING BACK UP. * REA00930 * * REA00940 * RETURN CODES (FOR FAKED I/O) = * REA00950 * R15 = 0 = EVERYTHING WENT OK. * REA00960 * OR R15 = 4 = THE FILE ICATS INDATA A DOES NOT EXIST. * REA00970 * OR R15 = 8 = INCORRECT BUFFER LENGTH (NOT POSITIVE). * REA00980 * * REA00990 * EXTERNAL REFERENCES = NONE * REA01000 * * REA01010 * CONTROL BLOCKS = ICDATA (ICATS COMMON DATA AREA) * REA01020 * * REA01030 * NON-STANDARD MACROS (FOUND IN ICATS MACLIB) * REA01040 * ICDATA = ICATS COMMON DATA AREA DSECT. * REA01050 * * REA01060 * CHANGE ACTIVITY * REA01070 * DATE NAME REASON FOR CHANGE * REA01080 * 04/21/83 RICK JASPER BROKEN AWAY FROM ICATS MAINLINE INTO * REA01090 * SEPARATE SUBROUTINE * REA01100 * 04/28/83 RICK JASPER REAL I/O ROUTINE WRITTEN. * REA01110 * 08/17/83 RICK JASPER ADDED RETRY IF UTS IS BUSY. * REA01120 * 08/23/83 RICK JASPER BUMPED NUMBER OF RETRIES TO 1000. * REA01130 * 09/06/83 RICK JASPER REDUCED NUMBER OF RETRIES TO 200. * REA01140 * * REA01150 *********************************************************************** REA01160 EJECT REA01170 PRINT GEN,NODATA REA01180 READUTS CSECT REA01190 ENTRY WRITEUTS,READRCB,INTERUTS ADDITIONAL ENTRY POINTS REA01200 USING ICDATA,R2 ADDRESS ICATS COMMON DATA AREA REA01210 USING CBUTS,R4 USE R4 TO ADDRESS UTS CONTROL BLOCK REA01220 USING READUTS,R15 USE R15 FOR NEXT INSTRUCTION ONLY REA01230 STM R1,R14,UTSIOREG SAVE CALLERS REGISTERS REA01240 DROP R15 REA01250 USING READUTS,R10 USE R10 FOR RIGHT NOW REA01260 LR R10,R15 SWITCH BASE REGISTER TO R10 REA01270 LA R11,SIOSUB PREPARE OTHER BASE REGISTER REA01280 TM FLAGC,FAKEINT IS THIS A FAKE REQUEST ?? REA01290 BO FAKEARD THEN, GO FAKE A READ FROM THE UTS REA01300 * PREPARE FOR THE REAL UTS I/O ROUTINE. REA01310 MVI UTSCCW,X'02' CCW OP CODE = X'02' = READ REA01320 B SIOSUB REA01330 FAKEARD DS 0H REA01340 L R15,=V(FAKEREAD) REA01350 BALR R14,R15 REA01360 B ALLBYE GO RETURN TO CALLER REA01370 DROP R10 REA01380 *********************************************************************** REA01390 *********************************************************************** REA01400 INTERUTS DS 0H REA01410 USING INTERUTS,R15 USE R15 FOR NEXT INSTRUCTION ONLY REA01420 STM R1,R14,UTSIOREG SAVE CALLERS REGISTERS REA01430 DROP R15 REA01440 USING INTERUTS,R10 USE R10 FOR RIGHT NOW REA01450 LR R10,R15 SWITCH BASE REGISTER TO R10 REA01460 LA R11,SIOSUB PREPARE OTHER BASE REGISTER REA01470 TM FLAGC,FAKEINT IS THIS A FAKE REQUEST ?? REA01480 BO FAKEAINT THEN, GO FAKE A UTS INTERRUPT REA01490 * PREPARE FOR THE REAL UTS I/O ROUTINE. REA01500 MVI UTSCCW,X'05' CCW OP CODE = X'01' = ASYNCH INTERRUPT REA01510 B SIOSUB REA01520 FAKEAINT DS 0H REA01530 L R15,=V(FAKEWRIT) REA01540 BALR R14,R15 REA01550 B ALLBYE GO RETURN TO CALLER REA01560 DROP R10 REA01570 *********************************************************************** REA01580 *********************************************************************** REA01590 WRITEUTS DS 0H REA01600 USING WRITEUTS,R15 USE R15 FOR NEXT INSTRUCTION ONLY REA01610 STM R1,R14,UTSIOREG SAVE CALLERS REGISTERS REA01620 DROP R15 REA01630 USING WRITEUTS,R10 USE R10 FOR RIGHT NOW REA01640 LR R10,R15 SWITCH BASE REGISTER TO R10 REA01650 LA R11,SIOSUB PREPARE OTHER BASE REGISTER REA01660 TM FLAGC,FAKEINT IS THIS A FAKE REQUEST ?? REA01670 BO FAKEAWRT THEN, GO FAKE A WRITE TO THE UTS REA01680 * PREPARE FOR THE REAL UTS I/O ROUTINE. REA01690 MVI UTSCCW,X'01' CCW OP CODE = X'01' = WRITE REA01700 B SIOSUB REA01710 FAKEAWRT DS 0H REA01720 L R15,=V(FAKEWRIT) REA01730 BALR R14,R15 REA01740 B ALLBYE GO RETURN TO CALLER REA01750 DROP R10 REA01760 *********************************************************************** REA01770 *********************************************************************** REA01780 READRCB DS 0H REA01790 USING READRCB,R15 USE R15 FOR NEXT INSTRUCTION ONLY REA01800 STM R1,R14,UTSIOREG SAVE CALLERS REGISTERS REA01810 DROP R15 REA01820 USING READRCB,R10 USE R10 FOR RIGHT NOW REA01830 LR R10,R15 SWITCH BASE REGISTER TO R10 REA01840 LA R11,SIOSUB PREPARE OTHER BASE REGISTER REA01850 TM FLAGC,FAKEINT IS THIS A FAKE REQUEST ?? REA01860 BO FAKEARR THEN, GO FAKE THE READ REQUEST REA01870 * PREPARE FOR THE REAL UTS I/O ROUTINE. REA01880 MVI UTSCCW,X'06' CCW OP CODE = X'06' = READ REQUEST REA01890 B SIOSUB CONTROL BLOCK REA01900 FAKEARR DS 0H REA01910 L R15,=V(FAKERRCB) REA01920 BALR R14,R15 REA01930 B ALLBYE GO RETURN TO CALLER REA01940 DROP R10 REA01950 *********************************************************************** REA01960 *********************************************************************** REA01970 SIOSUB DS 0H REA01980 USING SIOSUB,R11 REA01990 USING CBUTS,R4 REA02000 L R4,THISUTS GET MY VIRTUAL ADDRESS OF THE UTS REA02010 LH R8,CBUTSVAD MACHINE I'M CURRENTLY SERVICING REA02020 LA R9,UTSCCW SET UP CAW REA02030 MVI SENSE0,0 REA02040 STCM R1,B'0111',UTSCCW+1 SET DATA ADDRESS IN CCW REA02050 MVI UTSCCW+4,X'00' SET CCW FLAGS REA02060 STCM R0,B'0111',UTSCCW+5 SET BYTE COUNT IN CCW REA02070 L R4,THISUTS REA02080 * REA02090 SSM NONE DISABLE INTERRUPTS REA02100 * PUT AN ENTRY INTO THE TRACE TABLE. INCLUDE R8 = VAD, R9 = CAW, REA02110 * AND THE CCW. REA02120 LR R1,R8 PUT THE DEVICE ADDRESS IN THE TTE REA02130 L R15,ACONEHEX REA02140 BALR R14,R15 REA02150 STCM R1,B'0111',TTECUU REA02160 LR R1,R9 PUT THE CAW IN THE TTE REA02170 L R15,ACONEHEX REA02180 BALR R14,R15 REA02190 STCM R0,B'1111',TTECAWA REA02200 STCM R1,B'1111',TTECAWB REA02210 L R1,0(R9) PICK UP THE 1ST HALF OF THE CCW REA02220 L R15,ACONEHEX REA02230 BALR R14,R15 REA02240 STCM R0,B'1111',TTECCWA REA02250 STCM R1,B'1111',TTECCWB REA02260 L R1,4(R9) PICK UP THE 1ST HALF OF THE CCW REA02270 L R15,ACONEHEX REA02280 BALR R14,R15 REA02290 STCM R0,B'1111',TTECCWC REA02300 STCM R1,B'1111',TTECCWD REA02310 ETTE TTE1 REA02320 * NOW BACK TO BUSINESS REA02330 SR R12,R12 CLEAR SIO LOOP COUNTER REA02340 SIOAGN DS 0H REA02350 LA R12,1(R12) BUMP SIO LOOP COUNTER REA02360 C R12,=F'1000' ONLY LOOP 1000 TIMES REA02370 BL SKIP2 REA02380 LA R13,24 UTS HAS GONE DOWN REA02390 B ERETURN REA02400 SKIP2 LH R8,CBUTSVAD R8 = UTS ADDRESS REA02410 LA R9,UTSCCW R9 = CCW ADDRESS REA02420 OI 4(R9),X'20' REA02430 *********************************************************************** REA02440 * POSSIBLE RETURNS FROM THE DIAGNOSE INSTRUCTION ARE; * REA02450 * CC = 0 R15 = ?? I/O COMPLETED WITH NO ERRORS. * REA02460 * CC = 1 R15 = 1 DEVICE IS NOT ATTACHED OR * REA02470 * VIRTUAL CHANNEL IS DEDICATED * REA02480 * R15 = 5 VIRTUAL DEVICE IS BUSY OR * REA02490 * HAS AN INTERRUPT PENDING. * REA02500 * CC = 2 R15 = 2 UNIT EXCEPTION BIT IN CCW DEVICE STATUS IS ON. * REA02510 * R15 = 3 WRONG LENGTH RECORD DETECTED. * REA02520 * CC = 3 R15 = 13 A PERMANENT I/O ERROR OCCURRED OR * REA02530 * UNSUPPORTED DEVICE TYPE (I.E. NOT SYS-GEN'ED * REA02540 * AS DEVTYPE=TEST,CLASS=DASD) * REA02550 * FOR THIS LAST CASE ONLY, R9 = SENSE BYTES 0-3 (IN THIS * REA02560 * SCREWY ORDER 2,3,0,1). IF R9 = ALL ZEROS, ASSUME NO I/O * REA02570 * WAS DONE, OUR I/O REQUEST GOT REJECTED 'CAUSE OF AN * REA02580 * UNSUPPORTED DEVICE TYPE. IN ETF HERE, JOHN FISH MODIFIED * REA02590 * THE DIAGNOSE 20 CODE TO DO I/O TO TEST DEVICES (TEST * REA02600 * DEVICES, OF COURSE, AREN'T PART OF THE STANDARD VM CODE). * REA02610 * IF SOMETHING HAPPENS TO THIS MOD, THEN THIS ROUTINE WILL * REA02620 * STOP WORKING. * REA02630 *********************************************************************** REA02640 DIAG R8,R9,X'0020' GENERAL I/O DIAGNOSE REA02650 ******** L R15,=V(MYIORTN) ** TO USE YOUR OWN SIO ROUTINE, COMMENT REA02660 ******** BALR R14,R15 ** THE DIAG & UNCOMMENT THESE 3 LINES REA02670 ******** LTR R15,R15 ******** (DON'T DO IT - IT DOESN'T WORK AND REA02680 ******** ******** IT USES DIFFERENT RETURN CODES REA02690 MVC CBUTSCSW,68 SAVE LAST CSW STATUS REA02700 BZ SIOTOOK BRANCH IF SIO WORKED REA02710 CH R15,=H'5' COMPARE FOR BUSY OR INT. PENDING REA02720 BE SIOAGN YES GO DO AGAIN REA02730 CH R15,=H'3' COMPARE FOR WRONG LENGTH RECORD REA02740 BNE SIOCONA NOPE, THAT WASN'T IT. REA02750 LA R13,8 REA02760 B ERETURN REA02770 SIOCONA CH R15,=H'2' UNIT EXCEPTION BIT ON IN CSW ?? REA02780 BNE SIOCONB NOPE REA02790 LA R13,12 REA02800 B ERETURN REA02810 SIOCONB CH R15,=H'1' DEVICE NOT ATTACHED ?? REA02820 * BNE SIOCONC NOPE REA02830 BE SIOAGN ASSUME IT'S VIRTUAL CHANNEL DEDICATED REA02840 * LA R13,16 REA02850 * B ERETURN REA02860 SIOCONC EQU * R15 MUST BE = 13 REA02870 LTR R9,R9 DO WE HAVE ANY SENSE DATA ?? REA02880 BZ SIOCOND NOPE, MUST NOT BE SYS-GEN'ED RIGHT REA02890 * JEFF DOBBEK WANTED ME TO RETRY THE FOLLOWING BUSY INDICATION. REA02900 * IF HIS UTS DOES NOT RESPOND IN X AMOUNT OF TIME, THEN HIS REA02910 * DOBBOX (CONTROL UNIT) RETURNS UNIT CHECK WITH INTERVENTION REA02920 * REQUIRED (X'80') ON IN THE SENSE BYTE. RAJ 08/17/83 REA02930 CH R12,=H'200' REA02940 BL SIOAGN RETRY BUSY 200 TIMES OR SO REA02950 * RETRIED TOO MANY TIMES, AND STILL THE UTS IS DOWN. I GIVE UP. REA02960 STCM R9,B'0010',SENSE0 SAVE SENSE BYTE 0 REA02970 LA R13,4 REA02980 B ERETURN REA02990 SIOCOND LA R13,20 DEVICE IS NOT SYS-GEN'ED CORRECTLY REA03000 B ERETURN SHOULD BE DEVTYPE=TEST,CLASS=DASD REA03010 SIOTOOK DS 0H REA03020 SR R13,R13 I/O WORKED O.K. RETURN CODE = 0 REA03030 ERETURN DS 0H REA03040 SSM ALLOW REA03050 LR R1,R8 REA03060 L R15,ACONEHEX REA03070 BALR R14,R15 REA03080 STCM R1,B'0111',TTE2CUU REA03090 CVD R13,WORKA REA03100 OI WORKA+7,X'0F' REA03110 UNPK WORKB,WORKA+6(2) REA03120 MVC TTE2RC,WORKB+1 REA03130 MVC TTE2CSW,64 REA03140 MVC TTE2SNS0,SENSE0 REA03150 ETTE TTE2 REA03160 LR R15,R13 TRANSFER RETURN CODE TO R15 REA03170 ALLBYE DS 0H REA03180 LM R1,R14,UTSIOREG REA03190 BR R14 BYE REA03200 * REA03210 UTSIOREG DS 15F REA03220 WORKA DS D REA03230 WORKB DS F REA03240 NONE DC X'00' SYSTEM MASK TO DISALLOW INTERRUPTS REA03250 ALLOW DC X'FF' SYSTEM MASK TO ALLOW INTERRUPTS REA03260 * REA03270 TTE1 DC AL1(TTE1QU) REA03280 DC C'DOING AN I/O OPERATION TO DEVICE ' REA03290 TTECUU DS CL3 REA03300 DC C'. CAW = ' REA03310 TTECAWA DS CL4 REA03320 TTECAWB DS CL4 REA03330 DC C'. CCW = ' REA03340 TTECCWA DS CL4 REA03350 TTECCWB DS CL4 REA03360 DC C' ' REA03370 TTECCWC DS CL4 REA03380 TTECCWD DS CL4 REA03390 DC C'.' REA03400 TTE1QU EQU *-TTE1-1 REA03410 * REA03420 TTE2 DC AL1(TTE2QU) REA03430 DC C'I/O DONE TO DEVICE ' REA03440 TTE2CUU DS CL3 REA03450 DC C'. RC = ' REA03460 TTE2RC DS CL3 REA03470 DC C'. CSW = ' REA03480 TTE2CSW DS CL8 REA03490 DC C'. SENSE0 = ' REA03500 TTE2SNS0 DS CL1 REA03510 DC C'.' REA03520 TTE2QU EQU *-TTE2-1 REA03530 CC0 EQU 8 REA03540 CC1 EQU 4 REA03550 CC2 EQU 2 REA03560 CC3 EQU 1 REA03570 LTORG REA03580 ICDATA REA03590 END REA03600