From 6450b2fc55f73c4ce810304628205a53e371a626 Mon Sep 17 00:00:00 2001 From: gibbs Date: Sun, 21 Sep 1997 21:38:05 +0000 Subject: [PATCH] autoconf.c: Add cpu_rootconf and cpu_dumpconf so that configuring these two devices can be better controlled by the MI configuration code. machdep.c: MD initialization code for the new callout interface. trap.c: Add support for printing out whether cam interrupts are masked during a panic. --- sys/amd64/amd64/autoconf.c | 34 ++++++++++++++++++++++++++-------- sys/amd64/amd64/machdep.c | 23 +++++++++++++++++++---- sys/amd64/amd64/trap.c | 4 +++- sys/i386/i386/autoconf.c | 34 ++++++++++++++++++++++++++-------- sys/i386/i386/machdep.c | 23 +++++++++++++++++++---- sys/i386/i386/trap.c | 4 +++- sys/kern/subr_trap.c | 4 +++- 7 files changed, 99 insertions(+), 27 deletions(-) diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c index 9fbbbcf7b294..839ba0626389 100644 --- a/sys/amd64/amd64/autoconf.c +++ b/sys/amd64/amd64/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.74 1997/07/22 20:12:32 fsmp Exp $ + * $Id: autoconf.c,v 1.75 1997/09/09 12:48:56 jmg Exp $ */ /* @@ -192,6 +192,13 @@ configure(dummy) configure_start(); /* Allow all routines to decide for themselves if they want intrs */ + /* + * XXX Since this cannot be achieved on all architectures, we should + * XXX go back to disabling all interrupts until configuration is + * XXX completed and switch any devices that rely on the current + * XXX behavior to no longer rely on interrupts or to register an + * XXX interrupt_driven_config_hook for the task. + */ #ifdef APIC_IO bsp_apic_configure(); enable_intr(); @@ -221,9 +228,6 @@ configure(dummy) pccard_configure(); #endif - if (setdumpdev(dumpdev) != 0) - dumpdev = NODEV; - configure_finish(); cninit_finish(); @@ -266,7 +270,19 @@ configure(dummy) printf("Device configuration finished.\n"); } + setconf(); + cold = 0; + if (bootverbose) + printf("configure() finished.\n"); +} +void +cpu_rootconf() +{ + /* + * XXX NetBSD has a much cleaner approach to finding root. + * XXX We should adopt their code. + */ #ifdef CD9660 if ((boothowto & RB_CDROM)) { if (bootverbose) @@ -351,11 +367,13 @@ configure(dummy) if (!mountrootfsname) { panic("Nobody wants to mount my root for me"); } +} - setconf(); - cold = 0; - if (bootverbose) - printf("configure() finished.\n"); +void +cpu_dumpconf() +{ + if (setdumpdev(dumpdev) != 0) + dumpdev = NODEV; } static int diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index b3ad28701ef4..edf76866c4fa 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.263 1997/09/04 15:23:33 davidg Exp $ + * $Id: machdep.c,v 1.264 1997/09/21 15:03:57 peter Exp $ */ #include "apm.h" @@ -237,6 +237,15 @@ cpu_startup(dummy) */ setup_netisrs(&netisr_set); + /* + * Calculate callout wheel size + */ + for (callwheelsize = 1, callwheelbits = 0; + callwheelsize < ncallout; + callwheelsize <<= 1, ++callwheelbits) + ; + callwheelmask = callwheelsize - 1; + /* * Allocate space for system data structures. * The first available kernel virtual address is in "v". @@ -261,6 +270,7 @@ again: #define valloclim(name, type, num, lim) \ (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num))) valloc(callout, struct callout, ncallout); + valloc(callwheel, struct callout_tailq, callwheelsize); #ifdef SYSVSHM valloc(shmsegs, struct shmid_ds, shminfo.shmmni); #endif @@ -358,9 +368,14 @@ again: /* * Initialize callouts */ - callfree = callout; - for (i = 1; i < ncallout; i++) - callout[i-1].c_next = &callout[i]; + SLIST_INIT(&callfree); + for (i = 0; i < ncallout; i++) { + SLIST_INSERT_HEAD(&callfree, &callout[i], c_links.sle); + } + + for (i = 0; i < callwheelsize; i++) { + TAILQ_INIT(&callwheel[i]); + } #if defined(USERCONFIG) #if defined(USERCONFIG_BOOT) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 9cbd539ba902..b1e8c26d10bb 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.109 1997/08/28 14:36:54 jlemon Exp $ + * $Id: trap.c,v 1.110 1997/09/05 08:54:54 peter Exp $ */ /* @@ -780,6 +780,8 @@ trap_fatal(frame) printf("tty "); if ((cpl & bio_imask) == bio_imask) printf("bio "); + if ((cpl & cam_imask) == cam_imask) + printf("cam "); if (cpl == 0) printf("none"); #ifdef SMP diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index 9fbbbcf7b294..839ba0626389 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.74 1997/07/22 20:12:32 fsmp Exp $ + * $Id: autoconf.c,v 1.75 1997/09/09 12:48:56 jmg Exp $ */ /* @@ -192,6 +192,13 @@ configure(dummy) configure_start(); /* Allow all routines to decide for themselves if they want intrs */ + /* + * XXX Since this cannot be achieved on all architectures, we should + * XXX go back to disabling all interrupts until configuration is + * XXX completed and switch any devices that rely on the current + * XXX behavior to no longer rely on interrupts or to register an + * XXX interrupt_driven_config_hook for the task. + */ #ifdef APIC_IO bsp_apic_configure(); enable_intr(); @@ -221,9 +228,6 @@ configure(dummy) pccard_configure(); #endif - if (setdumpdev(dumpdev) != 0) - dumpdev = NODEV; - configure_finish(); cninit_finish(); @@ -266,7 +270,19 @@ configure(dummy) printf("Device configuration finished.\n"); } + setconf(); + cold = 0; + if (bootverbose) + printf("configure() finished.\n"); +} +void +cpu_rootconf() +{ + /* + * XXX NetBSD has a much cleaner approach to finding root. + * XXX We should adopt their code. + */ #ifdef CD9660 if ((boothowto & RB_CDROM)) { if (bootverbose) @@ -351,11 +367,13 @@ configure(dummy) if (!mountrootfsname) { panic("Nobody wants to mount my root for me"); } +} - setconf(); - cold = 0; - if (bootverbose) - printf("configure() finished.\n"); +void +cpu_dumpconf() +{ + if (setdumpdev(dumpdev) != 0) + dumpdev = NODEV; } static int diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index b3ad28701ef4..edf76866c4fa 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.263 1997/09/04 15:23:33 davidg Exp $ + * $Id: machdep.c,v 1.264 1997/09/21 15:03:57 peter Exp $ */ #include "apm.h" @@ -237,6 +237,15 @@ cpu_startup(dummy) */ setup_netisrs(&netisr_set); + /* + * Calculate callout wheel size + */ + for (callwheelsize = 1, callwheelbits = 0; + callwheelsize < ncallout; + callwheelsize <<= 1, ++callwheelbits) + ; + callwheelmask = callwheelsize - 1; + /* * Allocate space for system data structures. * The first available kernel virtual address is in "v". @@ -261,6 +270,7 @@ again: #define valloclim(name, type, num, lim) \ (name) = (type *)v; v = (caddr_t)((lim) = ((name)+(num))) valloc(callout, struct callout, ncallout); + valloc(callwheel, struct callout_tailq, callwheelsize); #ifdef SYSVSHM valloc(shmsegs, struct shmid_ds, shminfo.shmmni); #endif @@ -358,9 +368,14 @@ again: /* * Initialize callouts */ - callfree = callout; - for (i = 1; i < ncallout; i++) - callout[i-1].c_next = &callout[i]; + SLIST_INIT(&callfree); + for (i = 0; i < ncallout; i++) { + SLIST_INSERT_HEAD(&callfree, &callout[i], c_links.sle); + } + + for (i = 0; i < callwheelsize; i++) { + TAILQ_INIT(&callwheel[i]); + } #if defined(USERCONFIG) #if defined(USERCONFIG_BOOT) diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 9cbd539ba902..b1e8c26d10bb 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.109 1997/08/28 14:36:54 jlemon Exp $ + * $Id: trap.c,v 1.110 1997/09/05 08:54:54 peter Exp $ */ /* @@ -780,6 +780,8 @@ trap_fatal(frame) printf("tty "); if ((cpl & bio_imask) == bio_imask) printf("bio "); + if ((cpl & cam_imask) == cam_imask) + printf("cam "); if (cpl == 0) printf("none"); #ifdef SMP diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 9cbd539ba902..b1e8c26d10bb 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.109 1997/08/28 14:36:54 jlemon Exp $ + * $Id: trap.c,v 1.110 1997/09/05 08:54:54 peter Exp $ */ /* @@ -780,6 +780,8 @@ trap_fatal(frame) printf("tty "); if ((cpl & bio_imask) == bio_imask) printf("bio "); + if ((cpl & cam_imask) == cam_imask) + printf("cam "); if (cpl == 0) printf("none"); #ifdef SMP