diff options
| author | thorpej <thorpej@NetBSD.org> | 2021-04-24 23:36:23 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2021-04-24 23:36:23 +0000 |
| commit | 3bee0c110b9ff2a9a0e2833be339e1c873af3a44 (patch) | |
| tree | 82c9f34b9867882723e76eff95e5d7ca6cab69bf /sys/arch/arc | |
| parent | e77b3a7c4b6598de68d8b78f86e7851410840595 (diff) | |
Merge thorpej-cfargs branch:
Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.
Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)
Remove unnecessary or redundant interface attributes where they're not
needed.
There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)
...and a sentinel value CFARG_EOL.
Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.
Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
Diffstat (limited to 'sys/arch/arc')
| -rw-r--r-- | sys/arch/arc/arc/mainbus.c | 8 | ||||
| -rw-r--r-- | sys/arch/arc/dti/btl.c | 6 | ||||
| -rw-r--r-- | sys/arch/arc/isa/isabus.c | 8 | ||||
| -rw-r--r-- | sys/arch/arc/jazz/fd.c | 7 | ||||
| -rw-r--r-- | sys/arch/arc/jazz/jazzio.c | 6 | ||||
| -rw-r--r-- | sys/arch/arc/pci/necpb.c | 6 |
6 files changed, 22 insertions, 19 deletions
diff --git a/sys/arch/arc/arc/mainbus.c b/sys/arch/arc/arc/mainbus.c index 1463f2bedae..48d70d4f2e2 100644 --- a/sys/arch/arc/arc/mainbus.c +++ b/sys/arch/arc/arc/mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.23 2011/03/06 14:58:42 tsutsui Exp $ */ +/* $NetBSD: mainbus.c,v 1.24 2021/04/24 23:36:25 thorpej Exp $ */ /* $OpenBSD: mainbus.c,v 1.4 1998/10/15 21:30:15 imp Exp $ */ /* NetBSD: mainbus.c,v 1.3 1995/06/28 02:45:10 cgd Exp */ @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.23 2011/03/06 14:58:42 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.24 2021/04/24 23:36:25 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -78,13 +78,13 @@ mbattach(device_t parent, device_t self, void *aux) nca.ca_name = "cpu"; nca.ca_slot = 0; nca.ca_offset = 0; - config_found(self, &nca, mbprint); + config_found(self, &nca, mbprint, CFARG_EOL); for (i = 0; platform->mainbusdevs[i] != NULL; i++) { nca.ca_name = platform->mainbusdevs[i]; nca.ca_slot = 0; nca.ca_offset = 0; - config_found(self, &nca, mbprint); + config_found(self, &nca, mbprint, CFARG_EOL); } } diff --git a/sys/arch/arc/dti/btl.c b/sys/arch/arc/dti/btl.c index cf00ed2edc7..f7a0f092fff 100644 --- a/sys/arch/arc/dti/btl.c +++ b/sys/arch/arc/dti/btl.c @@ -1,4 +1,4 @@ -/* $NetBSD: btl.c,v 1.28 2018/09/03 16:29:22 riastradh Exp $ */ +/* $NetBSD: btl.c,v 1.29 2021/04/24 23:36:25 thorpej Exp $ */ /* NetBSD: bt.c,v 1.10 1996/05/12 23:51:54 mycroft Exp */ #undef BTDIAG @@ -51,7 +51,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: btl.c,v 1.28 2018/09/03 16:29:22 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: btl.c,v 1.29 2021/04/24 23:36:25 thorpej Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -411,7 +411,7 @@ btattach(device_t parent, device_t self, void *aux) /* * ask the adapter what subunits are present */ - config_found(self, &sc->sc_link, scsiprint); + config_found(self, &sc->sc_link, scsiprint, CFARG_EOL); } integrate void diff --git a/sys/arch/arc/isa/isabus.c b/sys/arch/arc/isa/isabus.c index eb4389ff272..01a0c8003a9 100644 --- a/sys/arch/arc/isa/isabus.c +++ b/sys/arch/arc/isa/isabus.c @@ -1,4 +1,4 @@ -/* $NetBSD: isabus.c,v 1.51 2020/11/18 02:14:13 thorpej Exp $ */ +/* $NetBSD: isabus.c,v 1.52 2021/04/24 23:36:25 thorpej Exp $ */ /* $OpenBSD: isabus.c,v 1.15 1998/03/16 09:38:46 pefo Exp $ */ /* NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp */ @@ -120,7 +120,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: isabus.c,v 1.51 2020/11/18 02:14:13 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isabus.c,v 1.52 2021/04/24 23:36:25 thorpej Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -207,7 +207,9 @@ isabrattach(struct isabr_softc *sc) iba.iba_memt = &arc_bus_mem; iba.iba_dmat = &sc->sc_dmat; iba.iba_ic = &sc->arc_isa_cs; - config_found_ia(sc->sc_dev, "isabus", &iba, isabrprint); + config_found(sc->sc_dev, &iba, isabrprint, + CFARG_IATTR, "isabus", + CFARG_EOL); } static int diff --git a/sys/arch/arc/jazz/fd.c b/sys/arch/arc/jazz/fd.c index 5b9617a427f..a6144664c62 100644 --- a/sys/arch/arc/jazz/fd.c +++ b/sys/arch/arc/jazz/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.49 2019/02/08 08:47:35 mrg Exp $ */ +/* $NetBSD: fd.c,v 1.50 2021/04/24 23:36:25 thorpej Exp $ */ /* $OpenBSD: fd.c,v 1.6 1998/10/03 21:18:57 millert Exp $ */ /* NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp */ @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.49 2019/02/08 08:47:35 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.50 2021/04/24 23:36:25 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -281,7 +281,8 @@ fdcattach(struct fdc_softc *fdc) /* physical limit: two drives per controller. */ for (fa.fa_drive = 0; fa.fa_drive < 2; fa.fa_drive++) { fa.fa_deftype = &fd_types[type]; - (void)config_found(fdc->sc_dev, (void *)&fa, fdprint); + (void)config_found(fdc->sc_dev, (void *)&fa, fdprint, + CFARG_EOL); } } diff --git a/sys/arch/arc/jazz/jazzio.c b/sys/arch/arc/jazz/jazzio.c index c1b4c32362a..3a2fbb8237f 100644 --- a/sys/arch/arc/jazz/jazzio.c +++ b/sys/arch/arc/jazz/jazzio.c @@ -1,4 +1,4 @@ -/* $NetBSD: jazzio.c,v 1.22 2011/07/01 19:25:41 dyoung Exp $ */ +/* $NetBSD: jazzio.c,v 1.23 2021/04/24 23:36:25 thorpej Exp $ */ /* $OpenBSD: picabus.c,v 1.11 1999/01/11 05:11:10 millert Exp $ */ /* NetBSD: tc.c,v 1.2 1995/03/08 00:39:05 cgd Exp */ @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: jazzio.c,v 1.22 2011/07/01 19:25:41 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: jazzio.c,v 1.23 2021/04/24 23:36:25 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -149,7 +149,7 @@ jazzioattach(device_t parent, device_t self, void *aux) ja.ja_dma = 0; /* Tell the autoconfig machinery we've found the hardware. */ - config_found(self, &ja, jazzioprint); + config_found(self, &ja, jazzioprint, CFARG_EOL); } } diff --git a/sys/arch/arc/pci/necpb.c b/sys/arch/arc/pci/necpb.c index 6244c9eaca7..335b718f6e0 100644 --- a/sys/arch/arc/pci/necpb.c +++ b/sys/arch/arc/pci/necpb.c @@ -1,4 +1,4 @@ -/* $NetBSD: necpb.c,v 1.46 2020/11/18 02:14:13 thorpej Exp $ */ +/* $NetBSD: necpb.c,v 1.47 2021/04/24 23:36:25 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1.46 2020/11/18 02:14:13 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1.47 2021/04/24 23:36:25 thorpej Exp $"); #include "opt_pci.h" @@ -276,7 +276,7 @@ necpbattach(device_t parent, device_t self, void *aux) pba.pba_bus = 0; pba.pba_bridgetag = NULL; - config_found_ia(self, "pcibus", &pba, pcibusprint); + config_found(self, &pba, pcibusprint, CFARG_EOL); } static void |
