*M*      CSEX560  XEROX 560 SPEC. CODE FOR CENTRAL SYSTEM ERRORS
*P*  NAME:  CSEX560
*P*
*P*  PURPOSE:  PROVIDE MACHINE SPECIFIC CODE FOR HANDLING
*P*            HARDWARE FAULTS ON XEROX 560.  USED IN
*P*            CONJUNCTION WITH CSEHAND AND CSECOM MODULES.
*P*
*P*  DESCRIPTION:  SEE CSEHAND MODULE FOR OVERVIEW OF FAULT HANDLING
         PCC      0
         TITLE    'CSEX560  -  XEROX 560 SPECIFIC CODE'
         DEF      CSEX560:
CSEX560: EQU      %
BITS     SET      1                 GET BT31TO0 BITS
         SYSTEM   UTS
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
R8       EQU      8
R9       EQU      9
R10      EQU      10
R11      EQU      11
R12      EQU      12
R13      EQU      13
R14      EQU      14
R15      EQU      15
         TITLE    'CSEX560  -  REFS AND DEFS'
*  REFS AND DEFS
         SPACE
         REF      CSED%BEST%END     FLAG WORD FOR EXIT CONDITION
         REF      CSED%PSD          TRAP PSD
         REF      CSED%LOG%MFI      FLAG TO LOG ALL MEMORY ERRORS
         REF      CSED%PATH         TRACK BITS FOR RE-ENTRY
         REF      PSD%I56           I56 TRAP PSD
         REF      CSED%MAPPED       MAP FLAG FOR TRAPPED INST
         REF      CSED%SPDF         RE-ENTRY FLAG WORD
         REF      CSED%RTRY%CNT     RETRY COUNTER
         REF      ERRLOG            ERROR LOGGING ROUTINE
         REF      LMA               USED TO RELOAD MAP AND ACC AND WR LOCKS
         REF      T:XMMC            USED TO RELOAD MAP FOR CURRENT USER
         REF      S:CUN             USED TO RELOAD MAP FOR CURRENT USER
         REF      S:ADR             CPU HARDWARE ADDRESS
         REF      C%PSTAT           PROCESSOR FAULT STATUS TABLE
         REF      C%PADDR           TABLE OF PROCESSOR ADDRESSES
         REF      C%PCNTL           TABLE OF PROCESSOR TYPES
         REF      C%PSZE            SIZE OF C%PADDR,C%PCNTL
         REF      CSE%END           EXIT POINT
         REF      CSE%BEST%END%STOP SET HALT FLAG
         REF      CSE%BEST%END%ABORT%STEP SET JOB STEP ABORT FLAG
         REF      CSE%BEST%END%SCREECH SET SCREECH FLAG
         REF      CSE%LOG%PRIMARY%PFI ROUTINE TO LOG PFI ENTRY
         REF      CSE%MFIX%ENTRY2   ROUTINE TO SET HALT FLAG ON BAD MEMORY
         REF      CSE%T4C%FIX%MAP   ROUTINE TO RELOAD MAP AND ACC
         REF      CSE%MFIX          ROUTINE TO EXAMINE MEMORY FOR PE
         SPACE
         REF      CSE%2             CSE BRANCH TABLE ENTRY #2
         REF      CSE%4             CSE BRANCH TABLE ENTRY #4
         REF      CSE%6             CSE BRANCH TABLE ENTRY #6
         SPACE
CSE%MPOLR  EQU    CSE%2
CSE%MLOG   EQU    CSE%4
CSE%MDEL   EQU    CSE%6
         SPACE
         DEF      CSE%1:560         CSE BRANCH TARGET #1
         DEF      CSE%3:560         CSE BRANCH TARGET #3
         DEF      CSE%5:560         CSE BRANCH TARGET #5
         DEF      CSE%7:560         CSE BRANCH TARGET #7
         DEF      CSE%A:560         CSE BRANCH TARGET #10
         DEF      CSE%C:560         CSE BRANCH TARGET #12
         DEF      CSE%D:560         CSE BRANCH TARGET #13
         DEF      CSE%E:560         CSE BRANCH TARGET #14
         DEF      CSE%F:560         CSE BRANCH TARGET #15
         SPACE
CSE%1:560  EQ  CSE%PPOLR            PROCESSOR POLLING
* CSE%2:560 IS DEF'D IN CSECOM
CSE%3:560  EQ  CSE%PLOG             PROC FAULT STAT LOGGING
* CSE%4:450 IS DEF'D IN CSECOM
CSE%5:560  EQ  CSE%PDEL             CLEAR PSTAT TABLE
* CSE%6:560 IS DEF'D IN CSECOM
CSE%7:560  EQ  CSE%MFIX%ENTRY       EXAMINE MEM BANK FLT STAT BITS
* CSE%8:560 IS DEF'D IN CSECOM
* CSE%9:560 IS DEF'D IN CSECOM
CSE%A:560  EQ  CSE%T4C%FIX          4C HANDLER
* CSE%B:560 IS DEF'D IN CSECOM
CSE%C:560  EQ  DUMMY                ENTRY NOT USED
CSE%D:560  EQ  DUMMY                ENTRY NOT USED
CSE%E:560  EQ  DUMMY                ENTRY NOT USED
CSE%F:560  EQ  DUMMY                ENTRY NOT USED
         SPACE
         DEF      CSE%PFI           PFI HANDLER
         SPACE
CSEI%PATH%PPOL  EQU  X'10'
CSEI%PATH%I56   EQU  X'20'
CSEP%WHY%T4C    EQU  3
CSEP%WHY%BAD%RBLK EQU 5
CSEP%WHY%PFI    EQU  7
CSEP%WHY%WLPE   EQU  12
         SPACE
*   PROCESSOR TYPE CODES AND ADDRESSES
         SPACE
CSEP%BP  EQU      1                 TYPE CODE FOR BP
CSEP%BP%ADDR  EQU  X'05'            PPOLR ADDRESS FOR BP
CSEP%MI  EQU      2                 TYPE CODE FOR MI IN BP'S CLUSTER
CSEP%MIOP EQU 4   TYPE CODE FOR MIOP
CSEP%MI%ADDR  EQU  X'06'            ADDDRESS OF MI IN BP'S CLUSTER
CSEP%PSTAT%SZE  EQU  6              SIZE OF C%PSTAT
         SPACE
*   ITEMS IN BP POLR STATUS
         SPACE
CSEP%MIE EQU      X'100'            MI ERROR FLAG
CSEP%RBLK%PEBIT  EQU  X'4000'
CSEP%BP%RETRY EQU  X'10'
         SPACE
*   ITEMS IN MI POLR STATUS
         SPACE
CSEP%MAPPE  EQU  X'4000'            MAP PARITY ERROR (OR ACCESS CODES)
         SPACE
*   ITEMS IN MIOP POLR STATUS
         SPACE
CSEP%MIOP%CME  EQU  X'3000'         CONTROL CHECK FAULT & CONTROL MEM FAULT
CSEP%MIOP%SACME  EQU  X'800'        SIGMA ADAPTER CONTROL MEM FAULT
         SPACE
         TITLE    'CSEX560  -  CSE%MFIX%ENTRY'
         SPACE
*   ENTER WITH BAL,R14
*        R3 CONTAINS ADDRESS OF MEMORY CELL WITH BAD PARITY
*        R1 CONTAINS ADDRESS OF MSTAT ENTRY WORD 0
*        USES R9 AND SETS R8 IF ERROR FOUND IS CORR PE (X560)
         SPACE
CSE%MFIX%ENTRY  EQU  %
         MTW,1    CSED%LOG%MFI      ALWAYS LOG MEM ERRORS ON X560
         LW,R9    1,R1              PICK UP MSW0 (MSTAT ENTRY WORD 1)
         CW,R9    =X'40000001'      CHECK FOR POWER FAIL, MULT ERR BITS
         BAZ      CSEM1A            B/ NOT SET OK TO CONTINUE
         BAL,R13  CSE%MFIX%ENTRY2   GO SET STOP SEQUENCE
CSEM1A   EQU      %
         DO       0                 NEEDED FOR BI-POLAR MEMORY ONLY
         CI,R9    X'200'            CHECK FOR CORRECTED PE
         BAZ      CSEM1             B/ NOT SET
         AI,R8    -1                TO AVOID SCREECH IF THIS IS ONLY ERROR
         B        *R14              RETURN
         FIN
CSEM1    EQU      %
         CI,R9    X'10'             CHECK FOR WRITE LOCK PE
         BAZ      *R14              B/ NOT WL PE RETURN
         PUSH     16,R0             SAVE OUR REGS
         BAL,R11  LMA               GO LOAD MAP, ACC
         LW,R4    S:CUN             LOAD MAP FOR CURRENT USER
         BAL,R11  T:XMMC
         PULL     16,R0             GET BACK OURS
         MTW,-1   CSED%RTRY%CNT     DECREMENT RETRY COUNTER
         BGZ      *R14              RETURN TO RETRY
         LI,R11   CSEP%WHY%WLPE     SET WHY CODE
         BAL,R12  CSE%BEST%END%STOP
         B        *R14              RETURN
         TITLE    'CSEX560  -  CSE%PPOLR'
CSE%PPOLR  EQU    %
         SPACE
*   PROCESSOR POLLING ROUTINE FOR XEROX 560
         SPACE
         LI,R3    CSEI%PATH%PPOL
         STS,R3   CSED%PATH         SET FOR REENTRY CHECK
         LI,R7    CSEP%BP%ADDR      ADDRESS OF BP UNIT
         LI,R8    CSEP%BP           TYPE CODE OF BP
         BAL,R14  CSEP              GO POLL BP
         BCS,1    CSEP1             NO STATUS
         STW,R9   C%PSTAT           PUT STATUS IN TABLE (WORD 0)
CSEP1    LI,R7    CSEP%MI%ADDR      ADDRES OF MI UNIT (CLUSTER 0)
         LI,R8    CSEP%MI           TYPE CODE OF MI UNIT
         BAL,R14  CSEP              GO POLL MI
         BCS,1    CSEP2
         STW,R9   C%PSTAT+1         PUT IN TABLE (WORD 1)
CSEP2    LI,R1    0                 INDEX TO CONFIG TABLE
         LI,R2    1                 INDEX TO PSTAT TABLE (STARTS @ WORD 2)
CSEP3    EQU      %
         LB,R7    C%PADDR,R1        GET ADDRESS
         LB,R8    C%PCNTL,R1        GET TYPE
         BAL,R14  CSEP              GO POLL THIS UNIT
         BCS,1    CSEP5             B/ NO STATUS THIS UNIT
CSEP4    AI,R2    1                 BUMP UP INDEX IN PPOLR TABLE
         CI,R2    CSEP%PSTAT%SZE    COMPARE W/ MAX INDEX
         BG       CSEP5             TABLE FULL , JUST POLL
         MTW,0    C%PSTAT,R2        CHECK TO SEE IF THIS ENTRY USED
         BLZ      CSEP4             TRY NEXT
         STW,R9   C%PSTAT,R2        STORE STATUS IN TABLE
CSEP5    EQU      %
         AI,R1    1                 NEXT PROCESSOR
         CI,R1    C%PSZE            MAXIMUM PROC INDEX
         BLE      CSEP3             GO DO NEXT
         LI,R2    0                 ALL DONE
         STS,R2   CSED%PATH         ALL DONE , RESET BIT (IN R3)
         B        *R15
         SPACE
CSEP     EQU      %                 ACTUAL POLL ROUTINE
         SLS,R7   8
         POLR,R9  0,R7              GET STATUS
         STCF     R7                TEMP SAVE OF CC
         CI,R8    CSEP%MI           SEE IF THIS IS MI OR BP
         BG       CSEP6             B/ NO, DO REGULAR CHECK
         CI,R8    CSEP%MIOP         SEE IF THIS IS MIOP
         BNE      CSEP6             B/ NO USE REG CHECK
         CI,R9    X'FC00'           LOOK FOR MIOP FAULT BITS
         BAZ      CSEP8             B/ NO FAULTS FOR MIOP
         B        CSEP51
         CI,R9    0                 BP, MI RETURN 0 IF NO FAULTS
         BEZ      CSEP8             NO FAULTS , RETURN WITH CC4=1
CSEP51   EQU      %
         LCF      R7                GET SAVED POLR CC
         B        CSEP7
CSEP6    LCF      R7                GET POLR CC
         BCS,8    CSEP8             B/ ADDRESS NOT RECOGNIZED
         BCR,4    CSEP8             DID NOT RAISE PFI, THEREFORE NO STATUS
CSEP7    STCF     R8                SAVE CC
         SLD,R8   -4                MOVE IN TYPE CODE
         SLS,R8   -24               POSITION CC
         SLD,R8   -4                MOVE IN CC
         LW,R8    R7                GET ADDRESS
         SLS,R8   -8                MOVE ADDRES OVER
         OR,R8    X80               SET USED BIT
         SLD,R8   -8                MOVE THEM IN
         LCI      0                 INDICATE VALID STATUS
         B        *R14              RETURN
CSEP8    LCI      1                 INDICATE NO FAULT STATUS
         B        *R14
         TITLE    'CSEX560  -  CSE%PLOG'
CSE%PLOG  EQU  %
         LW,R8    =X'32030000'      CODE AND COUNT
         OR,R8    S:ADR             MERGE CPU HARDWARE ADDRESS
         LI,R6    R8                ADDRESS OF BUFFER
         OR,R6    Y1
         LI,R1    CSEP%PSTAT%SZE+1  INDEX TO CSED%PSTAT
CSPL1    LW,R10   C%PSTAT-1,R1      PICK UP ENTRY
         BGEZ     CSPL2             EMPTY, TRY NEXT
         BAL,R5   ERRLOG            GO LOG IT
CSPL2    BDR,R1   CSPL1
         B        *R15              RETURN
         TITLE    'CSEX560  -  CSE%PDEL'
CSE%PDEL EQU      %                 ZERO OUT PSTAT TABLE
         LI,R1    CSEP%PSTAT%SZE+1
         LI,R0    0
CSPD1    STW,R0   C%PSTAT-1,R1      ZERO OUT PSTAT ENTRY
         BDR,R1   CSPD1             LOOP UNTIL DONE
         B        *R15              RETURN
         TITLE    'CSEX560  -  CSE%T4C%FIX'
CSE%T4C%FIX  EQU  %
         LI,R1    CSEP%MIE          MI ERROR BIT
         CW,R1    C%PSTAT           IN BP STATUS
         BANZ     CS4C1             B/ MIE FLAG SET, CHECK MI STATUS
         LI,R1    CSEP%RBLK%PEBIT   CHECK FOR REG P.E.
         CW,R1    C%PSTAT           IN BP STATUS
         BAZ      CSABORT           NOT R-BLK PARITY
         B        CSE%T4C%RBLOCK
CS4C1    EQU      %
         LI,R1    CSEP%MAPPE        MAP PE BIT IN...
         CW,R1    C%PSTAT+1         MI STATUS (CLUSTER 0)
         BANZ     CSE%T4C%FIX%MAP   GO RELOAD MAP AND ACC CODES
CSABORT  EQU      %
         LI,R11   CSEP%WHY%T4C      WHY CODE
         B        CSABRT1           GO ABORT STEP
         SPACE
         SPACE
CSE%T4C%RBLOCK      EQU %
         LI,R11   CSEP%WHY%BAD%RBLK SET WHY CODE
CSABRT1  EQU      %
         BAL,R12  CSE%BEST%END%ABORT%STEP
         B        *R15
         TITLE    'CSEX560  -  CSE%PFI'
CSE%PFI  EQU      %
         PUSH     16,R0             SAVE REG BLOCK 0 IN TSTACK
         LI,R1    CSEI%PATH%I56
         STW,R1   CSED%PATH         SET PATH BIT FOR REENTRY DETECTION
         LI,R1    0
         STW,R1   CSED%BEST%END     ZERO OUT ABORT FLAG
         SPACE
         BAL,R15  CSE%PPOLR         PROCESSOR POLLING
         BAL,R15  CSE%LOG%PRIMARY%PFI  GO LOG PRIMARY RECORD
         BAL,R15  CSE%PLOG          LOG POLR SECONDARIES
* CSE%PFIX  -  LOOP THRU PSTAT TABLES LOOKING AT ENTRIES
         LI,R2    0
CSPFI1   LW,R0    C%PSTAT,R2        IS THIS ENTRY USED
         BGEZ     CSPFI3            B/ NO, TRY NEXT
         SLS,R0   12                ISOLATE CODE
         SLS,R0   -28
         CI,R0    X'02'             IS IT MIOP
         BE       CSE%PFI%MIOP      B/ YES, GO CHECK STATUS
*        CI,R0    X'05'             IS IT RMP
*        BE       CSE%PFI%RMP       B/ YES, GO CHECK STATUS
         CI,R0    X'01'             IS IT BP
         BNE      CSPFI3            B/ NOT BP, JUST LOG IT
         LI,R1    CSEP%BP%RETRY        IS IT CORRECTED RETRY
         CW,R1    C%PSTAT,R2
         BANZ     CSPFI4            B/ YES, CONTINUE LOOKING
CSPFI2   LI,R11   CSEP%WHY%PFI      SET WHY CODE
         BAL,R12  CSE%BEST%END%SCREECH  SCREECH ON MI, AND UNCORRECTED BP
         B        CSPFI4
CSPFI3   CI,R0    X'02'             NOT BP,MIOP,RMP, IS IT MI
         BE       CSPFI2            B/ YES, SCREECH
CSPFI4   EQU      %
         CI,R2    CSEP%PSTAT%SZE    CHECK IF LAST ENTRY
         BGE      CSPFI5            ALL DONE, QUIT LOOPING
         AI,R2    1                 INCR INDEX
         B        CSPFI1            GO BACK TO NEXT
CSE%PFI%MIOP  EQU  %
         LI,R1    CSEP%MIOP%CME+CSEP%MIOP%SACME
         CW,R1    C%PSTAT,R2        CHECK FOR CONTROL EMORY ERRORS
         BAZ      CSPFI4            NOT CME, OK TO CONTINUE
CSE%PFI%RIO  EQU  %
         LW,R1    C%PSTAT,R2        PICK UP STATUS
         SLS,R1   4
         SLS,R1   -20               POSITION PROC ADDRESS
         RIO,0    0,R1              RIO TO PROCESSOR (MIOP)
         BCR,X'E' CSPFI4            B/ RIO ACCEPTED
         B        CSPFI2            SET SCREECH FLAG
CSPFI5   EQU      %
         MTW,0    CSED%BEST%END     CHECK ERROR LEVEL
         BNEZ     CSPFI6            B/ ERROR, USE CSE EXIT
         BAL,R15  CSE%PDEL          ZERO OUT PSTAT TABLE
         BAL,R15  CSE%MDEL          ZERO OUT MSTAT TABLE
         LI,R0    0
         LI,R1    CSEI%PATH%I56
         STS,R0   CSED%PATH         RESET PATH BITS
         PULL     16,R0             RESTORE REGS
         LPSD,X'B'  PSD%I56         GO BACK TO INTERRUPT POINT
         SPACE
CSPFI6   EQU      %
         LI,R0    0
         STW,R0   CSED%MAPPED       RESET  MAPPED FLAG
         STW,R0   CSED%SPDF         SET RENTRY FLAG
         LD,R0    PSD%I56           PICK UP PSD
         STD,R0   CSED%PSD
         CW,R0    Y004              CHECK MAP BIT
         BAZ      CSE%END           GO EXIT
         MTW,1    CSED%MAPPED       SET MAPPED FLAG
         B        CSE%END           GO EXIT
         SPACE
*   BAD ENTRY INTO BRANCH TABLE
         SPACE
DUMMY    EQU      %
         SCREECH  X'23'             .23
*S*  SCREECH CODE:  23-00
*S*
*S*  MESSAGE:  INVALID ENTRY TO CSE HANDLERS
*S*
*S*  REPORTED BY:  CSES7,CSES9,CSEX560
*S*
*S*  TYPE:  SCREECH
*S*
*S*  REMARKS:  ENTRY WAS MADE TO AN UNUSED SLOT OF THE CSE
*S*            BRANCH VECTOR FOR THIS MACHINE TYPE.
*S*
*S*  REGISTERS:  NONE SIGNIFICANT
         END

