]> Zhao Yanbai Git Server - minix.git/commitdiff
Kernel: make shutdown more verbose 77/377/2
authorThomas Veerman <thomas@minix3.org>
Thu, 28 Feb 2013 17:04:15 +0000 (17:04 +0000)
committerThomas Veerman <thomas@minix3.org>
Mon, 4 Mar 2013 10:13:50 +0000 (10:13 +0000)
Change-Id: Iab5fed4cb617a9dbce164ff81c7dedf408e9fd98

kernel/arch/i386/arch_reset.c
kernel/main.c

index c78e8746d9e71775afe3b635229de378f49f3215..2b4fc7fed4da02136f7c36dbf148870bd41eaba5 100644 (file)
@@ -84,13 +84,13 @@ void
 poweroff(void)
 {
        const char *shutdown_str;
-       
+
        /* Bochs/QEMU poweroff */
        shutdown_str = "Shutdown";
         while (*shutdown_str) outb(0x8900, *(shutdown_str++));
-       
-       /* fallback option: reset */
-       reset();
+
+       /* fallback option: hang */
+       for (; ; ) halt_cpu();
 }
 
 __dead void arch_shutdown(int how)
@@ -120,12 +120,12 @@ __dead void arch_shutdown(int how)
 
        switch (how) {
                case RBT_HALT:
-                       /* Stop */
+                       /* Hang */
                        for (; ; ) halt_cpu();
                        NOT_REACHABLE;
                        
                case RBT_POWEROFF:
-                       /* Power off if possible, reset otherwise */
+                       /* Power off if possible, hang otherwise */
                        poweroff();
                        NOT_REACHABLE;
 
index 48ac623689fe1b02adb44bd81a644ee62c4b10e9..87ec3523a8759a5f25b712d07b9013f83f241b00 100644 (file)
@@ -351,6 +351,8 @@ void minix_shutdown(timer_t *tp)
  * down MINIX. How to shutdown is in the argument: RBT_HALT (return to the
  * monitor), RBT_RESET (hard reset). 
  */
+  int how;
+
 #ifdef CONFIG_SMP
   /* 
    * FIXME
@@ -364,7 +366,27 @@ void minix_shutdown(timer_t *tp)
 #endif
   hw_intr_disable_all();
   stop_local_timer();
-  arch_shutdown(tp ? tmr_arg(tp)->ta_int : RBT_PANIC);
+
+  how = tp ? tmr_arg(tp)->ta_int : RBT_PANIC;
+
+  /* Show shutdown message */
+  direct_cls();
+  switch(how) {
+  case RBT_HALT:
+       direct_print("MINIX has halted. "
+                    "It is safe to turn off your computer.\n");
+       break;
+  case RBT_POWEROFF:
+       direct_print("MINIX has halted and will now power off.\n");
+       break;
+  case RBT_DEFAULT:
+  case RBT_REBOOT:
+  case RBT_RESET:
+  default:
+       direct_print("MINIX will now reset.\n");
+       break;
+  }
+  arch_shutdown(how);
 }
 
 /*===========================================================================*