Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcmips/hpcmips call config_hook_init before autoco...



details:   https://anonhg.NetBSD.org/src/rev/b06472304b09
branches:  trunk
changeset: 480613:b06472304b09
user:      uch <uch%NetBSD.org@localhost>
date:      Sun Jan 16 20:01:41 2000 +0000

description:
call config_hook_init before autoconfiguration.
initalize hr_mode.

diffstat:

 sys/arch/hpcmips/hpcmips/autoconf.c    |   9 +++++++--
 sys/arch/hpcmips/hpcmips/config_hook.c |  32 ++++++++------------------------
 2 files changed, 15 insertions(+), 26 deletions(-)

diffs (132 lines):

diff -r beb2c3d33f60 -r b06472304b09 sys/arch/hpcmips/hpcmips/autoconf.c
--- a/sys/arch/hpcmips/hpcmips/autoconf.c       Sun Jan 16 18:34:42 2000 +0000
+++ b/sys/arch/hpcmips/hpcmips/autoconf.c       Sun Jan 16 20:01:41 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.4 1999/09/25 03:09:01 takemura Exp $    */
+/*     $NetBSD: autoconf.c,v 1.5 2000/01/16 20:01:41 uch Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 1999/09/25 03:09:01 takemura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.5 2000/01/16 20:01:41 uch Exp $");
 
 /*
  * Setup the system to run on the current machine.
@@ -68,6 +68,8 @@
 #include <machine/autoconf.h>
 #include <machine/sysconf.h>
 
+#include <machine/config_hook.h>
+
 int    cpuspeed = 7;   /* approx # instr per usec. */
 
 static char booted_device_name[16];
@@ -85,6 +87,9 @@
 {
        /* Kick off autoconfiguration. */
        (void)splhigh();
+
+       config_hook_init();
+
        if (config_rootfound("mainbus", "mainbus") == NULL)
                panic("no mainbus found");
 
diff -r beb2c3d33f60 -r b06472304b09 sys/arch/hpcmips/hpcmips/config_hook.c
--- a/sys/arch/hpcmips/hpcmips/config_hook.c    Sun Jan 16 18:34:42 2000 +0000
+++ b/sys/arch/hpcmips/hpcmips/config_hook.c    Sun Jan 16 20:01:41 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: config_hook.c,v 1.1 1999/12/23 06:26:09 takemura Exp $ */
+/*     $NetBSD: config_hook.c,v 1.2 2000/01/16 20:01:41 uch Exp $      */
 
 /*-
  * Copyright (c) 1999
@@ -34,8 +34,6 @@
  *
  */
 
-#define XXX_AUTO_INIT  /* XXX, Where would we call config_hook_init() from? */
-
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/malloc.h>
@@ -60,14 +58,6 @@
 config_hook_init()
 {
        int i;
-#ifdef XXX_AUTO_INIT
-       static int initialized = 0;
-
-       if (initialized) {
-               return;
-       }
-       initialized = 1;
-#endif
 
        for (i = 0; i < CONFIG_HOOK_NTYPES; i++) {
                LIST_INIT(&hook_lists[i]);
@@ -85,9 +75,6 @@
        struct hook_rec *hr, *prev_hr;
        int s;
 
-#ifdef XXX_AUTO_INIT
-       config_hook_init();
-#endif
        /* Check type value. */
        if (type < 0 || CONFIG_HOOK_NTYPES <= type) {
                panic("config_hook: invalid hook type");
@@ -101,8 +88,9 @@
             hr = LIST_NEXT(hr, hr_link)) {
                if (hr->hr_id == id) {
                        if (hr->hr_mode != mode) {
-                               panic("config_hook: incompatible mode on type=%d/id=%d",
-                                     type, id);
+                               panic("config_hook: incompatible mode on "
+                                     "type=%d/id=%d != %d", 
+                                     type, id, hr->hr_mode);
                        }
                        prev_hr = hr;
                }
@@ -123,8 +111,8 @@
                break;
        case CONFIG_HOOK_EXCLUSIVE:
                if (prev_hr != NULL) {
-                       panic("config_hook: type=%d/id=%ld is already hooked",
-                             type, id);
+                       panic("config_hook: type=%d/id=%ld is already "
+                             "hooked(%d)", type, id, prev_hr);
                }
                break;
        default:
@@ -139,6 +127,8 @@
        hr->hr_type = type;
        hr->hr_id = id;
        hr->hr_func = func;
+       hr->hr_mode = mode;
+
        s = splhigh();
        LIST_INSERT_HEAD(&hook_lists[type], hr, hr_link);
        splx(s);
@@ -153,9 +143,6 @@
        int s;
        struct hook_rec *hr = (struct hook_rec*)hrx;
 
-#ifdef XXX_AUTO_INIT
-       config_hook_init();
-#endif
        if (hr->hr_link.le_next != NULL) {
                s = splhigh();
                LIST_REMOVE(hr, hr_link);
@@ -174,9 +161,6 @@
        int res;
        struct hook_rec *hr;
 
-#ifdef XXX_AUTO_INIT
-       config_hook_init();
-#endif
        /* Check type value. */
        if (type < 0 || CONFIG_HOOK_NTYPES <= type) {
                panic("config_hook: invalid hook type");



Home | Main Index | Thread Index | Old Index