summaryrefslogtreecommitdiff
path: root/sys/dev/ata
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-04-24 23:36:23 +0000
committerthorpej <thorpej@NetBSD.org>2021-04-24 23:36:23 +0000
commit3bee0c110b9ff2a9a0e2833be339e1c873af3a44 (patch)
tree82c9f34b9867882723e76eff95e5d7ca6cab69bf /sys/dev/ata
parente77b3a7c4b6598de68d8b78f86e7851410840595 (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/ata')
-rw-r--r--sys/dev/ata/ata.c15
-rw-r--r--sys/dev/ata/ata_raid.c12
2 files changed, 16 insertions, 11 deletions
diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c
index 847e1ab620f..bcde797d3d2 100644
--- a/sys/dev/ata/ata.c
+++ b/sys/dev/ata/ata.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ata.c,v 1.160 2020/10/03 22:32:50 riastradh Exp $ */
+/* $NetBSD: ata.c,v 1.161 2021/04/24 23:36:52 thorpej Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.160 2020/10/03 22:32:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.161 2021/04/24 23:36:52 thorpej Exp $");
#include "opt_ata.h"
@@ -205,8 +205,9 @@ ata_channel_attach(struct ata_channel *chp)
KASSERT(chp->ch_queue != NULL);
- chp->atabus = config_found_ia(chp->ch_atac->atac_dev, "ata", chp,
- atabusprint);
+ chp->atabus = config_found(chp->ch_atac->atac_dev, chp, atabusprint,
+ CFARG_IATTR, "ata",
+ CFARG_EOL);
}
/*
@@ -372,8 +373,10 @@ atabusconfig_thread(void *arg)
adev.adev_bustype = atac->atac_bustype_ata;
adev.adev_channel = chp->ch_channel;
adev.adev_drv_data = &chp->ch_drive[i];
- chp->ch_drive[i].drv_softc = config_found_ia(atabus_sc->sc_dev,
- "ata_hl", &adev, ataprint);
+ chp->ch_drive[i].drv_softc = config_found(atabus_sc->sc_dev,
+ &adev, ataprint,
+ CFARG_IATTR, "ata_hl",
+ CFARG_EOL);
if (chp->ch_drive[i].drv_softc != NULL) {
ata_probe_caps(&chp->ch_drive[i]);
} else {
diff --git a/sys/dev/ata/ata_raid.c b/sys/dev/ata/ata_raid.c
index 0da644648f8..0ef2e1be730 100644
--- a/sys/dev/ata/ata_raid.c
+++ b/sys/dev/ata/ata_raid.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ata_raid.c,v 1.43 2020/08/25 13:42:09 skrll Exp $ */
+/* $NetBSD: ata_raid.c,v 1.44 2021/04/24 23:36:52 thorpej Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.43 2020/08/25 13:42:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.44 2021/04/24 23:36:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -114,7 +114,7 @@ ataraidattach(int count)
/* ARGSUSED */
static int
-ataraid_rescan(device_t self, const char *attr, const int *flags)
+ataraid_rescan(device_t self, const char *ifattr, const int *locs)
{
finalize_done = 0;
@@ -215,8 +215,10 @@ ataraid_attach(device_t parent, device_t self, void *aux)
locs[ATARAIDCF_VENDTYPE] = aai->aai_type;
locs[ATARAIDCF_UNIT] = aai->aai_arrayno;
- config_found_sm_loc(self, "ataraid", locs, aai,
- ataraid_print, config_stdsubmatch);
+ config_found(self, aai, ataraid_print,
+ CFARG_SUBMATCH, config_stdsubmatch,
+ CFARG_LOCATORS, locs,
+ CFARG_EOL);
}
}