Module Name:    src
Committed By:   thorpej
Date:           Tue Apr 27 14:48:29 UTC 2021

Modified Files:
        src/sys/arch/amiga/amiga: autoconf.c device.h
        src/sys/arch/amiga/dev: grf.c grf_cc.c grf_cl.c grf_cv.c grf_cv3d.c
            grf_et.c grf_rh.c grf_rt.c grf_ul.c zbus.c
        src/sys/arch/amigappc/amigappc: autoconf.c
        src/sys/arch/atari/atari: autoconf.c device.h
        src/sys/arch/atari/dev: grf.c ite_cc.c ite_et.c
        src/sys/kern: subr_autoconf.c
        src/sys/sys: device.h

Log Message:
The Amiga and Atari ports abuse some autoconfiguration internals as part
of their early console bring-up, so we need to expose some of the new
internals to them and adapt the call sites.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/amiga/amiga/autoconf.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amiga/amiga/device.h
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/amiga/dev/grf.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/amiga/dev/grf_cc.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/amiga/dev/grf_cl.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/amiga/dev/grf_cv.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amiga/dev/grf_cv3d.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amiga/dev/grf_et.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amiga/dev/grf_rh.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amiga/dev/grf_rt.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/amiga/dev/grf_ul.c
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/amiga/dev/zbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amigappc/amigappc/autoconf.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/atari/atari/autoconf.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/atari/atari/device.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/atari/dev/grf.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/atari/dev/ite_cc.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/atari/dev/ite_et.c
cvs rdiff -u -r1.278 -r1.279 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.168 -r1.169 src/sys/sys/device.h

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

Modified files:

Index: src/sys/arch/amiga/amiga/autoconf.c
diff -u src/sys/arch/amiga/amiga/autoconf.c:1.118 src/sys/arch/amiga/amiga/autoconf.c:1.119
--- src/sys/arch/amiga/amiga/autoconf.c:1.118	Sat Apr 24 23:36:24 2021
+++ src/sys/arch/amiga/amiga/autoconf.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.118 2021/04/24 23:36:24 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.119 2021/04/27 14:48:28 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -30,8 +30,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define	__SUBR_AUTOCONF_PRIVATE		/* XXX amiga_config_found() */
+
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.118 2021/04/24 23:36:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.119 2021/04/27 14:48:28 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -162,14 +164,21 @@ matchname(const char *fp, const char *sp
  * by checking for NULL.
  */
 int
-amiga_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn)
+amiga_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn,
+    cfarg_t tag, ...)
 {
 	struct device temp;
 	cfdata_t cf;
 	const struct cfattach *ca;
+	int rv = 0;
+	va_list ap;
+
+	va_start(ap, tag);
 
-	if (amiga_realconfig)
-		return(config_found(parent, aux, pfn, CFARG_EOL) != NULL);
+	if (amiga_realconfig) {
+		rv = config_vfound(parent, aux, pfn, tag, ap) != NULL;
+		goto out;
+	}
 
 	if (parent == NULL) {
 		memset(&temp, 0, sizeof temp);
@@ -180,16 +189,17 @@ amiga_config_found(cfdata_t pcfp, device
 	parent->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name);
 	parent->dv_unit = pcfp->cf_unit;
 
-	if ((cf = config_search(parent, aux, CFARG_EOL)) != NULL) {
+	if ((cf = config_vsearch(parent, aux, tag, ap)) != NULL) {
 		ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname);
 		if (ca != NULL) {
 			(*ca->ca_attach)(parent, NULL, aux);
-			parent->dv_cfdata = NULL;
-			return(1);
+			rv = 1;
 		}
 	}
 	parent->dv_cfdata = NULL;
-	return(0);
+ out:
+	va_end(ap);
+	return rv;
 }
 
 /*
@@ -215,7 +225,7 @@ config_console(void)
 	/*
 	 * delay clock calibration.
 	 */
-	amiga_config_found(cf, NULL, __UNCONST("clock"), NULL);
+	amiga_config_found(cf, NULL, __UNCONST("clock"), NULL, CFARG_EOL);
 
 	/*
 	 * internal grf.
@@ -223,13 +233,14 @@ config_console(void)
 #ifdef DRACO
 	if (!(is_draco()))
 #endif
-		amiga_config_found(cf, NULL, __UNCONST("grfcc"), NULL);
+		amiga_config_found(cf, NULL, __UNCONST("grfcc"), NULL,
+		    CFARG_EOL);
 
 	/*
 	 * zbus knows when its not for real and will
 	 * only configure the appropriate hardware
 	 */
-	amiga_config_found(cf, NULL, __UNCONST("zbus"), NULL);
+	amiga_config_found(cf, NULL, __UNCONST("zbus"), NULL, CFARG_EOL);
 }
 
 /*

Index: src/sys/arch/amiga/amiga/device.h
diff -u src/sys/arch/amiga/amiga/device.h:1.14 src/sys/arch/amiga/amiga/device.h:1.15
--- src/sys/arch/amiga/amiga/device.h:1.14	Sat Oct 27 17:17:26 2012
+++ src/sys/arch/amiga/amiga/device.h	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: device.h,v 1.14 2012/10/27 17:17:26 chs Exp $	*/
+/*	$NetBSD: device.h,v 1.15 2021/04/27 14:48:28 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -38,7 +38,7 @@
  * passed in some cases and the devices will deal with it)
  */
 void config_console(void);
-int amiga_config_found(cfdata_t, device_t, void *, cfprint_t);
+int amiga_config_found(cfdata_t, device_t, void *, cfprint_t, cfarg_t, ...);
 int simple_devprint(void *, const char *);
 int matchname(const char *, const char *);
 /*

Index: src/sys/arch/amiga/dev/grf.c
diff -u src/sys/arch/amiga/dev/grf.c:1.65 src/sys/arch/amiga/dev/grf.c:1.66
--- src/sys/arch/amiga/dev/grf.c:1.65	Sat Apr 24 23:36:24 2021
+++ src/sys/arch/amiga/dev/grf.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf.c,v 1.65 2021/04/24 23:36:24 thorpej Exp $ */
+/*	$NetBSD: grf.c,v 1.66 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.65 2021/04/24 23:36:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.66 2021/04/27 14:48:28 thorpej Exp $");
 
 /*
  * Graphics display driver for the Amiga
@@ -213,7 +213,9 @@ grfattach(device_t parent, device_t self
 		wa.scrdata = gp->g_scrlist;
 		wa.accessops = gp->g_accessops;
 		wa.accesscookie = &gp->g_vd;
-		config_found(self, &wa, wsemuldisplaydevprint, CFARG_EOL);
+		config_found(self, &wa, wsemuldisplaydevprint,
+		    CFARG_IATTR, "wsemuldisplaydev",
+		    CFARG_EOL);
 #endif  /* NWSDISPLAY > 0 */
 	}
 
@@ -221,7 +223,9 @@ grfattach(device_t parent, device_t self
 	/*
 	 * try and attach an ite
 	 */
-	amiga_config_found(cfdata, self, gp, grfprint);
+	amiga_config_found(cfdata, self, gp, grfprint,
+	    CFARG_IATTR, "grf",
+	    CFARG_EOL);
 #endif
 }
 

Index: src/sys/arch/amiga/dev/grf_cc.c
diff -u src/sys/arch/amiga/dev/grf_cc.c:1.41 src/sys/arch/amiga/dev/grf_cc.c:1.42
--- src/sys/arch/amiga/dev/grf_cc.c:1.41	Sat Oct 27 17:17:28 2012
+++ src/sys/arch/amiga/dev/grf_cc.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cc.c,v 1.41 2012/10/27 17:17:28 chs Exp $ */
+/*	$NetBSD: grf_cc.c,v 1.42 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cc.c,v 1.41 2012/10/27 17:17:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cc.c,v 1.42 2021/04/27 14:48:28 thorpej Exp $");
 
 #include "grfcc.h"
 #include "ite.h"
@@ -151,7 +151,7 @@ grfccattach(device_t parent, device_t se
 	/*
 	 * attach grf
 	 */
-	amiga_config_found(cfdata, gp->g_device, gp, grfccprint);
+	amiga_config_found(cfdata, gp->g_device, gp, grfccprint, CFARG_EOL);
 }
 
 int

Index: src/sys/arch/amiga/dev/grf_cl.c
diff -u src/sys/arch/amiga/dev/grf_cl.c:1.50 src/sys/arch/amiga/dev/grf_cl.c:1.51
--- src/sys/arch/amiga/dev/grf_cl.c:1.50	Mon Nov 16 21:25:34 2015
+++ src/sys/arch/amiga/dev/grf_cl.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cl.c,v 1.50 2015/11/16 21:25:34 phx Exp $ */
+/*	$NetBSD: grf_cl.c,v 1.51 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 Klaus Burkert
@@ -36,7 +36,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1.50 2015/11/16 21:25:34 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cl.c,v 1.51 2021/04/27 14:48:28 thorpej Exp $");
 
 #include "grfcl.h"
 #include "ite.h"
@@ -455,7 +455,8 @@ grfclattach(device_t parent, device_t se
 	/*
 	 * attach grf (once)
 	 */
-	if (amiga_config_found(cfdata, gp->g_device, gp, grfclprint)) {
+	if (amiga_config_found(cfdata, gp->g_device, gp, grfclprint,
+			       CFARG_EOL)) {
 		attachflag = 1;
 		printf("grfcl: %dMB ", cl_fbsize / 0x100000);
 		switch (cltype) {

Index: src/sys/arch/amiga/dev/grf_cv.c
diff -u src/sys/arch/amiga/dev/grf_cv.c:1.59 src/sys/arch/amiga/dev/grf_cv.c:1.60
--- src/sys/arch/amiga/dev/grf_cv.c:1.59	Mon Nov 16 21:24:06 2015
+++ src/sys/arch/amiga/dev/grf_cv.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cv.c,v 1.59 2015/11/16 21:24:06 phx Exp $ */
+/*	$NetBSD: grf_cv.c,v 1.60 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Michael Teske
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.59 2015/11/16 21:24:06 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cv.c,v 1.60 2021/04/27 14:48:28 thorpej Exp $");
 
 #include "grfcv.h"
 #include "ite.h"
@@ -554,7 +554,8 @@ grfcvattach(device_t parent, device_t se
 	/*
 	 * attach grf
 	 */
-	if (amiga_config_found(cfdata, gp->g_device, gp, grfcvprint)) {
+	if (amiga_config_found(cfdata, gp->g_device, gp, grfcvprint,
+			       CFARG_EOL)) {
 		if (self != NULL)
 			printf("grfcv: CyberVision64 with %dMB being used\n",
 			    cv_fbsize/0x100000);

Index: src/sys/arch/amiga/dev/grf_cv3d.c
diff -u src/sys/arch/amiga/dev/grf_cv3d.c:1.34 src/sys/arch/amiga/dev/grf_cv3d.c:1.35
--- src/sys/arch/amiga/dev/grf_cv3d.c:1.34	Fri Jun 17 07:41:56 2016
+++ src/sys/arch/amiga/dev/grf_cv3d.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_cv3d.c,v 1.34 2016/06/17 07:41:56 phx Exp $ */
+/*	$NetBSD: grf_cv3d.c,v 1.35 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Michael Teske
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.34 2016/06/17 07:41:56 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_cv3d.c,v 1.35 2021/04/27 14:48:28 thorpej Exp $");
 
 #include "grfcv3d.h"
 #include "ite.h"
@@ -504,7 +504,8 @@ grfcv3dattach(device_t parent, device_t 
 	/*
 	 * attach grf
 	 */
-	if (amiga_config_found(cfdata, gp->g_device, gp, grfcv3dprint)) {
+	if (amiga_config_found(cfdata, gp->g_device, gp, grfcv3dprint,
+			       CFARG_EOL)) {
 		if (self != NULL)
 			printf("%s: CyberVision64/3D with %dMB being used\n",
 			    device_xname(self), cv3d_fbsize / 0x100000);

Index: src/sys/arch/amiga/dev/grf_et.c
diff -u src/sys/arch/amiga/dev/grf_et.c:1.36 src/sys/arch/amiga/dev/grf_et.c:1.37
--- src/sys/arch/amiga/dev/grf_et.c:1.36	Mon Mar  5 04:23:00 2018
+++ src/sys/arch/amiga/dev/grf_et.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_et.c,v 1.36 2018/03/05 04:23:00 rin Exp $ */
+/*	$NetBSD: grf_et.c,v 1.37 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 Klaus Burkert
@@ -37,7 +37,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1.36 2018/03/05 04:23:00 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_et.c,v 1.37 2021/04/27 14:48:28 thorpej Exp $");
 
 #include "grfet.h"
 #include "ite.h"
@@ -387,7 +387,8 @@ grfetattach(device_t parent, device_t se
 	/*
 	 * attach grf (once)
 	 */
-	if (amiga_config_found(cfdata, gp->g_device, gp, grfetprint)) {
+	if (amiga_config_found(cfdata, gp->g_device, gp, grfetprint,
+			       CFARG_EOL)) {
 		attachflag = 1;
 		printf("grfet: %dMB ", et_fbsize / 0x100000);
 		switch (ettype) {

Index: src/sys/arch/amiga/dev/grf_rh.c
diff -u src/sys/arch/amiga/dev/grf_rh.c:1.57 src/sys/arch/amiga/dev/grf_rh.c:1.58
--- src/sys/arch/amiga/dev/grf_rh.c:1.57	Wed Jan 22 00:25:16 2014
+++ src/sys/arch/amiga/dev/grf_rh.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_rh.c,v 1.57 2014/01/22 00:25:16 christos Exp $ */
+/*	$NetBSD: grf_rh.c,v 1.58 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994 Markus Wild
@@ -34,7 +34,7 @@
 #include "opt_retina.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1.57 2014/01/22 00:25:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1.58 2021/04/27 14:48:28 thorpej Exp $");
 
 #include "grfrh.h"
 #include "ite.h"
@@ -1617,7 +1617,7 @@ grfrhattach(device_t parent, device_t se
 	/*
 	 * attach grf
 	 */
-	amiga_config_found(cfdata, gp->g_device, gp, grfrhprint);
+	amiga_config_found(cfdata, gp->g_device, gp, grfrhprint, CFARG_EOL);
 }
 
 int

Index: src/sys/arch/amiga/dev/grf_rt.c
diff -u src/sys/arch/amiga/dev/grf_rt.c:1.58 src/sys/arch/amiga/dev/grf_rt.c:1.59
--- src/sys/arch/amiga/dev/grf_rt.c:1.58	Sat Oct 18 08:33:24 2014
+++ src/sys/arch/amiga/dev/grf_rt.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_rt.c,v 1.58 2014/10/18 08:33:24 snj Exp $ */
+/*	$NetBSD: grf_rt.c,v 1.59 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1993 Markus Wild
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_rt.c,v 1.58 2014/10/18 08:33:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_rt.c,v 1.59 2021/04/27 14:48:28 thorpej Exp $");
 
 #include "grfrt.h"
 #include "ite.h"
@@ -881,7 +881,7 @@ grfrtattach(device_t parent, device_t se
 	/*
 	 * attach grf
 	 */
-	amiga_config_found(cfdata, gp->g_device, gp, grfrtprint);
+	amiga_config_found(cfdata, gp->g_device, gp, grfrtprint, CFARG_EOL);
 }
 
 int

Index: src/sys/arch/amiga/dev/grf_ul.c
diff -u src/sys/arch/amiga/dev/grf_ul.c:1.51 src/sys/arch/amiga/dev/grf_ul.c:1.52
--- src/sys/arch/amiga/dev/grf_ul.c:1.51	Thu Nov  3 22:08:31 2016
+++ src/sys/arch/amiga/dev/grf_ul.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_ul.c,v 1.51 2016/11/03 22:08:31 kamil Exp $ */
+/*	$NetBSD: grf_ul.c,v 1.52 2021/04/27 14:48:28 thorpej Exp $ */
 #define UL_DEBUG
 
 /*-
@@ -33,7 +33,7 @@
 #include "opt_amigacons.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf_ul.c,v 1.51 2016/11/03 22:08:31 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_ul.c,v 1.52 2021/04/27 14:48:28 thorpej Exp $");
 
 #include "grful.h"
 #include "ite.h"
@@ -554,7 +554,7 @@ grfulattach(device_t parent, device_t se
 	/*
 	 * attach grf
 	 */
-	amiga_config_found(cfdata, gp->g_device, gp, grfulprint);
+	amiga_config_found(cfdata, gp->g_device, gp, grfulprint, CFARG_EOL);
 }
 
 int

Index: src/sys/arch/amiga/dev/zbus.c
diff -u src/sys/arch/amiga/dev/zbus.c:1.75 src/sys/arch/amiga/dev/zbus.c:1.76
--- src/sys/arch/amiga/dev/zbus.c:1.75	Wed Oct  4 09:44:09 2017
+++ src/sys/arch/amiga/dev/zbus.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: zbus.c,v 1.75 2017/10/04 09:44:09 rkujawa Exp $ */
+/*	$NetBSD: zbus.c,v 1.76 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.75 2017/10/04 09:44:09 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.76 2021/04/27 14:48:28 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -370,7 +370,8 @@ zbusattach(device_t parent, device_t sel
 			if (amiga_realconfig == 0)
 				pcp->vaddr = za.va;
 		}
-		amiga_config_found(early_cfdata, self, &za, zbusprint);
+		amiga_config_found(early_cfdata, self, &za, zbusprint,
+				   CFARG_EOL);
 	}
 }
 

Index: src/sys/arch/amigappc/amigappc/autoconf.c
diff -u src/sys/arch/amigappc/amigappc/autoconf.c:1.7 src/sys/arch/amigappc/amigappc/autoconf.c:1.8
--- src/sys/arch/amigappc/amigappc/autoconf.c:1.7	Sat Apr 24 23:36:25 2021
+++ src/sys/arch/amigappc/amigappc/autoconf.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.7 2021/04/24 23:36:25 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.8 2021/04/27 14:48:28 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -30,8 +30,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define	__SUBR_AUTOCONF_PRIVATE		/* XXX amiga_config_found() */
+
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.7 2021/04/24 23:36:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.8 2021/04/27 14:48:28 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -122,14 +124,21 @@ matchname(const char *fp, const char *sp
  * by checking for NULL.
  */
 int
-amiga_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn)
+amiga_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn,
+    cfarg_t tag, ...)
 {
 	struct device temp;
 	cfdata_t cf;
 	const struct cfattach *ca;
+	int rv = 0;
+	va_list ap;
+
+	va_start(ap, tag);
 
-	if (amiga_realconfig)
-		return config_found(parent, aux, pfn, CFARG_EOL) != NULL;
+	if (amiga_realconfig) {
+		rv = config_vfound(parent, aux, pfn, tag, ap) != NULL;
+		goto out;
+	}
 
 	if (parent == NULL) {
 		memset(&temp, 0, sizeof temp);
@@ -140,16 +149,17 @@ amiga_config_found(cfdata_t pcfp, device
 	parent->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name);
 	parent->dv_unit = pcfp->cf_unit;
 
-	if ((cf = config_search(parent, aux, CFARG_EOL)) != NULL) {
+	if ((cf = config_vsearch(parent, aux,  tag, ap)) != NULL) {
 		ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname);
 		if (ca != NULL) {
 			(*ca->ca_attach)(parent, NULL, aux);
-			parent->dv_cfdata = NULL;
-			return 1;
+			rv = 1;
 		}
 	}
 	parent->dv_cfdata = NULL;
-	return 0;
+ out:
+	va_end(ap);
+	return rv;
 }
 
 /*
@@ -174,13 +184,13 @@ config_console(void)
 	/*
 	 * internal grf.
 	 */
-	amiga_config_found(cf, NULL, __UNCONST("grfcc"), NULL);
+	amiga_config_found(cf, NULL, __UNCONST("grfcc"), NULL, CFARG_EOL);
 
 	/*
 	 * zbus knows when its not for real and will
 	 * only configure the appropriate hardware
 	 */
-	amiga_config_found(cf, NULL, __UNCONST("zbus"), NULL);
+	amiga_config_found(cf, NULL, __UNCONST("zbus"), NULL, CFARG_EOL);
 }
 
 /*

Index: src/sys/arch/atari/atari/autoconf.c
diff -u src/sys/arch/atari/atari/autoconf.c:1.69 src/sys/arch/atari/atari/autoconf.c:1.70
--- src/sys/arch/atari/atari/autoconf.c:1.69	Sat Apr 24 23:36:29 2021
+++ src/sys/arch/atari/atari/autoconf.c	Tue Apr 27 14:48:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.69 2021/04/24 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.70 2021/04/27 14:48:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -30,8 +30,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define	__SUBR_AUTOCONF_PRIVATE		/* XXX atari_config_found() */
+
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.69 2021/04/24 23:36:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.70 2021/04/27 14:48:29 thorpej Exp $");
 
 #include "opt_md.h"
 
@@ -138,14 +140,21 @@ simple_devprint(void *aux, const char *p
  * by checking for NULL.
  */
 int
-atari_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn)
+atari_config_found(cfdata_t pcfp, device_t parent, void *aux, cfprint_t pfn,
+    cfarg_t tag, ...)
 {
 	struct device temp;
 	cfdata_t cf;
 	const struct cfattach *ca;
+	int rv = 0;
+	va_list ap;
+
+	va_start(ap, tag);
 
-	if (atari_realconfig)
-		return config_found(parent, aux, pfn, CFARG_EOL) != NULL;
+	if (atari_realconfig) {
+		rv = config_vfound(parent, aux, pfn, tag, ap) != NULL;
+		goto out;
+	}
 
 	memset(&temp, 0, sizeof(temp));
 	if (parent == NULL)
@@ -155,16 +164,18 @@ atari_config_found(cfdata_t pcfp, device
 	parent->dv_cfdriver = config_cfdriver_lookup(pcfp->cf_name);
 	parent->dv_unit = pcfp->cf_unit;
 
-	if ((cf = config_search(parent, aux, CFARG_EOL)) != NULL) {
+	if ((cf = config_vsearch(parent, aux, tag, ap)) != NULL) {
 		ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname);
 		if (ca != NULL) {
 			(*ca->ca_attach)(parent, NULL, aux);
-			parent->dv_cfdata = NULL;
-			return 1;
+			rv = 1;
+			goto out;
 		}
 	}
 	parent->dv_cfdata = NULL;
-	return 0;
+ out:
+	va_end(ap);
+	return rv;
 }
 
 /*
@@ -192,9 +203,9 @@ config_console(void)
 	 * some setup for the 'grf-side'. This make it possible to use
 	 * a PCI card for both wscons and grfabs.
 	 */
-	atari_config_found(cf, NULL, __UNCONST("pcib")  , NULL);
-	atari_config_found(cf, NULL, __UNCONST("isab")  , NULL);
-	atari_config_found(cf, NULL, __UNCONST("grfbus"), NULL);
+	atari_config_found(cf, NULL, __UNCONST("pcib")  , NULL, CFARG_EOL);
+	atari_config_found(cf, NULL, __UNCONST("isab")  , NULL, CFARG_EOL);
+	atari_config_found(cf, NULL, __UNCONST("grfbus"), NULL, CFARG_EOL);
 }
 
 /*

Index: src/sys/arch/atari/atari/device.h
diff -u src/sys/arch/atari/atari/device.h:1.6 src/sys/arch/atari/atari/device.h:1.7
--- src/sys/arch/atari/atari/device.h:1.6	Sat Oct 27 17:17:42 2012
+++ src/sys/arch/atari/atari/device.h	Tue Apr 27 14:48:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: device.h,v 1.6 2012/10/27 17:17:42 chs Exp $	*/
+/*	$NetBSD: device.h,v 1.7 2021/04/27 14:48:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -39,7 +39,7 @@
  * *and know it* (i.e. everything is really tight certain params won't be 
  * passed in some cases and the devices will deal with it)
  */
-int atari_config_found(cfdata_t, device_t, void *, cfprint_t);
+int atari_config_found(cfdata_t, device_t, void *, cfprint_t, cfarg_t, ...);
 int simple_devprint(void *, const char *);
 int matchname(char *, char *);
 /*

Index: src/sys/arch/atari/dev/grf.c
diff -u src/sys/arch/atari/dev/grf.c:1.51 src/sys/arch/atari/dev/grf.c:1.52
--- src/sys/arch/atari/dev/grf.c:1.51	Sat Apr 24 23:36:29 2021
+++ src/sys/arch/atari/dev/grf.c	Tue Apr 27 14:48:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf.c,v 1.51 2021/04/24 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: grf.c,v 1.52 2021/04/27 14:48:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.51 2021/04/24 23:36:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.52 2021/04/27 14:48:29 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -147,9 +147,10 @@ grfbusattach(device_t parent, device_t s
 	grf_auxp.busprint       = grfbusprint;
 	grf_auxp.from_bus_match = 1;
 
-	if (self == NULL) /* Console init	*/
-		atari_config_found(cfdata_gbus, NULL, &grf_auxp, grfbusprint);
-	else {
+	if (self == NULL) { /* Console init	*/
+		atari_config_found(cfdata_gbus, NULL, &grf_auxp, grfbusprint,
+		    CFARG_EOL);
+	} else {
 		printf("\n");
 		config_found(self, &grf_auxp, grfbusprint, CFARG_EOL);
 	}

Index: src/sys/arch/atari/dev/ite_cc.c
diff -u src/sys/arch/atari/dev/ite_cc.c:1.41 src/sys/arch/atari/dev/ite_cc.c:1.42
--- src/sys/arch/atari/dev/ite_cc.c:1.41	Sat Apr 24 23:36:29 2021
+++ src/sys/arch/atari/dev/ite_cc.c	Tue Apr 27 14:48:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_cc.c,v 1.41 2021/04/24 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: ite_cc.c,v 1.42 2021/04/27 14:48:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite_cc.c,v 1.41 2021/04/24 23:36:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite_cc.c,v 1.42 2021/04/27 14:48:29 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -230,7 +230,8 @@ grfccattach(device_t parent, device_t se
 		grf_viewsync(&congrf);
 
 		/* Attach console ite */
-		atari_config_found(cfdata_grf, &itedev, &congrf, grfccprint);
+		atari_config_found(cfdata_grf, &itedev, &congrf, grfccprint,
+		    CFARG_EOL);
 		return;
 	}
 

Index: src/sys/arch/atari/dev/ite_et.c
diff -u src/sys/arch/atari/dev/ite_et.c:1.32 src/sys/arch/atari/dev/ite_et.c:1.33
--- src/sys/arch/atari/dev/ite_et.c:1.32	Sat Apr 24 23:36:29 2021
+++ src/sys/arch/atari/dev/ite_et.c	Tue Apr 27 14:48:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_et.c,v 1.32 2021/04/24 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: ite_et.c,v 1.33 2021/04/27 14:48:29 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1.32 2021/04/24 23:36:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1.33 2021/04/27 14:48:29 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -204,7 +204,8 @@ grfetattach(device_t parent, device_t se
 		grf_viewsync(&congrf);
 
 		/* Attach console ite */
-		atari_config_found(cfdata_grf, &itedev, &congrf, grfetprint);
+		atari_config_found(cfdata_grf, &itedev, &congrf, grfetprint,
+		    CFARG_EOL);
 		return;
 	}
 

Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.278 src/sys/kern/subr_autoconf.c:1.279
--- src/sys/kern/subr_autoconf.c:1.278	Sat Apr 24 23:37:00 2021
+++ src/sys/kern/subr_autoconf.c	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.278 2021/04/24 23:37:00 thorpej Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.279 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -76,8 +76,10 @@
  *	@(#)subr_autoconf.c	8.3 (Berkeley) 5/17/94
  */
 
+#define	__SUBR_AUTOCONF_PRIVATE	/* see <sys/device.h> */
+
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.278 2021/04/24 23:37:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.279 2021/04/27 14:48:28 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -168,8 +170,6 @@ struct alldevs_foray {
 
 static char *number(char *, int);
 static void mapply(struct matchinfo *, cfdata_t);
-static device_t config_vattach(device_t, cfdata_t, void *, cfprint_t, cfarg_t,
-			       va_list);
 static void config_devdelete(device_t);
 static void config_devunlink(device_t, struct devicelist *);
 static void config_makeroom(int, struct cfdriver *);
@@ -1113,7 +1113,7 @@ config_get_cfargs(cfarg_t tag,
  * an arbitrary function to all potential children (its return value
  * can be ignored).
  */
-static cfdata_t
+cfdata_t
 config_vsearch(device_t parent, void *aux, cfarg_t tag, va_list ap)
 {
 	cfsubmatch_t fn;
@@ -1224,7 +1224,7 @@ static const char * const msgs[3] = { ""
  * functions) and attach it, and return its device_t.  If the device was
  * not configured, call the given `print' function and return NULL.
  */
-static device_t
+device_t
 config_vfound(device_t parent, void *aux, cfprint_t print, cfarg_t tag,
     va_list ap)
 {
@@ -1689,7 +1689,7 @@ config_add_attrib_dict(device_t dev)
 /*
  * Attach a found device.
  */
-static device_t
+device_t
 config_vattach(device_t parent, cfdata_t cf, void *aux, cfprint_t print,
     cfarg_t tag, va_list ap)
 {

Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.168 src/sys/sys/device.h:1.169
--- src/sys/sys/device.h:1.168	Sat Apr 24 23:37:01 2021
+++ src/sys/sys/device.h	Tue Apr 27 14:48:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.168 2021/04/24 23:37:01 thorpej Exp $ */
+/* $NetBSD: device.h,v 1.169 2021/04/27 14:48:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -590,6 +590,17 @@ device_t config_attach(device_t, cfdata_
 int	config_match(device_t, cfdata_t, void *);
 int	config_probe(device_t, cfdata_t, void *);
 
+#if defined(__SUBR_AUTOCONF_PRIVATE)
+/*
+ * XXX Some ports abuse the internals of autoconfiguration, so we need
+ * XXX provide these symbols to them for the time being.
+ */
+cfdata_t config_vsearch(device_t, void *, cfarg_t, va_list);
+device_t config_vfound(device_t, void *, cfprint_t, cfarg_t, va_list);
+device_t config_vattach(device_t, cfdata_t, void *, cfprint_t, cfarg_t,
+			va_list);
+#endif /* __SUBR_AUTOCONF_PRIVATE */
+
 bool	ifattr_match(const char *, const char *);
 
 device_t config_attach_pseudo(cfdata_t);

Reply via email to