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 stop_cpu:
28 proc (tag, rcode);
29
30 dcl tag fixed bin (3);
31 dcl rcode fixed bin (35);
32
33 dcl pdp ptr;
34 dcl new_pdp ptr;
35 dcl new_tag fixed bin (3);
36 dcl found bit (1) aligned;
37 dcl mask_temp fixed bin (71);
38 dcl ptp ptr;
39 dcl cpu_mask bit (8) aligned;
40 dcl code fixed bin (35);
41 dcl timnow fixed bin (52);
42 dcl shutdown_entry bit (1) aligned;
43
44 dcl LETTERS char (8) static options (constant) init ("ABCDEFGH");
45 dcl my_name char (8) static options (constant) init ("stop_cpu");
46
47 dcl prds$simulated_mask ext,
48 tc_data$ncpu fixed bin ext;
49
50 dcl set_procs_required entry (bit (8) aligned, fixed bin (35)),
51 pxss$unthread_apte entry (ptr),
52 privileged_mode_ut$cioc
53 entry (ptr),
54 privileged_mode_ut$wire_and_mask
55 entry (fixed bin (71), ptr),
56 privileged_mode_ut$unwire_unmask
57 entry (fixed bin (71), ptr),
58 wire_proc$wire_me entry,
59 wire_proc$unwire_me entry,
60 scr_util$set_mask entry (fixed bin (3), fixed bin (3), bit (72) aligned),
61 scr_util$reassign_mask entry (fixed bin (3), fixed bin (3)),
62 scr_util$set_port_enable
63 entry (fixed bin (3), bit (1) unal),
64 scr_util$update_export_xipmsk
65 entry (fixed bin (3)),
66 scr_util$set_export_enable
67 entry (fixed bin (3), fixed bin (3), bit (1) aligned),
68 mask_instruction$staq entry returns (bit (36) aligned),
69 mask_instruction$ldaq entry returns (bit (36) aligned),
70 config_$find_2 entry (char (4) aligned, fixed bin (35), ptr),
71 config_$update entry (),
72 syserr$error_code entry options (variable),
73 syserr entry options (variable);
74
75 dcl 1 pdata based (pdp) like scs$processor_data aligned;
76 dcl 1 npdata based (new_pdp) like scs$processor_data aligned;
77
78 dcl (addr, clock, substr, unspec)
79 builtin;
80 ^L
81
82 shutdown_entry = "0"b;
83 goto SHUTDOWN_COMMON;
84
85 shutdown:
86 entry (tag, rcode);
87
88 shutdown_entry = "1"b;
89
90 SHUTDOWN_COMMON:
91 pdp = addr (scs$processor_data (tag));
92 fgbxp = addr (flagbox$);
93
94
95
96
97
98 if tag = scs$bos_processor_tag then do;
99 found = "0"b;
100 do new_tag = 0 to 7 while (^found);
101 new_pdp = addr (scs$processor_data (new_tag));
102
103
104 if npdata.online then
105 if new_tag ^= tag then
106 if npdata.interrupt_cpu
107 & ^npdata.expanded_port then do;
108
109 found = "1"b;
110 scs$bos_processor_tag = new_tag;
111 call syserr (ANNOUNCE, "^a: CPU ^a is now the bootload processor.", my_name,
112 substr (LETTERS, new_tag + 1, 1));
113 fgbx.hc_dbr = unspec (scs$idle_aptep (new_tag) -> apte.dbr);
114 end;
115 end;
116 if ^found then do;
117 rcode = rcerr_delcpu_no_good_blcpu;
118 return;
119 end;
120 end;
121
122
123
124
125
126 cpu_mask = "0"b;
127 substr (cpu_mask, scs$bos_processor_tag + 1, 1) = "1"b;
128 call set_procs_required (cpu_mask, code);
129 if code ^= 0 then do;
130 rcode = rcerr_sprq_failed;
131 return;
132 end;
133
134 pdata.delete_cpu = "1"b;
135 call privileged_mode_ut$cioc (addr (scs$cow (tag).cow));
136
137
138 call set_procs_required ("0"b, code);
139
140
141
142 timnow = clock;
143 do while (^pdata.halted_cpu);
144 if clock - timnow > 30000000 then do;
145 rcode = rcerr_delcpu_no_stop;
146 return;
147 end;
148 end;
149 ^L
150
151
152
153 pdp = addr (scs$processor_data (tag));
154
155
156
157 scs$nprocessors = scs$nprocessors - 1;
158 tc_data$ncpu = tc_data$ncpu - 1;
159
160 call syserr (ANNOUNCE, "^a: Removed CPU ^a.", my_name, substr (LETTERS, tag + 1, 1));
161 go to destroy;
162
163 destroy_1:
164 entry (tag, rcode);
165
166 shutdown_entry = "0"b;
167
168 destroy:
169 pdp = addr (scs$processor_data (tag));
170
171
172
173 if ^shutdown_entry then do;
174 call config_$find_2 (CPU_CARD_WORD, tag + 1, cpu_cardp);
175
176 cpu_card.state = "off ";
177 call config_$update ();
178 end;
179
180
181
182 call pxss$unthread_apte ((scs$idle_aptep (tag)));
183
184
185
186
187 call scr_util$set_mask (scs$interrupt_controller, (pdata.controller_port), scs$sys_level);
188
189
190 if ^pdata.expanded_port
191 then
192 call scr_util$set_port_enable ((pdata.controller_port), "0"b);
193
194 else call scr_util$set_export_enable ((pdata.controller_port), (pdata.expander_port), "0"b);
195
196 ^L
197
198
199
200
201 found = "0"b;
202 if pdata.interrupt_cpu then do;
203 do new_tag = 0 to 7 while (^found);
204 new_pdp = addr (scs$processor_data (new_tag));
205
206 if npdata.online & ^npdata.interrupt_cpu then do;
207
208
209 call scr_util$reassign_mask (tag, new_tag);
210
211
212 cpu_mask = "0"b;
213 substr (cpu_mask, new_tag + 1, 1) = "1"b;
214 call set_procs_required (cpu_mask, code);
215
216 if code ^= 0 then
217 call syserr$error_code (CRASH, code, "^a: Unable to run on CPU ^a", my_name,
218 substr (LETTERS, new_tag + 1, 1));
219 else do;
220 found = "1"b;
221 call wire_proc$wire_me;
222 call privileged_mode_ut$wire_and_mask (mask_temp, ptp);
223
224
225 scs$mask_ptr (new_tag) = scs$mask_ptr (tag);
226
227 scs$set_mask (new_tag) = scs$set_mask (tag);
228
229 scs$read_mask (new_tag) = scs$read_mask (tag);
230
231 npdata.interrupt_cpu = "1"b;
232 call privileged_mode_ut$unwire_unmask (mask_temp, ptp);
233 call wire_proc$unwire_me;
234 call set_procs_required ("0"b, code);
235
236
237 pdata.interrupt_cpu = "0"b;
238 scs$mask_ptr (tag) = addr (prds$simulated_mask);
239
240 scs$set_mask (tag) = mask_instruction$staq ();
241
242 scs$read_mask (tag) = mask_instruction$ldaq ();
243
244 end;
245 end;
246 end;
247 end;
248
249
250
251
252 if pdata.expanded_port then do;
253 call scr_util$update_export_xipmsk ((pdata.controller_port));
254 call scr_util$set_export_enable ((pdata.controller_port), (pdata.expander_port), "0"b);
255 found = "0"b;
256 do new_tag = 0 to 7 while (^found);
257 new_pdp = addr (scs$processor_data (new_tag));
258 if npdata.controller_port = pdata.controller_port & npdata.online & tag ^= new_tag then
259 found = "1"b;
260 end;
261 if ^found then
262 call scr_util$set_port_enable ((pdata.controller_port), "0"b);
263 end;
264
265 rcode = 0;
266
267 return;
268 ^L
269 %include rcerr;
270 %page;
271 %include config_cpu_card;
272 %page;
273 %include flagbox;
274 %page;
275 %include scs;
276 %page;
277 %include apte;
278 %page;
279 %include syserr_constants;
280 ^L
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326 end stop_cpu;