*--------------------------------------------------------------------* 00001000 * 00002000 * Command format: SENSE vaddr|? <(> 00003000 * 00004000 * Types: SENSE=______ 00005000 * or Stacks: * SENSE=______ 00006000 * 00007000 * When recreating the module, LOAD SENSE (ORIGIN TRANS 00008000 * and then GENMOD SENSE 00009000 * 00010000 * Return codes are 0 = All went ok. 00011000 * 4 = No address, or invalid address, given. 00012000 * 8 = Invalid option. 00013000 * 00014000 *--------------------------------------------------------------------* 00015000 SENSE START X'00E000' 00016000 USING *,R15 00017000 B ICATCHER 00018000 DC C'SENSE BY RICK JASPER 11/10/93' 00019000 ICATCHER DS 0H 00020000 DROP R15 00021000 USING SENSE,R12 00022000 LR R12,R15 Set the base reg 00023000 LA R1,8(R1) Get past module name 00024000 CLI 0(R1),C'?' Asking for help? 00025000 BE DUMB Yep. 00026000 *------------------------------------------------------------------- 00027000 * Parse device address. If error, exit rc = 4. 00028000 *------------------------------------------------------------------- 00029000 LA R15,4 00030000 CLI 0(R1),X'FF' Any parms given ?? 00031000 BER R14 If not, exit rc=4. 00032000 SR R0,R0 R0 = This digit 00033000 LR R11,R1 R11 = A(This digit) 00034000 LR R13,R0 R13 = Device address 00035000 B SKIP1 00036000 LOOP LA R11,1(R11) Bump the parm pointer +1 00037000 SKIP1 IC R0,0(R11) ... and get the character 00038000 CLI 0(R11),C'0' Less than zero? 00039000 BL TRYALFA Yes - might be alpha 00040000 CLI 0(R11),C'9' Higher than 9? 00041000 BHR R14 Yes - can't be an address 00042000 SH R0,=X'00F0' Remove the high order bits 00043000 B SHIFTER Looks like a number 00044000 TRYALFA CLI 0(R11),C'A' Look like alpha stuff 00045000 BL CHEKBL Nope - check for a blank 00046000 CLI 0(R11),C'F' Yes - but higher than F? 00047000 BHR R14 Yup - Not a hex character 00048000 SH R0,=X'00B7' Convert to numeric parm 00049000 SHIFTER SLL R13,4 Shift the result left 00050000 ALR R13,R0 Add in the new part 00051000 B LOOP Keep looking 00052000 CHEKBL CLI 0(R11),C' ' End of the address? 00053000 BNER R14 Return if not 00054000 *------------------------------------------------------------------- 00055000 * R13 = Device Address. Check for options. 00056000 *------------------------------------------------------------------- 00057000 LA R1,8(R1) Bump to next parm. 00058000 SR R2,R2 If R2=0, type. Else stack output. 00059000 LA R15,8 Preset rc for invalid option 00060000 CLI 0(R1),C'(' Maybe an option delimiter? 00061000 BNE NOTPAREN Nope. Keep looking 00062000 LA R1,8(R1) Allow optional parenthesis 00063000 NOTPAREN CLI 0(R1),X'FF' End of the options? 00064000 BE DOIT Yes - go do your work. 00065000 CLI 0(R1),C')' Even allow optional ending parens 00066000 BE ENDOPT Make sure the ')' is last. 00067000 LA R2,1234 Make R2 ^= 0 so we'll stack. 00068000 CLC 0(8,R1),=CL8'FIFO' FIFO stacking? 00069000 BNE TLIFO No - check LIFO 00070000 MVC ATTNT(4),=CL8'FIFO' Set the order 00071000 B GOTOPT Stack the stuff 00072000 TLIFO CLC 0(8,R1),=CL8'LIFO' LIFO stacking? 00073000 BNER R14 No, invalid option. Exit rc=8 00074000 MVC ATTNT(4),=CL8'LIFO' Set the order 00075000 GOTOPT CLI 8(R1),C')' Trivial ending paren ?? 00076000 BNE ENDOPT Nope. 00077000 LA R1,8(R1) 00078000 ENDOPT CLI 8(R1),X'FF' Now end of options? 00079000 BNER R14 Nope. Too many options. Error. 00080000 *------------------------------------------------------------------- 00081000 * Now do a sense to this device. Different devices return 00082000 * different number of sense bytes, so what we'll do is do a sense 00083000 * for a bunch of bytes and only return the number we read in. 00084000 * If we're in XA-mode, then Diag 20 will program check with a 00085000 * Specification Exception (Diag 20's supported in 370-mode only). 00086000 * So, if in XA-mode, use Diag A8. NUCON + x'5EA' = NUCMFLAG, 00087000 * which isn't defined in old NUCON DSECT's, so I hardcoded it. 00088000 * X'80' = We're in XA mode. X'40' = CP supports Diag x'A4'/'A8' 00089000 *------------------------------------------------------------------- 00090000 DOIT LA R1,CCWS Point to the CCW string 00091000 TM X'5EA',X'80' Are we in XA-mode? 00092000 BO XAMODE 00093000 DIAG R13,R1,X'0020' Do the sense now 00094000 * Diag 20 will change the condition code and R15 00095000 LA R15,12 LA doesn't change the cc 00096000 BNZR R14 Exit if all is not well (RC = 12) 00097000 B IODONE 00098000 LH R9,70 CSW Residual Count in 370-mode 00099000 * 00100000 XAMODE STH R13,SGDEVICE Setup up SGIOP with VDEV address 00101000 ST R1,SGCPA Point to our CCW's 00102000 LA R1,SGIOP 00103000 DIAG R1,R0,X'00A8' 00104000 LA R15,12 LA doesn't change the cc 00105000 BNZR R14 Exit if all is not well (RC = 12) 00106000 LH R9,SGCSWCNT CSW Residual Count 00107000 *------------------------------------------------------------------- 00108000 * Figure out how many sense bytes we actually read in. 00109000 *------------------------------------------------------------------- 00110000 IODONE DS 0H 00111000 LA R8,100 Number of bytes we tried to read 00112000 SR R8,R9 Less Residual CCW Count 00113000 LA R15,12 LA doesn't change the cc 00114000 BZR R14 Exit if no bytes read (RC = 12) 00115000 *------------------------------------------------------------------- 00116000 * Convert sense bytes to printable hex in output area. 00117000 * In loop, R4 = # bytes we've put in output area 00118000 * R5 = Address of where to put the next byte 00119000 * R6 = Counter of 4 to 0 to know when to add a blank 00120000 * R7 = Work register - byte to convert 00121000 * R8 = # bytes of sense left to convert 00122000 * R9 = Address of next sense byte to convert 00123000 *------------------------------------------------------------------- 00124000 LA R9,SNSBYTES 00125000 SR R4,R4 Output byte counter 00126000 LA R5,CHARSNS Output pointer 00127000 LA R6,5 Prime countdown counter 00128000 CVTLOOP DS 0H 00129000 BCT R6,NOBLANK Have we converted 4 bytes yet? 00130000 MVI 0(R5),C' ' Yes, move a blank in then. 00131000 LA R4,1(R4) Bump output byte counter 00132000 LA R5,1(R5) and output pointer 00133000 LA R6,4 Reset countdown counter 00134000 NOBLANK DS 0H 00135000 SR R7,R7 Clear for ICM 00136000 ICM R7,B'0001',0(R9) Get hex char to convert 00137000 SLL R7,1 Double it since 2 bytes/entry 00138000 LA R7,HEXTABLE(R7) Get A(printable hex from HEXTABLE) 00139000 MVC 0(2,R5),0(R7) Move two bytes to output 00140000 LA R4,2(R4) Bump output counter by two 00141000 LA R5,2(R5) and output pointer 00142000 LA R9,1(R9) Bump to next byte to convert 00143000 BCT R8,CVTLOOP 00144000 *------------------------------------------------------------------- 00145000 * Now type or stack the answer as he wishes. 00146000 *------------------------------------------------------------------- 00147000 LTR R2,R2 Are we typing today? 00148000 BZ TYPEIT Yep. 00149000 LA R4,8(R4) 8 Characters prefixing sense bytes 00150000 STCM R4,B'0001',ATTNL Save output length 00151000 LA R1,ATTN Point to the stack plist 00152000 SVC202 SVC 202 Type or stack the answer 00153000 DC AL4(*+4) 00154000 BR R14 All through now. Rc = 0. 00155000 * 00156000 TYPEIT DS 0H 00157000 LA R4,6(R4) 6 Characters prefixing sense bytes 00158000 STCM R4,B'0111',TYPLINL 00159000 LA R1,TYPLIN Point to TYPLIN PLIST 00160000 BZ SVC202 Go type it. 00161000 * 00162000 DUMB LA R1,TYPEHLP1 Show this guy the help text. 00163000 SVC 202 00164000 LA R1,TYPEHLP2 Second line 00165000 SVC 202 00166000 LA R1,TYPEHLP3 Last line 00167000 B SVC202 00168000 * 00169000 SGIOP DS 0D 00170000 SGDEVICE DC X'0191' Word 0 = Virtual Address in Hex 00171000 SGKEY DC X'E0' Storage Protection Key 00172000 SGFLAGG DC X'00' I/O Request Flag (Format 0 CCW's) 00173000 DC F'0' Word 1 = Zeros 00174000 SGCPA DS F Word 2 = Channel Program Address 00175000 DC F'0' Word 3 = Zeros 00176000 SGCSWADD DS F Word 4 = CSW Address (last CCW + 8) 00177000 SGCSWDS DS X Word 5 = CSW Device Status 00178000 SGCSWCS DS X CSW Channel Status 00179000 SGCSWCNT DS H CSW Residual Count 00180000 DC F'0' Word 6 = Zeros 00181000 DC H'0' Word 7 = Zeros 00182000 SGSNSCNT DS H Sense Byte Count 00183000 DC 6F'0' Words 8-13 = Zeros 00184000 SGSENSE DS 8F Words 14-21 = Sense Bytes if Unit Check 00185000 * 00186000 DS 0D Alignment 00187000 CCWS DC X'04' Sense 00188000 DC AL3(SNSBYTES) Address 00189000 DC X'20000064' SILI & 100 bytes 00190000 SNSBYTES DC 100X'00' 00191000 * 00192000 DS 0D 00193000 TYPLIN DC CL8'TYPLIN' TYPLIN plist 00194000 DC X'01' 00195000 DC AL3(TLINE) Message address 00196000 DC C'B' Black 00197000 TYPLINL DC AL3(0) Message Length 00198000 * 00199000 DS 0D Alignment 00200000 ATTN DC CL8'ATTN' STACK plist 00201000 ATTNT DC CL4'LIFO' Type 00202000 ATTNL DC AL1(14) Length 00203000 DC AL3(SLINE) Message address 00204000 * 00205000 DS 0D 00206000 TYPEHLP1 DC CL8'TYPLIN' TYPLIN plist 00207000 DC X'01' 00208000 DC AL3(HELP1) Message address 00209000 DC C'B' Black 00210000 DC AL3(L'HELP1) Message Length 00211000 TYPEHLP2 DC CL8'TYPLIN' TYPLIN plist 00212000 DC X'01' 00213000 DC AL3(HELP2) Message address 00214000 DC C'B' Black 00215000 DC AL3(L'HELP2) Message Length 00216000 TYPEHLP3 DC CL8'TYPLIN' TYPLIN plist 00217000 DC X'01' 00218000 DC AL3(HELP3) Message address 00219000 DC C'B' Black 00220000 DC AL3(L'HELP3) Message Length 00221000 * 00222000 * 00223000 HELP1 DC C'This module will do a sense for a given device and' 00224000 HELP2 DC C'return the sense bytes either on the console or in' 00225000 HELP3 DC C'the stack. To use, say SENSE vdev <(FIFO | LIFO' 00226000 * 00227000 SLINE DC C'* ' 00228000 TLINE DC C'SENSE=' 00229000 CHARSNS DC 224C' ' Sense Bytes Converted to EBCDIC 00230000 HEXTABLE DC C'000102030405060708090A0B0C0D0E0F' 00231000 DC C'101112131415161718191A1B1C1D1E1F' 00232000 DC C'202122232425262728292A2B2C2D2E2F' 00233000 DC C'303132333435363738393A3B3C3D3E3F' 00234000 DC C'404142434445464748494A4B4C4D4E4F' 00235000 DC C'505152535455565758595A5B5C5D5E5F' 00236000 DC C'606162636465666768696A6B6C6D6E6F' 00237000 DC C'707172737475767778797A7B7C7D7E7F' 00238000 DC C'808182838485868788898A8B8C8D8E8F' 00239000 DC C'909192939495969798999A9B9C9D9E9F' 00240000 DC C'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF' 00241000 DC C'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF' 00242000 DC C'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF' 00243000 DC C'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF' 00244000 DC C'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF' 00245000 DC C'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF' 00246000 REGEQU 00247000 END SENSE 00248000