Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Centralize cpu_reboot().



details:   https://anonhg.NetBSD.org/src/rev/dd31bfc01d40
branches:  trunk
changeset: 960822:dd31bfc01d40
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Mar 30 01:33:50 2021 +0000

description:
Centralize cpu_reboot().

diffstat:

 sys/arch/evbppc/explora/machdep.c        |  48 +--------------
 sys/arch/evbppc/obs405/obs200_machdep.c  |  90 +----------------------------
 sys/arch/evbppc/obs405/obs266_machdep.c  |  90 +----------------------------
 sys/arch/evbppc/obs405/obs600_machdep.c  |  90 +----------------------------
 sys/arch/evbppc/virtex/machdep.c         |  99 +-------------------------------
 sys/arch/evbppc/walnut/machdep.c         |  91 +----------------------------
 sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c |  83 ++++++++++++++++++++++++++-
 7 files changed, 93 insertions(+), 498 deletions(-)

diffs (truncated from 783 to 300 lines):

diff -r 643f0cf43e18 -r dd31bfc01d40 sys/arch/evbppc/explora/machdep.c
--- a/sys/arch/evbppc/explora/machdep.c Tue Mar 30 01:16:45 2021 +0000
+++ b/sys/arch/evbppc/explora/machdep.c Tue Mar 30 01:33:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.46 2021/03/07 09:43:56 rin Exp $ */
+/*     $NetBSD: machdep.c,v 1.47 2021/03/30 01:33:50 rin Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.46 2021/03/07 09:43:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.47 2021/03/30 01:33:50 rin Exp $");
 
 #include "opt_explora.h"
 #include "opt_modular.h"
@@ -178,47 +178,3 @@
         */
        fake_mapiodev = 0;
 }
-
-void
-cpu_reboot(int howto, char *what)
-{
-       static int syncing = 0;
-
-       boothowto = howto;
-       if (!cold && !(howto & RB_NOSYNC) && !syncing) {
-               syncing = 1;
-               vfs_shutdown();
-               resettodr();
-       }
-
-       splhigh();
-
-       if (!cold && (howto & RB_DUMP))
-               /*XXX dumpsys()*/;
-
-       doshutdownhooks();
-
-       pmf_system_shutdown(boothowto);
-
-       if (howto & RB_HALT) {
-               printf("halted\n\n");
-
-               while (1)
-                       ;
-       }
-
-       printf("rebooting\n\n");
-
-       /* flush cache for msgbuf */
-       __syncicache((void *)msgbuf_paddr, round_page(MSGBUFSIZE));
-
-       ppc4xx_reset();
-
-#ifdef DDB
-       while (1)
-               Debugger();
-#else
-       while (1)
-               ;
-#endif
-}
diff -r 643f0cf43e18 -r dd31bfc01d40 sys/arch/evbppc/obs405/obs200_machdep.c
--- a/sys/arch/evbppc/obs405/obs200_machdep.c   Tue Mar 30 01:16:45 2021 +0000
+++ b/sys/arch/evbppc/obs405/obs200_machdep.c   Tue Mar 30 01:33:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obs200_machdep.c,v 1.21 2021/03/30 01:16:45 rin Exp $  */
+/*     $NetBSD: obs200_machdep.c,v 1.22 2021/03/30 01:33:50 rin Exp $  */
 /*     Original: machdep.c,v 1.3 2005/01/17 17:24:09 shige Exp */
 
 /*
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obs200_machdep.c,v 1.21 2021/03/30 01:16:45 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs200_machdep.c,v 1.22 2021/03/30 01:33:50 rin Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -122,11 +122,6 @@
 
 #define        TLB_PG_SIZE     (16*1024*1024)
 
-/*
- * Global variables used here and there
- */
-extern paddr_t msgbuf_paddr;
-
 void initppc(vaddr_t, vaddr_t, char *, void *);
 
 void
@@ -212,87 +207,6 @@
        fake_mapiodev = 0;
 }
 
-/*
- * Halt or reboot the machine after syncing/dumping according to howto.
- */
-void
-cpu_reboot(int howto, char *what)
-{
-       static int syncing;
-       static char str[256];
-       char *ap = str, *ap1 = ap;
-
-       boothowto = howto;
-       if (!cold && !(howto & RB_NOSYNC) && !syncing) {
-               syncing = 1;
-               vfs_shutdown();         /* sync */
-               resettodr();            /* set wall clock */
-       }
-
-       splhigh();
-
-       if (!cold && (howto & RB_DUMP))
-               ibm4xx_dumpsys();
-
-       doshutdownhooks();
-
-       pmf_system_shutdown(boothowto);
-
-       if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
-         /* Power off here if we know how...*/
-       }
-
-       if (howto & RB_HALT) {
-               printf("halted\n\n");
-
-#if 0
-               goto reboot;    /* XXX for now... */
-#endif
-
-#ifdef DDB
-               printf("dropping to debugger\n");
-               while(1)
-                       Debugger();
-#endif
-       }
-
-       printf("rebooting\n\n");
-       if (what && *what) {
-               if (strlen(what) > sizeof str - 5)
-                       printf("boot string too large, ignored\n");
-               else {
-                       strcpy(str, what);
-                       ap1 = ap = str + strlen(str);
-                       *ap++ = ' ';
-               }
-       }
-       *ap++ = '-';
-       if (howto & RB_SINGLE)
-               *ap++ = 's';
-       if (howto & RB_KDB)
-               *ap++ = 'd';
-       *ap++ = 0;
-       if (ap[-2] == '-')
-               *ap1 = 0;
-
-       /* flush cache for msgbuf */
-       __syncicache((void *)msgbuf_paddr, round_page(MSGBUFSIZE));
-
-#if 0
- reboot:
-#endif
-       ppc4xx_reset();
-
-       printf("ppc4xx_reset() failed!\n");
-#ifdef DDB
-       while(1)
-               Debugger();
-#else
-       while (1)
-               /* nothing */;
-#endif
-}
-
 int
 ibm4xx_pci_bus_maxdevs(void *v, int busno)
 {
diff -r 643f0cf43e18 -r dd31bfc01d40 sys/arch/evbppc/obs405/obs266_machdep.c
--- a/sys/arch/evbppc/obs405/obs266_machdep.c   Tue Mar 30 01:16:45 2021 +0000
+++ b/sys/arch/evbppc/obs405/obs266_machdep.c   Tue Mar 30 01:33:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obs266_machdep.c,v 1.22 2021/03/30 01:16:45 rin Exp $  */
+/*     $NetBSD: obs266_machdep.c,v 1.23 2021/03/30 01:33:50 rin Exp $  */
 /*     Original: md_machdep.c,v 1.3 2005/01/24 18:47:37 shige Exp $    */
 
 /*
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: obs266_machdep.c,v 1.22 2021/03/30 01:16:45 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: obs266_machdep.c,v 1.23 2021/03/30 01:33:50 rin Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_ddb.h"
@@ -122,11 +122,6 @@
 
 #define        TLB_PG_SIZE     (16*1024*1024)
 
-/*
- * Global variables used here and there
- */
-extern paddr_t msgbuf_paddr;
-
 void initppc(vaddr_t, vaddr_t, char *, void *);
 
 void
@@ -203,87 +198,6 @@
        fake_mapiodev = 0;
 }
 
-/*
- * Halt or reboot the machine after syncing/dumping according to howto.
- */
-void
-cpu_reboot(int howto, char *what)
-{
-       static int syncing;
-       static char str[256];
-       char *ap = str, *ap1 = ap;
-
-       boothowto = howto;
-       if (!cold && !(howto & RB_NOSYNC) && !syncing) {
-               syncing = 1;
-               vfs_shutdown();         /* sync */
-               resettodr();            /* set wall clock */
-       }
-
-       splhigh();
-
-       if (!cold && (howto & RB_DUMP))
-               ibm4xx_dumpsys();
-
-       doshutdownhooks();
-
-       pmf_system_shutdown(boothowto);
-
-       if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
-         /* Power off here if we know how...*/
-       }
-
-       if (howto & RB_HALT) {
-               printf("halted\n\n");
-
-#if 0
-               goto reboot;    /* XXX for now... */
-#endif
-
-#ifdef DDB
-               printf("dropping to debugger\n");
-               while(1)
-                       Debugger();
-#endif
-       }
-
-       printf("rebooting\n\n");
-       if (what && *what) {
-               if (strlen(what) > sizeof str - 5)
-                       printf("boot string too large, ignored\n");
-               else {
-                       strcpy(str, what);
-                       ap1 = ap = str + strlen(str);
-                       *ap++ = ' ';
-               }
-       }
-       *ap++ = '-';
-       if (howto & RB_SINGLE)
-               *ap++ = 's';
-       if (howto & RB_KDB)
-               *ap++ = 'd';
-       *ap++ = 0;
-       if (ap[-2] == '-')
-               *ap1 = 0;
-
-       /* flush cache for msgbuf */
-       __syncicache((void *)msgbuf_paddr, round_page(MSGBUFSIZE));
-
-#if 0
- reboot:
-#endif
-       ppc4xx_reset();
-
-       printf("ppc4xx_reset() failed!\n");
-#ifdef DDB
-       while(1)
-               Debugger();
-#else
-       while (1)
-               /* nothing */;
-#endif
-}
-
 int



Home | Main Index | Thread Index | Old Index