1 /****^ ***********************************************************
2 * *
3 * Copyright, C Honeywell Bull Inc., 1987 *
4 * *
5 * Copyright, C Honeywell Information Systems Inc., 1982 *
6 * *
7 *********************************************************** */
8
9 /* format: style4,indattr,ifthenstmt,ifthen,idind35,^indcomtxt */
10
11 /* WARNING: THIS PROGRAM MUST BE RUN THROUGH PL1_MACRO BEFORE COMPILATION */
12
13 real_initializer:
14 procedure;
15
16 /* * REAL_INITIALIZER
17 *
18 * This is the driving procedure for Multics initialization. It is called from
19 * initializer, a component of bound_active_1 which exists solely to call this
20 * program, so this program can be an init-seg and get deleted. Because it is
21 * essentially an extension of initializer itself, it calls itself initializer.
22 *
23 * As of this program's installation, the collection structure
24 * of the MST is as follows:
25 * "collection" 0:
26 * - the bootable label, if booted from tape bootload_tape_label
27 * - bound_bootload_0, which:
28 * & sets up a fault environment
29 * & loads tape firmware as needed, finding in in collection 0.5
30 * & loads collection 1.0
31 * & transfers to bootload_1 which
32 * sets up the pl1 environment, and calls initializer,
33 * which calls us.
34 * - other segments at fixed absolute locations, such as the
35 * flagbox, and iom_mailbox.
36 * collection 0.5
37 * - firmware images for tape mpc's. bound_bootload_0 reads through
38 * these until it finds the one it wants, and then uses it
39 * to boot the MPC. It and all other are then discarded.
40
41 * collection 1.0
42 * - formerly collection 1. Programs to initialize paging and io.
43 * they include this program, and are called by it.
44 * collection 1.2
45 * - runcoms, config decks, etc for bootload Multics command level.
46 * They are loaded after the loading of collection 1.0 but before
47 * entering any user subsystems. They are paged.
48 * collection 1.5
49 * - programs paged off the bce partition for use by bce.
50
51 * collection 2.0:
52 * - formerly collection 2. The hardcore file system and relatives.
53 *
54 * collection 3.0:
55 * - user ring programs neccessary for a cold boot.
56 *
57 * This program can be called on in a number of situations.
58 * First, there either is or is not a config deck available.
59 * This is indicated by the value of sys_boot_info$assume_config
60 * deck.
61 * Second, there are three possible initializations to be performed:
62 * - service Multics. Complete initialization and return
63 * to initializer.pl1 for the call out to ring 1.
64 * - Collection 1 command level. Complete initialization as
65 * far as making segs paged, but use a special partition
66 * on the RPV other than the HC partition. Store an image
67 * of the unpaged collection 1 environment on disk to be
68 * returned to in case of a crash, before making_segs_paged.
69 * - cool boot without BOS, and therefore
70 * without a config deck. This happens iff sys_boot_info$assume_config
71 * deck is off. Fabricate a minimal config, asking the operator
72 * or trusting sys_boot_info for the RPV model, device, and channel,
73 * load firmware into the rpv disk mpc. Read a config deck from
74 * the config partition on the RPV, then start one of the other
75 * two initializations using the real config deck.
76 *
77 *****************************************************************************
78 ****** JOURNALIZATION *******************************************************
79 *****************************************************************************
80 *
81 * Modification history:
82 * 80-12-21, W. Olin Sibert: Split out of initializer.pl1
83 * 82-07-01, BIM: Partially rethought, and brought up to date with
84 * current version of initializer.pl1 mr10.0
85 * 82-08-01, BIM: Metering and check_stop added back.
86 * 82-08-12, JJB: RLV parasites expunged, scavenger added
87 * 83-02-05, ENK: kst_util$garbage_collect
88 * 83-04-15, KPL: bootload command level, through 5/84.
89 * 83-06-20, E. A. Ranzenbach: Modified for ocdcm_$init_all_consoles
90 * and ocdcm_$reconfigure.
91 * 83-06-26, CLJ: Deleted iobm stuff
92 * 84-08-20, KPL: Modified to not call scs_and_clock_init
93 * when shutting down bce.
94 * 84-10-17, WOS: Modified for new init_syserr_log and to initialize
95 * syserr log names in ring zero instead of AS initialization.
96 * 84-11-09, ADB: Added entry point collection_2 and collection_3 to
97 * make setting breakpoints in bce probe easier.
98 * 85-01-09, Keith Loepere: fix retry_rpv.
99 * 85-01-23, Keith Loepere: power up date/time software in paged bce;
100 * permanent collection 1.5 segs.
101 */
102
103 /****^ HISTORY COMMENTS:
104 1) change86-06-05GJohnson, approve86-06-05MCR7387,
105 audit86-06-10Martinson, install86-07-11MR12.0-1091:
106 Correct error message documentation.
107 2) change86-09-05Farley, approve86-07-18MCR7439,
108 audit86-09-24Fawcett, install86-10-20MR12.0-1189:
109 To move IOI into collection 1.0, so that it will be available
110 at BCE. Also reset sys_info$service_system. Added missing MESSAGE doc.
111 END HISTORY COMMENTS */
112
113 /**** MEMORY LAYOUT ISSUES:
114 * when this program is called, all of collection 1 has
115 * been loaded into the first 512K of absolute memory.
116 * init-segs and to-be-made-paged segs are high, and
117 * everything else perm-wired segs are low.
118 *
119 * Depending on what kind of initialization we are up to,
120 * this may need rearrangement.
121 *
122 * If service is to be booted, the high segments are relocated
123 * to actually high memory, leaving the low memory to be used
124 * for the sst and core map which want to be high in the low
125 * controller.
126 *
127 * If we are booting the command environment, everything is left as is,
128 * since the returnable-to system will be a pre-make-segs-paged
129 * core image, and it wants to be restricted to 512K.
130 *
131 * If there is no config deck at all, then we have no idea
132 * memory is around, and there is no choice but to stay in 512K.
133 * Once the config deck has been read, all memory obtained with
134 * get_main is returned, and a command environment initialization is
135 * undertaken.
136 *
137 * If the config deck is changed, initialization to store
138 * the returnable-to system is repeated.
139 *
140 * To turn a command environment into a service boot, the special
141 * segments, if any, are deleted, the memory allocated with
142 * get_main is returned, and a service initialization is undertaken.
143
144 */
145
146 %set STOP_NUM to 0;
147
148 dcl addr builtin;
149 dcl baseptr builtin;
150 dcl bin builtin;
151 dcl binary builtin;
152 dcl null builtin;
153 dcl pointer builtin;
154 dcl substr builtin;
155
156 dcl code fixed bin 35;
157 dcl done_one_initialization bit 1 aligned;
158 dcl meter_initialization bit 1 aligned;
159 dcl parm_ptr pointer;
160 dcl ready_to_y_and_s bit 1 aligned;
161 dcl saved_free_core_size fixed bin 24;
162 dcl saved_free_core_start fixed bin 24; /* Saved state of the SLT core allocation marks */
163 dcl saved_iupt_lth fixed bin; /* allocations in int_unpaged_page_tables */
164 dcl saved_upt_lth fixed bin; /* in unpaged_page_tables */
165 dcl yell_and_scream bit 1 aligned;
166
167 dcl bce_abs_seg$free entry;
168 dcl config_$find entry char 4 aligned pointer;
169 dcl config_$find_parm entry char 4 aligned pointer;
170 dcl condition_ entry char * entry;
171 dcl initial_error_handler entry;
172 dcl ocdcm_$reconfigure entry char 4 fixed bin 17 fixed bin 35;
173 dcl pmut$set_mask entry bit 72 aligned;
174 dcl pmut$trace_rsw entry bit 36 aligned;
175 dcl syserr entry options variable;
176 dcl syserr$error_code entry options variable;
177
178 dcl active_all_rings_data$system_id char 32 ext static;
179 dcl active_all_rings_data$version_id char 32 ext static;
180 dcl bce_request_table_$bce_request_table_ ext static;
181 dcl config_deck$ 4096 bit 36 aligned ext static;
182 dcl int_unpaged_page_tables$ ext static;
183 dcl safe_config_deck$ 4096 bit 36 aligned ext static;
184 dcl scs$sys_level bit 72 aligned external static;
185 dcl slt$ fixed bin external static;
186 dcl sys_boot_info$assume_config_deck bit 1 aligned external; /* implies BOS, by the way */
187 dcl sys_boot_info$boot_without_query bit 1 aligned external static;
188 dcl sys_boot_info$bootload_mem_size fixed bin 26 ext static;
189 dcl sys_boot_info$config_has_been_modified bit 1 aligned ext static;
190 dcl sys_boot_info$contig_mem_size fixed bin 26 ext static;
191 dcl sys_boot_info$rpv_cold_boot bit 1 aligned external static;
192 dcl sys_boot_info$system_type fixed bin external static;
193 dcl sys_info$initialization_state fixed bin external static;
194 dcl sys_info$service_system bit 1 aligned external static;
195 dcl sys_info$system_type fixed bin external static;
196 dcl 1 toehold$ aligned external like toe_hold;
197 dcl unpaged_page_tables$ ext static;
198 %page;
199
200 /* The programs called to to actual intitialization-like things. */
201
202 dcl accept_rpv entry;
203 dcl announce_chwm$after entry;
204 dcl announce_chwm$before entry;
205 dcl bce_get_to_command_level entry ptr;
206 dcl collect_free_core entry;
207 dcl dbm_man$init entry;
208 dcl debug_check$copy_card entry;
209 dcl delete_segs$temp entry;
210 dcl dir_lock_init entry;
211 dcl disk_reader$init entry;
212 dcl disk_reader$final entry;
213 dcl establish_config_deck entry;
214 dcl establish_temp_segs entry;
215 dcl find_file_partition entry;
216 dcl find_rpv_subsystem entry;
217 dcl fnp_init entry;
218 dcl get_io_segs entry;
219 dcl getuid$init entry;
220 dcl init_bce$paged entry;
221 dcl init_bce$wired entry;
222 dcl init_branches entry;
223 dcl init_dm_journal_seg entry;
224 dcl init_early_config entry;
225 dcl init_hardcore_gates entry;
226 dcl init_lvt entry;
227 dcl init_partitions entry;
228 dcl init_pvt entry;
229 dcl init_root_dir entry;
230 dcl init_root_vols entry fixed bin 35;
231 dcl init_scavenger_data entry;
232 dcl init_sst$early entry;
233 dcl init_sst$normal entry;
234 dcl init_sst_name_seg entry;
235 dcl init_stack_0 entry;
236 dcl init_str_seg entry;
237 dcl init_sys_var entry;
238 dcl init_toehold entry;
239 dcl init_toehold$save_safe_config_deck entry;
240 dcl init_vtoc_man entry;
241 dcl initialize_faults$fault_init_one entry;
242 dcl initialize_faults$fault_init_two entry;
243 dcl initialize_faults$interrupt_init entry;
244 dcl io_config_init entry;
245 dcl ioi_init entry;
246 dcl ioi_page_table$init entry;
247 dcl iom_data_init entry;
248 dcl kst_util$garbage_collect entry fixed bin 35;
249 dcl load_disk_mpcs entry;
250 dcl load_mst entry;
251 dcl load_mst$init_commands entry;
252 dcl load_mst$make_permanent entry;
253 dcl load_system entry;
254 dcl make_segs_paged entry;
255 dcl move_non_perm_wired_segs entry;
256 dcl ocdcm_$init_all_consoles entry;
257 dcl pre_link_hc entry;
258 dcl read_disk$init entry;
259 dcl scas_init entry;
260 dcl scs_and_clock_init$date_time entry;
261 dcl scs_and_clock_init$early entry;
262 dcl scs_and_clock_init$normal entry;
263 dcl segment_loader entry;
264 dcl init_syserr_log entry;
265 dcl syserr_seg_manager$initialize_log_names entry;
266 dcl tape_reader$final entry;
267 dcl tape_reader$init entry;
268 dcl tc_init entry;
269 dcl tc_init$early entry;
270 dcl tc_init$part_2 entry;
271 dcl tc_init$start_other_cpus entry;
272 %page;
273 /* Set up debugging flags */
274
275 done_one_initialization = "0"b;
276 meter_initialization = "0"b;
277 yell_and_scream = "0"b;
278
279 sys_info$system_type = sys_boot_info$system_type;
280 addr unpaged_page_tables$ -> upt.sst_absloc = 0;
281 addr unpaged_page_tables$ -> upt.sst_last_loc = 0; /* so we don't confuse page table lookers */
282
283 addr flagbox$ -> fgbx.return_to_bce_command = "";
284
285 if sys_boot_info$assume_config_deck then do; /* if we came from BOS */
286 parm_ptr = null;
287 call config_$find_parm "mtin" parm_ptr;
288 meter_initialization = parm_ptr ^= null;
289
290 parm_ptr = null ;
291 call config_$find_parm "erly" parm_ptr;
292 if parm_ptr ^= null then sys_boot_info$assume_config_deck = "0"b;
293 end;
294
295 /* Whatever the task at hand, set up fault handling */
296 /* The prds, set up by a call from scs_and_clock_init, is */
297 /* needed. */
298
299 /* if meter_initialization then call initial_meters$init; */
300
301 /* Everyone is interested in the SLT */
302
303 sltp = addr slt$;
304
305 /* This cannot have any effect until faults are initialized */
306
307 call condition_ "any_other" initial_error_handler;
308
309 /* First see if we need to do an exceptional initialization to */
310 /* Find the config deck. */
311
312 ready_to_y_and_s = "0"b;
313
314 sys_info$service_system = "0"b;
315 sys_info$initialization_state = 1;
316 sys_info$collection_1_phase = EARLY_INITIALIZATION;
317
318 if sys_boot_info$assume_config_deck then do;
319
320 /* When running BOS, we turn on rpv_cold_boot so that the normal pass */
321 /* of init_root_vols will format the root. When not running BOS, */
322 /* this is done in the early initialization pass. */
323
324 intk_cardp = null ;
325 call config_$find INTK_CARD_WORD intk_cardp;
326 if intk_cardp = null then call syserr CRASH "initializer: intk card missing.";
327 sys_boot_info$rpv_cold_boot = intk_card.warm_or_cold = "cold";
328 intk_card.warm_or_cold = "warm";
329
330 /* warm/cold here implies that of bce. warm/cold of service is decided in boot
331 command */
332
333 %set STOP_NUM to STOP_NUM + 1;
334
335 call check_stop STOP_NUM "scs_and_clock_init$normal";
336 call scs_and_clock_init$normal; /* may get called again to reflect config deck changes */
337
338 sys_info$collection_1_phase = BOOT_INITIALIZATION;
339 end;
340
341 bootload_Multics:
342 if sys_info$collection_1_phase ^= SERVICE_INITIALIZATION then do;
343 call collection_1;
344 if toehold$.memory_state = At_bce__shutdown then do; /* return from a previous boot */
345 call TURN_OFF$$masked;
346 sys_info$collection_1_phase = SHUT_INITIALIZATION; /* start up again */
347 end;
348 else if toehold$.memory_state = At_bce__crash then do;
349 call TURN_OFF$$masked;
350 if toehold$.multics_state.old_memory_state = At_bce__early then sys_info$collection_1_phase = RE_EARLY_INITIALIZATION;
351 else if toehold$.multics_state.old_memory_state = At_bce__boot then sys_info$collection_1_phase = BCE_CRASH_INITIALIZATION;
352 else sys_info$collection_1_phase = CRASH_INITIALIZATION; /* we made it far enough to feel config_deck was not the crash cause */
353 end;
354 else do; /* normal pass completion */
355 call TURN_OFF;
356 if sys_info$collection_1_phase = EARLY_INITIALIZATION then
357 sys_info$collection_1_phase = BOOT_INITIALIZATION;
358 else sys_info$collection_1_phase = SERVICE_INITIALIZATION;
359 end;
360 go to bootload_Multics;
361 end;
362
363 /* Perform normal initialization. */
364
365 call collection_1;
366 %page;
367 collection_1:
368 proc;
369
370 /* Repeated collection 1 initialization. This is run 4 times for
371 corresponding values of sys_info$collection_1_phase. First to find the
372 config deck. Second to set up the crash handler and command environments.
373 Fourth for service. The first uses limited everything. The second uses
374 limited memory and sst. The fourth uses all.
375 The "third" time is when we shutdown and crash to rebuild tables. */
376
377 collection_1_start:
378 if sys_info$collection_1_phase = RE_EARLY_INITIALIZATION | sys_info$collection_1_phase = BCE_CRASH_INITIALIZATION then
379 config_deck$ = safe_config_deck$;
380
381 sys_boot_info$config_has_been_modified = "0"b; /* set when modified forces query when booting service */
382
383 ready_to_y_and_s = "0"b;
384
385 saved_free_core_start = slt.free_core_start;
386 saved_free_core_size = slt.free_core_size;
387 saved_iupt_lth = addr int_unpaged_page_tables$ -> upt.current_length;
388 saved_upt_lth = addr unpaged_page_tables$ -> upt.current_length;
389 sys_boot_info$contig_mem_size = sys_boot_info$bootload_mem_size;
390 /* for the benefit of announce_chwm */
391
392 if sys_info$collection_1_phase = EARLY_INITIALIZATION then do;
393
394 %set STOP_NUM to STOP_NUM + 1;
395
396 call check_stop STOP_NUM "init_early_config";
397 call init_early_config; /* Fill in console clock default tape mpc itk sst tcd */
398 /* bootload cpu mem iom and dummy rpv subsystem */
399 end;
400
401 %set STOP_NUM to STOP_NUM + 1;
402
403 RETRY_RPV:
404 if sys_info$collection_1_phase = EARLY_INITIALIZATION then do;
405 /* The early entrypoint is as the normal except that it fills in */
406 /* port number on the cpu card. */
407 call check_stop STOP_NUM "scs_and_clock_init$early";
408 call scs_and_clock_init$early;
409 end;
410 else do;
411 call check_stop STOP_NUM "scs_and_clock_init$normal";
412 call scs_and_clock_init$normal; /* get new clok card if there is one */
413 end;
414
415 %set STOP_NUM to STOP_NUM + 1;
416
417 call check_stop STOP_NUM "initialize_faults$fault_init_one";
418 call initialize_faults$fault_init_one;
419
420 %set STOP_NUM to STOP_NUM + 1;
421
422 if sys_info$collection_1_phase = SERVICE_INITIALIZATION then do;
423 call check_stop STOP_NUM "move_non_perm_wired_segs";
424 call move_non_perm_wired_segs; /* use memory move segs fix SLT header */
425 end;
426
427 %set STOP_NUM to STOP_NUM + 1;
428
429 call check_stop STOP_NUM "get_io_segs";
430 call get_io_segs; /* Allocate the disk_seg pvt iom_data and ioi_data */
431 /* appropriately for the configuration */
432
433 %set STOP_NUM to STOP_NUM + 1;
434
435 call check_stop STOP_NUM "iom_data_init";
436 call iom_data_init; /* Initialize the iom_data for all configured devices. */
437
438 %set STOP_NUM to STOP_NUM + 1;
439
440 call check_stop STOP_NUM "ocdcm_$init_all_consoles";
441 call ocdcm_$init_all_consoles;
442
443 parm_ptr = null;
444 call config_$find_parm "loud" parm_ptr;
445 yell_and_scream = parm_ptr ^= null;
446
447 ready_to_y_and_s = "1"b;
448
449 %set STOP_NUM to STOP_NUM + 1;
450
451 call check_stop STOP_NUM "scas_init";
452 call scas_init; /* Set up the SCAS again */
453
454 %set STOP_NUM to STOP_NUM + 1;
455
456 if sys_info$collection_1_phase ^= SERVICE_INITIALIZATION then do;
457 call check_stop STOP_NUM "tc_init$early";
458 call tc_init$early;
459 end;
460 else do;
461 call check_stop STOP_NUM "tc_init";
462 call tc_init;
463 end;
464
465 %set STOP_NUM to STOP_NUM + 1;
466
467 if sys_info$collection_1_phase = SERVICE_INITIALIZATION then do;
468 call check_stop STOP_NUM "init_sst$normal";
469 call init_sst$normal; /* Set up the full sized SST with table sizes determined */
470 end;
471 else do;
472 call check_stop STOP_NUM "init_sst$early";
473 call init_sst$early;
474 end;
475
476 call debug_check$copy_card; /* not worth a stop */
477
478 if sys_info$collection_1_phase = EARLY_INITIALIZATION
479 | sys_info$collection_1_phase = BOOT_INITIALIZATION
480 | sys_info$collection_1_phase = SERVICE_INITIALIZATION then
481 call announce_chwm$before; /* from the config deck and announce the size of memory. */
482
483 %set STOP_NUM to STOP_NUM + 1;
484
485 call check_stop STOP_NUM "disabling slt allocation";
486 slt.free_core_start slt.free_core_size = 0; /* no more SLT mem allocations */
487
488 %set STOP_NUM to STOP_NUM + 1;
489
490 call check_stop STOP_NUM "initialize_faults$interrupt_init";
491 call initialize_faults$interrupt_init;
492
493 %set STOP_NUM to STOP_NUM + 1;
494
495 if ^done_one_initialization then do;
496 call check_stop STOP_NUM "init_bce$wired";/* Bootload Command Environment */
497 call init_bce$wired;
498 end;
499
500 if sys_info$collection_1_phase = EARLY_INITIALIZATION then do;
501
502 /* This call locates the RPV either via sys_boot_info or */
503 /* operator query as needed. it fills in the config */
504 /* ROOT card and fixes the fields in the prph dska and appropriate mpc */
505 /* and someday mpcs cards. After it is called paging can really be setup */
506
507 %set STOP_NUM to STOP_NUM + 1;
508
509 call check_stop STOP_NUM "find_rpv_subsystem";
510 call find_rpv_subsystem;
511 end;
512
513 if ^sys_info$collection_1_phase = SERVICE_INITIALIZATION |
514 sys_info$collection_1_phase = EARLY_INITIALIZATION |
515 sys_info$collection_1_phase = BOOT_INITIALIZATION & sys_boot_info$assume_config_deck then do;
516
517 %set STOP_NUM to STOP_NUM + 1;
518
519 call check_stop STOP_NUM "load_disk_mpcs";
520 call load_disk_mpcs;
521 end;
522
523 %set STOP_NUM to STOP_NUM + 1;
524
525 call check_stop STOP_NUM "init_pvt";
526 call init_pvt;
527
528 %set STOP_NUM to STOP_NUM + 1;
529
530 call check_stop STOP_NUM "read_disk$init";
531 call read_disk$init; /* This has to come AFTER init_pvt */
532
533 %set STOP_NUM to STOP_NUM + 1;
534
535 call check_stop STOP_NUM "init_root_vols";
536 call init_root_vols code;
537 if code ^= 0 then
538 if sys_info$collection_1_phase = EARLY_INITIALIZATION then do;
539 sys_boot_info$boot_without_query = "0"b;
540 call TURN_OFF;
541 go to RETRY_RPV;
542 end;
543 else call syserr CRASH "initializer: bad root volume.";
544
545 %set STOP_NUM to STOP_NUM + 1;
546
547 if sys_info$collection_1_phase ^= SERVICE_INITIALIZATION then do;
548
549 call check_stop STOP_NUM "establish_temp_segs";
550 call establish_temp_segs;
551
552 %set STOP_NUM to STOP_NUM + 1;
553
554 call check_stop STOP_NUM "find_file_partition";
555 call find_file_partition;
556
557 if ^done_one_initialization then do;
558
559 %set STOP_NUM to STOP_NUM + 1;
560
561 call check_stop STOP_NUM "tape_reader$init";
562 call tape_reader$init; /* Initialize the tape reading package. */
563
564 %set STOP_NUM to STOP_NUM + 1;
565
566 call check_stop STOP_NUM "load_mst";
567 call load_mst;
568
569 %set STOP_NUM to STOP_NUM + 1;
570
571 call check_stop STOP_NUM "tape_reader$final";
572 call tape_reader$final;
573 end;
574
575 %set STOP_NUM to STOP_NUM + 1;
576
577 call check_stop STOP_NUM "load_mst$init_commands";
578 call load_mst$init_commands; /* and get into addr space
579 load_mst$make_permanent is the counterpart for service pass */
580
581 %set STOP_NUM to STOP_NUM + 1;
582
583 if ^done_one_initialization then do;
584 call check_stop STOP_NUM "init_bce$paged";
585 call init_bce$paged; /* and add to bce_data switches */
586 end;
587 end;
588 else do;
589
590 %set STOP_NUM to STOP_NUM + 1;
591
592 call check_stop STOP_NUM "load_mst$make_permanent";
593 call load_mst$make_permanent; /* move coll 1.5 perm segs into coll 2 */
594 end;
595
596 sys_boot_info$rpv_cold_boot = "0"b; /* in case it was on; we are done with special cold boot operations */
597
598 %set STOP_NUM to STOP_NUM + 1;
599
600 call check_stop STOP_NUM "scs_and_clock_init$date_time";
601 call scs_and_clock_init$date_time; /* power up the date/time software */
602
603 %set STOP_NUM to STOP_NUM + 1;
604
605 call check_stop STOP_NUM "io_config_init";
606 call io_config_init; /* initialize io_config_data */
607
608 %set STOP_NUM to STOP_NUM + 1;
609
610 call check_stop STOP_NUM "ioi_init";
611 call ioi_init; /* Initialize the I/O Interfacer. */
612
613 %set STOP_NUM to STOP_NUM + 1;
614
615 if sys_info$collection_1_phase = SHUT_INITIALIZATION then
616 sys_info$collection_1_phase = BOOT_INITIALIZATION;
617
618 safe_config_deck$ = config_deck$; /* config_deck$ is good save for crashing */
619
620 if ^done_one_initialization then do;
621 done_one_initialization = "1"b; /* don't redo per-system initializations set before saving toehold */
622
623 /* Set up crash handler. */
624
625 call check_stop STOP_NUM "init_toehold";
626 call init_toehold;
627 if toehold$.memory_state = At_bce__crash | toehold$.memory_state = At_bce__shutdown then return; /* return to bce returns to image saved here */
628 end;
629 else if sys_info$collection_1_phase = EARLY_INITIALIZATION | sys_info$collection_1_phase = BOOT_INITIALIZATION | sys_info$collection_1_phase = SERVICE_INITIALIZATION then do;
630 call check_stop STOP_NUM "init_toehold$save_safe_config_deck";
631 call init_toehold$save_safe_config_deck;
632 end;
633
634 if sys_info$collection_1_phase = RE_EARLY_INITIALIZATION then
635 sys_info$collection_1_phase = EARLY_INITIALIZATION;
636
637 if sys_info$collection_1_phase = EARLY_INITIALIZATION then
638 toehold$.memory_state = At_bce__early;
639 else if sys_info$collection_1_phase = BOOT_INITIALIZATION then
640 toehold$.memory_state = At_bce__boot;
641 else if sys_info$collection_1_phase = SERVICE_INITIALIZATION then
642 toehold$.memory_state = Multics;
643
644 if sys_info$collection_1_phase = EARLY_INITIALIZATION | sys_info$collection_1_phase = BOOT_INITIALIZATION | sys_info$collection_1_phase = CRASH_INITIALIZATION | sys_info$collection_1_phase = BCE_CRASH_INITIALIZATION then do;
645
646 %set STOP_NUM to STOP_NUM + 1;
647
648 call check_stop STOP_NUM "bce_get_to_command_level";
649 call bce_get_to_command_level addr bce_request_table_$bce_request_table_;
650
651 if sys_info$collection_1_phase = BCE_CRASH_INITIALIZATION then do; /* operator decided to boot again */
652 sys_info$collection_1_phase = BOOT_INITIALIZATION;
653 toehold$.memory_state = At_bce__boot;
654 end;
655
656 /* As of now the Early Initialization has completed its task. */
657 end;
658
659 %set STOP_NUM to STOP_NUM + 1;
660
661 call check_stop STOP_NUM "establish_config_deck";
662 call establish_config_deck; /* read in the config deck */
663
664 if sys_info$collection_1_phase = SERVICE_INITIALIZATION then do;
665
666 %set STOP_NUM to STOP_NUM + 1;
667
668 call check_stop STOP_NUM "init_partitions";
669 call init_partitions;
670
671 %set STOP_NUM to STOP_NUM + 1;
672
673 call check_stop STOP_NUM "make_segs_paged";
674 call make_segs_paged; /* Make all pageable segments paged */
675
676 %set STOP_NUM to STOP_NUM + 1;
677
678 call check_stop STOP_NUM "collect_free_core";
679 call collect_free_core; /* and collect all unused core */
680 call announce_chwm$after; /* Announce the results */
681 end;
682 return;
683
684 end collection_1;
685 %page;
686
687 %set STOP_NUM to STOP_NUM + 1;
688
689 call check_stop STOP_NUM "delete_segs$temp 1";
690 call delete_segs$temp; /* Delete collection one temp segs */
691
692 %set STOP_NUM to STOP_NUM + 1;
693
694 call check_stop STOP_NUM "disk_reader$init";
695 call disk_reader$init;
696
697 %set STOP_NUM to STOP_NUM + 1;
698
699 call check_stop STOP_NUM "segment_loader 2.0";
700 call segment_loader; /* Load collection 2 */
701
702 %set STOP_NUM to STOP_NUM + 1;
703
704 call check_stop STOP_NUM "pre_link_hc 2.0";
705 call pre_link_hc; /* prelink collection 2 */
706 %page;
707 /* COLLECTION TWO */
708
709 collection_2:
710 entry; /* This will make setting breakpoints in bce_probe easier. */
711
712
713 sys_info$initialization_state = 2; /* Begin collection 2 */
714
715 %set STOP_NUM to STOP_NUM + 1;
716
717 call check_stop STOP_NUM "initialize_faults$fault_init_two";
718 call initialize_faults$fault_init_two;
719
720 %set STOP_NUM to STOP_NUM + 1;
721
722 call check_stop STOP_NUM "getuid$init";
723 call getuid$init; /* set up UID generator */
724 %set STOP_NUM to STOP_NUM + 1;
725
726 call check_stop STOP_NUM "init_vtoc_man";
727 call init_vtoc_man; /* Set up vtoc_man's buffers */
728
729 %set STOP_NUM to STOP_NUM + 1;
730
731 call check_stop STOP_NUM "dbm_man$init";
732 call dbm_man$init; /* Init the volume dumper's bit map. */
733
734
735 %set STOP_NUM to STOP_NUM + 1;
736
737 call check_stop STOP_NUM "init_scavenger_data";
738 call init_scavenger_data;
739
740 %set STOP_NUM to STOP_NUM + 1;
741
742 call check_stop STOP_NUM "init_dm_journal_seg";
743 call init_dm_journal_seg;
744
745
746 %set STOP_NUM to STOP_NUM + 1;
747
748 call check_stop STOP_NUM "init_sys_var";
749 call init_sys_var; /* Set some system variables */
750
751 %set STOP_NUM to STOP_NUM + 1;
752
753 call check_stop STOP_NUM "dir_lock_init";
754 call dir_lock_init;
755
756 %set STOP_NUM to STOP_NUM + 1;
757
758 /* ioi_page_table$init is also called by ioi_init but this call is
759 needed to have it switch over to using io_page_table_seg. */
760
761 call check_stop STOP_NUM "ioi_page_table$init";
762 call ioi_page_table$init; /* setup standard io_page_table_seg */
763
764 %set STOP_NUM to STOP_NUM + 1;
765
766 call check_stop STOP_NUM "fnp_init";
767 call fnp_init; /* make tty_buf SDW before tc_init$part_2 */
768
769 /* * After this point changes to the hardcore descriptor segment may
770 * not be reflected in idle process and hproc descriptor segments.
771 */
772
773 %set STOP_NUM to STOP_NUM + 1;
774
775 call check_stop STOP_NUM "tc_init$part_2";
776 call tc_init$part_2; /* Stage 2 of traffic control initialization */
777
778
779 %set STOP_NUM to STOP_NUM + 1;
780
781 call check_stop STOP_NUM "init_syserr_log";
782 call init_syserr_log ;
783
784 call syserr LOG "initializer: Multics ^a ^a syserr logging initialized" active_all_rings_data$system_id
785 active_all_rings_data$version_id;
786
787
788 %set STOP_NUM to STOP_NUM + 1;
789
790 call check_stop STOP_NUM "init_str_seg";
791 call init_str_seg; /* Initialize the trailer seg */
792
793 %set STOP_NUM to STOP_NUM + 1;
794
795 call check_stop STOP_NUM "init_sst_name_seg";
796 call init_sst_name_seg; /* Set up the SST name table */
797
798
799 %set STOP_NUM to STOP_NUM + 1;
800
801 call check_stop STOP_NUM "init_hardcore_gates";
802 call init_hardcore_gates; /* initialize linkage pointers in gates */
803
804 /* The permanent file system has not been touched up to this point.
805 Everything has been placed in the hc partition. */
806
807
808 %set STOP_NUM to STOP_NUM + 1;
809
810 call check_stop STOP_NUM "accept_rpv";
811 call accept_rpv; /* Flush PD salvage load vol map */
812
813 %set STOP_NUM to STOP_NUM + 1;
814
815 call check_stop STOP_NUM "init_lvt";
816 call init_lvt; /* get LVT in order */
817
818 call condition_ "bad_dir_" bad_dir_handler;
819 call condition_ "seg_fault_error" seg_fault_handler;
820
821 %set STOP_NUM to STOP_NUM + 1;
822
823 call check_stop STOP_NUM "init_root_dir";
824 call init_root_dir; /* Make the "root" known. */
825
826 %set STOP_NUM to STOP_NUM + 1;
827
828 call check_stop STOP_NUM "kst_util$garbage_collect";
829 call kst_util$garbage_collect 0; /* Clean up the KST after salvaging */
830
831 %set STOP_NUM to STOP_NUM + 1;
832
833 call check_stop STOP_NUM "init_branches";
834 call init_branches; /* Set up branches for init. and per-process segs. */
835
836 %set STOP_NUM to STOP_NUM + 1;
837
838 call check_stop STOP_NUM "syserr_seg_manager$initialize_log_names";
839 call syserr_seg_manager$initialize_log_names ;
840
841 %set STOP_NUM to STOP_NUM + 1;
842
843 call check_stop STOP_NUM "init_stack_0";
844 call init_stack_0;
845
846 %set STOP_NUM to STOP_NUM + 1;
847
848 call check_stop STOP_NUM "delete_segs$temp 2.0";
849 call delete_segs$temp; /* Delete collection 2 temp segs */
850 %page;
851
852 /*
853 Initialize collection 3.
854 */
855 sys_info$initialization_state = 3; /* Begin collection 3 */
856
857 collection_3:
858 entry; /* This will make setting breakpoints in bce_probe easier. */
859
860 %set STOP_NUM to STOP_NUM + 1;
861
862 call check_stop STOP_NUM "load_system";
863 call load_system; /* Load collection 3. */
864
865 %set STOP_NUM to STOP_NUM + 1;
866
867 call check_stop STOP_NUM "disk_reader$final";
868 call disk_reader$final;
869
870 %set STOP_NUM to STOP_NUM + 1;
871
872 call check_stop STOP_NUM "tc_init$start_other_cpus";
873
874
875 call tc_init$start_other_cpus; /* Start up additional CPUs */
876 sys_info$initialization_state = 4; /* Begin normal operation collection 4 */
877 sys_info$service_system = "1"b;
878
879 %set STOP_NUM to STOP_NUM + 1;
880
881 call check_stop STOP_NUM "init_proc";
882
883 return;
884 %page;
885 bad_dir_handler:
886 procedure a_mcp a_condition a_infop a_wcp a_continue;
887
888 dcl a_mcp pointer parameter;
889 dcl a_condition char * parameter;
890 dcl a_infop pointer parameter;
891 dcl a_wcp pointer parameter;
892 dcl a_continue bit 1 aligned parameter;
893
894 dcl ppr pointer;
895 dcl tpr pointer;
896
897 dcl pvt$root_pvtx fixed bin ext;
898
899 pvt_arrayp = addr pvt$array;
900 pvt_array pvt$root_pvtx.vol_trouble_count = pvt_array pvt$root_pvtx.vol_trouble_count + 1;
901
902
903 CRASH_BAD_DIR:
904 call syserr CRASH "initializer: bad_dir_ signal raised.";
905 goto CRASH_BAD_DIR;
906
907
908
909 seg_fault_handler:
910 entry a_mcp a_condition a_infop a_wcp a_continue;
911
912 mcp = a_mcp;
913 scup = addr mc.scu;
914 ppr = pointer baseptr binary scu.psr 15 scu.ilc;
915 tpr = pointer baseptr binary scu.tsr 15 scu.ca;
916
917 CRASH_SEG_FAULT:
918 call syserr$error_code CRASH mc.errcode "initializer: Segment fault error by ^p referencing ^p:" ppr tpr;
919 goto CRASH_SEG_FAULT;
920
921 end bad_dir_handler;
922
923 check_stop:
924 procedure P_Stop_Number About_To;
925 dcl P_Stop_Number fixed bin;
926 dcl About_To char *;
927 dcl cpu_switches bit 36 aligned;
928 dcl call_bce entry;
929 dcl stop_number fixed bin;
930 dcl Stop_Number fixed bin;
931
932 Stop_Number = P_Stop_Number + 1000 * sys_info$collection_1_phase;
933
934 /* if meter_initialization then call initialization_meters$entry Stop_Number About_To; */
935
936 if yell_and_scream & ready_to_y_and_s then call syserr ANNOUNCE "initializer: ^d^20t^a^2xstate ^d^2xphase ^d." Stop_Number About_To sys_info$initialization_state sys_info$collection_1_phase;
937
938 call pmut$trace_rsw cpu_switches;
939 if substr cpu_switches 1 9 = "123"b3 then do;
940 stop_number = BCD substr cpu_switches 10 24;
941 if stop_number = Stop_Number then do;
942 if yell_and_scream & ready_to_y_and_s then call syserr ANNOUNCE "initializer: ^a check_stop." About_To;
943 call call_bce;
944 end;
945 end;
946
947 BCD:
948 procedure Bits returns fixed bin;
949
950 declare Bits bit 24;
951 declare digits 4 fixed bin;
952 declare digits_bits 4 bit 6 unaligned defined Bits;
953
954 digits = bin digits_bits 6; /* Aggregate */
955 return digits 1 * 1000 + digits 2 * 100 + digits 3 * 10 + digits 4;
956 end BCD;
957
958 end check_stop;
959
960 TURN_OFF: procedure;
961
962 dcl not_masked bit 1 aligned init "0"b;
963
964 not_masked = "1"b;
965
966 TURN_OFF$$masked: entry; /* We are already masked; also our masks may be screwed up so don't try masking. */
967
968 ready_to_y_and_s = "0"b;
969 if not_masked then call ocdcm_$reconfigure "" SUSPEND_CONSOLE_SERVICE 0; /* deactivate the console... */
970 addr syserr_data$syserr_area -> sd.ocdcm_init_flag = "0"b; /* PANIC */
971
972 call bce_abs_seg$free; /* release SDWs */
973
974 if not_masked then call pmut$set_mask scs$sys_level;
975 call initialize_faults$fault_init_one;
976
977 addr int_unpaged_page_tables$ -> upt.current_length = saved_iupt_lth;
978 addr unpaged_page_tables$ -> upt.current_length = saved_upt_lth;
979 slt.free_core_start = saved_free_core_start;
980 slt.free_core_size = saved_free_core_size;
981 addr unpaged_page_tables$ -> upt.sst_absloc = 0;
982 addr unpaged_page_tables$ -> upt.sst_last_loc = 0; /* so we don't confuse page table lookers */
983 return;
984 end TURN_OFF;
985 %page; %include collection_1_phases;
986 %page; %include config_intk_card;
987 %page; %include flagbox;
988 %page; %include opc_reconfig_options;
989 %page; %include pvt;
990 %page; %include pvte;
991 %page; %include slt;
992 %page; %include syserr_constants;
993 %page; %include syserr_data;
994 %page; %include toe_hold;
995 %page; %include unpaged_page_tables;
996 %page;
997 /* BEGIN MESSAGE DOCUMENTATION
998
999 Message:
1000 initializer: intk card missing.
1001
1002 S: $crash
1003
1004 T: $init
1005
1006 M: No "intk" card was found in the config deck.
1007
1008 A: $config
1009
1010 Message:
1011 initializer: Bad root volume.
1012
1013 S: $crash
1014
1015 T: $init
1016
1017 M: A volume specified on a ROOT card was found ill formatted by
1018 init_root_vols.
1019
1020 A: $recover
1021
1022 Message:
1023 initializer: Multics SYSID VERSION syserr logging initialized.
1024
1025 S: $log
1026
1027 T: $init
1028
1029 M: This is the first syserr message produced by every bootload. It is
1030 produced as soon as the syserr logging mechanism is made operative which
1031 insures that it is the first message logged for every bootload. It
1032 identifies the system ID and version of the running system.
1033
1034 A: $ignore
1035
1036 Message:
1037 initializer: bad_dir_ signal raised
1038
1039 S: $crash
1040
1041 T: $init
1042
1043 M: During system bootload directory control has encountered an invalid
1044 directory. This usually occurs due to damage to the root or to
1045 >system_control_1. The RPV is automatically scheduled for volume salvage.
1046
1047 A: $recover
1048
1049 Message:
1050 initializer: Segment fault error by PPPP referencing PPPP: ERROR
1051
1052 S: $crash
1053
1054 T: $init
1055
1056 M: During system bootload a segment fault error has occurred. This
1057 usually indicates running out of room on the RLV. A BOOT RPVS may recover
1058 some of this space. The procedure causing the error and the segment being
1059 referenced are identified along with the error message.
1060
1061 A: $recover
1062
1063 Message:
1064 initializer: STOP_NUM ENTRY_TO_CALL state ISTATE phase CPHASE.
1065
1066 S: $beep
1067
1068 T: $init
1069
1070 M: The "loud" config parm is currently enabled. This message gives the
1071 current stop number STOP_NUM that can be used to stop the initialization
1072 process and return to BCE before calling ENTRY_TO_CALL. The current values
1073 of sys_info$initialization_state ISTATE and sys_info$collection_1_phase
1074 CPHASE are also given.
1075
1076 A: $ignore
1077
1078 Message:
1079 initializer: ENTRY_TO_CALL check_stop.
1080
1081 S: $beep
1082
1083 T: $init
1084
1085 M: The initializer has detected that the first nine data switches on the CPU
1086 contain an octal "123" and the STOP number of the entry to be called and the
1087 current collection_1_phase match the other CPU data switches. The
1088 initializer calls BCE after displaying this message but before actually
1089 calling the entry. The CPU data switches have the following usage:
1090 .spf;.inl +10;.unl +9
1091 0 - 8: must be set to an octal "123" for any other switches to be valid.
1092 .unl +9
1093 9 - 14: area for the BCD value of the collection_1_phase to stop in.
1094 .unl +9
1095 15 - 20: area for the BCD hundreds digit of the STOP number.
1096 .unl +9
1097 21 - 26: area for the BCD tens digit of the STOP number.
1098 .unl +9
1099 27 - 32: area for the BCD ones digit of the STOP number.
1100 .unl +9
1101 33 - 35: not used or checked.
1102 .inl -10
1103
1104 A: Execute any BCE functions desired. Modify the setting of the CPU data
1105 switches as required. Execute the BCE "go" function to resume initialization.
1106
1107 END MESSAGE DOCUMENTATION */
1108 end real_initializer;