- Centralize the declaration and clearing of `cold'.
- Call configure() after setting up proc0. - Call initclocks() from configure(), after cpu_configure(). Once the clocks are running, clear `cold'. Then run interrupt-driven autoconfiguration.
This commit is contained in:
parent
11cae42531
commit
0d7a86c356
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init_main.c,v 1.155 1999/09/15 18:10:34 thorpej Exp $ */
|
||||
/* $NetBSD: init_main.c,v 1.156 1999/09/17 20:11:56 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Christopher G. Demetriou. All rights reserved.
|
||||
@ -129,6 +129,7 @@ extern struct user *proc0paddr;
|
||||
|
||||
struct vnode *rootvp, *swapdev_vp;
|
||||
int boothowto;
|
||||
int cold = 1; /* still working on startup */
|
||||
struct timeval boottime;
|
||||
struct timeval runtime;
|
||||
|
||||
@ -209,12 +210,14 @@ main()
|
||||
/* Initialize sockets. */
|
||||
soinit();
|
||||
|
||||
disk_init(); /* must come before autoconfiguration */
|
||||
tty_init(); /* initialise tty list */
|
||||
/*
|
||||
* The following 3 things must be done before autoconfiguration.
|
||||
*/
|
||||
disk_init(); /* initialize disk list */
|
||||
tty_init(); /* initialize tty list */
|
||||
#if NRND > 0
|
||||
rnd_init();
|
||||
rnd_init(); /* initialize RNG */
|
||||
#endif
|
||||
configure(); /* configure the hardware */
|
||||
|
||||
/*
|
||||
* Initialize process and pgrp structures.
|
||||
@ -318,8 +321,8 @@ main()
|
||||
#endif
|
||||
vfsinit();
|
||||
|
||||
/* Start real time and statistics clocks. */
|
||||
initclocks();
|
||||
/* Configure the system hardware. This will enable interrupts. */
|
||||
configure();
|
||||
|
||||
#ifdef SYSVSHM
|
||||
/* Initialize System V style shared memory. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_autoconf.c,v 1.42 1999/09/15 19:37:08 thorpej Exp $ */
|
||||
/* $NetBSD: subr_autoconf.c,v 1.43 1999/09/17 20:11:56 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -50,6 +50,7 @@
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/errno.h>
|
||||
#include <machine/limits.h>
|
||||
|
||||
@ -94,13 +95,6 @@ static void config_process_deferred __P((struct deferred_config_head *,
|
||||
struct devicelist alldevs; /* list of all devices */
|
||||
struct evcntlist allevents; /* list of all event counters */
|
||||
|
||||
/*
|
||||
* This variable indicates, from the configuration machinery's point of
|
||||
* view, if interrupts are enabled. They start disabled, and are
|
||||
* considered enabled once cpu_configure() returns.
|
||||
*/
|
||||
int config_interrupts_enabled;
|
||||
|
||||
/*
|
||||
* Configure the system's hardware.
|
||||
*/
|
||||
@ -120,7 +114,14 @@ configure()
|
||||
* to be enabled.
|
||||
*/
|
||||
cpu_configure();
|
||||
config_interrupts_enabled = 1;
|
||||
|
||||
/*
|
||||
* Now that we've found all the hardware, start the real time
|
||||
* and statistics clocks.
|
||||
*/
|
||||
initclocks();
|
||||
|
||||
cold = 0; /* clocks are running, we're warm now! */
|
||||
|
||||
/*
|
||||
* Now callback to finish configuration for devices which want
|
||||
@ -323,7 +324,8 @@ config_attach(parent, cf, aux, print)
|
||||
panic("config_attach: device name too long");
|
||||
|
||||
/* get memory for all device vars */
|
||||
dev = (struct device *)malloc(ca->ca_devsize, M_DEVBUF, M_NOWAIT);
|
||||
dev = (struct device *)malloc(ca->ca_devsize, M_DEVBUF,
|
||||
cold ? M_NOWAIT : M_WAITOK);
|
||||
if (!dev)
|
||||
panic("config_attach: memory allocation for device softc failed");
|
||||
memset(dev, 0, ca->ca_devsize);
|
||||
@ -359,7 +361,8 @@ config_attach(parent, cf, aux, print)
|
||||
while (new <= dev->dv_unit)
|
||||
new *= 2;
|
||||
cd->cd_ndevs = new;
|
||||
nsp = malloc(new * sizeof(void *), M_DEVBUF, M_NOWAIT);
|
||||
nsp = malloc(new * sizeof(void *), M_DEVBUF,
|
||||
cold ? M_NOWAIT : M_WAITOK);
|
||||
if (nsp == 0)
|
||||
panic("config_attach: %sing dev array",
|
||||
old != 0 ? "expand" : "creat");
|
||||
@ -578,7 +581,9 @@ config_defer(dev, func)
|
||||
}
|
||||
#endif
|
||||
|
||||
dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK);
|
||||
dc = malloc(sizeof(*dc), M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
|
||||
if (dc == NULL)
|
||||
panic("config_defer: unable to allocate callback");
|
||||
|
||||
dc->dc_dev = dev;
|
||||
dc->dc_func = func;
|
||||
@ -599,7 +604,7 @@ config_interrupts(dev, func)
|
||||
/*
|
||||
* If interrupts are enabled, callback now.
|
||||
*/
|
||||
if (config_interrupts_enabled) {
|
||||
if (cold == 0) {
|
||||
(*func)(dev);
|
||||
return;
|
||||
}
|
||||
@ -612,7 +617,9 @@ config_interrupts(dev, func)
|
||||
}
|
||||
#endif
|
||||
|
||||
dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK);
|
||||
dc = malloc(sizeof(*dc), M_DEVBUF, cold ? M_NOWAIT : M_WAITOK);
|
||||
if (dc == NULL)
|
||||
panic("config_interrupts: unable to allocate callback");
|
||||
|
||||
dc->dc_dev = dev;
|
||||
dc->dc_func = func;
|
||||
|
Loading…
Reference in New Issue
Block a user