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/dev/hyperv | |
| 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/dev/hyperv')
| -rw-r--r-- | sys/dev/hyperv/genfb_vmbus.c | 8 | ||||
| -rw-r--r-- | sys/dev/hyperv/hvkbd.c | 6 | ||||
| -rw-r--r-- | sys/dev/hyperv/hvs.c | 7 | ||||
| -rw-r--r-- | sys/dev/hyperv/vmbus.c | 8 |
4 files changed, 16 insertions, 13 deletions
diff --git a/sys/dev/hyperv/genfb_vmbus.c b/sys/dev/hyperv/genfb_vmbus.c index 797fc43cb22..be53f9dc826 100644 --- a/sys/dev/hyperv/genfb_vmbus.c +++ b/sys/dev/hyperv/genfb_vmbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: genfb_vmbus.c,v 1.1 2019/05/24 14:28:48 nonaka Exp $ */ +/* $NetBSD: genfb_vmbus.c,v 1.2 2021/04/24 23:36:54 thorpej Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: genfb_vmbus.c,v 1.1 2019/05/24 14:28:48 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb_vmbus.c,v 1.2 2021/04/24 23:36:54 thorpej Exp $"); #include "opt_wsfb.h" #include "opt_genfb.h" @@ -114,7 +114,9 @@ genfb_vmbus_attach(device_t parent, device_t self, void *aux) return; /* now try to attach a DRM */ - config_found_ia(self, "drm", aux, genfb_vmbus_drm_print); + config_found(self, aux, genfb_vmbus_drm_print, + CFARG_IATTR, "drm", + CFARG_EOL); } static int diff --git a/sys/dev/hyperv/hvkbd.c b/sys/dev/hyperv/hvkbd.c index e38cfd265e3..fa13a0f738c 100644 --- a/sys/dev/hyperv/hvkbd.c +++ b/sys/dev/hyperv/hvkbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: hvkbd.c,v 1.7 2021/01/29 04:38:18 nonaka Exp $ */ +/* $NetBSD: hvkbd.c,v 1.8 2021/04/24 23:36:54 thorpej Exp $ */ /*- * Copyright (c) 2017 Microsoft Corp. @@ -36,7 +36,7 @@ #endif /* _KERNEL_OPT */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.7 2021/01/29 04:38:18 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.8 2021/04/24 23:36:54 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -237,7 +237,7 @@ hvkbd_attach(device_t parent, device_t self, void *aux) a.keymap = &hvkbd_keymapdata; a.accessops = &hvkbd_accessops; a.accesscookie = sc; - sc->sc_wskbddev = config_found(self, &a, wskbddevprint); + sc->sc_wskbddev = config_found(self, &a, wskbddevprint, CFARG_EOL); return; free_buf: diff --git a/sys/dev/hyperv/hvs.c b/sys/dev/hyperv/hvs.c index b7d74957a48..bee86e00b55 100644 --- a/sys/dev/hyperv/hvs.c +++ b/sys/dev/hyperv/hvs.c @@ -1,4 +1,4 @@ -/* $NetBSD: hvs.c,v 1.4 2020/05/25 10:14:58 nonaka Exp $ */ +/* $NetBSD: hvs.c,v 1.5 2021/04/24 23:36:54 thorpej Exp $ */ /* $OpenBSD: hvs.c,v 1.17 2017/08/10 17:22:48 mikeb Exp $ */ /*- @@ -37,7 +37,7 @@ /* #define HVS_DEBUG_IO */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.4 2020/05/25 10:14:58 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.5 2021/04/24 23:36:54 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -391,7 +391,8 @@ hvs_attach(device_t parent, device_t self, void *aux) chan->chan_flags = SCSIPI_CHAN_NOSETTLE; chan->chan_defquirks |= PQUIRK_ONLYBIG; - sc->sc_scsibus = config_found(self, &sc->sc_channel, scsiprint); + sc->sc_scsibus = config_found(self, &sc->sc_channel, scsiprint, + CFARG_EOL); /* * If the driver has successfully attached to an IDE device, diff --git a/sys/dev/hyperv/vmbus.c b/sys/dev/hyperv/vmbus.c index 5dee76f961f..f908854e249 100644 --- a/sys/dev/hyperv/vmbus.c +++ b/sys/dev/hyperv/vmbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: vmbus.c,v 1.12 2021/01/29 04:38:34 nonaka Exp $ */ +/* $NetBSD: vmbus.c,v 1.13 2021/04/24 23:36:54 thorpej Exp $ */ /* $OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $ */ /*- @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.12 2021/01/29 04:38:34 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.13 2021/04/24 23:36:54 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -2202,8 +2202,8 @@ vmbus_process_devq(void *arg) vaa.aa_chan = ch; vaa.aa_iot = sc->sc_iot; vaa.aa_memt = sc->sc_memt; - ch->ch_dev = config_found_ia(sc->sc_dev, - "hypervvmbus", &vaa, vmbus_attach_print); + ch->ch_dev = config_found(sc->sc_dev, + &vaa, vmbus_attach_print, CFARG_EOL); break; case VMBUS_DEV_TYPE_DETACH: |
