Source-Changes-HG archive

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

[src/trunk]: src Do not call setroot() from MD code and from MI code, which has



details:   https://anonhg.NetBSD.org/src/rev/140a7d8870ef
branches:  trunk
changeset: 780562:140a7d8870ef
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jul 29 18:05:39 2012 +0000

description:
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.

No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().

Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().

Make cpu_rootconf(9) describe the calling order.

diffstat:

 share/man/man9/cpu_rootconf.9               |  42 +++++++++++++++++++++-------
 sys/arch/acorn26/acorn26/autoconf.c         |   7 ++--
 sys/arch/acorn32/acorn32/autoconf.c         |   6 ++--
 sys/arch/algor/algor/autoconf.c             |   6 ++--
 sys/arch/alpha/alpha/autoconf.c             |   6 ++--
 sys/arch/amiga/amiga/autoconf.c             |   9 ++----
 sys/arch/amigappc/amigappc/autoconf.c       |   9 ++----
 sys/arch/arc/arc/autoconf.c                 |   7 ++--
 sys/arch/atari/atari/autoconf.c             |   6 ++--
 sys/arch/bebox/bebox/autoconf.c             |   6 ++--
 sys/arch/cats/cats/autoconf.c               |   6 ++--
 sys/arch/cesfic/cesfic/autoconf.c           |   6 ++--
 sys/arch/cobalt/cobalt/autoconf.c           |   6 ++--
 sys/arch/dreamcast/dreamcast/autoconf.c     |   6 ++--
 sys/arch/emips/emips/autoconf.c             |   6 ++--
 sys/arch/evbarm/evbarm/autoconf.c           |   6 ++--
 sys/arch/evbmips/adm5120/autoconf.c         |   6 ++--
 sys/arch/evbmips/alchemy/autoconf.c         |   6 ++--
 sys/arch/evbmips/atheros/autoconf.c         |   6 ++--
 sys/arch/evbmips/gdium/autoconf.c           |   6 ++--
 sys/arch/evbmips/loongson/autoconf.c        |   6 ++--
 sys/arch/evbmips/malta/autoconf.c           |   6 ++--
 sys/arch/evbmips/rasoc/autoconf.c           |   6 ++--
 sys/arch/evbmips/rmixl/autoconf.c           |   6 ++--
 sys/arch/evbppc/ev64260/autoconf.c          |   6 ++--
 sys/arch/evbppc/explora/autoconf.c          |   6 ++--
 sys/arch/evbppc/mpc85xx/autoconf.c          |   6 ++--
 sys/arch/evbppc/obs405/obs405_autoconf.c    |   6 ++--
 sys/arch/evbppc/pmppc/autoconf.c            |   6 ++--
 sys/arch/evbppc/virtex/autoconf.c           |   6 ++--
 sys/arch/evbppc/walnut/autoconf.c           |   6 ++--
 sys/arch/evbsh3/evbsh3/autoconf.c           |   6 ++--
 sys/arch/ews4800mips/ews4800mips/autoconf.c |  11 ++++---
 sys/arch/hp300/hp300/autoconf.c             |  10 ++----
 sys/arch/hp700/hp700/autoconf.c             |   7 ++--
 sys/arch/hpcarm/hpcarm/autoconf.c           |   6 ++--
 sys/arch/hpcmips/hpcmips/autoconf.c         |   8 ++--
 sys/arch/hpcsh/hpcsh/autoconf.c             |   6 ++--
 sys/arch/ia64/ia64/autoconf.c               |   4 +-
 sys/arch/ibmnws/ibmnws/autoconf.c           |   4 +-
 sys/arch/iyonix/iyonix/autoconf.c           |   6 ++--
 sys/arch/landisk/landisk/autoconf.c         |   6 ++--
 sys/arch/luna68k/luna68k/autoconf.c         |   6 ++--
 sys/arch/mac68k/mac68k/autoconf.c           |   6 ++--
 sys/arch/mipsco/mipsco/autoconf.c           |   6 ++--
 sys/arch/mmeye/mmeye/autoconf.c             |   6 ++--
 sys/arch/mvme68k/mvme68k/autoconf.c         |   7 ++--
 sys/arch/mvmeppc/mvmeppc/autoconf.c         |   6 ++--
 sys/arch/netwinder/netwinder/autoconf.c     |   6 ++--
 sys/arch/news68k/news68k/autoconf.c         |   6 ++--
 sys/arch/newsmips/newsmips/autoconf.c       |   6 ++--
 sys/arch/next68k/next68k/autoconf.c         |   6 ++--
 sys/arch/pmax/pmax/autoconf.c               |   6 ++--
 sys/arch/powerpc/oea/ofw_autoconf.c         |   6 ++--
 sys/arch/prep/prep/autoconf.c               |   6 ++--
 sys/arch/rs6000/rs6000/autoconf.c           |   6 ++--
 sys/arch/sandpoint/sandpoint/autoconf.c     |   6 ++--
 sys/arch/sbmips/sbmips/autoconf.c           |   6 ++--
 sys/arch/sgimips/sgimips/autoconf.c         |   6 ++--
 sys/arch/shark/shark/autoconf.c             |   6 ++--
 sys/arch/sparc/sparc/autoconf.c             |  14 ++++-----
 sys/arch/sparc64/sparc64/autoconf.c         |   8 ++---
 sys/arch/sun3/sun3/autoconf.c               |  22 ++++++--------
 sys/arch/sun68k/sun68k/autoconf.c           |  24 +++++++--------
 sys/arch/usermode/dev/cpu.c                 |   7 ++--
 sys/arch/vax/vax/autoconf.c                 |   6 ++--
 sys/arch/x68k/x68k/autoconf.c               |   6 ++--
 sys/arch/x86/x86/x86_autoconf.c             |   6 ++--
 sys/arch/xen/x86/autoconf.c                 |   6 ++--
 sys/arch/zaurus/zaurus/autoconf.c           |   6 ++--
 sys/kern/init_main.c                        |  17 ++++-------
 sys/sys/conf.h                              |   3 +-
 72 files changed, 271 insertions(+), 267 deletions(-)

diffs (truncated from 2099 to 300 lines):

diff -r 04ad8116159f -r 140a7d8870ef share/man/man9/cpu_rootconf.9
--- a/share/man/man9/cpu_rootconf.9     Sun Jul 29 14:44:13 2012 +0000
+++ b/share/man/man9/cpu_rootconf.9     Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: cpu_rootconf.9,v 1.6 2010/04/13 07:32:31 jruoho Exp $
+.\"     $NetBSD: cpu_rootconf.9,v 1.7 2012/07/29 18:05:48 mlelstv Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -32,6 +32,7 @@
 .Os
 .Sh NAME
 .Nm cpu_rootconf ,
+.Nm rootconf ,
 .Nm setroot
 .Nd root file system setup
 .Sh SYNOPSIS
@@ -40,6 +41,8 @@
 .Ft void
 .Fn cpu_rootconf "void"
 .Ft void
+.Fn rootconf "void"
+.Ft void
 .Fn setroot "device_t bootdv" "int bootpartition"
 .Sh DESCRIPTION
 The
@@ -47,16 +50,33 @@
 is a machine-dependent interface invoked during system bootstrap to
 determine the root file system device and initialize machine-dependent
 file system state.
+.Fn cpu_rootconf
+provides the global variables
+.Fa booted_device,
+.Fa booted_partition ,
+.Fa booted_startblk
+and
+.Fa booted_nblks
+and invokes the machine-independent function
+.Fa rootconf
+which 
+.Fa rootconf
+then calls the function
+.Fa setroot
+to record the boot/root device and the boot partition information
+for use in machine-independent code.
 .Pp
-The
-.Fn cpu_rootconf
-function invokes the machine-independent
-.Fn setroot
-function to record the boot/root device
-.Fa bootdv
-and the boot partition information
-.Fa bootpartition
-for use in machine-independent code.
+For disk boot, if
+.Fa booted_nblks
+is not 0, then
+.Fa booted_startblk
+and
+.Fa booted_nblks
+are supposed to specify a disk wedge that is used as the root device.
+Otherwise the
+.Fa booted_partition
+is used.
 .Sh SEE ALSO
 .Xr boot 8 ,
-.Xr boothowto 9
+.Xr boothowto 9 ,
+.Xr dk 4
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/acorn26/acorn26/autoconf.c
--- a/sys/arch/acorn26/acorn26/autoconf.c       Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/acorn26/acorn26/autoconf.c       Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.8 2011/12/17 14:51:07 kiyohara Exp $ */
+/* $NetBSD: autoconf.c,v 1.9 2012/07/29 18:05:39 mlelstv Exp $ */
 /*-
  * Copyright (c) 1998, 1999 Ben Harris
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.8 2011/12/17 14:51:07 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.9 2012/07/29 18:05:39 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -57,8 +57,7 @@
 cpu_rootconf(void)
 {
 
-       /* XXX This could actually do something */
-       setroot(NULL, 0);
+       rootconf();
 }
 
 void
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/acorn32/acorn32/autoconf.c
--- a/sys/arch/acorn32/acorn32/autoconf.c       Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/acorn32/acorn32/autoconf.c       Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.17 2011/06/03 07:35:37 matt Exp $       */
+/*     $NetBSD: autoconf.c,v 1.18 2012/07/29 18:05:39 mlelstv Exp $    */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.17 2011/06/03 07:35:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.18 2012/07/29 18:05:39 mlelstv Exp $");
 
 #include "opt_md.h"
 
@@ -137,7 +137,7 @@
        printf("boot device: %s\n",
            booted_device != NULL ? device_xname(booted_device) : "<unknown>");
 #endif
-       setroot(booted_device, booted_partition);
+       rootconf();
 }
 
 
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/algor/algor/autoconf.c
--- a/sys/arch/algor/algor/autoconf.c   Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/algor/algor/autoconf.c   Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.20 2011/07/09 16:03:00 matt Exp $       */
+/*     $NetBSD: autoconf.c,v 1.21 2012/07/29 18:05:39 mlelstv Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.20 2011/07/09 16:03:00 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.21 2012/07/29 18:05:39 mlelstv Exp $");
 
 #include "opt_algor_p4032.h"
 #include "opt_algor_p5064.h"
@@ -77,7 +77,7 @@
 cpu_rootconf(void)
 {
 
-       setroot(booted_device, booted_partition);
+       rootconf();
 }
 
 #if defined(ALGOR_P4032)
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/alpha/alpha/autoconf.c
--- a/sys/arch/alpha/alpha/autoconf.c   Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/alpha/alpha/autoconf.c   Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.51 2012/02/06 02:14:10 matt Exp $ */
+/* $NetBSD: autoconf.c,v 1.52 2012/07/29 18:05:39 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.51 2012/02/06 02:14:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.52 2012/07/29 18:05:39 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -100,7 +100,7 @@
        if (booted_device == NULL)
                printf("WARNING: can't figure what device matches \"%s\"\n",
                    bootinfo.booted_dev);
-       setroot(booted_device, booted_partition);
+       rootconf();
 }
 
 void
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/amiga/amiga/autoconf.c
--- a/sys/arch/amiga/amiga/autoconf.c   Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/amiga/amiga/autoconf.c   Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.112 2012/07/13 08:47:07 rkujawa Exp $   */
+/*     $NetBSD: autoconf.c,v 1.113 2012/07/29 18:05:39 mlelstv Exp $   */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.112 2012/07/13 08:47:07 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.113 2012/07/29 18:05:39 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -127,10 +127,7 @@
 #ifdef DEBUG_KERNEL_START
        printf("survived findroot()\n");
 #endif
-       setroot(booted_device, booted_partition);
-#ifdef DEBUG_KERNEL_START
-       printf("survived setroot()\n");
-#endif
+       rootconf();
 }
 
 /*ARGSUSED*/
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/amigappc/amigappc/autoconf.c
--- a/sys/arch/amigappc/amigappc/autoconf.c     Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/amigappc/amigappc/autoconf.c     Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.4 2011/06/18 08:08:27 matt Exp $        */
+/*     $NetBSD: autoconf.c,v 1.5 2012/07/29 18:05:39 mlelstv Exp $     */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2011/06/18 08:08:27 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.5 2012/07/29 18:05:39 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -91,10 +91,7 @@
 #ifdef DEBUG_KERNEL_START
        printf("survived findroot()\n");
 #endif
-       setroot(booted_device, booted_partition);
-#ifdef DEBUG_KERNEL_START
-       printf("survived setroot()\n");
-#endif
+       rootconf();
 }
 
 /*ARGSUSED*/
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/arc/arc/autoconf.c
--- a/sys/arch/arc/arc/autoconf.c       Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/arc/arc/autoconf.c       Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.33 2011/02/20 07:52:42 matt Exp $       */
+/*     $NetBSD: autoconf.c,v 1.34 2012/07/29 18:05:39 mlelstv Exp $    */
 /*     $OpenBSD: autoconf.c,v 1.9 1997/05/18 13:45:20 pefo Exp $       */
 
 /*
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.33 2011/02/20 07:52:42 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.34 2012/07/29 18:05:39 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -166,7 +166,8 @@
        printf("boot device: %s\n",
            booted_device ? booted_device->dv_xname : "<unknown>");
 
-       setroot(booted_device, booted_device ? bootdev_data->partition : 0);
+       booted_partition = booted_device ? bootdev_data->partition : 0;
+       rootconf();
 }
 
 struct devmap {
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/atari/atari/autoconf.c
--- a/sys/arch/atari/atari/autoconf.c   Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/atari/atari/autoconf.c   Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.62 2012/06/30 10:37:00 tsutsui Exp $    */
+/*     $NetBSD: autoconf.c,v 1.63 2012/07/29 18:05:40 mlelstv Exp $    */
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.62 2012/06/30 10:37:00 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.63 2012/07/29 18:05:40 mlelstv Exp $");
 
 #include "opt_md.h"
 
@@ -119,7 +119,7 @@
                }
        }
 #endif
-       setroot(booted_device, booted_partition);
+       rootconf();
 }
 
 /*ARGSUSED*/
diff -r 04ad8116159f -r 140a7d8870ef sys/arch/bebox/bebox/autoconf.c
--- a/sys/arch/bebox/bebox/autoconf.c   Sun Jul 29 14:44:13 2012 +0000
+++ b/sys/arch/bebox/bebox/autoconf.c   Sun Jul 29 18:05:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.24 2011/06/18 08:08:27 matt Exp $       */
+/*     $NetBSD: autoconf.c,v 1.25 2012/07/29 18:05:40 mlelstv Exp $    */



Home | Main Index | Thread Index | Old Index