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 %page;
44
45
46 scas_init:
47 procedure;
48
49 dcl (i, j) fixed bin,
50 found bit (1) aligned,
51 dps8 bit (1) aligned,
52 n_cpus fixed bin,
53 n_mems fixed bin,
54 cport fixed bin (3),
55 masks_found (4) bit (1) unal,
56 exp_port fixed bin (2),
57 tag fixed bin (3),
58 errtag fixed bin (3),
59 enabled bit (1) aligned,
60 base fixed bin (17),
61 size fixed bin (17),
62 interlace fixed bin (3),
63 expected_base fixed bin (17),
64 code fixed bin (35),
65 cpu_low_port fixed bin,
66 cpu_high_port fixed bin,
67 cpu_ports bit (36) aligned,
68 iom_low_port fixed bin,
69 iom_high_port fixed bin,
70 iom_ports bit (36) aligned,
71 toehold_abs fixed bin (24),
72 severity fixed bin;
73
74 declare 1 sdwi aligned like sdw_info;
75 declare tsdw fixed bin (71);
76
77 dcl tag_letter (0:7) char (1) aligned static init ("A", "B", "C", "D", "E", "F", "G", "H");
78
79 dcl (
80 ALL_ONES bit (36) aligned init ("777777777777"b3),
81 MAX_CYCLE_GROUP fixed bin init (5),
82 XED_INHIB bit (18) init ("717200"b3)
83 ) int static options (constant);
84
85 dcl 1 cdata like scs$controller_data based (cdp) aligned,
86 cdp ptr,
87 1 pdata like scs$processor_data based (pdp) aligned,
88 pdp ptr;
89
90 dcl scas$ ext,
91 toehold$ ext;
92
93 dcl privileged_mode_ut$swap_sdw entry (ptr, ptr),
94 absadr entry (ptr, fixed bin (35)) returns (fixed bin (24)),
95 init_scu entry (fixed bin (3), fixed bin (3), fixed bin (35)),
96 rsw_util$port_info entry (fixed bin (3), bit (1) aligned, fixed bin (17), fixed bin (17), fixed bin (3)),
97 rsw_util$set_rsw_mask entry (fixed bin (3), bit (1) aligned),
98 rsw_util$init_rsw_mask entry (fixed bin (3), bit (1) aligned),
99 scr_util$set_port_enable_bit entry (fixed bin (3), bit (1)),
100 scr_util$set_port_enable entry (fixed bin (3), bit (1)),
101 scr_util$set_cfg entry (fixed bin (3)),
102 sdw_util_$construct entry (ptr, ptr),
103 mask_instruction$smcm entry returns (bit (36) aligned),
104 mask_instruction$rmcm entry returns (bit (36) aligned),
105 config_$find entry (char (4) aligned, ptr),
106 syserr entry options (variable);
107
108 dcl (addr, binary, bin, bit, divide, hbound, null, rel, string, substr, unspec) builtin;
109 %page;
110 if ((sys_info$collection_1_phase = EARLY_INITIALIZATION) | (sys_info$collection_1_phase = BOOT_INITIALIZATION)
111 | (sys_info$collection_1_phase = SERVICE_INITIALIZATION))
112 then severity = CRASH;
113 else severity = ANNOUNCE;
114
115
116
117 unspec (scs$scas_page_table) = ""b;
118 do i = 0 to 31;
119 addr (scs$scas_page_table (i)) -> l68_ptw.df_no = "11"b;
120
121 end;
122
123 unspec (sdwi) = ""b;
124 sdwi.address = absadr (addr (scs$scas_page_table), code);
125 if code ^= 0 then call syserr (CRASH, "scas_init: Error from absadr setting up SCAS.");
126 sdwi.read = "1"b;
127 sdwi.write = "1"b;
128 sdwi.paged = "1"b;
129 sdwi.size = 32 * 1024;
130
131 call sdw_util_$construct (addr (tsdw), addr (sdwi));
132
133
134 call privileged_mode_ut$swap_sdw (addr (scas$), addr (tsdw));
135
136
137
138
139 do tag = 0 to 7;
140 call rsw_util$set_rsw_mask (tag, "1"b);
141 end;
142
143
144
145
146 scs$processor_switch_template = scs$processor_switch_data;
147
148
149
150
151 toehold_abs = absadr (addr (toehold$), code);
152 scs$processor_data_switch_value = bit (bin (toehold_abs, 18), 18) || XED_INHIB;
153 if sys_info$collection_1_phase = EARLY_INITIALIZATION | sys_info$collection_1_phase = BOOT_INITIALIZATION
154 | sys_info$collection_1_phase = SERVICE_INITIALIZATION
155 then if scs$processor_switch_data (0) ^= scs$processor_data_switch_value
156 then call syserr (ANNOUNCE, "scas_init: CPU data switches are ^w, should be ^w",
157 scs$processor_switch_data (0), scs$processor_data_switch_value);
158
159
160
161
162 iom_low_port, cpu_low_port = 36;
163 iom_high_port, cpu_high_port = -1;
164 iom_ports, cpu_ports = "0"b;
165 %page;
166
167
168 n_cpus = 0;
169 found = "0"b;
170 dps8 = "0"b;
171
172 do i = 0 to 7;
173 scs$processor_data (i).halted_cpu = "1"b;
174 end;
175
176 cpu_cardp = null ();
177 cpu_loop:
178 call config_$find (CPU_CARD_WORD, cpu_cardp);
179 if cpu_cardp = null () then go to cpu_loop_end;
180 n_cpus = n_cpus + 1;
181
182 tag = cpu_card.tag - 1;
183 if (tag < 0) | (tag > 7)
184 then
185 call syserr (CRASH, "scas_init: Illegal tag on ^a config card.", CPU_CARD_WORD);
186
187 pdp = addr (scs$processor_data (tag));
188 if pdata.offline
189 then
190 call syserr (CRASH, "scas_init: ^a ^a appears twice in config deck.", CPU_CARD_WORD, tag_letter (tag));
191
192 if tag = scs$bos_processor_tag then do;
193 found = "1"b;
194 if cpu_card.state ^= "on " then do;
195 call syserr (severity, "scas_init: Config card for bootload ^a ^a is ^a, must be on.", CPU_CARD_WORD,
196 tag_letter (tag), cpu_card.state);
197 cpu_card.state = "on";
198 end;
199 rswp = addr (scs$processor_switch_data (2));
200 if dps8_rsw_2.cpu_type > 0 then dps8 = "1"b;
201 end;
202 else if cpu_card.type = "dps8" then dps8 = "1"b;
203
204 cport = cpu_card.port;
205
206 if cport < cpu_low_port then cpu_low_port = cport;
207 if cport > cpu_high_port then cpu_high_port = cport;
208
209 if cpu_card.expander_port ^= -1 then do;
210 exp_port = cpu_card.expander_port - 1;
211 if (exp_port < 0 | exp_port > 3)
212 then call syserr (CRASH, "scas_init: Illegal expander subport tag on CPU ^a config card.",
213 tag_letter (tag));
214 if tag = scs$bos_processor_tag
215 then call syserr (CRASH, "scas_init: Bootload CPU may not be on an expander port.");
216 do i = 0 to 7;
217 if scs$processor_data (i).offline then do;
218
219 if scs$processor_data (i).controller_port = cport then do;
220 if ^scs$expanded_ports (cport)
221 then call syserr (CRASH,
222 "scas_init: SCU port ^d configured as both expanded and non-expanded.", cport);
223 if scs$processor_data (i).expander_port = exp_port
224 then call syserr (CRASH,
225 "scas_init: CPU ^a and CPU ^a both configured for port ^d subport ^a.",
226 tag_letter (tag), tag_letter (i), cport, tag_letter (cport));
227 end;
228 end;
229 end;
230 scs$cow (tag).expander_port = exp_port;
231 scs$cow (tag).expanded_port = "1"b;
232 scs$cow (tag).expander_command = "0"b3;
233 pdata.expanded_port = "1"b;
234 scs$expanded_ports (cport) = "1"b;
235 pdata.expander_port = exp_port;
236 end;
237 else if scs$expanded_ports (cport)
238 then call syserr (CRASH, "scas_init: SCU port ^d configured as both expanded and non-expanded port.",
239 cport);
240 pdata.controller_port = cport;
241 scs$cow (tag).controller_port = cport;
242 scs$cow_ptrs (tag).rel_cow_ptr = rel (addr (scs$cow (tag).cow));
243
244 scs$cow_ptrs (tag).tag = "00"b3;
245 pdata.offline = "1"b;
246
247 if sys_info$collection_1_phase = CRASH_INITIALIZATION
248
249 then if cpu_card.state = "on " then call scr_util$set_port_enable_bit (cport, "1"b);
250 go to cpu_loop;
251
252 cpu_loop_end:
253 if n_cpus < 1
254 then
255 call syserr (CRASH, "scas_init: No ^a config card.", CPU_CARD_WORD);
256
257 if ^found then call syserr (CRASH, "scas_init: No config card for bootload ^a.", CPU_CARD_WORD);
258 %page;
259
260
261 n_mems = 0;
262 found = "0"b;
263 expected_base = 0;
264
265 mem_cardp = null ();
266 mem_loop:
267 call config_$find ("mem ", mem_cardp);
268 if mem_cardp = null () then go to mem_loop_end;
269 n_mems = n_mems + 1;
270
271 tag = mem_card.tag - 1;
272 if (tag < 0) | (tag > 7)
273 then
274 call syserr (CRASH, "scas_init: Illegal tag on ^a config card.", MEM_CARD_WORD);
275
276 if dps8
277 then
278 if tag > 3
279 then call syserr (CRASH,
280 "scas_init: ^a ^a. Tags greater than ""D"" not supported by DPS8 CPUs", MEM_CARD_WORD,
281 tag_letter (tag));
282
283 cdp = addr (scs$controller_data (tag));
284 if cdata.online | cdata.offline
285 then
286 call syserr (CRASH, "scas_init: ^a ^a appears twice in config deck.", MEM_CARD_WORD, tag_letter (tag));
287
288 if mem_card.state = "on "
289 then
290 cdata.online = "1"b;
291 else if mem_card.state = "off "
292 then
293 cdata.offline = "1"b;
294 else
295 call syserr (CRASH, "scas_init: Config card for ^a ^a is neither on nor off.", MEM_CARD_WORD,
296 tag_letter (tag));
297
298 call rsw_util$port_info (tag, enabled, base, size, interlace);
299
300
301 if base = 0 then do;
302 if found
303 then
304 call syserr (CRASH, "scas_init: More than one low-order MEM.");
305 else do;
306 found = "1"b;
307 if cdata.offline then do;
308 call syserr (severity, "scas_init: Config card for bootload ^a indicates unit is offline.",
309 MEM_CARD_WORD);
310 mem_card.state = "on";
311 cdata.offline = "0"b;
312 cdata.online = "1"b;
313 end;
314 end;
315 end;
316
317 if cdata.online & ^enabled then do;
318 call syserr (severity, "scas_init: MEM ^a is not enabled.", tag_letter (tag));
319 mem_card.state = "off";
320 cdata.online = "0"b;
321 cdata.offline = "1"b;
322 end;
323 call rsw_util$init_rsw_mask (tag, (cdata.online));
324
325 cdata.size = size;
326 cdata.base = base;
327 if sys_info$collection_1_phase > SERVICE_INITIALIZATION
328 then scs$controller_config_size (tag) = 512;
329 else scs$controller_config_size (tag) = mem_card.size;
330
331
332 if base < expected_base
333 then call syserr (CRASH, "scas_init: MEM ^a address assignment disagrees with config deck.", tag_letter (tag));
334 if mem_card.size > size
335 then
336 call syserr (CRASH, "scas_init: Size too large on config card for MEM ^a.", tag_letter (tag));
337
338 expected_base = base + size;
339
340 cdata.ext_interlaced = (interlace ^= 0);
341 cdata.four_word = (interlace = 4);
342
343 if cdata.online then do;
344 call init_scu (tag, errtag, code);
345 if code ^= 0
346 then
347 if code = rcerr_addscu_size
348 then call syserr (CRASH, "scas_init: MEM ^a has more memory than indicated by CPU switches.",
349 tag_letter (tag));
350 else if code = rcerr_addscu_dup_mask
351 then call syserr (CRASH, "scas_init: MEM ^a has duplicate mask assignments to CPU ^a.",
352 tag_letter (tag), tag_letter (errtag));
353 else if code = rcerr_addscu_no_mask
354 then call syserr (CRASH, "scas_init: MEM ^a has no mask assigned to CPU ^a.", tag_letter (tag),
355 tag_letter (errtag));
356 else if code = rcerr_addscu_bad_mask
357 then call syserr (CRASH, "scas_init: MEM ^a has mask ^a assigned to non-processor port.",
358 tag_letter (tag), tag_letter (errtag));
359 else if code = rcerr_addscu_manual
360 then call syserr (CRASH, "scas_init: MEM ^a is not in PROGRAM mode.", tag_letter (tag));
361 else if code = rcerr_addscu_oldexpand
362 then call syserr (CRASH, "scas_init: MEM ^a is an old SCU with port expander", tag_letter (tag));
363 else if code = rcerr_addscu_bigconfig
364 then
365 call syserr (CRASH, "scas_init: Size too large on config card for MEM ^a.", tag_letter (tag));
366 else if code = rcerr_addscu_memoverlap
367 then
368 call syserr (CRASH, "scas_init: Possible memory address overlap in MEM ^a.", tag_letter (tag));
369
370
371 end;
372 if sys_info$collection_1_phase > SERVICE_INITIALIZATION then go to mem_loop_end;
373
374 go to mem_loop;
375
376 mem_loop_end:
377 if n_mems < 1
378 then
379 call syserr (CRASH, "scas_init: No ^a config card.", MEM_CARD_WORD);
380
381 if ^found then call syserr (CRASH, "scas_init: No config card for bootload ^a.", MEM_CARD_WORD);
382 %page;
383
384
385 scrp = addr (scs$cfg_data (scs$interrupt_controller));
386
387 if bin (scr_cfg1.port_no, 4) ^= scs$processor_data (scs$bos_processor_tag).controller_port
388 then call syserr (CRASH, "scas_init: CPU config card specifies wrong controller port number.");
389
390
391
392
393 if ^(sys_info$collection_1_phase = EARLY_INITIALIZATION | sys_info$collection_1_phase > SERVICE_INITIALIZATION)
394 then do tag = 0 to 7;
395 if ^scs$controller_data (tag).offline & ^scs$controller_data (tag).online then do;
396 call rsw_util$port_info (tag, enabled, base, size, interlace);
397 if enabled
398 then
399 call syserr (severity,
400 "scas_init: MEM ^a is not in the configuration, but is enabled by the CPU switches.",
401 tag_letter (tag));
402 end;
403 end;
404 %page;
405
406
407 iom_data_ptr = addr (iom_data$);
408 do tag = 0 to 7;
409 if scs$port_data (tag).assigned = IOM_PORT then do;
410 if iom_data.per_iom (scs$port_data (tag).iom_number).flags.on_line
411 then
412 call scr_util$set_port_enable_bit (tag, "1"b);
413 if tag < iom_low_port then iom_low_port = tag;
414 if tag > iom_high_port then iom_high_port = tag;
415 end;
416 end;
417
418
419
420 call scr_util$set_port_enable (binary (scs$processor_data (scs$bos_processor_tag).controller_port, 3), "1"b);
421
422 %page;
423
424
425 cdp = addr (scs$controller_data (scs$interrupt_controller));
426
427
428 string (masks_found) = "0000"b;
429 do i = 0 to 7;
430 pdp = addr (scs$processor_data (i));
431 if pdata.offline then do;
432 do j = 1 to 4;
433 if cdata.eima_data (j).mask_assigned & ^masks_found (j)
434 then if cdata.eima_data (j).mask_assignment = pdata.controller_port then do;
435 masks_found (j) = "1"b;
436 pdata.interrupt_cpu = "1"b;
437 scs$set_mask (i) = mask_instruction$smcm ();
438 scs$read_mask (i) = mask_instruction$rmcm ();
439 scs$mask_ptr (i) = addr (scs$port_addressing_word (scs$interrupt_controller));
440 end;
441 end;
442 end;
443 end;
444
445
446
447
448 if ^scs$processor_data (scs$bos_processor_tag).interrupt_cpu
449 then call syserr (CRASH, "scas_init: Bootload CPU has no system controller mask assigned.");
450 %page;
451
452
453
454
455
456
457
458
459
460
461 substr (iom_ports, iom_low_port + 1, iom_high_port - iom_low_port + 1) =
462 substr (ALL_ONES, 1, iom_high_port - iom_low_port + 1);
463 substr (cpu_ports, cpu_low_port + 1, cpu_high_port - cpu_low_port + 1) =
464 substr (ALL_ONES, 1, cpu_high_port - cpu_low_port + 1);
465
466 if (iom_ports & cpu_ports) = ""b
467 then do;
468 call set_cycle_group (iom_low_port, iom_high_port);
469 call set_cycle_group (cpu_low_port, cpu_high_port);
470 scs$set_cycle_switches = "1"b;
471 do i = 0 to hbound (scs$controller_data, 1);
472 if scs$controller_data (i).online then call scr_util$set_cfg (bin (i));
473 end;
474 end;
475 else do;
476 scs$set_cycle_switches = "0"b;
477 call syserr (ANNOUNCE,
478 "scs_init: CPU/IOM port range overlap. Using manual settings for cycle port priority.");
479 end;
480
481 return;
482 %page;
483
484
485
486 set_cycle_group:
487 proc (low_port, high_port);
488
489 dcl low_port fixed bin;
490 dcl high_port fixed bin;
491
492 dcl middle_port fixed bin;
493
494
495 if high_port <= low_port then return;
496 if high_port - low_port > MAX_CYCLE_GROUP then do;
497 middle_port = low_port + divide (high_port - low_port - 1, 2, 17);
498
499 call set_cycle_group (low_port, middle_port);
500 call set_cycle_group (middle_port + 1, high_port);
501 end;
502 else substr (scs$cycle_priority_template, low_port + 1, high_port - low_port) =
503 substr (ALL_ONES, 1, high_port - low_port);
504
505 end set_cycle_group;
506 %page;
507 %include collection_1_phases;
508 %page;
509 %include config_mem_card;
510 %page;
511 %include config_cpu_card;
512 %page;
513 %include iom_data;
514 %page;
515 dcl ptp pointer;
516 %include "ptw.l68";
517 %page;
518 %include rcerr;
519 %page;
520 %include rsw;
521 %page;
522 %include scr;
523 %page;
524 %include scs;
525 %page;
526 %include sdw_info;
527 %page;
528 %include syserr_constants;
529 %page;
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971 end scas_init;