1 /****^  ***********************************************************
  2         *                                                         *
  3         * Copyright, (C) Honeywell Bull Inc., 1987                *
  4         *                                                         *
  5         * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  6         *                                                         *
  7         * Copyright (c) 1972 by Massachusetts Institute of        *
  8         * Technology and Honeywell Information Systems, Inc.      *
  9         *                                                         *
 10         *********************************************************** */
 11 
 12 
 13 wired_shutdown$wired_emergency: procedure;
 14 
 15 /* Created by Bernard Greenberg, 03/29/76, when he removed
 16    wired_shutdown from wired_shutdown and unwired it. What is left
 17    is a pl1-coded transitional interface between
 18    ESD and shutdown */
 19 
 20 /*  Modified 06/07/76 by Greenberg for vtoc_man$stabilize */
 21 /*  Modified 03/14/77 by Greenberg for ESD with drive down */
 22 /*  Modified 02/28/82 by J. Bongiovanni to eliminate use of FSDCT, reset PVT entries */
 23 /*  Modified March 1982 by J. Bongiovanni to call shutdown_file_system */
 24 /*  Modified August 1982 by J. Bongiovanni to reset scavenge */
 25 /*  Modified 830620 for new ocdcm_$drain_io call... -E. A. Ranzenbach */
 26 /*  Modified 8/83 for pmut$bce - K. Loepere */
 27 /*  Modified  84-01-17 BIM for get_pvtx$reset. */
 28 
 29 dcl  pc$flush entry;
 30 dcl  page$reset_pvte entry (ptr);
 31 dcl  pmut$bce entry;
 32 dcl  ocdcm_$drain_io entry ();
 33 dcl  syserr entry options (variable);
 34 dcl  vtoc_man$stabilize entry;
 35 dcl  get_pvtx$reset entry;
 36 dcl  pmut$set_mask entry (fixed bin (71), fixed bin (71));
 37 dcl  fsout_vol entry (fixed bin, fixed bin);
 38 dcl  shutdown_file_system entry;
 39 dcl  control char (8) static internal init ("tooearly");
 40 
 41 
 42 dcl  scs$open_level fixed bin (71) ext;
 43 
 44 dcl  pvt$shutdown_state fixed bin external,
 45      pvt$esd_state fixed bin external,
 46      pvt$n_entries fixed bin external,
 47      sst$root_pvtx fixed bin external;
 48 
 49 
 50 dcl  save_mask fixed bin (71);
 51 dcl  condition_ entry (char (*), entry);
 52 dcl  pvtx fixed bin;
 53 
 54 /* This portion of emergency shutdown gets entered on the
 55    shutdown_stack after preliminary resetting has been
 56    accomplished.                                             */
 57 
 58           call condition_ ("any_other", handler);
 59           call pmut$set_mask (scs$open_level, save_mask);   /* Open mask to allow I/O interrupts. */
 60 
 61           if control = "tooearly" | sst$root_pvtx = 0 then do;
 62                call syserr (0, "esd before fs enabled");
 63 shut:          call syserr (0, "shutdown complete");
 64                call ocdcm_$drain_io;                                            /* quies the console...                 */
 65                do while ("1"b);
 66                     call pmut$bce;
 67                end;
 68           end;
 69 
 70           pvt_arrayp = addr (pvt$array);
 71 
 72           if ^pvt_array (sst$root_pvtx).used then do;
 73                call syserr (0, "system already shut down");
 74                go to shut;
 75           end;
 76 
 77           vtoc_buffer_segp = addr (vtoc_buffer_seg$);       /* Mark trouble pv, perhaps */
 78           if vtoc_buffer.unsafe_pvtx > 0 then do;
 79                pvt_array (vtoc_buffer.unsafe_pvtx).vol_trouble_count = pvt_array (vtoc_buffer.unsafe_pvtx).vol_trouble_count + 1;
 80                vtoc_buffer.unsafe_pvtx = 0;
 81           end;
 82 
 83           do pvtx = 1 to pvt$n_entries;
 84                pvtep = addr (pvt_array (pvtx));
 85                if pvte.used
 86                     then do;
 87                     pvte.scav_check_address = "0"b;
 88                     pvte.scavenger_block_rel = ""b;
 89                     call page$reset_pvte (pvtep);
 90                end;
 91           end;
 92 
 93           call get_pvtx$reset; /* mark trouble for all held pvte's
 94                                   and release all held pvtes. */
 95 
 96           call syserr (0, "begin emergency shutdown part 1.");
 97 
 98 
 99           pvt$shutdown_state = 1;                           /* Indicate that esd part 1 started */
100           pvt$esd_state = 1;                                /* System in ESD */
101           call fsout_vol (sst$root_pvtx, 0);                /* Get this fact out */
102 
103           call pc$flush;                                    /* Flush out all pages in core. */
104           pvt$shutdown_state = 2;                           /* Indicate that emergency shutdown part 1 is successful. */
105           pvt$esd_state = 2;
106           call fsout_vol (sst$root_pvtx, 0);
107 
108           call syserr (0, "emergency shutdown part 1 complete.");
109 
110           call vtoc_man$stabilize;                          /* Get VTOC buffers in shape */
111           call shutdown_file_system;                        /* Try to complete a normal shutdown now. */
112           return;                                           /* Should never happen */
113 
114 enable:   entry;
115           control = "enabled";
116           return;
117 
118 handler:  proc (mcptr, condname, coptr, infoptr, cont);
119 
120 dcl (mcptr, coptr, infoptr) ptr;
121 dcl  condname char (*);
122 dcl  cont bit (1);
123 
124                call syserr (1, "wired_shutdown: ^a fault during emergency shutdown", condname);
125 
126           end handler;
127 
128           ^L %include pvte;
129           ^L %include vtoc_buffer;
130 
131 
132 ^L
133 /* BEGIN MESSAGE DOCUMENTATION
134 
135    Message:
136    esd before fs enabled
137 
138    S: $info
139 
140    T: Emergency shutdown
141 
142    M: The system crashed before the storage system was accessed by
143    Multics. An ESD was attempted, but no ESD is necessary.
144    The "shutdown complete" message will always follow.
145 
146    A: Reboot the system.
147 
148    Message:
149    shutdown complete
150 
151    S: $info
152 
153    T: Emergency shutdown
154 
155    M: Emergency shutdown is complete; this message was
156    preceded by either "esd before fs enabled" or
157    "system already shut down":
158    no ESD was necessary.
159 
160    A: Reboot the system.
161 
162    Message:
163    system already shut down
164 
165    S: $info
166 
167    T: Emergency shutdown
168 
169    M: An attempt to perform emergency shutdown was made after
170    a previous attempt, or normal shutdown, succeeded. No ESD
171    is necessary in this case. The "shutdown complete" message
172    follows.
173 
174    A: $ignore
175 
176    Message:
177    begin emergency shutdown part 1
178 
179    S: $info
180 
181    T: Emergency shutdown
182 
183    M: The system emergency shutdown environment has been
184    successfully established. An attempt will be made to write
185    out all of memory and flush the paging device.
186 
187    A: $ignore
188 
189    Message:
190    emergency shutdown part 1 complete
191 
192    S: $info
193 
194    T: Emergency shutdown
195 
196    M: All of memory has been written out once, and those
197    pages on the paging device which could be written out to
198    operative drives flushed. All segments and directories will
199    now be deactivated, and all drives shut down.
200 
201    A: $ignore
202 
203    Message:
204    wired_shutdown: FFF fault during emergency shutdown
205 
206    S: $crash
207 
208    T: Emergency shutdown
209 
210    M: An unexpected fault has occured during emergency
211    shutdown.  Emergency shutdown
212    cannot complete.
213 
214    A: Get a dump for system programmers. If an disk dump was taken
215    of the preceding crash, get a dump to paper via the bce dump facility.
216    Re-attempt ESD as many times as necessary.
217 
218    END MESSAGE DOCUMENTATION */
219 
220 
221      end;