1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 ^L
107 ocdcm_:
108 proc ();
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 Note
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226 ^L
227 console_free:
228 entry (console_to_check_parm, console_is_free_parm);
229
230
231
232
233
234
235
236
237
238
239
240
241 dcl console_to_check_parm char (4) parameter;
242 dcl console_is_free_parm bit (1) parameter;
243
244
245
246
247 console_to_check = console_to_check_parm;
248
249 call lock_oc_data ();
250
251 oc_entry_ptr = find_oc_entry (console_to_check);
252 if oc_entry_ptr = null then do;
253 call unlock_oc_data ();
254 console_is_free_parm = false;
255 return;
256 end;
257
258 console_is_free = (^oc_entry.bootload_console & ^oc_entry.alternate);
259
260 call unlock_oc_data ();
261
262 console_is_free_parm = console_is_free;
263
264 return;
265 ^L
266 console_info:
267 entry (oc_name, oc_flags, oc_channel, oc_device_idx, oc_line_leng, code);
268
269
270
271
272
273
274
275
276
277
278 dcl oc_name char (4) aligned
279 parameter;
280 dcl oc_flags bit (36) parameter;
281 dcl oc_channel char (8) parameter;
282 dcl oc_device_idx fixed bin (17) parameter;
283 dcl oc_line_leng fixed bin (17) parameter;
284
285
286
287
288 oc_entry_ptr = find_oc_entry (oc_name);
289
290 if oc_entry_ptr = null then do;
291 code = error_table_$device_not_active;
292 return;
293 end;
294
295 oc_flags = unspec (oc_entry.flags);
296 oc_channel = oc_entry.channel;
297 oc_device_idx = oc_entry.device_idx;
298 oc_line_leng = oc_entry.line_leng;
299
300 code = 0;
301
302 return;
303 ^L
304 drain_io:
305 entry ();
306
307
308
309
310
311
312 Note
313
314
315
316 oc_data_ptr = addr (oc_data$);
317
318 if ^oc_data.in_service | oc_data.mc_io_enabled then return;
319
320 oc_entry_ptr = find_oc_entry ("");
321 if oc_entry_ptr = null then return;
322
323 do while (^done);
324 call lock_oc_data ();
325 do while (oc_entry.io_in_progress);
326 call process_io_status ();
327 end;
328 if next_console_io () = null then done = true;
329 else call process_io ();
330 call unlock_oc_data ();
331 end;
332
333 oc_entry.io_in_progress = true;
334
335 return;
336 ^L
337 err_event_chan:
338 entry (event_chan);
339
340
341
342
343
344
345
346
347
348
349
350 dcl event_chan fixed bin (71) parameter;
351
352
353
354 oc_data_ptr = addr (oc_data$);
355
356 oc_data.err_event_cid = event_chan;
357 oc_data.err_event_pid = pds$process_id;
358
359 return;
360 ^L
361 esd_reset:
362 entry ();
363
364
365
366
367
368
369
370 entrypoint = "esd_reset";
371
372 oc_data_ptr = addr (oc_data$);
373 oc_data.lock = ""b;
374
375 if ^oc_data.in_service then do;
376 return;
377 end;
378
379 oc_data.mc_io_enabled = false;
380
381 oc_data.crash_on_crf = false;
382
383 unspec (oc_data.priority_io) = ""b;
384 oc_data.priority_io.completed = true;
385
386 do idx = 1 to WRITE_QUEUE_SIZE;
387 unspec (oc_data.write_queue (idx)) = ""b;
388 oc_data.write_queue (idx).completed = true;
389 end;
390 oc_data.write_q_full = false;
391
392 oc_data.stacked_read_cnt = 1;
393 unspec (oc_data.read_io) = ""b;
394 oc_data.read_io.completed = true;
395
396 call unassign_bootload_console ();
397
398 if oc_entry_ptr = null then do;
399 oc_data.in_service = false;
400 return;
401 end;
402
403 oc_entry.io_in_progress = false;
404 oc_entry.discard = false;
405 oc_entry.discarded = false;
406 oc_entry.got_special_int = false;
407 oc_entry.oper_request = false;
408 oc_entry.retry_cnt = 0;
409 oc_entry.io_time = 0;
410
411 call assign_bootload_console (oc_entry.name, err_code);
412
413 call reset_channel ();
414
415 return;
416 ^L
417 get_input:
418 entry (input_text, input_length, code);
419
420
421
422
423
424
425
426
427
428
429
430 dcl input_text char (256) parameter;
431 dcl input_length fixed bin (17) parameter;
432
433
434
435
436 input_text = "";
437 input_length = 0;
438 code = 0;
439
440 oc_entry_ptr = find_oc_entry ("");
441 if oc_entry_ptr = null then return;
442
443 call lock_oc_data ();
444
445 local_io = oc_data.read_io;
446 call reset_read ();
447 oc_data.stacked_read_cnt = oc_data.stacked_read_cnt - 1;
448 if oc_data.stacked_read_cnt > 0 then do;
449 call log_console_event (POPPED_READ, addr (oc_data.read_io));
450 end;
451 call unlock_oc_data ();
452 input_text = local_io.text;
453 input_length = local_io.leng;
454 call log_console_event (READ_PICKUP, addr (oc_data.read_io));
455
456 return;
457 ^L
458 get_mc_output:
459 entry (mc_io_uid , output_length, output_text);
460
461
462
463
464
465
466
467
468
469
470
471
472
473 dcl mc_io_uid fixed bin (71) parameter;
474 dcl output_length fixed bin (17) parameter;
475 dcl output_text char (256) parameter;
476
477
478
479 oc_data_ptr = addr (oc_data$);
480 oc_entry_ptr = null;
481
482 do idx = 1 to WRITE_QUEUE_SIZE;
483 if -oc_data.write_queue (idx).time_queued = mc_io_uid then do;
484 console_io_ptr = addr (oc_data.write_queue (idx));
485 output_length = multiply (console_io.leng, 4, 17);
486 output_text = console_io.text;
487 console_io.completed = true;
488 oc_data.write_q_full = false;
489 call log_console_event (MC_IO_PICKUP, console_io_ptr);
490 return;
491 end;
492 end;
493
494 output_length = 0;
495 output_text = "";
496
497 call log_console_event (MC_IO_FAILURE, null);
498
499 return;
500 ^L
501 init_all_consoles:
502 entry ();
503
504
505
506
507
508
509
510
511 entrypoint = "init_all_consoles";
512
513 oc_data_ptr = addr (oc_data$);
514 oc_entry_ptr = null;
515
516 unspec (oc_data) = ""b;
517
518 sd_ptr = addr (syserr_data$syserr_area);
519 sd.char_type_flag = true;
520 sd.ocdcm_init_flag = false;
521
522 oc_data.version = oc_data_version;
523 oc_data.flags.printer_on = true;
524
525 oc_data.last_read_queued = -1;
526 oc_data.last_write_queued = -1;
527 oc_data.last_poll_time = -1;
528 oc_data.max_computed_io_time = MAX_MAX_IO_TIME * 1e06;
529
530 oc_data.next_free_write = 1;
531 oc_data.next_event = 1;
532
533 oc_data.read_io.completed = true;
534 oc_data.priority_io.completed = true;
535
536 do idx = 1 to WRITE_QUEUE_SIZE;
537 oc_data.write_queue (idx).completed = true;
538 end;
539
540 oc_data.abs_addr = absadr (oc_data_ptr, err_code);
541 if err_code ^= 0 then call report_error (PANIC, entrypoint,
542 "Unable to determine absolute memory address of oc_data.");
543
544 oc_data.prompt = "M-> " || copy (byte (binary ("177"b3)), 4);
545 oc_data.write_return = "177177012015"b3;
546 oc_data.discard_notice = byte (10) || byte (13) || "(output discarded)" ||
547 byte (10) || byte (13) || copy (byte (binary ("177"b3)), 2);
548
549 prph_opc_cardp = null;
550
551 call config_$find_parm ("ccrf", parm_ptr);
552 if parm_ptr ^= null then oc_data.crash_on_crf = true;
553
554 call config_$find_parm ("clst", parm_ptr);
555 if parm_ptr ^= null then oc_data.list_consoles = true;
556
557 do while (^done);
558 call config_$find ("prph", prph_opc_cardp);
559 if prph_opc_cardp = null then done = true;
560 else do;
561 if substr (prph_opc_card.name, 1, 3) = "opc" then do;
562 if oc_data.console_cnt = MAX_OPC_CNT then do;
563 done = true;
564 call report_error (BEEP, entrypoint, "Maximum console count exceeded.");
565 call report_error (ANNOUNCE, entrypoint, "Additional consoles will not be configured.");
566 end;
567 else do;
568 call fill_oc_entry (oc_data_ptr,
569 oc_data.console_cnt + 1, prph_opc_cardp, oc_entry_ptr);
570 if oc_entry.active then
571 oc_data.console_cnt = oc_data.console_cnt + 1;
572 end;
573 end;
574 end;
575 end;
576
577 if oc_data.console_cnt < 1 then do;
578 call report_error (PANIC, entrypoint, "Missing prph opc card.");
579 end;
580
581 do idx = 1 to oc_data.console_cnt;
582 oc_entry_ptr = addr (oc_data.opc (idx));
583 if oc_entry.bootload_console then do;
584 call assign_bootload_console (oc_entry.name, err_code);
585 if err_code ^= 0 then call console_recovery ();
586 if oc_data.bootload_console_idx < 1 then
587 call report_error (PANIC, entrypoint, "Console channel assignment failed.");
588 sd.ocdcm_init_flag = true;
589 end;
590 end;
591
592 if oc_data.bootload_console_idx < 1 then do;
593 call console_recovery ();
594 if oc_data.bootload_console_idx < 1 then
595 call report_error (PANIC, entrypoint, "No active console configured.");
596 end;
597
598 prph_opc_cardp = null;
599 cpu_cnt = 0;
600 done = false;
601
602 do while (^done);
603 call config_$find ("cpu", prph_opc_cardp);
604 if prph_opc_cardp ^= null then cpu_cnt = cpu_cnt + 1;
605 else done = true;
606 end;
607
608 oc_data.max_computed_io_time = oc_data.max_computed_io_time * max (1, cpu_cnt);
609
610 if oc_data.list_consoles &
611 (sys_info$collection_1_phase = BOOT_INITIALIZATION
612 | sys_info$collection_1_phase = SERVICE_INITIALIZATION) then
613 do idx = 1 to oc_data.console_cnt;
614 oc_entry_ptr = addr (oc_data.opc (idx));
615 device_type = "uninitialized";
616 if oc_entry.bootload_console then device_type = "bootload";
617 else if oc_entry.alternate then device_type = "alternate";
618 else if oc_entry.io_device then device_type = "I/O";
619 else if oc_entry.inop_device then device_type = "inoperative";
620 else if oc_entry.no_device then device_type = "off";
621 call report_error (ANNOUNCE, entrypoint, "Assigned console ^a as ^a device.",
622 oc_entry.name, device_type);
623 end;
624
625 if sys_info$collection_1_phase < SERVICE_INITIALIZATION then do;
626 oc_data.opc (oc_data.bootload_console_idx).oper_request = true;
627 end;
628
629 call log_console_event (INIT_OC_DATA, oc_data.io_ptr);
630
631 return;
632 ^L
633 interrupt_handler:
634 entry (assigned_idx, interrupt_level, fault_status);
635
636
637
638
639
640
641
642
643
644
645
646
647
648 dcl assigned_idx fixed bin (35) parameter;
649 dcl interrupt_level fixed bin (3) parameter;
650 dcl fault_status bit (36) parameter;
651
652
653
654 entrypoint = "interrupt_handler";
655
656
657 entered_via_interrupt = true;
658
659 if interrupt_level = 1 then do;
660 call report_error (JUST_LOG, entrypoint, "System Fault.");
661 return;
662 end;
663
664 oc_data_ptr = addr (oc_data$);
665
666 oc_entry_ptr = find_oc_entry ("");
667 if oc_entry_ptr = null then return;
668 if assigned_idx > 0 & assigned_idx ^= oc_entry.device_idx then do;
669 if interrupt_level = 7 then return;
670 do idx = 1 to oc_data.console_cnt;
671 if oc_data.opc (idx).device_idx = assigned_idx then
672 oc_entry_ptr = (addr (oc_data.opc (idx)));
673 end;
674 if assigned_idx ^= oc_entry.device_idx then return;
675 if ^oc_entry.assigned then return;
676 end;
677
678 if stac (addr (oc_data.lock), pds$process_id) then do;
679 call wire_and_mask;
680 if interrupt_level = 7 then oc_entry.got_special_int = true;
681
682 call process_io_status ();
683
684 call process_io ();
685
686 call unlock_oc_data ();
687 end;
688 else if interrupt_level = 7 then do;
689 oc_data.no_lock_flags.got_special_int = true;
690 oc_data.meters.queued_special_int_count = oc_data.meters.queued_special_int_count +1;
691 end;
692 else if interrupt_level = 3 then do;
693 oc_data.no_lock_flags.got_terminate_int = true;
694 end;
695
696 return;
697 ^L
698 poll_for_timeout:
699 entry ();
700
701
702
703
704
705
706
707 oc_data_ptr = addr (oc_data$);
708
709 if ^oc_data.in_service | oc_data.mc_io_enabled then return;
710
711 if oc_data.lock = pds$process_id then do;
712 call report_error (PANIC, "lock_oc_data", "Mylock error.");
713 end;
714
715 if ^stac (addr (oc_data.lock), pds$process_id) then return;
716
717 oc_data.last_poll_time = clock (); note
718
719 oc_entry_ptr = find_oc_entry ("");
720
721 if oc_entry_ptr ^= null then do;
722 call process_io_status ();
723
724 call process_io ();
725 end;
726 else if ^oc_data.mc_io_enabled then
727 oc_data.in_service = false;
728
729 if ^stacq (oc_data.lock, ""b, pds$process_id) then do;
730 if oc_data.lock ^= ""b then
731 call report_error (PANIC, "unlock_oc_data", "Lock not mine.");
732 end;
733
734 return;
735 ^L
736 printer_off:
737 entry ();
738
739
740
741
742
743
744
745
746 oc_data_ptr = addr (oc_data$);
747 oc_data.flags.printer_on = false;
748 return;
749
750 printer_on:
751 entry ();
752
753
754
755
756
757
758
759 oc_data_ptr = addr (oc_data$);
760 oc_data.flags.printer_on = true;
761 return;
762 ^L
763 priority_io:
764 entry (priority_io_ptr);
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782 Note
783
784
785
786
787
788
789 dcl priority_io_ptr ptr parameter;
790
791
792
793 oc_data_ptr = addr (oc_data$);
794
795 if ^oc_data.in_service then return;
796
797 local_io = priority_io_ptr -> console_io;
798
799 call lock_oc_data ();
800
801 oc_data.priority_io = local_io;
802
803 oc_data.priority_io.time_queued = clock ();
804 oc_data.priority_io.process_id = pds$process_id;
805 oc_data.priority_io.event_chan = 0;
806 oc_data.priority_io.completed = false;
807 oc_data.priority_io.in_progress = false;
808 oc_data.priority_io.alerted = false;
809
810 if oc_data.priority_io.read then do;
811 oc_data.priority_io.sequence_no = 0;
812 oc_data.priority_io.prompted = false;
813 oc_data.priority_io.leng = 0;
814 oc_data.priority_io.text = "";
815 end;
816
817 oc_entry_ptr = find_oc_entry ("");
818
819 if oc_entry_ptr ^= null then
820 do while (oc_entry.io_in_progress);
821 call process_io_status ();
822 end;
823
824 if oc_data.mc_io_enabled then do;
825 if ^oc_data.priority_io.read then do;
826 call bump_io_to_mc ((oc_data.priority_io.sequence_no));
827 oc_data.priority_io.completed = true;
828 end;
829 call unlock_oc_data ();
830 return;
831 end;
832
833
834 do while (^oc_data.priority_io.completed);
835 call process_io ();
836 if oc_data.priority_io.read & ^oc_data.priority_io.in_progress then do;
837 call unlock_oc_data ();
838 call lock_oc_data ();
839 end;
840 call process_io_status ();
841 end;
842
843 local_io = oc_data.priority_io;
844 oc_data.priority_io.read = false;
845
846 call unlock_oc_data ();
847
848 if local_io.read then do;
849 priority_io_ptr -> console_io = local_io;
850 end;
851
852 return;
853 ^L
854 queue_io:
855 entry (user_io_ptr, io_queue_time);
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871 dcl user_io_ptr ptr parameter;
872 dcl io_queue_time fixed bin (71) parameter;
873
874
875
876 oc_data_ptr = addr (oc_data$);
877
878 if ^oc_data.in_service then do;
879 call syserr (JUST_LOG, substr (user_io_ptr -> console_io.text, 1,
880 multiply (user_io_ptr -> console_io.leng, 4, 17)));
881 io_queue_time = clock ();
882 return;
883 end;
884
885 local_io = user_io_ptr -> console_io;
886
887 if oc_data.write_q_full & ^local_io.read then do;
888 oc_data.meters.write_q_full_cnt = oc_data.meters.write_q_full_cnt + 1;
889 io_queue_time = 0;
890 return;
891 end;
892
893 call lock_oc_data ();
894
895 oc_entry_ptr = find_oc_entry ("");
896
897 if oc_data.mc_io_enabled then do;
898 local_time = 0;
899 if ^local_io.read then do;
900 local_time = queue_console_io ();
901 if local_time ^= 0 then do;
902 call bump_io_to_mc ((-local_time));
903 end;
904 end;
905 else local_time = clock ();
906 call unlock_oc_data ();
907 io_queue_time = local_time;
908 return;
909 end;
910
911 if oc_entry_ptr = null then do;
912 call syserr (JUST_LOG, substr (user_io_ptr -> console_io.text, 1,
913 multiply (user_io_ptr -> console_io.leng, 4, 17)));
914 io_queue_time = clock ();
915 oc_data.in_service = false;
916 return;
917 end;
918
919 if oc_entry.discard & ^local_io.read then do;
920 if ^oc_entry.discarded then do;
921 oc_entry.discarded = true; note
922 call log_console_event (DISCARDED_OUTPUT, oc_data.io_ptr);
923 end;
924 call unlock_oc_data ();
925 io_queue_time = -1;
926 return;
927 end;
928
929 call process_io_status ();
930 call process_io ();
931 local_time = queue_console_io ();
932
933 call process_io ();
934
935 call unlock_oc_data ();
936
937 io_queue_time = local_time;
938
939 return;
940 ^L
941 reconfigure:
942 entry (console_name_parm, reconfig_option_parm, code);
943
944
945
946
947
948
949
950
951
952
953
954 dcl console_name_parm char (4) parameter;
955
956 dcl reconfig_option_parm fixed bin (17) parameter;
957
958
959
960
961 entrypoint = "reconfigure";
962 audit_flag = "0"b;
963 code = 0;
964 console_name = console_name_parm;
965 reconfig_option = reconfig_option_parm;
966
967 oc_data_ptr = addr (oc_data$);
968
969 if reconfig_option = NOP then do;
970 code = error_table_$no_operation;
971 end;
972
973 if reconfig_option = SUSPEND_CONSOLE_SERVICE then do;
974 oc_data.in_service = false;
975 return;
976 end;
977
978 if reconfig_option = ENABLE_CONSOLE_SERVICE then do;
979 oc_data.in_service = true;
980 return;
981 end;
982
983 if reconfig_option = SEND_MC_IO then do;
984 oc_data.mc_io_enabled = true;
985 return;
986 end;
987
988 if reconfig_option = CRASH_ON_CRF then do;
989 oc_data.crash_on_crf = true;
990 return;
991 end;
992
993 if reconfig_option = RUN_ON_CRF then do;
994 oc_data.crash_on_crf = false;
995 return;
996 end;
997
998 if reconfig_option = UNLOCK_MCA_INPUT then do;
999 mca_to_unlock = cv_dec_check_ (substr (console_name, 3, 2), err_code);
1000 if substr (console_name, 1, 2) ^= "M_" | err_code ^= 0 | mca_to_unlock < MIN_MCA | mca_to_unlock > MAX_MCA then do;
1001 code = error_table_$bad_arg;
1002 return;
1003 end;
1004 console_name = "";
1005 end;
1006
1007 call lock_oc_data ();
1008
1009 oc_entry_ptr = find_oc_entry (console_name);
1010 if oc_entry_ptr = null then do;
1011 null_ocep:
1012 call unlock_oc_data ();
1013 code = error_table_$dev_nt_assnd;
1014 return;
1015 end;
1016
1017 if reconfig_option = RESET_CONSOLE then do;
1018 call reset_console ();
1019 call unlock_oc_data ();
1020 return;
1021 end;
1022
1023 if reconfig_option = MAKE_BOOTLOAD_CONSOLE then do;
1024 call unassign_bootload_console ();
1025 if oc_entry_ptr ^= null then do;
1026 oc_entry.alternate = true;
1027 oc_entry.io_device = false;
1028 call change_console_state ();
1029 end;
1030 call assign_bootload_console (console_name, err_code);
1031 if err_code ^= 0 then do;
1032 if old_console_name ^= "" then
1033 call assign_bootload_console (old_console_name, (0));
1034 call unlock_oc_data ();
1035 code = err_code;
1036 return;
1037 end;
1038 call report_error (BEEP, entrypoint, "Assigned ^a as the bootload console for ^a.", oc_entry.name, pds$process_group_id);
1039 call unlock_oc_data ();
1040 return;
1041 end;
1042
1043 if reconfig_option = MAKE_ALTERNATE_CONSOLE then do;
1044 if oc_entry.bootload_console then do;
1045 call unlock_oc_data ();
1046 code = error_table_$device_busy;
1047 return;
1048 end;
1049 oc_entry.alternate = true;
1050 oc_entry.io_device = false;
1051 oc_entry.inop_device = false;
1052 oc_entry.no_device = false;
1053 oc_entry.config_change = true; note
1054 call change_console_state ();
1055 call report_error (BEEP, entrypoint, "Assigned ^a as an alternate console for ^a.",
1056 oc_entry.name, pds$process_group_id);
1057 call unlock_oc_data ();
1058 return;
1059 end;
1060
1061 if reconfig_option = MAKE_IO_DEVICE then do;
1062 if oc_entry.bootload_console then do;
1063 if oc_data.err_event_cid ^= 0 then oc_data.mc_io_enabled = true;
1064 else do;
1065 if oc_data.crash_on_crf then call report_error (PANIC,
1066 entrypoint, "Bootload console deconfigured with CCRF set.");
1067 else oc_data.in_service = false;
1068 end;
1069 call unassign_bootload_console ();
1070 if oc_entry_ptr = null then do;
1071 oc_entry_ptr = find_oc_entry (console_name);
1072 if oc_entry_ptr = null then goto null_ocep;
1073 end;
1074 end;
1075 oc_entry.io_device = true;
1076 oc_entry.alternate = false;
1077 oc_entry.inop_device = false;
1078 oc_entry.no_device = false;
1079 oc_entry.config_change = true; note
1080 call change_console_state ();
1081 call report_error (BEEP, entrypoint, "Consigned ^a as an I/O device for ^a.",
1082 oc_entry.name, pds$process_group_id);
1083 call unlock_oc_data ();
1084 return;
1085 end;
1086
1087 if reconfig_option = MAKE_INOP_DEVICE then do;
1088 if oc_entry.bootload_console then do;
1089 if oc_data.err_event_cid ^= 0 then oc_data.mc_io_enabled = true;
1090 else do;
1091 if oc_data.crash_on_crf then call report_error (PANIC,
1092 entrypoint, "Bootload console deconfigured with CCRF set.");
1093 else oc_data.in_service = false;
1094 end;
1095 call unassign_bootload_console ();
1096 if oc_entry_ptr = null then do;
1097 oc_entry_ptr = find_oc_entry (console_name);
1098 if oc_entry_ptr = null then goto null_ocep;
1099 end;
1100 end;
1101 oc_entry.inop_device = true;
1102 oc_entry.io_device = false;
1103 oc_entry.alternate = false;
1104 oc_entry.no_device = false;
1105 oc_entry.config_change = true; note
1106 call change_console_state ();
1107 call report_error (BEEP, entrypoint, "Marked ^a as an inoperative device for ^a.",
1108 oc_entry.name, pds$process_group_id);
1109 call unlock_oc_data ();
1110 return;
1111 end;
1112
1113 if reconfig_option = MAKE_UNAVAILABLE then do;
1114 if oc_entry.bootload_console then do;
1115 call unlock_oc_data ();
1116 code = error_table_$resource_not_free;
1117 return;
1118 end;
1119 else do;
1120 oc_entry.inop_device = false;
1121 oc_entry.io_device = false;
1122 oc_entry.alternate = false;
1123 oc_entry.no_device = true;
1124 oc_entry.config_change = true; note
1125 call change_console_state ();
1126 call unlock_oc_data ();
1127 return;
1128 end;
1129 end;
1130
1131 if reconfig_option = LOCK_MCA_INPUT |
1132 reconfig_option = UNLOCK_MCA_INPUT then do;
1133 audit_flag = (sys_info$collection_1_phase = SERVICE_INITIALIZATION);
1134 call lock_unlock_mca ();
1135 if ^mca_lock_unlock_success then code = error_table_$action_not_performed;
1136 call unlock_oc_data ();
1137 return;
1138 end;
1139
1140 call unlock_oc_data ();
1141
1142 return;
1143
1144 ^L
1145 set_prompt:
1146 entry (new_prompt_parm);
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157 dcl new_prompt_parm char (8) parameter;
1158
1159
1160
1161 new_prompt = new_prompt_parm;
1162
1163 call lock_oc_data ();
1164
1165 if rtrim (new_prompt) = "" then new_prompt = "M->";
1166 else new_prompt = rtrim (substr (new_prompt, 1, 6)) || "->";
1167
1168 oc_data.prompt = new_prompt;
1169
1170 call unlock_oc_data ();
1171
1172 return;
1173 ^L
1174 BAIL_OUT:
1175
1176
1177
1178
1179
1180
1181
1182 if ^stacq (oc_data.lock, ""b, pds$process_id) then do;
1183 if oc_data.lock ^= ""b then
1184 call report_error (PANIC, "unlock_oc_data", "Lock not mine.");
1185 end;
1186
1187 call unwire_and_unmask;
1188
1189 return;
1190 ^L
1191
1192 assign_bootload_console:
1193 proc (name, error_code);
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208 dcl name char (4) aligned
1209 parameter;
1210 dcl error_code fixed bin (35) parameter;
1211
1212
1213
1214 oc_entry_ptr = find_oc_entry (name);
1215 if oc_entry_ptr = null then do;
1216 error_code = error_table_$device_not_active;
1217 return;
1218 end;
1219
1220 call io_manager$assign (oc_entry.device_idx, oc_entry.channel,
1221 ocdcm_$interrupt_handler, (0), oc_data.status_ptr, error_code);
1222 if error_code ^= 0 then return;
1223
1224 oc_entry.assigned = true;
1225 oc_data.bootload_console_idx = oc_entry.opc_idx; note
1226 oc_entry.bootload_console = true;
1227 oc_entry.alternate = false;
1228 oc_entry.io_device = false;
1229 oc_entry.inop_device = false;
1230 oc_entry.no_device = false;
1231 oc_entry.retry_cnt = 0;
1232 oc_entry.config_change = true; note
1233 call change_console_state ();
1234
1235 oc_data.in_service = true;
1236 if oc_data.mc_io_enabled then do;
1237 call pxss$ring_0_wakeup (oc_data.err_event_pid, oc_data.err_event_cid, 0, (0));
1238 oc_data.mc_io_enabled = false;
1239 end;
1240
1241 return;
1242
1243 end assign_bootload_console;
1244 ^L
1245 bump_io_to_mc:
1246 proc (io_uid);
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260 dcl io_uid fixed bin (71) parameter;
1261
1262
1263
1264 if oc_data.err_event_cid ^= 0 then do;
1265 call pxss$ring_0_wakeup (oc_data.err_event_pid, oc_data.err_event_cid,
1266 io_uid, (0));
1267 if io_uid > 0 then call log_console_event (SENT_MC_PRIORITY_IO, addr (oc_data.priority_io));
1268 else call log_console_event (SENT_MC_IO, console_io_ptr);
1269 return;
1270 end;
1271 else do;
1272 if oc_data.crash_on_crf | sys_info$collection_1_phase < SERVICE_INITIALIZATION then
1273
1274 call unlock_oc_data ();
1275 call syserr_real$panic ("ocdcm_ (bump_io_to_mc): Console recovery failure.");
1276 oc_data.mc_io_enabled = false;
1277 oc_data.in_service = false;
1278 call report_error (JUST_LOG, "bump_io_to_mc", "Message Coordinator failure.");
1279 return;
1280 end;
1281
1282 end bump_io_to_mc;
1283 ^L
1284 change_console_state:
1285 proc ();
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295 do idx = 1 to MAX_OPC_CNT;
1296 if oc_data.opc (idx).active then do;
1297 if oc_data.opc (idx).config_change then do;
1298 oc_data.opc (idx).config_change = false;
1299 if oc_data.opc (idx).bootload_console then new_state = "on";
1300 else if oc_data.opc (idx).alternate then new_state = "alt";
1301 else if oc_data.opc (idx).io_device then new_state = "io";
1302 else if oc_data.opc (idx).inop_device then new_state = "inop";
1303 else if oc_data.opc (idx).no_device then new_state = "off";
1304 prph_opc_cardp = null;
1305 console_found = false;
1306 do while (^console_found);
1307 call config_$find ("prph", prph_opc_cardp);
1308 if prph_opc_cardp = null then console_found = true;
1309 else do;
1310 if prph_opc_card.name = oc_data (idx).name then do;
1311 prph_opc_card.state = new_state;
1312 console_found = true;
1313 end;
1314 end;
1315 end;
1316 end;
1317 end;
1318 end;
1319
1320 return;
1321
1322 end change_console_state;
1323 ^L
1324 console_recovery:
1325 proc ();
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346 entrypoint = "console_recovery";
1347
1348 if oc_data.must_have_console then do;
1349 call poll_for_console ();
1350 oc_data.must_have_console = false;
1351 return;
1352 end;
1353
1354 error_msg = "";
1355
1356 call unassign_bootload_console ();
1357
1358 if oc_entry_ptr ^= null then do;
1359 oc_entry.io_device = false;
1360 oc_entry.inop_device = true;
1361 oc_entry.config_change = true; note
1362 end;
1363
1364 found = false;
1365
1366 do idx = 1 to oc_data.console_cnt while (^found);
1367 oc_entry_ptr = addr (oc_data.opc (idx));
1368 if oc_entry.alternate then do;
1369 found = true;
1370 call assign_bootload_console (oc_entry.name, err_code);
1371 if err_code = 0 then do;
1372 call ioa_$rsnnl ("Console inoperative, alternate ^a assigned.",
1373 error_msg, 0, oc_entry.name);
1374 end;
1375 else do;
1376 call ioa_$rsnnl ("Console failed, assignment of alternate ^a failed.",
1377 error_msg, 0, oc_entry.name);
1378 oc_entry.inop_device = true;
1379 oc_entry.alternate = false;
1380 oc_entry.config_change = true; note
1381 found = false;
1382 end;
1383 end;
1384 end;
1385
1386 if ^found then do;
1387 if oc_data.err_event_cid = 0 then do;
1388 if oc_data.crash_on_crf | sys_info$collection_1_phase < SERVICE_INITIALIZATION then do;
1389
1390 call report_error (PANIC, entrypoint, "Console recovery failure.");
1391 end;
1392 oc_data.in_service = false;
1393 oc_data.mc_io_enabled = false;
1394 end;
1395 else oc_data.mc_io_enabled = true;
1396
1397 if oc_data.mc_io_enabled then do;
1398 error_msg = "Console inoperative, no alternates available.";
1399 end;
1400 else do;
1401 error_msg = "Console inoperative, no alternates, no MC.";
1402 console_io_ptr = oc_data.io_ptr;
1403 console_io.in_progress = false;
1404 oc_data.priority_io.completed = true;
1405 end;
1406 end;
1407
1408 call change_console_state ();
1409
1410 if error_msg ^= "" then call report_error (JUST_LOG, entrypoint, error_msg);
1411
1412 return;
1413
1414 end console_recovery;
1415 ^L
1416 console_responds_to_bell:
1417 proc (console_idx) returns (bit (1));
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428 dcl console_idx fixed bin (17) parameter;
1429
1430
1431
1432
1433 oc_entry_ptr = addr (oc_data.opc (console_idx));
1434 oc_entry.dcw_list_idx = ALERT_DCW;
1435 call initiate_io ();
1436 do while (^io_status.t);
1437 end;
1438
1439 if io_status_overlay.major = "00"b3 then return (true);
1440 else return (false);
1441
1442 end console_responds_to_bell;
1443 ^L
1444 console_in_imu:
1445 proc () returns (bit (1));
1446
1447
1448
1449
1450
1451
1452
1453
1454 iom_cardp = null;
1455 call config_$find ("iom", iom_cardp);
1456 do while (iom_cardp ^= null);
1457 if iom_card.model = "imu" | iom_card.model = "iioc" then do;
1458 if iom_card.tag = prph_opc_card.iom then return (true);
1459 end;
1460 call config_$find ("iom", iom_cardp);
1461 end;
1462 return (false);
1463 end console_in_imu;
1464 ^L
1465 fill_oc_entry:
1466 proc (oc_data_struct_ptr, console_entry_idx, opc_card_ptr, oc_entry_ptr_arg);
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479 dcl oc_data_struct_ptr ptr parameter;
1480 dcl console_entry_idx fixed bin (17) unaligned
1481 parameter,
1482 opc_card_ptr ptr parameter,
1483 oc_entry_ptr_arg ptr parameter;
1484
1485
1486
1487 oc_data_ptr = oc_data_struct_ptr;
1488 prph_opc_cardp = opc_card_ptr;
1489
1490 oc_entry_ptr = addr (oc_data.opc (console_entry_idx));
1491 oc_entry_ptr_arg = oc_entry_ptr;
1492
1493 unspec (oc_entry) = ""b;
1494
1495 if prph_opc_card.name < "opca" | prph_opc_card.name > "opcz" then do;
1496 call report_error (BEEP, "Illegal console name (^a) specified. It will be ignored.", prph_opc_card.name);
1497 return;
1498 end;
1499
1500 oc_entry.active = true;
1501
1502 if substr (prph_opc_card.mask, 1, 4) = "mask" then oc_entry.flags.read_unechoed_option = false;
1503 else oc_entry.flags.read_unechoed_option = true;
1504
1505 oc_entry.name = prph_opc_card.name;
1506 oc_entry.opc_idx = console_entry_idx; note
1507 oc_entry.imu = console_in_imu ();
1508
1509 if substr (prph_opc_card.state, 1, 2) = "on" then do;
1510 do idx = 1 to oc_data.console_cnt while (oc_data.opc (idx).bootload_console = false);
1511 end;
1512 if idx > oc_data.console_cnt then do;
1513 oc_entry.bootload_console = true;
1514 end;
1515 else do;
1516 call report_error (BEEP, entrypoint, "Changing state of ^a to alt.", oc_entry.name);
1517 prph_opc_card.state = "alt";
1518 oc_entry.alternate = true;
1519 end;
1520 end;
1521
1522 else if substr (prph_opc_card.state, 1, 3) = "alt" then do;
1523 oc_entry.alternate = true;
1524 end;
1525
1526 else if prph_opc_card.state = "inop" then do;
1527 oc_entry.inop_device = true;
1528 end;
1529
1530 else if substr (prph_opc_card.state, 1, 2) = "io" then do;
1531 oc_entry.io_device = true;
1532 end;
1533
1534 else if substr (prph_opc_card.state, 1, 3) = "off" then do;
1535 oc_entry.no_device = true;
1536 end;
1537
1538 else do;
1539 call report_error (BEEP, entrypoint, "Invalid state of ^a for console ^a.",
1540 prph_opc_card.state, prph_opc_card.name);
1541 call report_error (ANNOUNCE, entrypoint, "This console will not be configured.");
1542 unspec (oc_entry) = ""b;
1543 return;
1544 end;
1545
1546 oc_entry.line_leng = prph_opc_card.line_leng;
1547
1548 console_data_ptr = addr (config_data_$console_model_names);
1549
1550 found = false;
1551
1552 do idx = 1 to console_data.count while (^found);
1553 if console_data.model (idx) = prph_opc_card.model then do;
1554 found = true;
1555 oc_entry.model = prph_opc_card.model;
1556 if substr (console_data.io_type (idx), 1, 3) = "pcw" then do;
1557 oc_entry.pcw_io = true;
1558 oc_entry.flags.read_unechoed_option = false;
1559 end;
1560 end;
1561 end;
1562
1563 if ^found then do;
1564 call report_error (BEEP, entrypoint, "Unknown model, ^i, specified for ^a. It will not be configured.",
1565 prph_opc_card.model, oc_entry.name);
1566 unspec (oc_entry) = ""b;
1567 return;
1568 end;
1569
1570 call io_chnl_util$iom_to_name ((prph_opc_card.iom), (prph_opc_card.chan),
1571 oc_entry.channel, err_code);
1572
1573 if err_code ^= 0 then do;
1574 call report_error (PANIC, entrypoint, "Invalid channel specified for ^a.", oc_entry.name);
1575 end;
1576 idcwp = addr (oc_entry.dcw_list (WRITE_DCW));
1577 idcw.command = "33"b3;
1578 idcw.code = "111"b;
1579
1580 idcwp = addr (oc_entry.dcw_list (READ_DCW));
1581 idcw.command = "23"b3;
1582 idcw.code = "111"b;
1583 dcwp = addr (oc_entry.dcw_list (READ_DCW + 1));
1584 dcw.tally = bit (binary (divide (MAX_IO_LENGTH, 4, 17), 12));
1585
1586 idcwp = addr (oc_entry.dcw_list (READ_UNECHOED_DCW));
1587 idcw.command = "43"b3;
1588 idcw.code = "111"b;
1589 dcwp = addr (oc_entry.dcw_list (READ_UNECHOED_DCW + 1));
1590 dcw.tally = bit (binary (divide (MAX_IO_LENGTH, 4, 17), 12));
1591
1592 idcwp = addr (oc_entry.dcw_list (RESET_DCW));
1593 idcw.command = "57"b3;
1594 idcw.code = "111"b;
1595 idcw.chan_cmd = "02"b3;
1596 idcw.count = "01"b3;
1597
1598 idcwp = addr (oc_entry.dcw_list (ALERT_DCW));
1599 idcw.command = "51"b3;
1600 idcw.code = "111"b;
1601 idcw.chan_cmd = "02"b3;
1602 idcw.count = "01"b3;
1603
1604 oc_entry.dcw_list (NEWLINE_DCW) = oc_entry.dcw_list (WRITE_DCW);
1605 dcwp = addr (oc_entry.dcw_list (NEWLINE_DCW + 1));
1606 dcw.address = bit (binary (wordno (addr (oc_data.write_return))
1607 + oc_data.abs_addr, 18));
1608 dcw.tally = "0001"b3;
1609
1610 oc_entry.dcw_list (PROMPT_DCW) = oc_entry.dcw_list (WRITE_DCW);
1611 dcwp = addr (oc_entry.dcw_list (PROMPT_DCW + 1));
1612 dcw.address = bit (binary (wordno (addr (oc_data.prompt))
1613 + oc_data.abs_addr, 18));
1614 dcw.tally = "0002"b3;
1615
1616 oc_entry.dcw_list (DISCARD_DCW) = oc_entry.dcw_list (WRITE_DCW);
1617 dcwp = addr (oc_entry.dcw_list (DISCARD_DCW + 1));
1618 dcw.address = bit (binary (wordno (addr (oc_data.discard_notice))
1619 + oc_data.abs_addr, 18));
1620 dcw.tally = "0006"b3;
1621
1622 idcwp = addr (oc_entry.dcw_list (LOCK_MCA_DCW));
1623 idcw.command = "60"b3;
1624 idcw.code = "111"b;
1625 idcw.chan_cmd = "02"b3;
1626 idcw.count = "00"b3;
1627
1628 idcwp = addr (oc_entry.dcw_list (UNLOCK_MCA_DCW));
1629 idcw.command = "63"b3;
1630 idcw.code = "111"b;
1631 idcw.chan_cmd = "02"b3;
1632 idcw.count = "00"b3;
1633
1634 oc_entry.prompt = true;
1635
1636 return;
1637
1638 end fill_oc_entry;
1639 ^L
1640 find_oc_entry:
1641 proc (opc_name) returns (ptr);
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654 dcl opc_name char (4) aligned
1655 parameter;
1656
1657
1658
1659 oc_data_ptr = addr (oc_data$);
1660
1661 if opc_name = "" then do;
1662 if oc_data.bootload_console_idx = 0 then return (null);
1663 return (addr (oc_data.opc (oc_data.bootload_console_idx)));
1664 end;
1665
1666 do idx = 1 to oc_data.console_cnt;
1667 if oc_data.opc (idx).name = opc_name then do;
1668 return (addr (oc_data.opc (idx)));
1669 end;
1670 end;
1671
1672 return (null);
1673
1674 end find_oc_entry;
1675 ^L
1676 initiate_io:
1677 proc ();
1678
1679
1680
1681
1682
1683
1684
1685 oc_entry.io_time = clock ();
1686 oc_entry.io_in_progress = true;
1687
1688 if oc_entry.dcw_list_idx = READ_DCW |
1689 oc_entry.dcw_list_idx = READ_UNECHOED_DCW |
1690 oc_entry.dcw_list_idx = WRITE_DCW |
1691 oc_entry.dcw_list_idx = PROMPT_DCW |
1692 oc_entry.dcw_list_idx = ALERT_DCW then do;
1693 oc_data.io_ptr = console_io_ptr;
1694 console_io.console = oc_data.opc (oc_data.bootload_console_idx).name; note
1695 end;
1696
1697 iom_args.chx = oc_entry.device_idx;
1698
1699 if oc_entry.pcw_io then do;
1700 iom_args.pcw = oc_entry.dcw_list (oc_entry.dcw_list_idx);
1701 iom_args.listp = addr (oc_entry.dcw_list (oc_entry.dcw_list_idx + 1));
1702 end;
1703
1704 else do;
1705 iom_args.pcw = false;
1706 iom_args.listp = addr (oc_entry.dcw_list (oc_entry.dcw_list_idx));
1707 end;
1708
1709 iom_args.ptp = null;
1710
1711 call io_manager$connect_abs (iom_args);
1712
1713 return;
1714
1715 end initiate_io;
1716 ^L
1717 lock_oc_data:
1718 proc ();
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730 oc_data_ptr = addr (oc_data$);
1731
1732 if oc_data.lock = pds$process_id then do;
1733 call report_error (PANIC, "lock_oc_data", "Mylock error.");
1734 end;
1735
1736 call wire_and_mask;
1737
1738 time_lock_expires = clock () + oc_data.max_computed_io_time;
1739
1740 do while (clock () < time_lock_expires);
1741 if stac (addr (oc_data.lock), pds$process_id) then return;
1742 end;
1743
1744 call report_error (PANIC, "lock_oc_data", "Lock wait timer expired.");
1745
1746 end lock_oc_data;
1747 ^L
1748 lock_unlock_mca:
1749 proc ();
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762 bootload_console_name = oc_entry.name;
1763 save_status_ptr = oc_data.status_ptr;
1764 ad_code = 0;
1765 mca_lock_unlock_success = false;
1766
1767 do while (oc_entry.io_in_progress);
1768 call process_io_status ();
1769 end;
1770
1771 do idx = 1 to oc_data.console_cnt;
1772 if oc_data.opc (idx).imu &
1773 ^oc_data.opc (idx).inop_device &
1774 ^oc_data.opc (idx).no_device &
1775 ^oc_data.opc (idx).io_device then do;
1776 oc_entry_ptr = addr (oc_data.opc (idx));
1777 must_unassign = false;
1778 if ^oc_entry.assigned then do;
1779 call io_manager$assign (oc_entry.device_idx, oc_entry.channel,
1780 ocdcm_$interrupt_handler, (0), oc_data.status_ptr, err_code);
1781 if err_code ^= 0 then do;
1782 ad_code, code = err_code;
1783 goto locate_bootload;
1784 end;
1785 oc_entry.assigned = true;
1786 oc_entry.io_in_progress = false;
1787 must_unassign = true;
1788 end;
1789 else oc_data.status_ptr = save_status_ptr;
1790
1791 if reconfig_option = LOCK_MCA_INPUT then do;
1792 oc_entry.dcw_list_idx = LOCK_MCA_DCW;
1793 call log_console_event (LOCK_MCA_IO, null);
1794 end;
1795 else do;
1796 idcwp = addr (oc_entry.dcw_list (UNLOCK_MCA_DCW));
1797 idcw.count = bit (binary (mca_to_unlock, 6));
1798 oc_entry.dcw_list_idx = UNLOCK_MCA_DCW;
1799 call log_console_event (UNLOCK_MCA_IO, null);
1800 end;
1801 call initiate_io ();
1802
1803 do while (oc_entry.io_in_progress);
1804 call process_io_status ();
1805 if console_io_timeout then do;
1806 ad_code = error_table_$timeout;
1807 call report_error (JUST_LOG, entrypoint, "Timeout executing MCA^[(^2.3b)^;^s^] ^[LOCK^;UNLOCK^] on ^a for ^a.",
1808 (reconfig_option = UNLOCK_MCA_INPUT), bit (binary (mca_to_unlock, 6)),
1809 (reconfig_option = LOCK_MCA_INPUT), oc_entry.name, pds$process_group_id);
1810 end;
1811 oc_entry_ptr = addr (oc_data.opc (idx));
1812 end;
1813
1814 if oc_entry.status_word = "400002000000"b3 then do;
1815 call report_error (JUST_LOG, entrypoint, "MCA^[(^2.3b)^;^s^] input through ^a, ^[dis^;en^]abled by ^a.",
1816 (reconfig_option = UNLOCK_MCA_INPUT), bit (binary (mca_to_unlock, 6)),
1817 oc_entry.name, (reconfig_option = LOCK_MCA_INPUT), pds$process_group_id);
1818 oc_entry_ptr = addr (oc_data.opc (idx));
1819 mca_lock_unlock_success = true;
1820 end;
1821
1822 if must_unassign then do;
1823 call io_manager$unassign (oc_entry.device_idx, (0));
1824 oc_entry.assigned = false;
1825 oc_entry.io_in_progress = false;
1826 oc_entry_ptr = null;
1827 end;
1828 end;
1829 end;
1830
1831 locate_bootload:
1832 if audit_flag then do;
1833 if mca_lock_unlock_success then ad_code = 0;
1834 audit_eventflags = "0"b;
1835 addr (audit_eventflags) -> audit_event_flags.priv_op = "1"b;
1836 addr (audit_eventflags) -> audit_event_flags.grant = "1"b;
1837 if reconfig_option = LOCK_MCA_INPUT then
1838 call access_audit_$log_general ("ocdcm_$reconfigure", level$get (), audit_eventflags,
1839 access_operations_$lock_mca, "", ad_code, null (), 0, "");
1840 else call access_audit_$log_general ("ocdcm_$reconfigure", level$get (), audit_eventflags,
1841 access_operations_$unlock_mca, "", ad_code, null (), 0, "MCA ^d", mca_to_unlock);
1842 end;
1843 oc_entry_ptr = find_oc_entry (bootload_console_name);
1844 oc_data.status_ptr = save_status_ptr;
1845 return;
1846 end lock_unlock_mca;
1847 ^L
1848 log_console_error:
1849 proc ();
1850
1851
1852
1853
1854 note
1855
1856
1857
1858 call io_manager$get_status (oc_entry.device_idx, addr (oc_status));
1859
1860 unspec (log_message) = ""b;
1861
1862 log_message.level = "3"b3;
1863 log_message.channel = oc_entry.channel;
1864 log_message.device = "00"b;
1865 log_message.time_out = console_io_timeout;
1866 log_message.type = oc_status.action_code;
1867 log_message.command = addr (oc_entry.dcw_list (oc_entry.dcw_list_idx)) -> idcw.command;
1868 log_message.status = oc_entry.status_word;
1869 log_message.devname = oc_entry.name;
1870
1871 call ioa_$rsnnl ("^[in_service^1x^]^[crash_on_crf^1x^]^[mc_io_enabled^1x^]^[list_consoles^1x^]^[printer_on^1x^]^[write_q_full^]",
1872 oc_data_flags, 0,
1873 oc_data.in_service, oc_data.crash_on_crf, oc_data.mc_io_enabled,
1874 oc_data.list_consoles, oc_data.printer_on, oc_data.write_q_full);
1875
1876 call ioa_$rsnnl ("^[io_in_progress^1x^]^[prompt^1x^]^[got_special_int^1x^]^[oper_request^1x^]^[discard^1x^]^[discarded^]",
1877 oc_entry_flags, 0,
1878 oc_entry.io_in_progress, oc_entry.prompt, oc_entry.got_special_int,
1879 oc_entry.oper_request, oc_entry.discard, oc_entry.discarded);
1880
1881 call ioa_$rsnnl ("^[alert^1x^]^[alerted^1x^]^[read^1x^]^[prompted^1x^]^[in_progress^1x^]^[completed^1x^]^[retry_reset^1x^]",
1882 console_io_flags, 0,
1883 console_io.alert, console_io.alerted, console_io.read,
1884 console_io.prompted, console_io.in_progress,
1885 console_io.completed, console_io.retry_reset);
1886
1887 call syserr$binary (JUST_LOG, addr (log_message), SB_ocdcm_err, SBL_ocdcm_err,
1888 "ocdcm_ (log_console_error): I/O ^[timeout ^]error on ^a; status = ^.3b^/oc_data flags: ^a^/oc_entry flags: ^a^/console_io flags: ^a",
1889 console_io_timeout, oc_entry.name,
1890 substr (string (log_message.status), 1, 36), oc_data_flags,
1891 oc_entry_flags, console_io_flags);
1892
1893 call log_console_event (LOGGED_ERROR, oc_data.io_ptr);
1894
1895 return;
1896
1897 end log_console_error;
1898 ^L
1899 log_console_event:
1900 proc (event_no, event_io_ptr_parm);
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910 dcl event_no fixed bin (35) parameter;
1911 dcl event_io_ptr_parm ptr parameter;
1912
1913
1914
1915
1916 oc_data.event (oc_data.next_event).time = clock (); note
1917 oc_data.event (oc_data.next_event).process_id = pds$process_id;
1918 oc_data.event (oc_data.next_event).event_number = event_no;
1919 oc_data.event (oc_data.next_event).event_io_ptr = event_io_ptr_parm; note
1920 if oc_entry_ptr ^= null then do;
1921 oc_data.event (oc_data.next_event).opc_name = oc_entry.name; note
1922 oc_data.event (oc_data.next_event).opc_flags = oc_entry.flags;
1923 end;
1924 else do;
1925 oc_data.event (oc_data.next_event).opc_name = "";
1926 oc_data.event (oc_data.next_event).opc_flags = ""b;
1927 end;
1928
1929 oc_data.next_event = oc_data.next_event + 1;
1930 if oc_data.next_event > EVENT_QUEUE_SIZE then oc_data.next_event = 1;
1931
1932 return;
1933
1934 end log_console_event;
1935 ^L
1936 next_console_io:
1937 proc () returns (ptr);
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947 if oc_data.read_io.in_progress then return (addr (oc_data.read_io));
1948
1949 if ^oc_data.priority_io.completed then do;
1950 if oc_data.priority_io.read then do;
1951 if ^oc_entry.oper_request then return (null);
1952 end;
1953 return (addr (oc_data.priority_io));
1954 end;
1955
1956 if oc_data.write_q_full then do;
1957 return (addr (oc_data.write_queue (oc_data.next_free_write)));
1958 end;
1959
1960 first_search_pass = true;
1961 first_io_slot = oc_data.next_free_write + 1;
1962 if first_io_slot > WRITE_QUEUE_SIZE then first_io_slot = 1;
1963 last_io_slot = WRITE_QUEUE_SIZE;
1964
1965 SEARCH_WRITE_QUEUE:
1966
1967 do idx = first_io_slot to last_io_slot;
1968 console_io_ptr = addr (oc_data.write_queue (idx));
1969 if ^console_io.completed then return (console_io_ptr);
1970 end;
1971 if first_search_pass then do;
1972 first_search_pass = false;
1973 first_io_slot = 1;
1974 last_io_slot = oc_data.next_free_write;
1975 go to SEARCH_WRITE_QUEUE;
1976 end;
1977
1978 if oc_entry.discarded then do;
1979 oc_entry.dcw_list_idx = DISCARD_DCW;
1980 call initiate_io ();
1981 return (null);
1982 end;
1983
1984 if oc_entry.oper_request then do;
1985 if oc_data.stacked_read_cnt > 0 then do;
1986 if ^oc_data.read_io.in_progress & oc_data.read_io.completed
1987 then return (addr (oc_data.read_io));
1988 end;
1989 end;
1990
1991 return (null);
1992
1993 end next_console_io;
1994 ^L
1995 poll_for_console:
1996 proc ();
1997
1998
1999
2000
2001
2002
2003
2004 if oc_data.bootload_console_idx ^= 0 then do;
2005 if console_responds_to_bell ((oc_data.bootload_console_idx)) then return;
2006 end;
2007
2008 call unassign_bootload_console ();
2009
2010 do while (true);
2011 poll_idx = poll_idx + 1;
2012 if poll_idx > oc_data.console_cnt then poll_idx = 1;
2013 if ^oc_data.opc (poll_idx).no_device then do;
2014 if console_responds_to_bell (poll_idx) then do;
2015 call assign_bootload_console (oc_data.opc (poll_idx).name, code);
2016 if code = 0 then return;
2017 end;
2018 end;
2019 end;
2020
2021 end poll_for_console;
2022 ^L
2023 process_io:
2024 proc ();
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034 if oc_entry_ptr = null () then goto BAIL_OUT;
2035
2036 if oc_entry.io_in_progress then return;
2037
2038 console_io_ptr = next_console_io ();
2039 if console_io_ptr = null then return;
2040
2041 if console_io.read then do;
2042 oc_entry.discard = false;
2043 wired_hardcore_data$abort_request = false;
2044 console_io.in_progress = true;
2045 console_io.completed = false;
2046 if oc_entry.prompt & ^console_io.prompted then do;
2047 oc_entry.dcw_list_idx = PROMPT_DCW;
2048 console_io.prompted = true;
2049 call log_console_event (SENT_PROMPT, console_io_ptr);
2050 end;
2051 else do;
2052 if oc_data.flags.printer_on | ^oc_entry.read_unechoed_option then do;
2053 oc_entry.dcw_list_idx = READ_DCW;
2054 dcwp = addr (oc_entry.dcw_list (READ_DCW + 1));
2055 call log_console_event (STARTED_READ, console_io_ptr);
2056 end;
2057 else do;
2058 oc_entry.dcw_list_idx = READ_UNECHOED_DCW;
2059 dcwp = addr (oc_entry.dcw_list (READ_UNECHOED_DCW + 1));
2060 call log_console_event (STARTED_UNECHOED_READ, console_io_ptr);
2061 end;
2062 dcw.address = bit (binary (oc_data.abs_addr +
2063 wordno (addr (console_io.text)), 18));
2064 end;
2065 call initiate_io ();
2066 return;
2067 end;
2068
2069 else do;
2070 if console_io.alert & ^console_io.alerted then do;
2071 oc_entry.dcw_list_idx = ALERT_DCW;
2072 console_io.alerted = true;
2073 call log_console_event (SENT_ALERT, console_io_ptr);
2074 end;
2075 else do;
2076 console_io.in_progress = true;
2077 dcwp = addr (oc_entry.dcw_list (WRITE_DCW + 1));
2078 dcw.tally = bit (binary (console_io.leng, 12), 12);
2079 dcw.address = bit (binary (oc_data.abs_addr +
2080 wordno (addr (console_io.text)), 18));
2081 oc_entry.dcw_list_idx = WRITE_DCW;
2082 if console_io_ptr = addr (oc_data.priority_io) then
2083 call log_console_event (PRIORITY_OUTPUT, console_io_ptr);
2084 else call log_console_event (STARTED_WRITE, console_io_ptr);
2085 end;
2086 call initiate_io ();
2087 return;
2088 end;
2089
2090 end process_io;
2091 ^L
2092 process_io_status:
2093 proc ();
2094
2095
2096
2097
2098
2099
2100
2101 if oc_entry.got_special_int then do;
2102 call log_console_event (GOT_SPECIAL_INT, oc_data.io_ptr);
2103 oc_entry.got_special_int = false;
2104 if oc_entry.oper_request then do;
2105 if ^oc_entry.discard then do;
2106 oc_entry.discard = true;
2107 oc_entry.discarded = false;
2108 wired_hardcore_data$abort_request = true;
2109 end;
2110 return;
2111 end;
2112 else oc_entry.oper_request = true; note
2113 return;
2114 end;
2115
2116 if ^oc_entry.io_in_progress then return;
2117
2118 if timeout () & ^io_status.t then do;
2119 call io_manager$mask (oc_entry.device_idx);
2120 call retry_io ();
2121 return;
2122 end;
2123
2124 if ^io_status.t then return;
2125
2126 oc_entry.status_word = unspec (io_status);
2127 io_status.t = false;
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140 if ^entered_via_interrupt then do;
2141 if io_status.initiate & ^oc_entry.pcw_io & ^oc_entry.imu then return;
2142 wait_timer = clock () + 5000;
2143 do while (clock () < wait_timer);
2144 end;
2145 end;
2146
2147 if io_status.power | io_status.channel_stat | io_status.central_stat then do;
2148 call io_manager$mask (oc_entry.device_idx);
2149 call retry_io ();
2150 return;
2151 end;
2152
2153 if io_status_overlay.major = "00"b3 then do;
2154 if io_status.initiate & ^oc_entry.pcw_io & ^oc_entry.imu then return;
2155 call terminate_io ();
2156 return;
2157 end;
2158
2159 if io_status_overlay.major = "01"b3 then do;
2160 call retry_io ();
2161 return;
2162 end;
2163
2164 if io_status_overlay.major = "02"b3 &
2165 (oc_entry.dcw_list_idx = LOCK_MCA_DCW |
2166 oc_entry.dcw_list_idx = UNLOCK_MCA_DCW) then do;
2167 call terminate_io ();
2168 return;
2169 end;
2170
2171 if io_status_overlay.major ^= "03"b3 |
2172 (oc_entry.dcw_list_idx ^= READ_DCW &
2173 oc_entry.dcw_list_idx ^= READ_UNECHOED_DCW) then do;
2174 call io_manager$mask (oc_entry.device_idx);
2175 call retry_io ();
2176 return;
2177 end;
2178
2179 console_io_ptr = oc_data.io_ptr;
2180
2181 if io_status_overlay.sub = "10"b3 then do;
2182 oc_entry.oper_request = false;
2183 oc_entry.discard = false;
2184 oc_entry.discarded = false;
2185 call reset_read ();
2186 call send_newline ();
2187 return;
2188 end;
2189
2190 if io_status_overlay.sub = "04"b3 |
2191 io_status_overlay.sub = "40"b3 then do;
2192 call reset_read ();
2193 call send_newline ();
2194 return;
2195 end;
2196
2197 call io_manager$mask (oc_entry.device_idx);
2198 call retry_io ();
2199
2200 return;
2201
2202 end process_io_status;
2203 ^L
2204 queue_console_io:
2205 proc () returns (fixed bin (71));
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215 local_io.in_progress = false;
2216 local_io.completed = false;
2217 local_io.alerted = false;
2218 local_io.prompted = false;
2219 local_io.retry_reset = false;
2220 local_io.console = "";
2221
2222 if local_io.read then do;
2223 if oc_data.last_read_queued = -1 then do;
2224 oc_data.reader_process_id = pds$process_id;
2225 end;
2226 oc_data.stacked_read_cnt = oc_data.stacked_read_cnt + 1;
2227 if oc_data.stacked_read_cnt > 1 then do;
2228 call log_console_event (PUSHED_READ, addr (oc_data.read_io));
2229 oc_data.meters.pushed_read_cnt = oc_data.meters.pushed_read_cnt + 1;
2230 return (0);
2231 end;
2232 local_io.completed = true;
2233 local_io.leng = 0;
2234 local_io.text = "";
2235 local_io.sequence_no = 0;
2236 local_io.time_queued = clock ();
2237 local_io.process_id = pds$process_id;
2238 oc_data.read_io = local_io;
2239 oc_data.last_read_queued = local_io.time_queued;
2240 call log_console_event (QUEUED_READ, addr (oc_data.read_io));
2241 return (local_io.time_queued);
2242 end;
2243 else do;
2244 if ^oc_data.write_queue (oc_data.next_free_write).completed then do;
2245 oc_data.meters.write_q_full_cnt = oc_data.meters.write_q_full_cnt + 1;
2246 oc_data.write_q_full = true;
2247 return (0);
2248 end;
2249 else do;
2250 local_io.time_queued = clock ();
2251 local_io.process_id = pds$process_id;
2252 console_io_ptr = addr (oc_data.write_queue (oc_data.next_free_write));
2253 console_io = local_io;
2254 oc_data.last_write_queued = local_io.time_queued;
2255 call log_console_event (QUEUED_WRITE, console_io_ptr);
2256 oc_data.next_free_write = oc_data.next_free_write + 1;
2257 if oc_data.next_free_write > WRITE_QUEUE_SIZE then
2258 oc_data.next_free_write = 1;
2259 if ^oc_data.write_queue (oc_data.next_free_write).completed then do;
2260 oc_data.meters.write_q_full_cnt = oc_data.meters.write_q_full_cnt + 1;
2261 oc_data.write_q_full = true;
2262 end;
2263 return (local_io.time_queued);
2264 end;
2265 end;
2266
2267 end queue_console_io;
2268 ^L
2269 report_error:
2270 proc options (variable);
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281 Note
2282
2283
2284
2285 dcl arg_list_ptr ptr;
2286 dcl based_epname char (32) based;
2287 dcl based_severity fixed bin (17) based;
2288 dcl entrypoint_name char (32);
2289 dcl error_msg char (256);
2290 dcl error_buffer char (256);
2291 dcl severity fixed bin (17);
2292
2293 dcl 1 saved_priority_io aligned
2294 like priority_io;
2295
2296
2297
2298
2299 arg_list_ptr = arg_list_ptr_ ();
2300
2301 severity = arg_list_ptr -> arg_list.arg_ptrs (1) -> based_severity;
2302 if arg_list_ptr -> arg_list.call_type = Envptr_supplied_call_type then
2303 entrypoint_name = substr (arg_list_ptr -> arg_list_with_envptr.arg_ptrs (2) -> based_epname, 1,
2304 arg_list_ptr -> arg_list_with_envptr.desc_ptrs (2) -> arg_descriptor.size);
2305 else entrypoint_name = substr (arg_list_ptr -> arg_list.arg_ptrs (2) -> based_epname, 1, arg_list_ptr -> arg_list.desc_ptrs (2) -> arg_descriptor.size);
2306
2307 error_msg = "";
2308
2309 call formline_ (3, 4, addr (error_msg), length (error_msg), 1, arg_list_ptr);
2310
2311 error_msg = "ocdcm_ (" || rtrim (entrypoint_name) || "): " || rtrim (error_msg);
2312
2313 oc_entry_ptr = find_oc_entry ("");
2314
2315 if severity = PANIC then do;
2316 call unlock_oc_data ();
2317 call syserr_real$panic (error_msg);
2318 end;
2319
2320 call syserr (JUST_LOG, error_msg);
2321
2322 if severity = JUST_LOG then return;
2323
2324 if ^oc_data.in_service then do;
2325 if sys_info$collection_1_phase > SERVICE_INITIALIZATION then do;
2326 oc_data.must_have_console = true;
2327 call console_recovery ();
2328 end;
2329 else if oc_data.crash_on_crf | sys_info$collection_1_phase < SERVICE_INITIALIZATION then do;
2330 call unlock_oc_data ();
2331 call syserr_real$panic (error_msg);
2332 end;
2333 else return;
2334 end;
2335
2336 if ^oc_data.priority_io.completed then do;
2337 i_saved_priority_io = true;
2338 if ^saved_priority_io.completed then do;
2339 call syserr (JUST_LOG, "ocdcm_ (report_error): LOST CONSOLE I/O. I/O follows...");
2340 call syserr (JUST_LOG, saved_priority_io.text);
2341 end;
2342 saved_priority_io = oc_data.priority_io;
2343 end;
2344
2345 oc_data.priority_io.time_queued = clock ();
2346 oc_data.priority_io.process_id = pds$process_id;
2347 oc_data.priority_io.event_chan = 0;
2348 oc_data.priority_io.in_progress = false;
2349 oc_data.priority_io.alert = (severity <= BEEP);
2350
2351 if oc_data.mc_io_enabled then do;
2352 call bump_io_to_mc ((oc_data.priority_io.sequence_no));
2353 oc_data.priority_io.completed = true;
2354 return;
2355 end;
2356
2357 if oc_entry_ptr = null then return;
2358 to_write_ptr = addr (error_msg);
2359 to_write_length = length (rtrim (error_msg));
2360 continue_flag = false;
2361 this_part_length = 0;
2362 console_line_length = oc_entry.line_leng;
2363
2364 do while (to_write_length > 0);
2365 oc_data.priority_io.completed = false;
2366 oc_data.priority_io.in_progress = false;
2367 error_buffer = "";
2368 call oc_trans_output_ (to_write_ptr, to_write_length, this_part_length, addr (error_buffer),
2369 word_length, console_line_length, continue_flag);
2370 oc_data.priority_io.leng = word_length;
2371 oc_data.priority_io.text = substr (error_buffer, 1, multiply (word_length, 4, 17));
2372
2373 oc_data.priority_io.completed = false;
2374
2375 do while (^oc_data.priority_io.completed & oc_data.in_service);
2376 call process_io ();
2377 call process_io_status ();
2378 end;
2379 to_write_ptr = addcharno (to_write_ptr, (this_part_length));
2380 to_write_length = to_write_length - this_part_length;
2381 end;
2382
2383 if i_saved_priority_io then priority_io = saved_priority_io;
2384 saved_priority_io.completed = true;
2385
2386 end report_error;
2387 ^L
2388 reset_channel:
2389 proc ();
2390
2391
2392
2393
2394
2395
2396
2397
2398 if true then return;
2399
2400 oc_entry.dcw_list_idx = RESET_DCW;
2401
2402 call log_console_event (RESET_CHANNEL, oc_data.io_ptr);
2403
2404 call initiate_io ();
2405
2406 return;
2407
2408 end reset_channel;
2409 ^L
2410 reset_console:
2411 proc ();
2412
2413
2414
2415
2416
2417
2418
2419 entrypoint = "reset_console";
2420
2421 oc_data.in_service = true;
2422 oc_data.mc_io_enabled = false;
2423
2424 do idx = 1 to WRITE_QUEUE_SIZE;
2425 oc_data.write_queue (idx).completed = true;
2426 end;
2427 oc_data.write_q_full = false;
2428
2429 oc_data.stacked_read_cnt = 1;
2430 call reset_read ();
2431
2432 call unassign_bootload_console ();
2433
2434 if oc_entry_ptr = null then do;
2435 call console_recovery ();
2436 return;
2437 end;
2438
2439 oc_entry.io_in_progress = false;
2440 oc_entry.discard = false;
2441 oc_entry.discarded = false;
2442 oc_entry.got_special_int = false;
2443 oc_entry.oper_request = false;
2444 oc_entry.retry_cnt = 0;
2445 oc_entry.io_time = 0;
2446
2447 call assign_bootload_console (oc_entry.name, err_code);
2448 if err_code ^= 0 then do;
2449 call console_recovery ();
2450 return;
2451 end;
2452
2453 call reset_channel ();
2454
2455 call report_error (BEEP, entrypoint, "Reset bootload console for ^a.", pds$process_group_id);
2456
2457 return;
2458
2459 end reset_console;
2460 ^L
2461 reset_read:
2462 proc ();
2463
2464
2465
2466
2467
2468
2469
2470 if oc_data.priority_io.read then read_io_ptr = addr (oc_data.priority_io);
2471 else read_io_ptr = addr (oc_data.read_io);
2472
2473 unspec (read_io_ptr -> console_io.flags) = ""b;
2474 read_io_ptr -> console_io.read = true;
2475 read_io_ptr -> console_io.completed = true;
2476 read_io_ptr -> console_io.console = "";
2477 read_io_ptr -> console_io.leng = 0;
2478 read_io_ptr -> console_io.text = "";
2479
2480 return;
2481
2482 end reset_read;
2483 ^L
2484 retry_io:
2485 proc ();
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495 console_io_ptr = oc_data.io_ptr;
2496
2497 if oc_entry.retry_cnt = 0 then call log_console_error ();
2498
2499 call log_console_event (RETRY_IO, oc_data.io_ptr);
2500
2501 if oc_entry.retry_cnt = MAX_RETRIES then do;
2502 call console_recovery ();
2503 if ^oc_data.in_service then do;
2504 console_io.completed = true;
2505 return;
2506 end;
2507 else if oc_data.mc_io_enabled then do;
2508 local_io = console_io;
2509 if local_io.sequence_no > 0 then do;
2510 call bump_io_to_mc ((local_io.sequence_no));
2511 console_io.completed = true;
2512 end;
2513 else call bump_io_to_mc (-(local_io.time_queued));
2514 return;
2515 end;
2516 end;
2517
2518 else do;
2519 oc_entry.retry_cnt = oc_entry.retry_cnt + 1;
2520 if console_io.read then do;
2521 oc_entry.oper_request = false;
2522 oc_entry.discard = false;
2523 oc_entry.discarded = false;
2524 oc_entry.io_in_progress = false;
2525 call reset_read ();
2526 call send_newline ();
2527 return;
2528 end;
2529 call reset_channel ();
2530 call initiate_io ();
2531 return;
2532 end;
2533
2534 return;
2535
2536 end retry_io;
2537 ^L
2538 send_newline:
2539 proc ();
2540
2541
2542
2543
2544
2545
2546
2547 oc_entry.dcw_list_idx = NEWLINE_DCW;
2548
2549 call log_console_event (SENT_NEWLINE, oc_data.io_ptr);
2550
2551 call initiate_io ();
2552
2553 return;
2554
2555 end send_newline;
2556 ^L
2557 terminate_io:
2558 proc ();
2559
2560
2561
2562
2563
2564
2565
2566 oc_entry.io_in_progress = false;
2567 oc_entry.retry_cnt = 0;
2568
2569 if oc_entry.dcw_list_idx = NEWLINE_DCW then do;
2570 call log_console_event (TERMINATED_NEWLINE, oc_data.io_ptr);
2571 return;
2572 end;
2573
2574 if oc_entry.dcw_list_idx = LOCK_MCA_DCW then do;
2575 call log_console_event (TERMINATED_MCA_LOCK, null);
2576 return;
2577 end;
2578
2579 if oc_entry.dcw_list_idx = UNLOCK_MCA_DCW then do;
2580 call log_console_event (TERMINATED_MCA_UNLOCK, null);
2581 return;
2582 end;
2583
2584 if oc_entry.dcw_list_idx = DISCARD_DCW then do;
2585 oc_entry.discard = false;
2586 oc_entry.discarded = false;
2587 return;
2588 end;
2589
2590 console_io_ptr = oc_data.io_ptr;
2591
2592 if oc_entry.dcw_list_idx = RESET_DCW then do;
2593 call log_console_event (TERMINATED_RESET, oc_data.io_ptr);
2594 return;
2595 end;
2596
2597 if oc_entry.dcw_list_idx = ALERT_DCW then do;
2598 call log_console_event (TERMINATED_ALERT, oc_data.io_ptr);
2599 return;
2600 end;
2601
2602 if oc_entry.dcw_list_idx = PROMPT_DCW then do; note
2603 call log_console_event (TERMINATED_PROMPT, oc_data.io_ptr);
2604 return;
2605 end;
2606
2607 if oc_entry.dcw_list_idx = WRITE_DCW then do;
2608 oc_data.write_q_full = false;
2609 console_io.completed = true;
2610 console_io.in_progress = false;
2611 call log_console_event (TERMINATED_WRITE, oc_data.io_ptr);
2612 return;
2613 end;
2614
2615 if (oc_entry.dcw_list_idx = READ_DCW |
2616 oc_entry.dcw_list_idx = READ_UNECHOED_DCW) then do;
2617 console_io.in_progress = false;
2618 call io_manager$get_status (oc_entry.device_idx, addr (oc_status));
2619 console_io.leng =
2620 multiply ((divide (MAX_IO_LENGTH, 4, 17) - oc_status.tally_residue), 4, 17);
2621 if oc_status.character_position > 0 then
2622 console_io.leng = console_io.leng + oc_status.character_position - 4;
2623 call log_console_event (TERMINATED_READ, oc_data.io_ptr);
2624 call send_newline ();
2625 if console_io.leng = 0 then do;
2626 oc_entry.oper_request = false;
2627 call reset_read ();
2628 return;
2629 end;
2630 if console_io_ptr = addr (oc_data.priority_io) then do;
2631 console_io.completed = true;
2632 return;
2633 end;
2634 call pxss$ring_0_wakeup (oc_data.reader_process_id,
2635 console_io.event_chan, console_io.time_queued, (0));
2636 call log_console_event (SENT_WAKEUP, oc_data.io_ptr);
2637 end;
2638
2639 return;
2640
2641 end terminate_io;
2642 ^L
2643 timeout:
2644 proc () returns (bit (1));
2645
2646
2647
2648
2649
2650
2651
2652 console_io_timeout = false;
2653 if oc_entry.imu then
2654 if (clock () > (oc_entry.io_time + 1e06 * MAX_IMU_IO_TIME)) then
2655 goto console_timed_out;
2656 else return (false);
2657 else if (clock () > (oc_entry.io_time + 1e06 * MAX_IO_TIME (oc_entry.dcw_list_idx))) then do;
2658 console_timed_out:
2659 console_io_timeout = true;
2660 call log_console_event (IO_TIMEOUT, oc_data.io_ptr);
2661 return (true);
2662 end;
2663
2664 return (false);
2665
2666 end timeout;
2667 ^L
2668 unassign_bootload_console:
2669 proc ();
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679 oc_entry_ptr = null;
2680
2681 if oc_data.bootload_console_idx = 0 then do;
2682 old_console_name = "";
2683 return;
2684 end;
2685
2686 oc_entry_ptr = addr (oc_data.opc (oc_data.bootload_console_idx));
2687 old_console_name = oc_entry.name;
2688 oc_entry.io_in_progress = false;
2689
2690 call io_manager$unassign (oc_entry.device_idx, (0));
2691 oc_entry.assigned = false;
2692 oc_data.bootload_console_idx = 0;
2693 oc_entry.bootload_console = false;
2694 oc_entry.io_device = true;
2695 oc_entry.config_change = true; note
2696
2697 return;
2698
2699 end unassign_bootload_console;
2700 ^L
2701 unlock_oc_data:
2702 proc ();
2703
2704 dcl special_interrupt_received bit (1) automatic init (false);
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717 do while (oc_data.no_lock_flags.got_special_int | oc_data.no_lock_flags.got_terminate_int);
2718
2719
2720
2721 if oc_data.no_lock_flags.got_special_int then do;
2722 special_interrupt_received = true;
2723 oc_data.no_lock_flags.got_special_int = false;
2724 end;
2725 if oc_data.no_lock_flags.got_terminate_int then
2726 oc_data.no_lock_flags.got_terminate_int = false;
2727
2728
2729 oc_entry_ptr = find_oc_entry ("");
2730 if oc_entry_ptr ^= null then do;
2731
2732 if special_interrupt_received then do;
2733 special_interrupt_received = false;
2734 oc_entry.got_special_int = true;
2735 end;
2736
2737 call process_io_status ();
2738 call process_io ();
2739 end;
2740 else if ^oc_data.mc_io_enabled then
2741 oc_data.in_service = false;
2742
2743 end;
2744
2745 if ^stacq (oc_data.lock, ""b, pds$process_id) then do;
2746 if oc_data.lock ^= ""b then
2747 call report_error (PANIC, "unlock_oc_data", "Lock not mine.");
2748 end;
2749
2750 call unwire_and_unmask;
2751
2752 return;
2753
2754 end unlock_oc_data;
2755 ^L
2756 wire_and_mask:
2757 proc ();
2758
2759 call privileged_mode_ut$wire_and_mask (wire_mask, wire_ptw_ptr);
2760 wired_and_masked = true;
2761 return;
2762
2763 unwire_and_unmask:
2764 entry;
2765 if wired_and_masked then do;
2766 call privileged_mode_ut$unwire_unmask (wire_mask, wire_ptw_ptr);
2767 wired_and_masked = false;
2768 end;
2769 return;
2770
2771 end wire_and_mask;
2772 ^L
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782 dcl code fixed bin (35) parameter;
2783
2784
2785
2786
2787 dcl absadr entry (ptr, fixed bin (35)) returns (fixed bin (26));
2788 dcl access_audit_$log_general entry options (variable);
2789 dcl arg_list_ptr_ entry () returns (ptr);
2790 dcl config_$find entry (char(4) aligned, ptr);
2791 dcl config_$find_parm entry (char(4) aligned, ptr);
2792 dcl cv_dec_check_ entry (char(*), fixed bin(35)) returns(fixed bin(35));
2793 dcl formline_ entry options(variable);
2794 dcl ioa_$rsnnl entry() options(variable);
2795
2796
2797
2798
2799
2800
2801 dcl level$get entry () returns (fixed bin);
2802 dcl ocdcm_$interrupt_handler entry (fixed bin (35), fixed bin (3), bit (36) aligned);
2803 dcl oc_trans_output_ entry (ptr, fixed bin(21), fixed bin(21), ptr, fixed bin(19), fixed bin, bit(1) aligned);
2804 dcl privileged_mode_ut$wire_and_mask entry (fixed bin (71), ptr);
2805 dcl privileged_mode_ut$unwire_unmask entry (fixed bin (71), ptr);
2806 dcl pxss$ring_0_wakeup entry (bit (36) aligned, fixed bin (71), fixed bin (71), fixed bin (35));
2807 dcl syserr entry options (variable);
2808 dcl syserr$binary entry options (variable);
2809 dcl syserr_real$panic entry options (variable);
2810
2811
2812
2813 dcl addr builtin;
2814 dcl addcharno builtin;
2815 dcl binary builtin;
2816 dcl bit builtin;
2817 dcl byte builtin;
2818 dcl clock builtin;
2819 dcl copy builtin;
2820 dcl divide builtin;
2821 dcl length builtin;
2822 dcl max builtin;
2823 dcl multiply builtin;
2824 dcl null builtin;
2825 dcl rtrim builtin;
2826 dcl stac builtin;
2827 dcl stacq builtin;
2828 dcl string builtin;
2829 dcl substr builtin;
2830 dcl unspec builtin;
2831 dcl wordno builtin;
2832
2833
2834
2835 dcl console_data_ptr ptr;
2836 dcl read_io_ptr ptr;
2837 dcl to_write_ptr ptr;
2838 dcl wire_ptw_ptr ptr;
2839 dcl save_status_ptr ptr;
2840
2841
2842
2843 dcl audit_flag bit (1);
2844 dcl true bit (1) init ("1"b)
2845 internal static options (constant);
2846
2847 dcl false bit (1) init ("0"b)
2848 internal static options (constant);
2849
2850 dcl console_found bit (1) init ("0"b);
2851 dcl console_is_free bit (1);
2852 dcl continue_flag bit (1) init ("0"b)
2853 aligned;
2854 dcl done bit (1) init ("0"b);
2855 dcl first_search_pass bit (1) init ("0"b);
2856 dcl found bit (1) init ("0"b);
2857 dcl i_saved_priority_io bit (1) init ("0"b);
2858 dcl entered_via_interrupt bit (1) init ("0"b)
2859 aligned;
2860 dcl mca_lock_unlock_success bit (1);
2861 dcl must_unassign bit (1);
2862 dcl console_io_timeout bit (1);
2863 dcl wired_and_masked bit (1) init ("0"b)
2864 aligned;
2865 dcl wired_hardcore_data$abort_request
2866 bit (1) aligned
2867 external static;
2868
2869
2870
2871 dcl error_table_$action_not_performed
2872 fixed bin (35) external static;
2873 dcl error_table_$bad_arg fixed bin (35) external static;
2874 dcl error_table_$device_busy fixed bin (35) external static;
2875 dcl error_table_$device_not_active
2876 fixed bin (35) external static;
2877 dcl error_table_$dev_nt_assnd fixed bin (35) external static;
2878 dcl error_table_$no_operation fixed bin (35) external static;
2879 dcl error_table_$resource_not_free
2880 fixed bin (35) external static;
2881 dcl error_table_$timeout fixed bin (35) external static;
2882
2883
2884
2885 dcl access_operations_$lock_mca bit (36) aligned external static;
2886 dcl access_operations_$unlock_mca bit (36) aligned external static;
2887
2888
2889
2890 dcl 1 console_data aligned like config_data_$console_model_names
2891 based (console_data_ptr);
2892 dcl 1 io_status aligned like io_status_word
2893 based (oc_data.status_ptr);
2894 dcl 1 iom_args aligned like io_manager_arg;
2895 dcl 1 local_io aligned like console_io;
2896 dcl 1 log_message aligned like io_msg;
2897 dcl 1 oc_status aligned like io_status_entry;
2898
2899
2900
2901 dcl 1 io_status_overlay based (oc_data.status_ptr),
2902 2 major bit (6),
2903 2 sub bit (6);
2904
2905
2906
2907 dcl MAX_MCA fixed bin (17) init (31)
2908 internal static options (constant);
2909 dcl MIN_MCA fixed bin (17) init (0)
2910 internal static options (constant);
2911 dcl PANIC fixed bin (17) init (6)
2912 internal static options (constant);
2913 dcl ad_code fixed bin (35);
2914 dcl audit_eventflags bit (36) aligned;
2915 dcl bootload_console_name char (4) aligned;
2916 dcl console_name char (4) aligned;
2917 dcl console_to_check char (4) aligned;
2918 dcl console_io_flags char (80);
2919 dcl console_line_length fixed bin (17);
2920 dcl cpu_cnt fixed bin (17);
2921 dcl device_type char (16);
2922 dcl entrypoint char (32);
2923 dcl err_code fixed bin (35);
2924 dcl error_msg char (80);
2925 dcl first_io_slot fixed bin (17);
2926 dcl idx fixed bin (17);
2927 dcl last_io_slot fixed bin (17);
2928 dcl local_time fixed bin (71);
2929 dcl mca_to_unlock fixed bin (35);
2930 dcl new_prompt char (8);
2931 dcl new_state char (4);
2932 dcl oc_data_flags char (80);
2933 dcl oc_entry_flags char (80);
2934 dcl old_console_name char (4) aligned;
2935 dcl word_length fixed bin (19);
2936 dcl pds$process_id bit (36) external static;
2937 dcl pds$process_group_id char (32) external static;
2938 dcl poll_idx fixed bin (17);
2939 dcl reconfig_option fixed bin (17);
2940 dcl time_lock_expires fixed bin (71);
2941 dcl wait_timer fixed bin (71);
2942 dcl this_part_length fixed bin (21);
2943 dcl to_write_length fixed bin (21);
2944 dcl wire_mask fixed bin (71);
2945 ^L
2946
2947
2948 %include access_audit_eventflags;
2949 ^L
2950 %include arg_descriptor;
2951 ^L
2952 %include arg_list;
2953 ^L
2954 %include collection_1_phases;
2955 ^L
2956 %include config_data_dcls;
2957 ^L
2958 %include config_parm_card;
2959 ^L
2960 %include config_prph_opc_card;
2961 ^L
2962 %include config_iom_card;
2963 ^L
2964 %include io_chnl_util_dcls;
2965 ^L
2966 %include io_manager_dcls;
2967 ^L
2968 %include io_status_entry;
2969 ^L
2970 %include io_syserr_msg;
2971 ^L
2972 %include iom_dcw;
2973 ^L
2974 %include iom_pcw;
2975 ^L
2976 %include oc_data;
2977 ^L
2978 %include opc_reconfig_options;
2979 ^L
2980 %include syserr_binary_def;
2981 ^L
2982 %include syserr_constants;
2983 ^L
2984 %include syserr_data;
2985 ^L
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440 end ocdcm_;