Module Name:    src
Committed By:   tsutsui
Date:           Tue Jul 14 13:24:00 UTC 2009

Modified Files:
        src/sys/kern: subr_autoconf.c

Log Message:
Add a workaround for some traditional ports (amiga and atari):
- Defer callout_setfunc() call after config_init() call in configure().

Fixes silent hang before consinit() at least on atari.

These traditional ports use config(9) structures and
autoconf(9) functions to detect console devices, and
config_init() is called at very early stage at boot
where mutex(9) is not ready.

Actually config_init() has been split out from configure()
for these ports:
http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/kern/subr_autoconf.c#rev1.74
while x68k has been fixed properly:
http://mail-index.NetBSD.org/source-changes/2009/01/17/msg215673.html

See also:
http://mail-index.NetBSD.org/port-x68k/2008/12/31/msg000006.html
http://mail-index.NetBSD.org/port-atari/2009/07/03/msg000419.html


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/kern/subr_autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.178 src/sys/kern/subr_autoconf.c:1.179
--- src/sys/kern/subr_autoconf.c:1.178	Fri Jun 26 19:30:45 2009
+++ src/sys/kern/subr_autoconf.c	Tue Jul 14 13:24:00 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.178 2009/06/26 19:30:45 dyoung Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.179 2009/07/14 13:24:00 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.178 2009/06/26 19:30:45 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.179 2009/07/14 13:24:00 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "drvctl.h"
@@ -356,7 +356,6 @@
 	cv_init(&config_misc_cv, "cfgmisc");
 
 	callout_init(&config_twiddle_ch, CALLOUT_MPSAFE);
-	callout_setfunc(&config_twiddle_ch, config_twiddle_fn, NULL);
 
 	/* allcfdrivers is statically initialized. */
 	for (i = 0; cfdriver_list_initial[i] != NULL; i++) {
@@ -411,6 +410,14 @@
 {
 	/* Initialize data structures. */
 	config_init();
+	/*
+	 * XXX
+	 * callout_setfunc() requires mutex(9) so it can't be in config_init()
+	 * on amiga and atari which use config_init() and autoconf(9) fucntions
+	 * to initialize console devices.
+	 */
+	callout_setfunc(&config_twiddle_ch, config_twiddle_fn, NULL);
+
 	pmf_init();
 #if NDRVCTL > 0
 	drvctl_init();

Reply via email to