Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys The Amiga and Atari ports abuse some autoconfigurati...



details:   https://anonhg.NetBSD.org/src/rev/dd062959ac5c
branches:  trunk
changeset: 378888:dd062959ac5c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Apr 27 14:48:28 2021 +0000

description:
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.

diffstat:

 sys/arch/amiga/amiga/autoconf.c       |  35 +++++++++++++++++++++++------------
 sys/arch/amiga/amiga/device.h         |   4 ++--
 sys/arch/amiga/dev/grf.c              |  12 ++++++++----
 sys/arch/amiga/dev/grf_cc.c           |   6 +++---
 sys/arch/amiga/dev/grf_cl.c           |   7 ++++---
 sys/arch/amiga/dev/grf_cv.c           |   7 ++++---
 sys/arch/amiga/dev/grf_cv3d.c         |   7 ++++---
 sys/arch/amiga/dev/grf_et.c           |   7 ++++---
 sys/arch/amiga/dev/grf_rh.c           |   6 +++---
 sys/arch/amiga/dev/grf_rt.c           |   6 +++---
 sys/arch/amiga/dev/grf_ul.c           |   6 +++---
 sys/arch/amiga/dev/zbus.c             |   7 ++++---
 sys/arch/amigappc/amigappc/autoconf.c |  32 +++++++++++++++++++++-----------
 sys/arch/atari/atari/autoconf.c       |  35 +++++++++++++++++++++++------------
 sys/arch/atari/atari/device.h         |   4 ++--
 sys/arch/atari/dev/grf.c              |  11 ++++++-----
 sys/arch/atari/dev/ite_cc.c           |   7 ++++---
 sys/arch/atari/dev/ite_et.c           |   7 ++++---
 sys/kern/subr_autoconf.c              |  14 +++++++-------
 sys/sys/device.h                      |  13 ++++++++++++-
 20 files changed, 144 insertions(+), 89 deletions(-)

diffs (truncated from 756 to 300 lines):

diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/amiga/autoconf.c
--- a/sys/arch/amiga/amiga/autoconf.c   Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/amiga/autoconf.c   Tue Apr 27 14:48:28 2021 +0000
@@ -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;
 
-       if (amiga_realconfig)
-               return(config_found(parent, aux, pfn, CFARG_EOL) != NULL);
+       va_start(ap, tag);
+
+       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);
 }
 
 /*
diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/amiga/device.h
--- a/sys/arch/amiga/amiga/device.h     Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/amiga/device.h     Tue Apr 27 14:48:28 2021 +0000
@@ -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 *);
 /*
diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/dev/grf.c
--- a/sys/arch/amiga/dev/grf.c  Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/dev/grf.c  Tue Apr 27 14:48:28 2021 +0000
@@ -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
 }
 
diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/dev/grf_cc.c
--- a/sys/arch/amiga/dev/grf_cc.c       Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/dev/grf_cc.c       Tue Apr 27 14:48:28 2021 +0000
@@ -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
diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/dev/grf_cl.c
--- a/sys/arch/amiga/dev/grf_cl.c       Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/dev/grf_cl.c       Tue Apr 27 14:48:28 2021 +0000
@@ -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) {
diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/dev/grf_cv.c
--- a/sys/arch/amiga/dev/grf_cv.c       Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/dev/grf_cv.c       Tue Apr 27 14:48:28 2021 +0000
@@ -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);
diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/dev/grf_cv3d.c
--- a/sys/arch/amiga/dev/grf_cv3d.c     Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/dev/grf_cv3d.c     Tue Apr 27 14:48:28 2021 +0000
@@ -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);
diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/dev/grf_et.c
--- a/sys/arch/amiga/dev/grf_et.c       Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/dev/grf_et.c       Tue Apr 27 14:48:28 2021 +0000
@@ -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) {
diff -r c29a94ca3057 -r dd062959ac5c sys/arch/amiga/dev/grf_rh.c
--- a/sys/arch/amiga/dev/grf_rh.c       Tue Apr 27 14:18:25 2021 +0000
+++ b/sys/arch/amiga/dev/grf_rh.c       Tue Apr 27 14:48:28 2021 +0000
@@ -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



Home | Main Index | Thread Index | Old Index