TITLE  'ICATS UTS INTERRUPT HANDLING ROUTINE'                  UTS00010
*********************************************************************** UTS00020
*                                                                     * UTS00030
*  MODULE NAME =  UTSIOIH                                             * UTS00040
*                                                                     * UTS00050
*  FUNCTION =  HANDLE UTS I/O INTERRUPTS.  THE ONLY INTERRUPTS WE     * UTS00060
*              SHOULD SEE ARE THE UNSOLICITED ATTENTION INTERRUPTS    * UTS00070
*              CAUSED WHEN THE UTS INITIATES A REQUEST.  WE SHOULD    * UTS00080
*              NOT SEE THE INTERRUPTS FROM OTHER I/O WE INITIATE.     * UTS00090
*                                                                     * UTS00100
*  ENTRY POINTS =  UTSIOIH                                            * UTS00110
*                                                                     * UTS00120
*  LINKAGE =  FROM CMS'S FIRST LEVEL INTERRUPT HANDLER.  HE SEES      * UTS00130
*             THAT WE'VE DONE A HNDINT FOR THAT DEVICE AND PASSES     * UTS00140
*             CONTROL TO THIS ROUTINE.                                * UTS00150
*                                                                     * UTS00160
*  REGISTER CONTENTS UPON ENTRY =                                     * UTS00170
*      R0-R1 = I/O OLD PSW                                            * UTS00180
*      R2-R3 = CHANNEL STATUS WORD (CSW).                             * UTS00190
*      R4 = DEVICE ADDRESS.                                           * UTS00200
*      R14 = RETURN ADDRESS BACK TO CMS.                              * UTS00210
*      R15 = ENTRY POINT TO THIS MODULE                               * UTS00220
*                                                                     * UTS00230
*  REGISTER USAGE =                                                   * UTS00240
*      R0-R1 = USED TO PASS PARAMETERS TO SUBROUTINES.                * UTS00250
*      R2 =  USED TO ADDRESS THE ICATS COMMON DATA AREA.              * UTS00260
*      R3 =  FREE                                                     * UTS00270
*      R4 =  USED TO ADDRESS THE UTS CONTROL BLOCKS.                  * UTS00280
*      R5-R10 = FREE                                                  * UTS00290
*      R11 = MY BASE REGISTER                                         * UTS00300
*      R14 = MY RETURN ADDRESS WHEN I CALL SOMEBODY                   * UTS00310
*      R15 = SUBROUTINE ADDRESS                                       * UTS00320
*                                                                     * UTS00330
*                                                                     * UTS00340
*  MODULE LOGIC:                                                      * UTS00350
*      1)  MAKE SURE THIS INTERRUPT HAS ATTENTION ON IN THE CSW       * UTS00360
*          AND NOTHING ELSE.  THIS IS THE ONLY KIND OF INTERRUPT      * UTS00370
*          I KNOW WHAT TO DO WITH.  IGNORE ANY OTHER KIND OF          * UTS00380
*          INTERRUPT.                                                 * UTS00390
*      2)  GO THROUGH THE UTS CONTROL BLOCK CHAIN AND FIND THE        * UTS00400
*          CONTROL BLOCK FOR THIS INTERRUPTING UTS.  IF NOT FOUND,    * UTS00410
*          THEN THE INTERRUPTING DEVICE MUST NOT BE A UTS I'M         * UTS00420
*          HANDLING.  I DON'T KNOW WHAT IT IS, SO JUST IGNORE IT.     * UTS00430
*      3)  IF A CORRESPONDING UTS CONTROL BLOCK IS FOUND, POST        * UTS00440
*          THIS INTERRUPT AND SET THE BIT THAT SAYS AN UTS            * UTS00450
*          INTERRUPT IS IN.  THE DISPATCHER WILL LOOK AT THAT         * UTS00460
*          BIT LATER AND FIND OUT THAT THIS UTS NEEDS TO BE SERVICED. * UTS00470
*                                                                     * UTS00480
*  NORMAL EXIT =                                                      * UTS00490
*      R15 = 0                                                        * UTS00500
*                                                                     * UTS00510
*  EXTERNAL REFERENCES = NONE                                         * UTS00520
*                                                                     * UTS00530
*  MACROS =  ICDATA = ICATS COMMON DATA AREA                          * UTS00540
*            ETTE   = ENTER TRACE TABLE ENTRY SUBROUTINE              * UTS00550
*                                                                     * UTS00560
*  CHANGE ACTIVITY                                                    * UTS00570
*    DATE        NAME       REASON FOR CHANGE                         * UTS00580
*  04/19/83  RICK JASPER    BROKEN AWAY FROM ICATS MAINLINE INTO      * UTS00590
*                           SEPARATE SUBROUTINE                       * UTS00600
*                                                                     * UTS00610
*********************************************************************** UTS00620
         PRINT GEN,NODATA                                               UTS00630
UTSIOIH  CSECT                                                          UTS00640
         USING ICDATA,R2            ADDRESS ICATS COMMON DATA AREA      UTS00650
         USING CBUTS,R4             ADDRESS UTS CONTROL BLOCK           UTS00660
         USING *,R15              USE R15 FOR NEXT INSTRUCTION ONLY     UTS00670
         STM   R0,R14,UTSIOREG    SAVE ALL THE REGISTERS                UTS00680
         DROP  R15                                                      UTS00690
         USING UTSIOIH,R11        SWITCH BASE REGISTER TO R11           UTS00700
         LR    R11,R15                                                  UTS00710
         L     R2,=V(ICDATA)      RELOAD ICDATA BASE REGISTER           UTS00720
*    START OUT BY PUTTING AN ENTRY INTO THE TRACE TABLE RECORDING       UTS00730
         TM    FLAGC,TRACEMOD        THE FACT WE SAW AN INTERRUPT       UTS00740
         BNO   SKIPTTE               DO ONLY IF TRACE MODE IS ON.       UTS00750
         LH    R1,UTSIOREG+18                                           UTS00760
         L     R15,ACONEHEX                                             UTS00770
         BALR  R14,R15                                                  UTS00780
         STCM  R1,B'0111',TTECUU                                        UTS00790
         L     R1,UTSIOREG      PUT 1ST HALF OF I/O OLD PSW IN TTE      UTS00800
         L     R15,ACONEHEX                                             UTS00810
         BALR  R14,R15                                                  UTS00820
         STCM  R0,B'1111',TTEOLDA                                       UTS00830
         STCM  R1,B'1111',TTEOLDA+4                                     UTS00840
         L     R1,UTSIOREG+4    PUT 2ND HALF OF I/O OLD PSW IN TTE      UTS00850
         L     R15,ACONEHEX                                             UTS00860
         BALR  R14,R15                                                  UTS00870
         STCM  R0,B'1111',TTEOLDB                                       UTS00880
         STCM  R1,B'1111',TTEOLDB+4                                     UTS00890
         L     R1,UTSIOREG+8    PUT 1ST HALF OF CSW IN TTE              UTS00900
         L     R15,ACONEHEX                                             UTS00910
         BALR  R14,R15                                                  UTS00920
         STCM  R0,B'1111',TTECSWA                                       UTS00930
         STCM  R1,B'1111',TTECSWA+4                                     UTS00940
         L     R1,UTSIOREG+12   PUT 2ND HALF OF CSW IN TTE              UTS00950
         L     R15,ACONEHEX                                             UTS00960
         BALR  R14,R15                                                  UTS00970
         STCM  R0,B'1111',TTECSWB                                       UTS00980
         STCM  R1,B'1111',TTECSWB+4                                     UTS00990
         ETTE  IOTTE                                                    UTS01000
SKIPTTE  DS    0H                                                       UTS01010
         TM    UTSIOREG+12,X'80'     CHECK CSW STATUS FOR ATTN ON       UTS01020
         BNO   IOIGNORE                                                 UTS01030
*  GO FIND THIS UTS MACHINE'S CONTROL BLOCK IN THE UTSCB CHAIN          UTS01040
*     R4 = THE UTS MACHINE'S VIRTUAL ADDRESS IN HEX                     UTS01050
         L     R4,CBFIRST        GET ADDRESS OF FIRST UTSCB             UTS01060
         LTR   R4,R4             ARE THERE ANY UTS'S ??                 UTS01070
         BZ    IOIGNORE          IF NOT, IGNORE THIS INTERRUPT          UTS01080
IOLOOP   CLC   UTSIOREG+18(2),CBUTSVAD  IS THIS THE INTERRUPTING UTS ?? UTS01090
         BE    IOCONA            YES, GO TAKE CARE OF IT.               UTS01100
         L     R4,CBUTSFP        GET POINTER TO NEXT UTSCB.             UTS01110
         LTR   R4,R4             ARE WE AT THE END OF THE CHAIN ??      UTS01120
         BNE   IOLOOP            NOPE, GO CHECK THIS UTSCB              UTS01130
         B     IOIGNORE          IF UTS NOT FOUND, IGNORE INTERRUPT     UTS01140
*                                                                       UTS01150
*     NOW R4 IS POINTING TO THE CORRECT UTSCB.                          UTS01160
*     TURN ON THE I-NEED-SERVICING FLAG FOR THIS UTS &                  UTS01170
*     TURN ON THE A-UTS-NEEDS-SERVICING FLAG.                           UTS01180
*     REMEMBER THE TIME AND DATE OF THIS INTERRUPT.                     UTS01190
IOCONA   DS    0H                                                       UTS01200
         OI    CBUTSFGA,INTISIN                                         UTS01210
         OI    FLAGA,UTSINT                                             UTS01220
*-------------------------------------------------------------*         UTS01230
*    GET THE TIME AND DATE FROM CP                            *         UTS01240
*-------------------------------------------------------------*         UTS01250
         LA    R1,CPDATA           ADDRESS OF DATA FROM DIAG            UTS01260
         DIAG  R1,R0,X'000C'       REQUEST DATE AND TIME FROM CP        UTS01270
*-------------------------------------------------------------*         UTS01280
*    CPDATA IS NOW IN THE FORMAT OF                           *         UTS01290
*           DC    CL8'MM/DD/YY'                               *         UTS01300
*           DC    CL8'HH:MM:SS'                               *         UTS01310
*           DS    2D     THE REST IS JUNK                     *         UTS01320
*-------------------------------------------------------------*         UTS01330
         MVC   CBUTSDAT,CPDATA                                          UTS01340
         MVC   CBUTSTIM,CPDATA+8                                        UTS01350
         ETTE  OKINTTTE                                                 UTS01360
UTSIOBYE DS    0H                                                       UTS01370
         LM    R0,R14,UTSIOREG                                          UTS01380
         SR    R15,R15                RETURN CODE = 0                   UTS01390
         BR    R14                    BYE                               UTS01400
*                                                                       UTS01410
IOIGNORE DS    0H                                                       UTS01420
         TM    TEST0916,TEST9                                           UTS01430
         BNO   IGCONA                                                   UTS01440
         LH    R9,68                                                    UTS01450
         LINEDIT TEXT='IGNORING THIS UTS INTERRUPT.  CSW STATUS = ....'-UTS01460
               ,SUB=(HEX,(R9)),RENT=NO                                  UTS01470
IGCONA   DS    0H                                                       UTS01480
         ETTE  BADINTTE                                                 UTS01490
         B     UTSIOBYE                                                 UTS01500
*                                                                       UTS01510
CPDATA   DS    4D                                                       UTS01520
UTSIOREG DS    15F                                                      UTS01530
*                                                                       UTS01540
IOTTE    DC    AL1(IOTTEQU)                                             UTS01550
         DC    C'INTERRUPT RECEIVED FROM '                              UTS01560
TTECUU   DS    CL3                                                      UTS01570
         DC    C'.  I/O OLD PSW = '                                     UTS01580
TTEOLDA  DS    CL8                                                      UTS01590
         DC    C' '                                                     UTS01600
TTEOLDB  DS    CL8                                                      UTS01610
         DC    C'. CSW = '                                              UTS01620
TTECSWA  DS    CL8                                                      UTS01630
         DC    C' '                                                     UTS01640
TTECSWB  DS    CL8                                                      UTS01650
         DC    C'.'                                                     UTS01660
IOTTEQU  EQU   *-IOTTE-1                                                UTS01670
*                                                                       UTS01680
OKINTTTE DC    AL1(OKEQU)                                               UTS01690
         DC    C'INTERRUPT DULY RECORDED'                               UTS01700
OKEQU    EQU   *-OKINTTTE-1                                             UTS01710
*                                                                       UTS01720
BADINTTE DC    AL1(BADEQU)                                              UTS01730
         DC    C'INTERRUPT IGNORED'                                     UTS01740
BADEQU   EQU   *-BADINTTE-1                                             UTS01750
         LTORG                                                          UTS01760
         ICDATA                                                         UTS01770
         END                                                            UTS01780