call config_hook_init before autoconfiguration.

initalize hr_mode.
This commit is contained in:
uch 2000-01-16 20:01:41 +00:00
parent 68f1c29b5a
commit dac63389a8
2 changed files with 15 additions and 26 deletions

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 1999/09/25 03:09:01 takemura Exp $"
#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 @@ cpu_configure()
{
/* Kick off autoconfiguration. */
(void)splhigh();
config_hook_init();
if (config_rootfound("mainbus", "mainbus") == NULL)
panic("no mainbus found");

View File

@ -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 @@ void
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 @@ config_hook(type, id, mode, func, ctx)
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 @@ config_hook(type, id, mode, func, ctx)
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 @@ config_hook(type, id, mode, func, ctx)
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 @@ config_hook(type, id, mode, func, ctx)
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 @@ config_unhook(hrx)
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 @@ config_hook_call(type, id, msg)
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");