Source-Changes-HG archive

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

[src/trunk]: src/sys Phase out the use of a string as first "attach args" mem...



details:   https://anonhg.NetBSD.org/src/rev/87d29f6dd688
branches:  trunk
changeset: 569702:87d29f6dd688
user:      drochner <drochner%NetBSD.org@localhost>
date:      Mon Aug 30 15:05:15 2004 +0000

description:
Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.

diffstat:

 sys/arch/algor/dev/bonito_mainbus.c    |  22 ++---------------
 sys/arch/algor/dev/vtpbc_mainbus.c     |  22 ++---------------
 sys/arch/algor/pci/pcib.c              |  18 ++-----------
 sys/arch/alpha/a12/a12dc.c             |   7 ++---
 sys/arch/alpha/a12/if_xb.c             |   7 ++---
 sys/arch/alpha/conf/files.alpha        |  17 ++++++++----
 sys/arch/alpha/jensenio/jensenio.c     |  43 ++++++++++++---------------------
 sys/arch/alpha/jensenio/jenseniovar.h  |   4 +-
 sys/arch/alpha/pci/a12c.c              |  35 ++++++---------------------
 sys/arch/alpha/pci/apecs.c             |  23 ++---------------
 sys/arch/alpha/pci/cia.c               |  23 ++---------------
 sys/arch/alpha/pci/dwlpx.c             |  22 ++---------------
 sys/arch/alpha/pci/irongate.c          |  25 +++----------------
 sys/arch/alpha/pci/lca.c               |  23 ++---------------
 sys/arch/alpha/pci/mcpcia.c            |  22 ++---------------
 sys/arch/alpha/pci/sio.c               |  25 +++---------------
 sys/arch/alpha/pci/tsc.c               |  22 ++---------------
 sys/arch/alpha/pci/ttwoga.c            |  25 +++++++-----------
 sys/arch/alpha/sableio/sableio.c       |   7 +---
 sys/arch/amd64/amd64/mainbus.c         |  19 ++++++--------
 sys/arch/amd64/conf/files.amd64        |   6 ++--
 sys/arch/amd64/pci/pchb.c              |  19 +-------------
 sys/arch/amd64/pci/pcib.c              |  20 ++-------------
 sys/arch/arc/isa/isabus.c              |  10 +++----
 sys/arch/arc/pci/necpb.c               |  22 ++---------------
 sys/arch/arm/footbridge/footbridge.c   |  13 +++------
 sys/arch/arm/ixp12x0/ixp12x0.c         |  22 ++---------------
 sys/arch/arm/s3c2xx0/s3c2800_pci.c     |  20 ++-------------
 sys/arch/arm/xscale/becc.c             |  28 ++-------------------
 sys/arch/arm/xscale/i80312.c           |  29 +++-------------------
 sys/arch/arm/xscale/i80321.c           |  30 +++-------------------
 sys/arch/arm/xscale/ixp425.c           |  21 ++--------------
 sys/arch/atari/isa/isa_machdep.c       |  11 +++----
 sys/arch/atari/pci/pci_machdep.c       |  11 +++----
 sys/arch/bebox/bebox/mainbus.c         |  40 ++++++++++---------------------
 sys/arch/bebox/conf/files.bebox        |   4 +-
 sys/arch/bebox/pci/pcib.c              |  20 ++-------------
 sys/arch/cats/pci/pcib.c               |  20 ++-------------
 sys/arch/cobalt/dev/gt.c               |   7 ++---
 sys/arch/dreamcast/dev/g2/gapspci.c    |  21 ++--------------
 sys/arch/evbarm/ifpga/ifpga.c          |  29 ++++------------------
 sys/arch/evbmips/malta/dev/gt.c        |   7 ++---
 sys/arch/evbmips/malta/pci/pcib.c      |  18 ++-----------
 sys/arch/evbppc/walnut/pci/pchb.c      |   7 ++---
 sys/arch/evbsh5/dev/superio.c          |  19 ++------------
 sys/arch/hp700/dev/dino.c              |  18 ++-----------
 sys/arch/hp700/dev/mongoose.c          |  24 +++---------------
 sys/arch/hpcmips/isa/isa_machdep.c     |   7 ++---
 sys/arch/hpcmips/isa/plumisa_machdep.c |   7 ++---
 sys/arch/hpcmips/vr/vrc4172pci.c       |  25 ++-----------------
 sys/arch/hpcmips/vr/vrpciu.c           |  25 ++-----------------
 sys/arch/i386/bios/vesabios.c          |   9 +-----
 sys/arch/i386/conf/files.i386          |  16 ++++++++---
 sys/arch/i386/i386/apm.c               |  10 +------
 sys/arch/i386/i386/cpu.c               |   9 ++----
 sys/arch/i386/i386/mainbus.c           |  35 +++++++++++---------------
 sys/arch/i386/mca/mca_machdep.c        |   7 ++---
 sys/arch/i386/pci/pceb.c               |  23 +++---------------
 sys/arch/i386/pci/pchb.c               |  34 +++-----------------------
 sys/arch/i386/pci/pcib.c               |  20 ++-------------
 sys/arch/i386/pci/pcmb.c               |  37 +++++++----------------------
 sys/arch/i386/pnpbios/files.pnpbios    |   4 +-
 sys/arch/i386/pnpbios/pnpbios.c        |   9 +-----
 sys/arch/ibmnws/ibmnws/mainbus.c       |  13 +++------
 sys/arch/ibmnws/pci/pcib.c             |  20 ++-------------
 sys/arch/macppc/macppc/mainbus.c       |  18 +------------
 sys/arch/macppc/pci/bandit.c           |  21 ++--------------
 sys/arch/macppc/pci/grackle.c          |  21 ++--------------
 sys/arch/macppc/pci/uninorth.c         |  21 ++--------------
 sys/arch/mipsco/isa/isa_machdep.c      |  11 +++----
 sys/arch/mvmeppc/mvmeppc/cpu.c         |   7 +---
 sys/arch/mvmeppc/mvmeppc/mainbus.c     |  38 +++++++++++------------------
 sys/arch/mvmeppc/pci/pcib.c            |  20 ++-------------
 sys/arch/netwinder/pci/pcib.c          |  20 ++-------------
 sys/arch/ofppc/firepower/firepower.c   |  21 ++--------------
 sys/arch/powerpc/ibm4xx/pci/pchb.c     |   7 ++---
 sys/arch/prep/pci/pcib.c               |  20 ++-------------
 sys/arch/prep/prep/mainbus.c           |  15 ++++-------
 sys/arch/sandpoint/pci/pcib.c          |  20 ++-------------
 sys/arch/sandpoint/sandpoint/mainbus.c |  43 +++++++++++----------------------
 sys/arch/sgimips/mace/pci_mace.c       |  24 ++----------------
 sys/arch/sh5/pci/sh5_pci.c             |   7 ++---
 sys/arch/sparc/conf/files.sparc        |   4 +-
 sys/arch/sparc/sparc/msiiep.c          |   7 ++---
 sys/arch/sparc64/dev/psycho.c          |   7 ++---
 sys/arch/x86/conf/files.x86            |   6 ++--
 sys/arch/x86/x86/mpacpi.c              |  19 ++++++++------
 sys/arch/x86/x86/mpbios.c              |  16 +++++++-----
 sys/arch/xen/conf/files.xen            |  21 ++++++++++------
 sys/arch/xen/i386/mainbus.c            |  34 +++++++++++---------------
 sys/dev/acpi/acpi.c                    |   9 +-----
 sys/dev/cardbus/rbus_ppb.c             |   9 +++---
 sys/dev/eisa/eisa.c                    |   9 +-----
 sys/dev/eisa/eisavar.h                 |   4 +-
 sys/dev/ic/cpc700.c                    |  25 +++++--------------
 sys/dev/isa/isa.c                      |   9 +-----
 sys/dev/isa/isavar.h                   |   4 +-
 sys/dev/marvell/gtpci.c                |   7 ++---
 sys/dev/mca/mca.c                      |   7 +---
 sys/dev/mca/mcavar.h                   |   4 +-
 sys/dev/pci/agp.c                      |   7 +---
 sys/dev/pci/agpvar.h                   |   4 +-
 sys/dev/pci/pci.c                      |   7 +---
 sys/dev/pci/pcivar.h                   |   4 +-
 sys/dev/pci/ppb.c                      |  23 ++---------------
 105 files changed, 457 insertions(+), 1340 deletions(-)

diffs (truncated from 5442 to 300 lines):

diff -r 98228d05c2cb -r 87d29f6dd688 sys/arch/algor/dev/bonito_mainbus.c
--- a/sys/arch/algor/dev/bonito_mainbus.c       Mon Aug 30 14:36:51 2004 +0000
+++ b/sys/arch/algor/dev/bonito_mainbus.c       Mon Aug 30 15:05:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bonito_mainbus.c,v 1.8 2003/07/14 22:57:47 lukem Exp $ */
+/*     $NetBSD: bonito_mainbus.c,v 1.9 2004/08/30 15:05:15 drochner Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bonito_mainbus.c,v 1.8 2003/07/14 22:57:47 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bonito_mainbus.c,v 1.9 2004/08/30 15:05:15 drochner Exp $");
 
 #include "opt_algor_p6032.h"
 
@@ -68,8 +68,6 @@
     bonito_mainbus_match, bonito_mainbus_attach, NULL, NULL);
 extern struct cfdriver bonito_cd;
 
-int    bonito_mainbus_print(void *, const char *);
-
 int
 bonito_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
 {
@@ -103,7 +101,6 @@
            BONITO_REV_FPGA(rev) ? "FPGA" : "ASIC",
            BONITO_REV_MAJOR(rev), BONITO_REV_MINOR(rev));
 
-       pba.pba_busname = "pci";
        pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
        pba.pba_bus = 0;
        pba.pba_bridgetag = NULL;
@@ -120,18 +117,5 @@
            }
 #endif /* ALGOR_P6032 */
 
-       (void) config_found(self, &pba, bonito_mainbus_print);
+       (void) config_found_ia(self, "pcibus", &pba, pcibusprint);
 }
-
-int
-bonito_mainbus_print(void *aux, const char *pnp)
-{
-       struct pcibus_attach_args *pba = aux;
-
-       /* only PCIs can attach to BONITOs; easy. */
-       if (pnp)
-               aprint_normal("%s at %s", pba->pba_busname, pnp);
-       aprint_normal(" bus %d", pba->pba_bus);
-
-       return (UNCONF);
-}
diff -r 98228d05c2cb -r 87d29f6dd688 sys/arch/algor/dev/vtpbc_mainbus.c
--- a/sys/arch/algor/dev/vtpbc_mainbus.c        Mon Aug 30 14:36:51 2004 +0000
+++ b/sys/arch/algor/dev/vtpbc_mainbus.c        Mon Aug 30 15:05:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vtpbc_mainbus.c,v 1.12 2003/07/14 22:57:47 lukem Exp $ */
+/*     $NetBSD: vtpbc_mainbus.c,v 1.13 2004/08/30 15:05:15 drochner Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vtpbc_mainbus.c,v 1.12 2003/07/14 22:57:47 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vtpbc_mainbus.c,v 1.13 2004/08/30 15:05:15 drochner Exp $");
 
 #include "opt_algor_p4032.h"
 #include "opt_algor_p5064.h"
@@ -73,8 +73,6 @@
     vtpbc_mainbus_match, vtpbc_mainbus_attach, NULL, NULL);
 extern struct cfdriver vtpbc_cd;
 
-int    vtpbc_mainbus_print(void *, const char *);
-
 int
 vtpbc_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
 {
@@ -109,7 +107,6 @@
        printf("%s: PCI DMA window base: 0x%08lx\n", sc->sc_dev.dv_xname,
            (u_long) vt->vt_dma_winbase);
 
-       pba.pba_busname = "pci";
        pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
        pba.pba_bus = 0;
        pba.pba_bridgetag = NULL;
@@ -139,18 +136,5 @@
            }
 #endif /* ALGOR_P4032 || ALGOR_P5064 */
 
-       (void) config_found(self, &pba, vtpbc_mainbus_print);
+       (void) config_found_ia(self, "pcibus", &pba, pcibusprint);
 }
-
-int
-vtpbc_mainbus_print(void *aux, const char *pnp)
-{
-       struct pcibus_attach_args *pba = aux;
-
-       /* only PCIs can attach to VTPBCs; easy. */
-       if (pnp)
-               aprint_normal("%s at %s", pba->pba_busname, pnp);
-       aprint_normal(" bus %d", pba->pba_bus);
-
-       return (UNCONF);
-}
diff -r 98228d05c2cb -r 87d29f6dd688 sys/arch/algor/pci/pcib.c
--- a/sys/arch/algor/pci/pcib.c Mon Aug 30 14:36:51 2004 +0000
+++ b/sys/arch/algor/pci/pcib.c Mon Aug 30 15:05:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcib.c,v 1.15 2004/04/23 21:13:05 itojun Exp $ */
+/*     $NetBSD: pcib.c,v 1.16 2004/08/30 15:05:15 drochner Exp $       */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.15 2004/04/23 21:13:05 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.16 2004/08/30 15:05:15 drochner Exp $");
 
 #include "opt_algor_p5064.h" 
 #include "opt_algor_p6032.h"
@@ -124,7 +124,6 @@
 CFATTACH_DECL(pcib, sizeof(struct pcib_softc),
     pcib_match, pcib_attach, NULL, NULL);
 
-int    pcib_print(void *, const char *pnp);
 void   pcib_isa_attach_hook(struct device *, struct device *,
            struct isabus_attach_args *);
 
@@ -305,7 +304,6 @@
 
        memset(&iba, 0, sizeof(iba));
 
-       iba.iba_busname = "isa";
 #if defined(ALGOR_P5064)
            {
                struct p5064_config *acp = &p5064_configuration;
@@ -327,17 +325,7 @@
        iba.iba_ic = &sc->sc_ic;
        iba.iba_ic->ic_attach_hook = pcib_isa_attach_hook;
 
-       (void) config_found(&sc->sc_dev, &iba, pcib_print);
-}
-
-int
-pcib_print(void *aux, const char *pnp)
-{
-       struct isabus_attach_args *iba = aux;
-
-       if (pnp)
-               aprint_normal("%s at %s", iba->iba_busname, pnp);
-       return (UNCONF);
+       (void) config_found_ia(&sc->sc_dev, "isabus", &iba, isabusprint);
 }
 
 void
diff -r 98228d05c2cb -r 87d29f6dd688 sys/arch/alpha/a12/a12dc.c
--- a/sys/arch/alpha/a12/a12dc.c        Mon Aug 30 14:36:51 2004 +0000
+++ b/sys/arch/alpha/a12/a12dc.c        Mon Aug 30 15:05:15 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: a12dc.c,v 1.11 2003/01/20 05:29:57 simonb Exp $ */
+/* $NetBSD: a12dc.c,v 1.12 2004/08/30 15:05:15 drochner Exp $ */
 
 /* [Notice revision 2.2]
  * Copyright (c) 1997, 1998 Avalon Computer Systems, Inc.
@@ -64,7 +64,7 @@
 #ifndef BSIDE
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.11 2003/01/20 05:29:57 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a12dc.c,v 1.12 2004/08/30 15:05:15 drochner Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -149,7 +149,6 @@
        struct pcibus_attach_args *pba = aux;
 
        return  cputype == ST_AVALON_A12
-           &&  strcmp(pba->pba_busname, a12dc_cd.cd_name) == 0
            &&  !a12dcfound;
 }
 
@@ -164,7 +163,7 @@
        /* note that we've attached the chipset; can't have 2 A12Cs. */
        a12dcfound = 1;
 
-       printf(": driver %s\n", "$Revision: 1.11 $");
+       printf(": driver %s\n", "$Revision: 1.12 $");
 
        tp = a12dc_tty[0] = ttymalloc();
        tp->t_oproc = a12dcstart;
diff -r 98228d05c2cb -r 87d29f6dd688 sys/arch/alpha/a12/if_xb.c
--- a/sys/arch/alpha/a12/if_xb.c        Mon Aug 30 14:36:51 2004 +0000
+++ b/sys/arch/alpha/a12/if_xb.c        Mon Aug 30 15:05:15 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xb.c,v 1.11 2002/10/02 04:06:37 thorpej Exp $ */
+/* $NetBSD: if_xb.c,v 1.12 2004/08/30 15:05:15 drochner Exp $ */
 
 /* [Notice revision 2.2]
  * Copyright (c) 1997, 1998 Avalon Computer Systems, Inc.
@@ -74,7 +74,7 @@
 #include "opt_avalon_a12.h"            /* Config options headers */
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: if_xb.c,v 1.11 2002/10/02 04:06:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xb.c,v 1.12 2004/08/30 15:05:15 drochner Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -218,7 +218,6 @@
        struct pcibus_attach_args *pba = aux;
 
        return  cputype == ST_AVALON_A12
-           &&  strcmp(pba->pba_busname, xb_cd.cd_name) == 0
                && !xbfound;
 }
 
@@ -233,7 +232,7 @@
        xbfound = 1;
        ccp = &xb_configuration;
        xb_init_config(ccp, 1);
-       printf(": driver %s mtu %d\n", "$Revision: 1.11 $", xbi.if_mtu);
+       printf(": driver %s mtu %d\n", "$Revision: 1.12 $", xbi.if_mtu);
 }
 
 static void
diff -r 98228d05c2cb -r 87d29f6dd688 sys/arch/alpha/conf/files.alpha
--- a/sys/arch/alpha/conf/files.alpha   Mon Aug 30 14:36:51 2004 +0000
+++ b/sys/arch/alpha/conf/files.alpha   Mon Aug 30 15:05:15 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.166 2004/03/13 17:31:33 bjh21 Exp $
+# $NetBSD: files.alpha,v 1.167 2004/08/30 15:05:15 drochner Exp $
 #
 # alpha-specific configuration info
 
@@ -300,7 +300,10 @@
 file   arch/alpha/pci/cia_swiz_bus_io.c cia
 file   arch/alpha/pci/cia_swiz_bus_mem.c cia
 
-device a12c { }: pcibus
+define a12c_xb {}
+define a12c_a12dc {}
+
+device a12c { }: pcibus, a12c_xb, a12c_a12dc
 attach a12c at mainbus
 file   arch/alpha/pci/a12c.c           a12c
 file   arch/alpha/pci/a12c_bus_mem.c   a12c
@@ -352,7 +355,9 @@
 
 device ttwoga { hose = -1 }
 attach ttwoga at mainbus
-device ttwopci: pcibus, alpha_sgmap, alpha_pci_sgmap_pte64
+# identical to pcibus
+define sableiobus {[bus = -1]}
+device ttwopci: pcibus, sableiobus, alpha_sgmap, alpha_pci_sgmap_pte64
 attach ttwopci at ttwoga
 file   arch/alpha/pci/ttwoga.c         ttwoga
 file   arch/alpha/pci/ttwoga_bus_io.c  ttwoga
@@ -364,7 +369,7 @@
 # Sable STDIO support
 #
 device sableio { port = -1 }
-attach sableio at pcibus
+attach sableio at sableiobus
 file   arch/alpha/sableio/sableio.c            sableio
 
 attach com at sableio with com_sableio
@@ -430,13 +435,13 @@
 # Switch
 
 device xb
-attach xb at a12c
+attach xb at a12c_xb
 file   arch/alpha/a12/if_xb.c  xb
 
 # Console
 
 device a12dc
-attach a12dc at a12c
+attach a12dc at a12c_a12dc
 file   arch/alpha/a12/a12dc.c  a12dc           needs-flag
 
 #
diff -r 98228d05c2cb -r 87d29f6dd688 sys/arch/alpha/jensenio/jensenio.c
--- a/sys/arch/alpha/jensenio/jensenio.c        Mon Aug 30 14:36:51 2004 +0000
+++ b/sys/arch/alpha/jensenio/jensenio.c        Mon Aug 30 15:05:15 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: jensenio.c,v 1.8 2003/01/01 00:39:19 thorpej Exp $ */
+/* $NetBSD: jensenio.c,v 1.9 2004/08/30 15:05:15 drochner Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@



Home | Main Index | Thread Index | Old Index