1
2
3
4
5
6
7
8
9
10
11
12
13
14 init_sst:
15 procedure;
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 dcl base fixed bin (18);
52 dcl cm_size fixed bin (18);
53 dcl cmp ptr;
54 dcl coresize fixed bin (18);
55 dcl early_call bit (1) aligned;
56 dcl i fixed bin;
57 dcl initbase fixed bin (18);
58 dcl memory_address fixed bin (26);
59 dcl n_astes fixed bin;
60 dcl n_buckets fixed bin;
61 dcl next_available ptr;
62 dcl page_no fixed bin (18);
63 dcl pool_idx fixed bin;
64 dcl scu_top fixed bin (18);
65 dcl size_mod_1024 fixed bin (18, -10);
66 dcl sizes (0:3) fixed bin (18);
67 dcl sst_size fixed bin (18);
68 dcl sst_absadr fixed bin (26);
69 dcl total_base fixed bin (18);
70 dcl total_pages fixed bin (18);
71 dcl total_size fixed bin (21);
72 dcl total_top fixed bin (18);
73 dcl suptop fixed bin (18);
74 dcl top fixed bin (18);
75 dcl uid_mask bit (36) aligned;
76
77 dcl (cm_sdw, sst_sdw) fixed bin (71);
78 dcl 1 local_sst_card aligned like sst_card;
79
80
81
82 debug
83 dcl AVG_HT_DEPTH fixed bin int static options (constant) init (5);
84
85 dcl HT_SIZES (6) fixed bin int static options (constant)
86 init (64, 128, 256, 512, 1024, 2048);
87 dcl HT_UID_MASKS (6) bit (36) aligned int static options (constant)
88
89 init ("000000000077"b3, "000000000177"b3, "000000000377"b3, "000000000777"b3, "000000001777"b3,
90 "000000003777"b3);
91 dcl PTS (0:3) fixed bin static init (4, 16, 64, 256) options (constant);
92
93
94 dcl WHOAMI char (8) init ("init_sst") int static options (constant);
95
96
97
98 dcl (addr, addrel, baseno, divide, hbound, lbound, max, min, bit, bin, null, size, sum, unspec) builtin;
99
100
101
102 dcl core_map$ ext bit (36) aligned;
103 dcl slt$ ext bit (36) aligned;
104 dcl sys_boot_info$bce_sst_sizes (0:3) fixed bin ext static;
105 dcl sys_boot_info$bootload_mem_size fixed bin (26) ext static;
106 dcl unpaged_page_tables$ ext static;
107
108
109
110 dcl absadr entry (ptr, fixed bin (35)) returns (fixed bin (26));
111 dcl config_$init_card entry (char (4) aligned, ptr);
112 dcl config_$add entry (ptr, ptr);
113 dcl config_$find_parm entry (char (4) aligned, ptr);
114 dcl freecore entry (fixed bin (18));
115 dcl get_main entry (ptr, fixed bin (18), fixed bin (71));
116 dcl get_main$given_address entry (ptr, fixed bin (26), fixed bin (18), fixed bin (71));
117 dcl init_aste_pools entry;
118 dcl pmut$swap_sdw entry (ptr, ptr);
119 dcl syserr entry options (variable);
120 dcl config_$find entry (char (4) aligned, ptr);
121 ^L
122
123 early:
124 entry;
125
126
127
128
129
130
131 call init_ptrs;
132
133 early_call = "1"b;
134
135 sizes (*) = sys_boot_info$bce_sst_sizes (*);
136
137 coresize = divide (sys_boot_info$bootload_mem_size, 1024, 26, 0);
138
139 suptop = divide (slt.free_core_start + 1023, 1024, 18, 0);
140
141 initbase = divide (slt.free_core_start + slt.free_core_size, 1024, 18, 0) - 1;
142
143 goto ALLOCATE_SST;
144 ^L
145
146 normal:
147 entry;
148
149
150
151
152 call init_ptrs;
153
154 early_call = "0"b;
155
156
157
158 sst_cardp = null;
159 call config_$find ("sst ", sst_cardp);
160 if sst_cardp = null then do;
161 sst_cardp = addr (local_sst_card);
162 call config_$init_card (SST_CARD_WORD, sst_cardp);
163
164 sst_card.no_aste (0) = 400;
165 sst_card.no_aste (1) = 150;
166 sst_card.no_aste (2) = 50;
167 sst_card.no_aste (3) = 20;
168
169 do pool_idx = 1 to 4;
170 sst_card.field_type (pool_idx) = CONFIG_DECIMAL_TYPE;
171 end;
172
173 call config_$add (sst_cardp, null);
174
175
176 call syserr (BEEP, "^a: No SST card in config deck. One has been added: SST^2x^4(^d.^2x^)", WHOAMI,
177 sst_card.no_aste);
178
179 end;
180
181 sizes (*) = sst_card.no_aste (*);
182 ^L
183
184
185 Note
186
187
188
189 suptop = divide (slt.free_core_start + 1023, 1024, 18, 0);
190
191 initbase = divide (slt.free_core_start + slt.free_core_size, 1024, 18, 0) - 1;
192
193
194 scu_top = 0;
195 coresize = 0;
196 do i = 0 to 7;
197 if scs$controller_data (i).online | scs$controller_data (i).offline
198
199 then do;
200 coresize = max (coresize, scs$controller_data (i).size + scs$controller_data (i).base);
201 if scs$controller_data (i).online then do;
202 base = scs$controller_data (i).base;
203
204 top = base + scs$controller_config_size (i) - 1;
205
206 if base < suptop
207 then
208 if top > scu_top
209 then scu_top = top;
210 end;
211 end;
212 end;
213 ^L
214
215 ALLOCATE_SST:
216
217
218
219 n_astes = sum (sizes);
220
221 n_buckets = divide (n_astes, AVG_HT_DEPTH, 17);
222 do i = 1 to hbound (HT_SIZES, 1) while (n_buckets > HT_SIZES (i));
223 end;
224 if i > hbound (HT_SIZES, 1)
225 then i = hbound (HT_SIZES, 1);
226 n_buckets = HT_SIZES (i);
227 uid_mask = HT_UID_MASKS (i);
228
229
230
231 sst_size = size (sst) + n_buckets;
232 do i = 0 to 3;
233 sst_size = sst_size + (size (aste) + PTS (i)) * sizes (i);
234 end;
235
236 cm_size = coresize * size (cme) + 8;
237
238 size_mod_1024 = sst_size + 1023;
239 sst_size = size_mod_1024;
240
241 size_mod_1024 = cm_size + 1023;
242 cm_size = size_mod_1024;
243
244
245 if early_call
246 then do;
247 call get_main (sstp, sst_size, sst_sdw);
248 call get_main (cmp, cm_size, cm_sdw);
249 call pmut$swap_sdw (sstp, addr (sst_sdw));
250 call pmut$swap_sdw (cmp, addr (cm_sdw));
251 debug
252 end;
253 else do;
254 total_size = sst_size + cm_size;
255 size_mod_1024 = total_size + 1023;
256 total_pages = divide (size_mod_1024, 1024, 18, 0);
257
258
259
260 total_top = min (scu_top, initbase);
261
262 total_base = total_top - total_pages + 1;
263
264
265 if total_base < suptop
266 then call syserr (CRASH, "init_sst: insufficient main storage for sst_seg and core map.");
267
268
269 memory_address = total_base * 1024;
270 call get_main$given_address (sstp, memory_address, sst_size, sst_sdw);
271 call pmut$swap_sdw (sstp, addr (sst_sdw));
272
273 memory_address = (total_base * 1024) + sst_size;
274 call get_main$given_address (cmp, memory_address, cm_size, cm_sdw);
275 call pmut$swap_sdw (cmp, addr (cm_sdw));
276 debug
277 end;
278
279 declare 1 CME (0:coresize - 1) aligned like cme based (cmp);
280
281 addr (flagbox$) -> fgbx.sst_sdw = unspec (sst_sdw);
282
283
284
285 sst.astsize = size (aste);
286 sst.cmesize = size (cme);
287 sst_absadr = absadr (addr (sst_seg$), (0));
288 addr (unpaged_page_tables$) -> upt.sst_absloc, sst.ptwbase = sst_absadr;
289 addr (unpaged_page_tables$) -> upt.sst_last_loc = sst_absadr + sst_size - 1;
290
291 do i = 0 to 3;
292 sst.pts (i) = PTS (i);
293 sst.no_aste (i) = bit (sizes (i), 18);
294 end;
295
296
297
298 begin;
299 declare BACK_STOP (8) bit (36) aligned based (cmp);
300 BACK_STOP = (36)"1"b;
301 end;
302 cmp = addrel (cmp, 8);
303
304
305 sst.cmp = cmp;
306
307 begin;
308 declare 1 TEMPLATE_CME aligned like cme;
309 unspec (TEMPLATE_CME) = ""b;
310 TEMPLATE_CME.fp, TEMPLATE_CME.bp = "777777"b3;
311 CME (*) = TEMPLATE_CME;
312 end;
313
314
315
316 next_available = addrel (sstp, size (sst));
317 sst.ast_ht_ptr = next_available;
318 sst.ast_ht_n_buckets = n_buckets;
319 sst.ast_ht_uid_mask = uid_mask;
320 next_available = addrel (next_available, n_buckets);
321
322 sst.astap, astep = next_available;
323
324
325
326 sst.astl_event = "400000000000"b3;
327 sst.temp_w_event = "200000000000"b3;
328
329 call init_aste_pools;
330
331
332
333
334
335
336
337
338 if ^early_call
339 then do i = 0 to 7;
340 base = scs$controller_data (i).base;
341 top = base + scs$controller_config_size (i) - 1;
342 if scs$controller_data (i).online | scs$controller_data (i).offline
343 then begin;
344 declare 1 THIS_CTRL_CME (0:top - base) aligned like cme defined (CME (base));
345
346 scs$controller_data (i).abs_wired = (base < suptop);
347
348
349 THIS_CTRL_CME.contr = bit (bin (i, 3));
350 end;
351 end;
352 else do i = lbound (scs$controller_data, 1) to hbound (scs$controller_data, 1);
353 base = scs$controller_data (i).base;
354 top = base + 511;
355 if (scs$controller_data (i).online | scs$controller_data (i).offline) & base = 0
356 then begin;
357 declare 1 THIS_CTRL_CME (0:top - base) aligned like cme defined (CME (base));
358
359 scs$controller_data (i).abs_wired = "1"b;
360
361
362 THIS_CTRL_CME.contr = bit (bin (i, 3));
363 end;
364 end;
365
366 if early_call
367 then do page_no = divide (slt.free_core_start + 1023, 1024, 24, 0)
368 to divide (slt.free_core_start + slt.free_core_size - 1, 1024, 24, 0) - 1;
369
370 call freecore (page_no);
371 end;
372 else do page_no = suptop to total_base - 1, total_top + 1 to initbase - 1;
373
374 call freecore (page_no);
375 end;
376
377 sst.space (*) = -1;
378
379
380 sst.write_limit = slt.free_core_size / 8192;
381
382
383
384 sst.segmove_lock.pid = ""b;
385 declare SEGM char (4) init ("segm") int static options (constant);
386 sst.segmove_lock.event = unspec (SEGM);
387 sst.segmove_lock.notify = "0"b;
388 sst.segmove_io_limit = 20;
389 sst.segmove_found_synch = 0;
390 sst.segmove_synch_disappeared = 0;
391 sst.segmove_max_tries = 0;
392 sst.segmove_astep, sst.segmove_old_addr_astep, sst.segmove_new_addr_astep = null;
393
394 sst.segmove_pvtx, sst.segmove_vtocx = 0;
395
396 sst.seg_state_change_limit = 256;
397 sst.max_seg_state_change_bw = 50;
398 sst.audit_seg_state_change_bw = 5;
399 return;
400 ^L
401
402
403
404 init_ptrs:
405 procedure;
406 sstp = addr (sst_seg$);
407 sstnp = addr (sst_names_$);
408 sltp = addr (slt$);
409 cmp = addr (core_map$);
410 end init_ptrs;
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428 ^L
429
430
431 %page; %include flagbox;
432 %page; %include null_addresses;
433 %page; %include scs;
434 %page; %include config_sst_card;
435 %include config_parm_card;
436 %include config_deck;
437 %page; %include sst;
438 %page; %include aste;
439 %page; %include slt;
440 %page; %include slte;
441 %page; %include cmp;
442 %page; %include sdw_info;
443 %page; %include sstnt;
444 %page; %include syserr_constants;
445 %page; %include unpaged_page_tables;
446 ^L
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478 end init_sst;