Source-Changes-HG archive

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

[src/thorpej-cfargs]: src/sys/dev/ic - In nvme_rescan(), pass the locators us...



details:   https://anonhg.NetBSD.org/src/rev/ad88324390dc
branches:  thorpej-cfargs
changeset: 954088:ad88324390dc
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Mar 28 20:33:46 2021 +0000

description:
- In nvme_rescan(), pass the locators used for matching to config_found()
  and use config_stdsubmatch().
- No need to be explicit about interface attribute, because we carry
  only one.

diffstat:

 sys/dev/ic/nvme.c |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (74 lines):

diff -r 4ee5cba0ef92 -r ad88324390dc sys/dev/ic/nvme.c
--- a/sys/dev/ic/nvme.c Sun Mar 28 20:31:05 2021 +0000
+++ b/sys/dev/ic/nvme.c Sun Mar 28 20:33:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvme.c,v 1.54.2.1 2021/03/21 21:09:12 thorpej Exp $    */
+/*     $NetBSD: nvme.c,v 1.54.2.2 2021/03/28 20:33:46 thorpej Exp $    */
 /*     $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.54.2.1 2021/03/21 21:09:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.54.2.2 2021/03/28 20:33:46 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -41,6 +41,7 @@
 #include <dev/ic/nvmeio.h>
 
 #include "ioconf.h"
+#include "locators.h"
 
 #define        B4_CHK_RDY_DELAY_MS     2300    /* workaround controller bug */
 
@@ -447,7 +448,7 @@
        /* probe subdevices */
        sc->sc_namespaces = kmem_zalloc(sizeof(*sc->sc_namespaces) * sc->sc_nn,
            KM_SLEEP);
-       nvme_rescan(sc->sc_dev, "nvme", &i);
+       nvme_rescan(sc->sc_dev, NULL, NULL);
 
        return 0;
 
@@ -467,7 +468,7 @@
 }
 
 int
-nvme_rescan(device_t self, const char *attr, const int *flags)
+nvme_rescan(device_t self, const char *ifattr, const int *locs)
 {
        struct nvme_softc *sc = device_private(self);
        struct nvme_attach_args naa;
@@ -475,7 +476,7 @@
        struct nvme_namespace *ns;
        uint64_t cap;
        int ioq_entries = nvme_ioq_size;
-       int i;
+       int i, mlocs[NVMECF_NLOCS];
        int error;
 
        cap = nvme_read8(sc, NVME_CAP);
@@ -511,13 +512,18 @@
                        continue;
                }
 
+               mlocs[NVMECF_NSID] = i;
+
                memset(&naa, 0, sizeof(naa));
                naa.naa_nsid = i;
                naa.naa_qentries = (ioq_entries - 1) * sc->sc_nq;
                naa.naa_maxphys = sc->sc_mdts;
                naa.naa_typename = sc->sc_modelname;
-               sc->sc_namespaces[i - 1].dev = config_found(sc->sc_dev, &naa,
-                   nvme_print, CFARG_EOL);
+               sc->sc_namespaces[i - 1].dev =
+                   config_found(sc->sc_dev, &naa, nvme_print,
+                                CFARG_SUBMATCH, config_stdsubmatch,
+                                CFARG_LOCATORS, mlocs,
+                                CFARG_EOL);
        }
        return 0;
 }



Home | Main Index | Thread Index | Old Index