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 reconfig:
31 proc;
32
33
34
35 dcl tag fixed bin (3);
36 dcl (cpu_tag, scu_tag, scu_port)
37 fixed bin (5);
38 dcl switches (4) bit (36) aligned;
39 dcl lace bit (1) aligned;
40 dcl badtag fixed bin (3);
41 dcl code fixed bin (35);
42 dcl first_frame fixed bin;
43 dcl n_frames fixed bin;
44 dcl (rci_ptr, wseg_p) ptr;
45
46
47
48 dcl tcode fixed bin (35);
49 dcl errtag fixed bin (3);
50 dcl first fixed bin (3);
51 dcl last fixed bin (3);
52 dcl (i, k) fixed bin;
53 dcl j fixed bin (3);
54 dcl vl fixed bin (3);
55 dcl req_mem fixed bin;
56 dcl size fixed bin;
57 dcl base fixed bin;
58 dcl top fixed bin;
59 dcl abs_seg_p ptr;
60 dcl p_mess bit (1);
61 dcl switchesp ptr;
62 dcl 1 tsdw aligned like sdw;
63
64
65
66 dcl based_switches (4) bit (36) aligned based (switchesp);
67
68
69
70 dcl error_table_$bad_subr_arg fixed bin(35) ext static;
71 dcl pds$processid bit (36) aligned ext;
72 dcl pds$process_group_id char (32) aligned ext;
73 dcl isolts_abs_seg$ ext;
74
75
76
77 dcl syserr entry options (variable);
78 dcl start_cpu entry (fixed bin (3), fixed bin (35));
79 dcl configure_test_cpu entry (fixed bin (35));
80 dcl configure_test_cpu$isolts_final
81 entry;
82 dcl level$get entry returns (fixed bin (3));
83 dcl privileged_mode_ut$swap_sdw
84 entry (ptr, ptr);
85 dcl config_$find_2 entry (char (4) aligned, fixed bin, ptr);
86 dcl config_$update entry ();
87 dcl stop_cpu entry (fixed bin (3), fixed bin (35));
88 dcl add_scu entry (fixed bin (3), fixed bin (3), fixed bin (35));
89 dcl freecore entry (fixed bin);
90 dcl pc_abs$remove_core entry (fixed bin, fixed bin, fixed bin (35));
91 dcl add_scu$remove_scu entry (fixed bin (3));
92 dcl validate_cpu_card entry (fixed bin (3), ptr);
93
94
95
96 dcl (addr, bin, bit, divide, hbound, max, mod, null, rel, stac, stacq, string, substr, unspec)
97 builtin;
98
99
100
101 dcl letters char (15) int static options (constant) init ("abcdefghijklmo");
102 ^L
103
104
105
106
107
108
109
110 add_cpu:
111 entry (tag, switches, code);
112
113 if check_lock () then
114 return;
115
116 if scs$processor_data (tag).online then do;
117 code = rcerr_online;
118 call UNLOCK;
119 return;
120 end;
121
122 if ^scs$processor_data (tag).offline then do;
123 code = rcerr_no_config;
124 call UNLOCK;
125 return;
126 end;
127
128 call start_cpu (tag, tcode);
129
130
131
132 if tcode ^= 0 then do;
133 code = tcode;
134 switchesp = addr (scs$processor_switch_compare (1));
135 switches = based_switches;
136
137 end;
138
139 call UNLOCK;
140
141 return;
142 ^L
143
144
145
146
147
148
149
150
151 del_cpu:
152 entry (tag, code);
153
154 if check_lock () then
155 return;
156
157 if ^scs$processor_data (tag).online then do;
158 code = rcerr_not_online;
159 call UNLOCK;
160 return;
161 end;
162
163 if scs$nprocessors <= 1 then do;
164 code = rcerr_delcpu_last;
165 call UNLOCK;
166 return;
167 end;
168
169 call stop_cpu (tag, tcode);
170 if tcode ^= 0 then
171 code = tcode;
172
173 call UNLOCK;
174
175 return;
176 ^L
177
178
179
180
181
182
183
184
185
186 add_scu:
187 entry (tag, lace, badtag, code);
188
189 if check_lock () then
190 return;
191
192 if scs$controller_data (tag).online then do;
193 code = rcerr_online;
194 call UNLOCK;
195 return;
196 end;
197 if ^scs$controller_data (tag).offline then do;
198 code = rcerr_no_config;
199 call UNLOCK;
200 return;
201 end;
202 if scs$controller_data (tag).ext_interlaced then do;
203 first = tag - mod (tag, 2);
204 last = first + 1;
205 lace = "1"b;
206 end;
207 else do;
208 first, last = tag;
209 lace = "0"b;
210 end;
211
212 do j = first to last;
213 call add_scu (j, errtag, tcode);
214 if tcode ^= 0 then do;
215 code = tcode;
216 badtag = errtag;
217
218 if (first ^= last) & (j = last) then
219 call add_scu$remove_scu (first);
220
221 call UNLOCK;
222
223 return;
224 end;
225 end;
226
227 do j = first to last;
228 call free_all_of (j);
229 end;
230
231 call UNLOCK;
232
233 call recompute_write_limit;
234
235 return;
236 ^L
237
238
239
240
241
242
243
244
245
246
247 del_scu:
248 entry (tag, lace, code);
249
250 if check_lock () then
251 return;
252
253 if ^scs$controller_data (tag).online then do;
254 code = rcerr_not_online;
255 call UNLOCK;
256 return;
257 end;
258 if scs$controller_data (tag).ext_interlaced then do;
259 first = tag - mod (tag, 2);
260 last = first + 1;
261 lace = "1"b;
262 end;
263 else do;
264 first, last = tag;
265 lace = "0"b;
266 end;
267
268 do j = first to last;
269 base = scs$controller_data (j).base;
270 size = scs$controller_config_size (j);
271
272
273 call pc_abs$remove_core (base, size, tcode);
274 if tcode ^= 0 then do;
275 if (first ^= last) & (j ^= first) then
276 call free_all_of (first);
277
278 call UNLOCK;
279
280 if tcode = 1 then
281 code = rcerr_delmain_nomem;
282 else if tcode = 2 then
283 code = rcerr_delmain_abs_wired;
284 else code = tcode;
285
286 return;
287 end;
288 end;
289
290 do j = first to last;
291 call add_scu$remove_scu (j);
292 end;
293
294 call UNLOCK;
295
296 call recompute_write_limit;
297
298 return;
299 ^L
300
301
302
303
304
305
306
307
308 add_main:
309 entry (first_frame, n_frames, code);
310
311 if check_lock () then
312 return;
313
314 if check_range () then
315 return;
316
317 do k = first_frame to first_frame + n_frames - 1;
318 call freecore (k);
319 end;
320
321 call UNLOCK;
322
323 call recompute_write_limit;
324
325 return;
326
327
328
329
330
331
332
333
334
335
336
337
338 del_main:
339 entry (first_frame, n_frames, code);
340
341 if check_lock () then
342 return;
343
344 if check_range () then
345 return;
346
347 call pc_abs$remove_core (first_frame, n_frames, tcode);
348 if tcode ^= 0 then do;
349 if tcode = 1 then
350 code = rcerr_delmain_nomem;
351 else if tcode = 2 then
352 code = rcerr_delmain_abs_wired;
353 else code = tcode;
354 end;
355
356 call UNLOCK;
357
358 call recompute_write_limit;
359
360 return;
361 ^L
362
363
364
365
366
367
368
369
370 recompute_write_limit:
371 proc;
372
373 declare sst$write_limit fixed bin (35) external static;
374 declare sst$nused fixed bin (35) external static;
375
376 sst$write_limit = max (30, divide (sst$nused, 8, 17, 0));
377
378 end;
379 ^L
380
381
382
383
384
385
386
387
388 rc_unlock:
389 entry;
390
391 if scs$reconfig_lock ^= pds$processid then
392 return;
393
394
395 rc_force_unlock:
396 entry;
397
398 call UNLOCK;
399
400 return;
401
402
403
404
405
406
407
408
409
410
411
412
413 rc_lock:
414 entry (code);
415
416 if ^check_lock () then
417 code = 0;
418
419 return;
420
421
422
423
424 UNLOCK:
425 proc;
426
427 if ^stacq (scs$reconfig_lock, (36)"0"b, scs$reconfig_lock) then
428 call syserr (0, "reconfig: trouble unlocking scs$reconfig_lock");
429
430 end UNLOCK;
431
432
433
434
435
436 check_lock:
437 proc returns (bit (1) aligned);
438
439 code = 0;
440
441 if ^stac (addr (scs$reconfig_lock), pds$processid) then do;
442 code = rcerr_locked;
443 return ("1"b);
444 end;
445
446 else do;
447 scs$reconfig_locker_id = pds$process_group_id;
448 return ("0"b);
449 end;
450
451
452 end check_lock;
453 ^L
454
455
456 free_all_of:
457 proc (mem);
458
459 dcl mem fixed bin (3);
460
461 dcl i fixed bin;
462 dcl base fixed bin;
463 dcl top fixed bin;
464
465 base = scs$controller_data (mem).base;
466 top = scs$controller_config_size (mem) + base - 1;
467 do i = base to top;
468 call freecore (i);
469 end;
470
471 end free_all_of;
472
473
474
475
476
477 check_range:
478 proc returns (bit (1) aligned);
479
480 dcl i fixed bin;
481 dcl base fixed bin;
482 dcl top fixed bin;
483
484 if n_frames < 0 then do;
485 code = error_table_$bad_subr_arg;
486 goto check_range_error;
487 end;
488
489 do i = 0 to 7;
490 if scs$controller_data (i).online then do;
491 base = scs$controller_data (i).base;
492 top = base + scs$controller_config_size (i) - 1;
493 if (first_frame >= base) & (first_frame + n_frames - 1 <= top) then
494 return ("0"b);
495 end;
496 end;
497
498 code = rcerr_range;
499 check_range_error:
500 call UNLOCK;
501
502 return ("1"b);
503
504 end check_range;
505 ^L
506
507
508
509
510
511
512
513
514
515
516 reconfig_info:
517 entry (rci_ptr, code);
518
519 if ^stac (addr (scs$reconfig_lock), pds$processid) then do;
520 rci_ptr -> rci.locker_group_id = scs$reconfig_locker_id;
521 code = rcerr_locked;
522 return;
523 end;
524
525 code = 0;
526 scs$reconfig_locker_id = pds$process_group_id;
527
528
529
530 rci_ptr -> rci.controller_data = scs$controller_data;
531 rci_ptr -> rci.processor_data = scs$processor_data;
532
533 return;
534 ^L
535
536
537
538
539
540 Note
541
542
543
544
545 check_resource:
546 entry (cpu_tag, scu_tag, scu_port, code);
547
548 code = 0;
549
550 if check_lock () then do;
551 code = rcerr_isolts_locked;
552 return;
553 end;
554
555 if cpu_tag > hbound (scs$processor_data, 1) then do;
556
557 code = rcerr_isolts_illegal_cpu;
558 call UNLOCK;
559 return;
560 end;
561
562 if scs$processor_data (cpu_tag).online then do;
563 code = rcerr_isolts_cpu_online;
564 call UNLOCK;
565 return;
566 end;
567
568 if ^scs$processor_data (cpu_tag).offline then do;
569 code = rcerr_isolts_no_config;
570 call UNLOCK;
571 return;
572 end;
573
574 if scu_tag = -1 then do;
575
576
577
578 k = -1;
579 do i = 0 to hbound (scs$controller_data, 1);
580 if scs$controller_data (i).online then
581 if scs$controller_data (i).base ^= 0 then
582
583 if scs$controller_data (i).size >= 128 then
584
585 if ^scs$controller_data (i).abs_wired then
586
587 if ^scs$controller_data (i).ext_interlaced then
588
589 if k ^= -1 then
590 if scs$controller_data (i).size <
591
592 scs$controller_data (k).size then
593
594 k = i;
595
596 else ;
597 else k = i;
598 end;
599
600 if k = -1 then do;
601 code = rcerr_isolts_two_scu;
602 call UNLOCK;
603 return;
604 end;
605 scu_tag = k;
606 end;
607
608 else do;
609
610 if scu_tag > hbound (scs$controller_data, 1) then do;
611
612 code = rcerr_isolts_illegal_scu;
613 call UNLOCK;
614 return;
615 end;
616
617 if scu_tag = scs$interrupt_controller then do;
618
619 code = rcerr_isolts_bootload_scu;
620 call UNLOCK;
621 return;
622 end;
623
624 if ^scs$controller_data (scu_tag).online then do;
625
626 code = rcerr_isolts_scu_not;
627 call UNLOCK;
628 return;
629 end;
630
631 end;
632
633 scu_port = scs$processor_data (cpu_tag).controller_port;
634
635
636 return;
637 ^L
638
639
640
641
642
643
644
645
646
647 create_cpu_test_env:
648 entry (cpu_tag, scu_tag, switches, wseg_p, code);
649
650 code = 0;
651 wseg_p = null;
652
653 if scs$reconfig_lock ^= pds$processid then do;
654 code = rcerr_isolts_not;
655 return;
656 end;
657 scs$processor_test_data.cpu_tag = cpu_tag;
658 scs$processor_test_data.scu_tag = scu_tag;
659 scs$processor_test_data.scu_state = "00"b;
660 scs$processor_test_data.active = "1"b;
661
662 call configure_test_cpu (tcode);
663 switchesp = addr (scs$processor_switch_compare (1));
664 switches = based_switches;
665 if tcode ^= 0 then do;
666 call destroy_cpu_test_env_no_mess;
667 code = tcode;
668 return;
669 end;
670 abs_seg_p = addr (isolts_abs_seg$);
671 req_mem = scs$processor_test_data.req_mem;
672
673
674
675 vl = level$get ();
676 string (tsdw) = "0"b;
677 tsdw.add = bit (bin (scs$controller_data (scu_tag).base * 1024, 24), 24);
678 tsdw.r1, tsdw.r2, tsdw.r3 = bit (bin (vl, 3), 3);
679 tsdw.df = "1"b;
680 tsdw.read = "1"b;
681 tsdw.write = "1"b;
682 tsdw.unpaged = "1"b;
683 tsdw.bound = bit (bin (divide (req_mem * 1024, 16, 14) - 1, 14), 14);
684
685 call privileged_mode_ut$swap_sdw (abs_seg_p, addr (tsdw));
686
687 wseg_p = abs_seg_p;
688 call config_$find_2 (CPU_CARD_WORD, cpu_tag + 1, cpu_cardp);
689
690 cpu_card.state = "test";
691 call config_$update ();
692 call validate_cpu_card ((cpu_tag), addr (scs$processor_switch_compare (2)));
693
694
695 call syserr (0, "reconfig: Assigned CPU ^a to ^a for testing",
696
697 substr (letters, cpu_tag + 1, 1), pds$process_group_id);
698 call syserr (0, "reconfig: Using base ^dk of MEM ^a for testing CPU ^a", req_mem,
699 substr (letters, scu_tag + 1, 1), substr (letters, cpu_tag + 1, 1));
700
701 return;
702 ^L
703
704
705
706
707
708
709
710
711
712
713 destroy_cpu_test_env:
714 entry;
715
716 p_mess = "1"b;
717 go to destroy_test_env_com;
718
719 destroy_cpu_test_env_no_mess:
720 entry;
721
722 p_mess = "0"b;
723
724 destroy_test_env_com:
725 if scs$processor_test_data.active then do;
726 call configure_test_cpu$isolts_final;
727 abs_seg_p = addr (isolts_abs_seg$);
728 string (tsdw) = "0"b;
729 call privileged_mode_ut$swap_sdw (abs_seg_p, addr (tsdw));
730 call config_$find_2 (CPU_CARD_WORD, scs$processor_test_data.cpu_tag + 1, cpu_cardp);
731 cpu_card.state = "off ";
732 call config_$update ();
733 if p_mess then do;
734 call syserr (0, "reconfig: Unassigned CPU ^a from ^a",
735
736 substr (letters, scs$processor_test_data.cpu_tag + 1, 1), scs$reconfig_locker_id);
737 call syserr (0, "reconfig: Releasing base ^dk of MEM ^a", scs$processor_test_data.req_mem,
738 substr (letters, scs$processor_test_data.scu_tag + 1, 1));
739 end;
740 unspec (scs$processor_test_data) = "0"b;
741 end;
742
743
744
745 call UNLOCK;
746
747 return;
748 ^L
749 %include config_cpu_card;
750 %page;
751 %include scs;
752 %page;
753 %include sdw;
754 %page;
755 %include rcerr;
756 %include rci;
757 ^L
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 end reconfig;