Type ASSEMBLE
Source Lines : 1,729
Fixes Applied : 6
Most Recent Version : Thursday, December 7, 1978
Last Fix ID : [R13548DK]
Module
DMKVCA
Function
TO SIMULATE THE CHANNEL AND DEVICE OPERATIONS OF THE CHANNEL-TO-CHANNEL ADAPTER (CTCA) CONNECTED BETWEEN TWO VIRTUAL MACHINES UNDER VM/370
Attributes
REENTRANT, PAGEABLE, CALLED VIA SVC
Operation
DMKVCAST IS CALLED FROM DMKVIOEX AT THE SAME POINT WHERE DMKIOSQV IS CALLED FOR NON-SIMULATED DEVICES. AT ENTRY, DMKVCAST INITIALIZES THE IOBLOK AS DMKIOSQV WOULD, AND THEN TESTS THE VDEVBLOK TO DETERMINE IF THE VIRTUAL CTCA IS 'COUPLE'D TO ANOTHER CTCA. IF NOT, DMKDIASM IS CALLED TO INTERPRET THE CCW STRING AND SIMULATE THE CORRECT CSW AND SENSE STATUS. IF YES, START I/O SIMULATION PROCEEDS AS FOLLOWS: 1. THE 'CHXBLOK' AND 'CHYBLOK' ARE REFERENCED THRU THE X-SIDE AND Y-SIDE VDEVBLOK'S (IN THIS DISCUSSION, THE X-SIDE IS ALWAYS THE INITIATING CHANNEL). 2. THE FIRST REAL CCW AND THE IOBCAW ARE VALIDATED. IF ANY ERRORS ARE DETECTED, A CHANNEL PROGRAM CHECK IS GENERATED AND THE SIMULATION TERMINATES VIA STEP ?? 3. THE REAL CCW STRING PRODUCED BY DMKCCWTR IS INTERPRETED ONE CCW AT A TIME BASED ON THE OPERATION TYPE: TRANSFER IN CHANNEL: X'08' IF 'TIC' IS FIRST CCW, GENERATE CHANNEL PROGRAM CHK IF 'TIC' POINTS TO 'TIC', CAUSE CHANNEL PROGRAM CHK OTHERWISE, RESTART WITH NEW CCW STRING. SENSE ADAPTER STATE (EXTENDED MODE ONLY): X'14' TEST FOR A PREVIOUS Y-SIDE RESET NOT YET CLEARED AND PRESENT INTERVENTION REQUIRED IF YES. TEST FOR ATTENTION PENDING FROM Y-SIDE, PRESENT 'ATTN + BUSY' IN INITIAL STATUS IF YES. OTHERWISE, PRESENT SENSE BYTE ZERO. IN ALL CASES, SUPPRESS DATA TRANSFER IF 'SKIP' IN CCW. SENSE COMMAND BYTE: X'04' EXTENDED MODE: IF PREVIOUS X-SIDE RESET OR HALT I/O HAS NOT BEEN CLEARED, CLEAR RESET CONDITION, PRESENT DEVICE END TO Y-SIDE, AND STORE COMMAND BYTE OF ZERO. IF PREVIOUS Y-SIDE RESET OR HALT I/O HAS NOT BEEN CLEARED, PRESENT UNIT CHECK IN INITIAL STATUS. IF X-SIDE END-OF-FILE LATCH IS SET, RESET LATCH AND STORE COMMAND BYTE OF ZERO. OTHERWISE, STORE COMMAND BYTE FROM Y-SIDE ADAPTER BLOCK. IF THE Y-SIDE COMMAND WAS A CONTROL, PRESENT DEVICE END TO THE Y-SIDE CHANNEL. COMPATIBILITY MODE: STORE COMMAND BYTE FROM Y-SIDE ADAPTER BLOCK. IF THE Y-SIDE COMMAND WAS A CONTROL, PRESENT DEVICE END TO THE Y-SIDE CHANNEL. IN ALL CASES, SUPPRESS DATA TRANSFER IF 'SKIP' IN CCW. EXTENDED-MODE ONLY - WRITE, READ CONTROL: IF A PREVIOUS X-SIDE HALT I/O OR RESET HAS NOT BEEN CLEARED, CLEAR THE CONDITION AND PRESENT DEVICE END TO THE Y-SIDE CHANNEL. IF A PREVIOUS Y-SIDE HALT I/O OR RESET HAS NOT BEEN CLEARED, PRESENT UNIT CHECK IN INITIAL STATUS. OTHERWISE, CONTINUE WITH COMMAND PROCESSING. CONTROL IMMEDIATE: X'07' RESET THE X-SIDE END-OF-FILE LATCH IF SET. IF THE Y-SIDE HAS AN ACTIVE READ, WRITE OR CONTROL COMMAND, PRESENT 'ATTN + BUSY'. OTHERWISE, PRESENT ATTENTION TO THE Y-SIDE CHANNEL, CHANNEL END TO THE X-SIDE CHANNEL, AND WAIT FOR A 'SENSE COMMAND BYTE' FROM THE Y-SIDE. DISABLE COMPATIBILITY - MODIFIED NO-OP X'C3': SET THE INHIBIT COMPATIBILITY LATCH IN THE X-SIDE ADAPTER BLOCK, INIDCATE THAT BOTH SIDES OF THE ADAPTER ARE IN EXTENDED MODE, ADVANCE TO NEXT CCW. ENABLE COMPATIBILITY - MODIFIED NO-OP X'43': RESET THE X-SIDE INHIBIT COMPATIBILITY LATCH. IF THE Y-SIDE INHIBIT COMPATIBILITY LATCH IS SET, LEAVE ADAPTER IN EXTENDED MODE AND ADVANCE TO NEXT CCW. IF THE Y-SIDE LATCH IS NOT SET, FORCE THE ADAPTER INTO COMPATIBILITY MODE. WRITE: X'01' RESET THE X-SIDE END-OF-FILE LATCH IF SET. IF THE Y-SIDE HAS AN ACTIVE READ COMMAND, ENTER DATA TRANSFER MODE. IF THE Y-SIDE HAS AN ACTIVE WRITE OR CONTROL COMMAND, PRESENT 'ATTN + BUSY'. IF THERE IS NO ACTIVE Y-SIDE COMMAND, PRESENT 'ATTN' TO THE Y-SIDE CHANNEL AND WAIT FOR Y-SIDE ACTIVITY. WRITE END OF FILE: X'81' (EXTENDED MODE ONLY) RESET THE X-SIDE END-OF-FILE LATCH IF SET. IF THE Y-SIDE HAS NO ACTIVE COMMAND, SET THE Y-SIDE END-OF-FILE LATCH AND CONTINUE PROCESSING. IF THE Y-SIDE HAS AN ACTIVE READ COMMAND, PRESENT CHANNEL END, DEVICE END, UNIT EXCEPTION TO THE Y-SIDE. IF THE Y-SIDE HAS AN ACTIVE CONTROL OR WRITE COMMAND, PRESENT 'ATTN + BUSY' TO THE X-SIDE CHANNEL. READ X'02' OR READ BACKWARD X'0C': EXTENDED MODE: IF THE X-SIDE END-OF-FILE LATCH IS SET, RESET THE LATCH AND PRESENT UNIT EXCEPTION IN INITIAL STATUS. IF THE Y-SIDE HAS AN ACTIVE WRITE COMMAND, ENTER DATA TRANSFER MODE. IF THE Y-SIDE HAS AN ACTIVE WRITE OR CONTROL COMMAND, PRESENT 'ATTN + BUSY'. IF THERE IS NO ACTIVE Y-SIDE COMMAND, PRESENT 'ATTN' TO THE Y-SIDE CHANNEL AND WAIT FOR Y-SIDE ACTIVITY. WHENEVER IT IS NECESSARY TO WAIT FOR ACTIVITY FROM THE Y-SIDE CHANNEL, A CPEXBLOK IS BUILT AND THE ADDRESS STORED IN THE CHXBLOK FOR LATER RE-CONNECTION VIA A CALL TO DMKSTKCP. ANOTHER CPEXBLOK IS BUILT FOR AN EXIT TO THE CALLING ROUTINE WHILE PRESERVING THE ENTRY SAVE-AREA. AT APPROPRIATE PLACES DURING COMMAND PROCESSING, A CPEXBLOK EXIT FOLLOWED BY A CPEXBLOK RESTART IS TAKEN FOR SEQUENCING CONTROL AND TIMING CONSIDERATIONS. DATA TRANSFER MODE: UPON ENTERING DATA TRANSFER MODE, THE FOLLOWING INIT- IALIZATION STEPS ARE TAKEN: 1. RESET ANY PENDING ATTENTION INTERRUPTS OR FLAGS ON BOTH THE X-SIDE AND Y-SIDE ADAPTERS. 2. BUILD A CPEXBLOK FOR THE X-SIDE SUCH THAT BOTH X AND Y ADAPTERS ARE IN A SOFTWARE 'WAIT' STATUS. 3. PRESENT ZERO INITIAL STATUS TO THE X-SIDE CHANNEL. 4. EXCHANGE THE X-SIDE AND Y-SIDE IF NECESSARY SUCH THAT THE 'READ' OPERATION IS ALWAYS THE X-SIDE ADAPTER. DATA TRANSFER WILL PROCEED UNINTERRUPTIBLY TO COMPLETION, IN THE FOLLOWING MANNER: 1. EXAMINE THE Y-SIDE (WRITE) CCW TO DETERMINE THE MAXIMUM SEGMENT LENGTH FOR DATA TRANSFER. 2. EXAMINE THE X-SIDE (READ) CCW TO DETERMINE ITS MAXIMUM SEGMENT LENGTH FOR DATA TRANSFER. 3. EXAMINE THE 'CAW' PROTECTION KEY FOR THE READ CCW AND SIMULATE A PROTECTION CHECK IF IT DOES NOT MATCH THE REAL STORAGE KEY OF THE READ AREA. 4. COMPARE THE DATA SEGMENT LENGTHS FOR READ AND WRITE. 5. IF THE READ COUNT IS GREATER THAN THE WRITE COUNT, TRANSFER THE DATA SEGMENT AS SPECIFIED BY THE WRITE COUNT, AND UPDATE THE WRITE COUNT BY RESTARTING AT STEP 1. AND SKIPPING STEPS 2. AND 3. 6. IF THE WRITE COUNT IS GREATER THAN THE READ COUNT, TRANSFER THE DATA SEGMENT AS SPECIFIED BY THE READ COUNT AND UPDATE THE READ COUNT BY RESTARTING AT STEP 2. 7. IF THE READ COUNT EQUALS THE WRITE COUNT, TRANSFER THE DATA SEGMENT AND RESTART AT STEP 1. 8. WHEN EITHER THE READ OR WRITE CCW STRING HAS BEEN EXHAUSTED, DETERMINE IF INCORRECT LENGTH SHOULD BE INDICATED FOR EITHER OR BOTH CHANNELS AND RE-CONNECT BOTH SIDES VIA CALLS TO DMKSTKCP. THE MAXIMUM DATA SEGMENT LENGTH WHICH MAY BE TRANSFERRED IN A SINGLE STEP IS DETERMINED AS FOLLOWS: 1. NO MORE THAN 2048 BYTES AT ANY TIME - FOR PROTECTION KEY CHECKING. 2. NO MORE THAN THE LENGTH OF BUFFER FROM THE STARTING ADDRESS TO THE NEAREST 2048-BYTE STORAGE BOUNDARY. 3. NO MORE THAN THE TOTAL OR REMAINING CCW DATA COUNT. DATA TRANSFER WILL CONTINUE SO LONG AS THERE IS REMAINING CCW DATA COUNT OR DATA CHAINED CCW'S. COMMAND CHAINING WILL STOP DATA TRANSFER IF THE PREVIOUS CCW COUNT IS EXHAUSTED. READ BACKWARD DATA TRANSFER: THE READ BACKWARD COMMAND TO A CHANNEL-TO-CHANNEL ADAPTER RESULTS IN THE DATA BEING INVERTED ON A CHARACTER BASIS., SINCE THE WRITE-ING CHANNEL IS SENDING DATA IN FORWARD SEUENCE, BUT THE INDEPENDENT READ-ING CHANNEL IS READING IN BACKWARD SEQUENCE. DATA INVERSION IS PERFORMED IN THE FOLLOWING MANNER: 1. IF THE READ BUFFER STARTS AT A 7-BYTE BOUNDARY (I.E. AT THE LOW-ORDER BYTE OF A DOUBLE WORD), SKIP TO STEP 3. 2. MOVE DATA ONE BYTE AT A TIME UNTIL A 7-BYTE BOUNDARY IS REACHED, OR THE DATA COUNT IS EXHAUSTED. 3. LOAD INTO A REGISTER PAIR EIGHT BYTES OF WRITE DATA IN INVERTED ORDER, AND MOVE TO READ BUFFER VIA A DOUBLE- WORD STORE, UNTIL THE LAST DOUBLE-WORD-ALIGNED DATA HAS BEEN MOVED. 4. MOVE THE REMAINDER OF THE DATA SEGMENT A SINGLE CHARACTER AT A TIME UNTIL THE COUNT IS EXHAUSTED.
Calls to Other Routines
DMKFREE - TO OBTAIN FREE STORAGE DMKFRET - TO RELEASE FREE STORAGE OBTAINED FROM DMKFREE DMKDIBSM - TO SIMULATE STATUS FOR A NOT READY DEVICE @V407510 DMKSCNVU - TO LOCATE VDEVBLOK, VCUBLOK, VCHBLOK DMKSTKCP - TO STACK CPEXBLOKS FOR DEFERRED EXECUTION DMKSTKIO - TO STACK IOBLOKS FOR THE SLIH DMKTRDSI - TO TRACE SIO'S AND CCW STRINGS TO VIRTUAL CTCA