{"action":"reopened","issue":{"url":"https://api.github.com/repos/hercules-390/hyperion/issues/59","labels_url":"https://api.github.com/repos/hercules-390/hyperion/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/hercules-390/hyperion/issues/59/comments","events_url":"https://api.github.com/repos/hercules-390/hyperion/issues/59/events","html_url":"https://github.com/hercules-390/hyperion/issues/59","id":95963724,"number":59,"title":"Fix wrong condition code on Halt Device","user":{"login":"Fish-Git2","id":13174225,"avatar_url":"https://avatars.githubusercontent.com/u/13174225?v=3","gravatar_id":"","url":"https://api.github.com/users/Fish-Git2","html_url":"https://github.com/Fish-Git2","followers_url":"https://api.github.com/users/Fish-Git2/followers","following_url":"https://api.github.com/users/Fish-Git2/following{/other_user}","gists_url":"https://api.github.com/users/Fish-Git2/gists{/gist_id}","starred_url":"https://api.github.com/users/Fish-Git2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fish-Git2/subscriptions","organizations_url":"https://api.github.com/users/Fish-Git2/orgs","repos_url":"https://api.github.com/users/Fish-Git2/repos","events_url":"https://api.github.com/users/Fish-Git2/events{/privacy}","received_events_url":"https://api.github.com/users/Fish-Git2/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hercules-390/hyperion/labels/BUG","name":"BUG","color":"FF3300"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-20T00:54:34Z","updated_at":"2015-08-13T03:45:36Z","closed_at":null,"body":"_(copy of spinhawk issue rbowler/spinhawk#40: \"Halt Device -- wrong condition code\", which also happens to exist in 4.0 Hyperion as well):_\r\n\r\nWhen using a \"Teletype\" (ASCII terminal) to log in to VM/370, every console Prepare command ends with an attention signal. Example:\r\n\r\n    VM/370 ONLINE\r\n    ?!\r\n\r\n    .login maint\r\n    !\r\n    ENTER PASSWORD:\r\n    .cpcmsSSS\r\n\r\n    !\r\n    DASD 190 LINKED R/W; R/O BY OPERATOR\r\n    DASD 194 LINKED R/W; R/O BY OPERATOR\r\n    LOGON AT 20:36:41 GMT FRIDAY 07/10/15\r\n    !\r\n    .q n\r\n\r\n    !\r\n    OPERATOR - 01F, MAINT    - 0F1\r\n    !\r\n    .i cms\r\n\r\n    !\r\n    RELEASE 6 CMS 12/25/78\r\n    !\r\n    .\r\n\r\n    !\r\n    .#cp log\r\n\r\n    !\r\n    CONNECT= 00:36:35 VIRTCPU= 000:00.02 TOTCPU= 000:00.22\r\n    !\r\n    LOGOFF AT 21:13:16 GMT FRIDAY 07/10/15\r\n\r\nThere are artifacts, here, from the implementation of commadpt.c but, besides that, VM prints an exclamation mark in response to Attention. There are a lot of exclamation marks there. `IPL CMS` never gets to the Ready message, because the VM read is retried over and over. I used `#CP` to break out.\r\n\r\nPrepare marks time when there is nothing else to do. If the terminal user presses Break, this is Attention; Prepare completes with CE+DE. Before starting a new console task, VM uses Halt Device to stop the Prepare. After that, Prepare is assumed to have completed without Attention.\r\n\r\nThe problem is that Halt Device signals, via `dev->halt_device(dev)`for the device to stop, then sets Condition Code 0, which indicates failure. Normal, successful completion should be CC 1, with zeroes in the CSW status field. Because Halt Device failed, VM (_DMKCNS_) takes the ensuing I/O interrupt as an Attention signal.\r\n\r\nQuoting from the S/370 PoP (_09/74, p.202_):\r\n\r\n  *  **Condition Code 0** indicates that HALT DEVICE cannot signal the control unit until an interrupt condition on the same subchannel is cleared.\r\n  *  **Condition Code 1** _with Control-Unit-Busy Status in the CSW_ indicates that HALT DEVICE cannot signal the control unit until the control-unit-end status is received from that control unit.\r\n  *  **Condition Code 1** _with Zeroes in the Status Field of the CSW_ indicates that the addressed device was selected and signaled to terminate the current operation, if any.\r\n  *  **Condition Code 2** indicates that the control unit cannot be signaled until the end of a busy condition in the channel. The end of the busy condition can be detected by noting an interruption from the channel or by noting the results of repeatedly executing HALT DEVICE.\r\n  *  **Condition Code 3** indicates that manual intervention is required to allow HALT DEVICE to signal the control unit to terminate.\r\n\r\nThis can be cured in channel.c. Here is the diff:\r\n\r\n    361c361,364\r\n    <             cc=0;                               /* @ISW */\r\n    ---\r\n    >             psa = (PSA_3XX*)( regs->mainstor + regs->PX );\r\n    >             psa->csw[4] = 0;    /*  Store partial CSW       */\r\n    >             psa->csw[5] = 0;\r\n    >             cc = 1;             /*  Set CC for CSW stored   */\r\n\r\nAfter applying it, the VM login looks like this:\r\n\r\n    VM/370 ONLINE\r\n    ?!\r\n\r\n    .l maint\r\n\r\n    ENTER PASSWORD:\r\n    .cpcmsSSS\r\n\r\n    DASD 190 LINKED R/W; R/O BY OPERATOR\r\n    DASD 194 LINKED R/W; R/O BY OPERATOR\r\n    LOGMSG - 22:05:10 GMT MONDAY 06/29/15\r\n    * WELCOME TO THE FIRST LEVEL 3330 SYSTEM.\r\n    LOGON AT 03:44:42 GMT SUNDAY 07/12/15\r\n    .i cms\r\n\r\n    RELEASE 6 CMS 12/25/78\r\n    .\r\n\r\n    R; T=0.01/0.01 03:44:48\r\n\r\n    .l dmkcns(d\r\n\r\n    FILENAME FILETYPE  FM  FORMAT    RECS BLOCKS   DATE   TIME\r\n    DMKCNS   ASSEMBLE  A1  F    80  2181   219   2/22/15 14:46\r\n    DMKCNS   UPDATES   A1  F    80    20     2   2/22/15 14:46\r\n    DMKCNS   UPDLOG    A1  F    97   129    16   2/22/15 14:46\r\n    R; T=0.01/0.01 03:44:59\r\n\r\n    .log hold\r\n\r\n    CONNECT= 00:00:44 VIRTCPU= 000:00.01 TOTCPU= 000:00.09\r\n    LOGOFF AT 03:45:25 GMT SUNDAY 07/12/15\r\n\r\n    VM/370 ONLINE\r\n\r\n-- WolfHimself\r\n"}}