diff --git a/sys/dev/ata/ata_raid.c b/sys/dev/ata/ata_raid.c index 545202a11336..1be80cb15fc2 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.8 2004/01/25 18:06:48 hannken Exp $ */ +/* $NetBSD: ata_raid.c,v 1.9 2004/09/13 12:55:47 drochner Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.8 2004/01/25 18:06:48 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_raid.c,v 1.9 2004/09/13 12:55:47 drochner Exp $"); #include #include @@ -75,7 +75,8 @@ static int ataraid_match(struct device *, struct cfdata *, void *); static void ataraid_attach(struct device *, struct device *, void *); static int ataraid_print(void *, const char *); -static int ataraid_submatch(struct device *, struct cfdata *, void *); +static int ataraid_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); static int ata_raid_finalize(struct device *); @@ -182,6 +183,8 @@ static void ataraid_attach(struct device *parent, struct device *self, void *aux) { struct ataraid_array_info *aai; + int help[3]; + locdesc_t *ldesc = (void *)help; /* XXX */ /* * We're a pseudo-device, so we get to announce our own @@ -192,7 +195,12 @@ ataraid_attach(struct device *parent, struct device *self, void *aux) ataraid_array_info_count == 1 ? "" : "s"); TAILQ_FOREACH(aai, &ataraid_array_info_list, aai_list) { - config_found_sm(self, aai, ataraid_print, ataraid_submatch); + ldesc->len = 2; + ldesc->locs[ATARAIDCF_VENDTYPE] = aai->aai_type; + ldesc->locs[ATARAIDCF_UNIT] = aai->aai_arrayno; + + config_found_sm_loc(self, "ataraid", NULL, aai, + ataraid_print, ataraid_submatch); } } @@ -218,16 +226,16 @@ ataraid_print(void *aux, const char *pnp) * Submatch routine for ATA RAID logical disks. */ static int -ataraid_submatch(struct device *parent, struct cfdata *cf, void *aux) +ataraid_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { - struct ataraid_array_info *aai = aux; if (cf->cf_loc[ATARAIDCF_VENDTYPE] != ATARAIDCF_VENDTYPE_DEFAULT && - cf->cf_loc[ATARAIDCF_VENDTYPE] != aai->aai_type) + cf->cf_loc[ATARAIDCF_VENDTYPE] != ldesc->locs[ATARAIDCF_VENDTYPE]) return (0); if (cf->cf_loc[ATARAIDCF_UNIT] != ATARAIDCF_UNIT_DEFAULT && - cf->cf_loc[ATARAIDCF_UNIT] != aai->aai_arrayno) + cf->cf_loc[ATARAIDCF_UNIT] != ldesc->locs[ATARAIDCF_UNIT]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/cardbus/cardslot.c b/sys/dev/cardbus/cardslot.c index 62cf60d1f47b..823b6e8fa8c6 100644 --- a/sys/dev/cardbus/cardslot.c +++ b/sys/dev/cardbus/cardslot.c @@ -1,4 +1,4 @@ -/* $NetBSD: cardslot.c,v 1.24 2003/11/02 09:56:38 wiz Exp $ */ +/* $NetBSD: cardslot.c,v 1.25 2004/09/13 12:55:47 drochner Exp $ */ /* * Copyright (c) 1999 and 2000 @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.24 2003/11/02 09:56:38 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.25 2004/09/13 12:55:47 drochner Exp $"); #include "opt_cardslot.h" @@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: cardslot.c,v 1.24 2003/11/02 09:56:38 wiz Exp $"); #include #include +#include "locators.h" #if defined CARDSLOT_DEBUG #define STATIC @@ -72,7 +73,8 @@ static void cardslot_event_thread __P((void *arg)); STATIC int cardslot_cb_print __P((void *aux, const char *pcic)); static int cardslot_16_print __P((void *, const char *)); -static int cardslot_16_submatch __P((struct device *, struct cfdata *,void *)); +static int cardslot_16_submatch __P((struct device *, struct cfdata *, + const locdesc_t *, void *)); CFATTACH_DECL(cardslot, sizeof(struct cardslot_softc), cardslotmatch, cardslotattach, NULL, NULL); @@ -116,20 +118,25 @@ cardslotattach(parent, self, aux) SIMPLEQ_INIT(&sc->sc_events); sc->sc_th_enable = 0; - printf(" slot %d flags %x\n", sc->sc_slot, sc->sc_dev.dv_cfdata->cf_flags); + printf(" slot %d flags %x\n", sc->sc_slot, + sc->sc_dev.dv_cfdata->cf_flags); DPRINTF(("%s attaching CardBus bus...\n", sc->sc_dev.dv_xname)); if (cba != NULL) { - if (NULL != (csc = (void *)config_found(self, cba, cardslot_cb_print))) { + csc = (void *)config_found_ia(self, "cbbus", cba, + cardslot_cb_print); + if (csc) { /* cardbus found */ - DPRINTF(("cardslotattach: found cardbus on %s\n", sc->sc_dev.dv_xname)); + DPRINTF(("cardslotattach: found cardbus on %s\n", + sc->sc_dev.dv_xname)); sc->sc_cb_softc = csc; } } if (pa != NULL) { - if (NULL != (psc = (void *)config_found_sm(self, pa, - cardslot_16_print, cardslot_16_submatch))) { + psc = (void *)config_found_sm_loc(self, "pcmciabus", NULL, pa, + cardslot_16_print, cardslot_16_submatch); + if (psc) { /* pcmcia 16-bit bus found */ DPRINTF(("cardslotattach: found 16-bit pcmcia bus\n")); sc->sc_16_softc = psc; @@ -178,9 +185,10 @@ cardslot_cb_print(aux, pnp) static int -cardslot_16_submatch(parent, cf, aux) +cardslot_16_submatch(parent, cf, ldesc, aux) struct device *parent; struct cfdata *cf; + const locdesc_t *ldesc; void *aux; { diff --git a/sys/dev/cardbus/cardslotvar.h b/sys/dev/cardbus/cardslotvar.h index 06786500ff1b..4a695fd52268 100644 --- a/sys/dev/cardbus/cardslotvar.h +++ b/sys/dev/cardbus/cardslotvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cardslotvar.h,v 1.7 2003/07/08 10:06:29 itojun Exp $ */ +/* $NetBSD: cardslotvar.h,v 1.8 2004/09/13 12:55:47 drochner Exp $ */ /* * Copyright (c) 1999 @@ -122,8 +122,6 @@ typedef struct cardslot_softc *cardslot_t; #define IS_CARDSLOT_INSERT_REMOVE_EV(x) (0 <= (x) && (x) <= 3) -#include "locators.h" - void cardslot_event_throw __P((cardslot_t, int)); #endif /* !_DEV_CARDBUS_CARDSLOTVAR_H_ */ diff --git a/sys/dev/gpib/cs80bus.c b/sys/dev/gpib/cs80bus.c index a4b72f000d7a..a6ab294f2509 100644 --- a/sys/dev/gpib/cs80bus.c +++ b/sys/dev/gpib/cs80bus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cs80bus.c,v 1.1 2003/06/02 03:51:04 gmcgarry Exp $ */ +/* $NetBSD: cs80bus.c,v 1.2 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cs80bus.c,v 1.1 2003/06/02 03:51:04 gmcgarry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs80bus.c,v 1.2 2004/09/13 12:55:47 drochner Exp $"); #include #include @@ -71,7 +71,8 @@ CFATTACH_DECL(cs80bus, sizeof(struct cs80bus_softc), cs80busmatch, cs80busattach, NULL, NULL); static int cs80bus_alloc(struct cs80bus_softc *, int, int); -static int cs80bussearch(struct device *, struct cfdata *, void *); +static int cs80bussearch(struct device *, struct cfdata *, + const locdesc_t *, void *); static int cs80busprint(void *, const char *); /* @@ -141,7 +142,7 @@ cs80busattach(parent, self, aux) ca.ca_slave = slave; ca.ca_id = id; - (void)config_search(cs80bussearch, &sc->sc_dev, &ca); + (void)config_search_ia(cs80bussearch, &sc->sc_dev, "cs80bus", &ca); } } @@ -149,6 +150,7 @@ int cs80bussearch(parent, cf, aux) struct device *parent; struct cfdata *cf; + const locdesc_t *ldesc; void *aux; { struct cs80bus_softc *sc = (struct cs80bus_softc *)parent; diff --git a/sys/dev/gpib/gpib.c b/sys/dev/gpib/gpib.c index 9dc5dda3bc41..a5ed21ddf8b0 100644 --- a/sys/dev/gpib/gpib.c +++ b/sys/dev/gpib/gpib.c @@ -1,4 +1,4 @@ -/* $NetBSD: gpib.c,v 1.1 2003/06/02 03:45:42 gmcgarry Exp $ */ +/* $NetBSD: gpib.c,v 1.2 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gpib.c,v 1.1 2003/06/02 03:45:42 gmcgarry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gpib.c,v 1.2 2004/09/13 12:55:47 drochner Exp $"); #include #include @@ -71,8 +71,10 @@ void gpibattach __P((struct device *, struct device *, void *)); CFATTACH_DECL(gpib, sizeof(struct gpib_softc), gpibmatch, gpibattach, NULL, NULL); -static int gpibsubmatch1(struct device *, struct cfdata *, void *); -static int gpibsubmatch2(struct device *, struct cfdata *, void *); +static int gpibsubmatch1(struct device *, struct cfdata *, + const locdesc_t *, void *); +static int gpibsubmatch2(struct device *, struct cfdata *, + const locdesc_t *, void *); static int gpibprint(void *, const char *); dev_type_open(gpibopen); @@ -139,18 +141,19 @@ gpibattach(parent, self, aux) for (address=0; addresssc_ic; ga.ga_address = address; - (void) config_search(gpibsubmatch1, &sc->sc_dev, &ga); + (void) config_search_ia(gpibsubmatch1, &sc->sc_dev, "gpib", &ga); } /* attach the wild-carded devices - probably protocol busses */ ga.ga_ic = sc->sc_ic; - (void) config_search(gpibsubmatch2, &sc->sc_dev, &ga); + (void) config_search_ia(gpibsubmatch2, &sc->sc_dev, "gpib", &ga); } int -gpibsubmatch1(parent, cf, aux) +gpibsubmatch1(parent, cf, ldesc, aux) struct device *parent; struct cfdata *cf; + const locdesc_t *ldesc; void *aux; { struct gpib_softc *sc = (struct gpib_softc *)parent; @@ -175,6 +178,7 @@ int gpibsubmatch2(parent, cf, aux) struct device *parent; struct cfdata *cf; + const locdesc_t *ldesc; void *aux; { struct gpib_attach_args *ga = aux; diff --git a/sys/dev/hpc/hpcioman.c b/sys/dev/hpc/hpcioman.c index 148f7b38e863..58ed770acf3d 100644 --- a/sys/dev/hpc/hpcioman.c +++ b/sys/dev/hpc/hpcioman.c @@ -1,4 +1,4 @@ -/* $NetBSD: hpcioman.c,v 1.10 2003/01/01 00:19:31 thorpej Exp $ */ +/* $NetBSD: hpcioman.c,v 1.11 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpcioman.c,v 1.10 2003/01/01 00:19:31 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpcioman.c,v 1.11 2004/09/13 12:55:47 drochner Exp $"); #include #include @@ -56,7 +56,8 @@ __KERNEL_RCSID(0, "$NetBSD: hpcioman.c,v 1.10 2003/01/01 00:19:31 thorpej Exp $" int hpcioman_match(struct device *, struct cfdata *, void *); void hpcioman_attach(struct device *, struct device *, void *); int hpcioman_print(void *, const char *); -int hpcioman_search(struct device *, struct cfdata *, void *); +int hpcioman_search(struct device *, struct cfdata *, + const locdesc_t *, void *); struct hpcioman_softc { struct device sc_dev; @@ -84,11 +85,12 @@ hpcioman_attach(struct device *parent, struct device *self, void *aux) { printf("\n"); - config_search(hpcioman_search, self, aux); + config_search_ia(hpcioman_search, self, "hpcioman", aux); } int -hpcioman_search(struct device *parent, struct cfdata *cf, void *aux) +hpcioman_search(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { //struct hpcioman_softc *sc = (struct hpcioman_softc *)parent; struct hpcio_attach_args *haa = aux; diff --git a/sys/dev/i2c/i2c.c b/sys/dev/i2c/i2c.c index a152af6d5095..495bf0866c9f 100644 --- a/sys/dev/i2c/i2c.c +++ b/sys/dev/i2c/i2c.c @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.c,v 1.2 2004/05/16 11:42:28 wiz Exp $ */ +/* $NetBSD: i2c.c,v 1.3 2004/09/13 12:55:47 drochner Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -72,7 +72,8 @@ iic_print(void *aux, const char *pnp) } static int -iic_search(struct device *parent, struct cfdata *cf, void *aux) +iic_search(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct iic_softc *sc = (void *) parent; struct i2c_attach_args ia; @@ -111,7 +112,7 @@ iic_attach(struct device *parent, struct device *self, void *aux) * Attach all i2c devices described in the kernel * configuration file. */ - config_search(iic_search, self, NULL); + config_search_ia(iic_search, self, "iic", NULL); } CFATTACH_DECL(iic, sizeof(struct iic_softc), diff --git a/sys/dev/i2o/iop.c b/sys/dev/i2o/iop.c index 267a06aa9f8d..4377bb24751b 100644 --- a/sys/dev/i2o/iop.c +++ b/sys/dev/i2o/iop.c @@ -1,4 +1,4 @@ -/* $NetBSD: iop.c,v 1.43 2004/04/22 00:17:10 itojun Exp $ */ +/* $NetBSD: iop.c,v 1.44 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.43 2004/04/22 00:17:10 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.44 2004/09/13 12:55:47 drochner Exp $"); #include "opt_i2o.h" #include "iop.h" @@ -67,6 +67,8 @@ __KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.43 2004/04/22 00:17:10 itojun Exp $"); #include #include +#include "locators.h" + #define POLL(ms, cond) \ do { \ int i; \ @@ -226,7 +228,8 @@ static void iop_configure_devices(struct iop_softc *, int, int); static void iop_devinfo(int, char *, size_t); static int iop_print(void *, const char *); static void iop_shutdown(void *); -static int iop_submatch(struct device *, struct cfdata *, void *); +static int iop_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); static void iop_adjqparam(struct iop_softc *, int); static void iop_create_reconf_thread(void *); @@ -483,6 +486,8 @@ iop_config_interrupts(struct device *self) struct iop_softc *sc, *iop; struct i2o_systab_entry *ste; int rv, i, niop; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ sc = (struct iop_softc *)self; LIST_INIT(&sc->sc_iilist); @@ -586,7 +591,9 @@ iop_config_interrupts(struct device *self) */ ia.ia_class = I2O_CLASS_ANY; ia.ia_tid = I2O_TID_IOP; - config_found_sm(self, &ia, iop_print, iop_submatch); + ldesc->len = 1; + ldesc->locs[IOPCF_TID] = I2O_TID_IOP; + config_found_sm_loc(self, "iop", NULL, &ia, iop_print, iop_submatch); /* * Start device configuration. @@ -796,6 +803,8 @@ iop_configure_devices(struct iop_softc *sc, int mask, int maskval) struct device *dv; int i, j, nent; u_int usertid; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ nent = sc->sc_nlctent; for (i = 0, le = sc->sc_lct->entry; i < nent; i++, le++) { @@ -832,7 +841,11 @@ iop_configure_devices(struct iop_softc *sc, int mask, int maskval) if (ii != NULL) continue; - dv = config_found_sm(&sc->sc_dv, &ia, iop_print, iop_submatch); + ldesc->len = 1; + ldesc->locs[IOPCF_TID] = ii->ii_tid; + + dv = config_found_sm_loc(&sc->sc_dv, "iop", NULL, &ia, + iop_print, iop_submatch); if (dv != NULL) { sc->sc_tidmap[i].it_flags |= IT_CONFIGURED; strcpy(sc->sc_tidmap[i].it_dvname, dv->dv_xname); @@ -890,13 +903,12 @@ iop_print(void *aux, const char *pnp) } static int -iop_submatch(struct device *parent, struct cfdata *cf, void *aux) +iop_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { - struct iop_attach_args *ia; - - ia = aux; - if (cf->iopcf_tid != IOPCF_TID_DEFAULT && cf->iopcf_tid != ia->ia_tid) + if (cf->cf_loc[IOPCF_TID] != IOPCF_TID_DEFAULT && + cf->cf_loc[IOPCF_TID] != ldesc->locs[IOPCF_TID]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/i2o/iopvar.h b/sys/dev/i2o/iopvar.h index 055be8da75fa..6b98d5213357 100644 --- a/sys/dev/i2o/iopvar.h +++ b/sys/dev/i2o/iopvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: iopvar.h,v 1.13 2003/12/09 19:43:54 ad Exp $ */ +/* $NetBSD: iopvar.h,v 1.14 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. @@ -39,8 +39,6 @@ #ifndef _I2O_IOPVAR_H_ #define _I2O_IOPVAR_H_ -#include "locators.h" - /* * Transfer descriptor. */ @@ -164,7 +162,6 @@ struct iop_attach_args { int ia_class; /* device class */ int ia_tid; /* target ID */ }; -#define iopcf_tid cf_loc[IOPCF_TID] /* TID */ void iop_init(struct iop_softc *, const char *); int iop_intr(void *); diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c index 623355b80f52..cfcd9b636394 100644 --- a/sys/dev/ic/aac.c +++ b/sys/dev/ic/aac.c @@ -1,4 +1,4 @@ -/* $NetBSD: aac.c,v 1.12 2004/08/24 00:53:28 thorpej Exp $ */ +/* $NetBSD: aac.c,v 1.13 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -77,9 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.12 2004/08/24 00:53:28 thorpej Exp $"); - -#include "locators.h" +__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.13 2004/09/13 12:55:47 drochner Exp $"); #include #include @@ -96,6 +94,8 @@ __KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.12 2004/08/24 00:53:28 thorpej Exp $"); #include #include +#include "locators.h" + static int aac_check_firmware(struct aac_softc *); static void aac_describe_controller(struct aac_softc *); static int aac_dequeue_fib(struct aac_softc *, int, u_int32_t *, @@ -111,7 +111,8 @@ static int aac_sync_command(struct aac_softc *, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t, u_int32_t *); static int aac_sync_fib(struct aac_softc *, u_int32_t, u_int32_t, void *, u_int16_t, void *, u_int16_t *); -static int aac_submatch(struct device *, struct cfdata *, void *); +static int aac_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); #ifdef AAC_DEBUG static void aac_print_fib(struct aac_softc *, struct aac_fib *, char *); @@ -153,6 +154,8 @@ aac_attach(struct aac_softc *sc) struct aac_ccb *ac; struct aac_fib *fib; bus_addr_t fibpa; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ SIMPLEQ_INIT(&sc->sc_ccb_free); SIMPLEQ_INIT(&sc->sc_ccb_queue); @@ -250,7 +253,12 @@ aac_attach(struct aac_softc *sc) if (!sc->sc_hdr[i].hd_present) continue; aaca.aaca_unit = i; - config_found_sm(&sc->sc_dv, &aaca, aac_print, aac_submatch); + + ldesc->len = 1; + ldesc->locs[AACCF_UNIT] = i; + + config_found_sm_loc(&sc->sc_dv, "aac", ldesc, &aaca, + aac_print, aac_submatch); } /* @@ -302,14 +310,15 @@ aac_print(void *aux, const char *pnp) * Match a sub-device. */ static int -aac_submatch(struct device *parent, struct cfdata *cf, void *aux) +aac_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct aac_attach_args *aaca; aaca = aux; - if (cf->aaccf_unit != AACCF_UNIT_DEFAULT && - cf->aaccf_unit != aaca->aaca_unit) + if (cf->cf_loc[AACCF_UNIT] != AACCF_UNIT_DEFAULT && + cf->cf_loc[AACCF_UNIT] != ldesc->locs[AACCF_UNIT]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/ic/aacvar.h b/sys/dev/ic/aacvar.h index 920902674820..356893185d88 100644 --- a/sys/dev/ic/aacvar.h +++ b/sys/dev/ic/aacvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: aacvar.h,v 1.3 2004/08/24 00:53:28 thorpej Exp $ */ +/* $NetBSD: aacvar.h,v 1.4 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -298,8 +298,6 @@ struct aac_attach_args { int aaca_unit; }; -#define aaccf_unit cf_loc[AACCF_UNIT] - int aac_attach(struct aac_softc *); void aac_ccb_enqueue(struct aac_softc *, struct aac_ccb *); void aac_ccb_free(struct aac_softc *, struct aac_ccb *); diff --git a/sys/dev/ic/atppc.c b/sys/dev/ic/atppc.c index 44ad72e36ed4..e901016894a8 100644 --- a/sys/dev/ic/atppc.c +++ b/sys/dev/ic/atppc.c @@ -1,4 +1,4 @@ -/* $NetBSD: atppc.c,v 1.17 2004/08/24 00:53:29 thorpej Exp $ */ +/* $NetBSD: atppc.c,v 1.18 2004/09/13 12:55:47 drochner Exp $ */ /* * Copyright (c) 2001 Alcove - Nicolas Souchu @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atppc.c,v 1.17 2004/08/24 00:53:29 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atppc.c,v 1.18 2004/09/13 12:55:47 drochner Exp $"); #include "opt_atppc.h" @@ -80,7 +80,7 @@ static int (*chipset_detect[])(struct atppc_softc *) = { /* Prototypes for functions. */ -/* Print function for config_found_sm() */ +/* Print function for config_found() */ static int atppc_print(void *, const char *); /* Detection routines */ @@ -237,8 +237,8 @@ atppc_sc_attach(struct atppc_softc *lsc) lsc->sc_use = 0; /* Configure child of the device. */ - lsc->child = config_found_sm(&(lsc->sc_dev), &(sc_parport_adapter), - atppc_print, NULL); + lsc->child = config_found(&(lsc->sc_dev), &(sc_parport_adapter), + atppc_print); return; } @@ -267,7 +267,7 @@ atppc_sc_detach(struct atppc_softc *lsc, int flag) return 0; } -/* Used by config_found_sm() to print out device information */ +/* Used by config_found() to print out device information */ static int atppc_print(void *aux, const char *name) { diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index 9563964aa337..b6cb49bede01 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,4 +1,4 @@ -/* $NetBSD: cac.c,v 1.27 2004/08/24 00:53:29 thorpej Exp $ */ +/* $NetBSD: cac.c,v 1.28 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.27 2004/08/24 00:53:29 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.28 2004/09/13 12:55:47 drochner Exp $"); #include #include @@ -62,6 +62,8 @@ __KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.27 2004/08/24 00:53:29 thorpej Exp $"); #include #include +#include "locators.h" + static struct cac_ccb *cac_ccb_alloc(struct cac_softc *, int); static void cac_ccb_done(struct cac_softc *, struct cac_ccb *); static void cac_ccb_free(struct cac_softc *, struct cac_ccb *); @@ -69,7 +71,8 @@ static int cac_ccb_poll(struct cac_softc *, struct cac_ccb *, int); static int cac_ccb_start(struct cac_softc *, struct cac_ccb *); static int cac_print(void *, const char *); static void cac_shutdown(void *); -static int cac_submatch(struct device *, struct cfdata *, void *); +static int cac_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); static struct cac_ccb *cac_l0_completed(struct cac_softc *); static int cac_l0_fifo_full(struct cac_softc *); @@ -98,6 +101,8 @@ cac_init(struct cac_softc *sc, const char *intrstr, int startfw) int error, rseg, size, i; bus_dma_segment_t seg; struct cac_ccb *ccb; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ if (intrstr != NULL) aprint_normal("%s: interrupting at %s\n", sc->sc_dv.dv_xname, @@ -179,7 +184,12 @@ cac_init(struct cac_softc *sc, const char *intrstr, int startfw) sc->sc_nunits = cinfo.num_drvs; for (i = 0; i < cinfo.num_drvs; i++) { caca.caca_unit = i; - config_found_sm(&sc->sc_dv, &caca, cac_print, cac_submatch); + + ldesc->len = 1; + ldesc->locs[CACCF_UNIT] = i; + + config_found_sm_loc(&sc->sc_dv, "cac", ldesc, &caca, + cac_print, cac_submatch); } /* Set our `shutdownhook' before we start any device activity. */ @@ -231,14 +241,12 @@ cac_print(void *aux, const char *pnp) * Match a sub-device. */ static int -cac_submatch(struct device *parent, struct cfdata *cf, void *aux) +cac_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { - struct cac_attach_args *caca; - caca = (struct cac_attach_args *)aux; - - if (cf->cacacf_unit != CACCF_UNIT_DEFAULT && - cf->cacacf_unit != caca->caca_unit) + if (cf->cf_loc[CACCF_UNIT] != CACCF_UNIT_DEFAULT && + cf->cf_loc[CACCF_UNIT] != ldesc->locs[CACCF_UNIT]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/ic/cacvar.h b/sys/dev/ic/cacvar.h index 7811eafbd7e2..d0a921a18a38 100644 --- a/sys/dev/ic/cacvar.h +++ b/sys/dev/ic/cacvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cacvar.h,v 1.9 2002/01/25 16:10:36 ad Exp $ */ +/* $NetBSD: cacvar.h,v 1.10 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -39,8 +39,6 @@ #ifndef _IC_CACVAR_H_ #define _IC_CACVAR_H_ -#include "locators.h" - #define CAC_MAX_CCBS 20 #define CAC_MAX_XFER (0xffff * 512) #define CAC_SG_SIZE 32 @@ -125,8 +123,6 @@ struct cac_attach_args { int caca_unit; }; -#define cacacf_unit cf_loc[CACCF_UNIT] - int cac_cmd(struct cac_softc *, int, void *, int, int, int, int, struct cac_context *); int cac_init(struct cac_softc *, const char *, int); diff --git a/sys/dev/ic/icp.c b/sys/dev/ic/icp.c index a7aa90f1f271..8cb1812d05ae 100644 --- a/sys/dev/ic/icp.c +++ b/sys/dev/ic/icp.c @@ -1,4 +1,4 @@ -/* $NetBSD: icp.c,v 1.12 2003/10/29 00:48:15 mycroft Exp $ */ +/* $NetBSD: icp.c,v 1.13 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.12 2003/10/29 00:48:15 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.13 2004/09/13 12:55:47 drochner Exp $"); #include #include @@ -111,11 +111,14 @@ __KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.12 2003/10/29 00:48:15 mycroft Exp $"); #include #include +#include "locators.h" + int icp_async_event(struct icp_softc *, int); void icp_ccb_submit(struct icp_softc *icp, struct icp_ccb *ic); void icp_chain(struct icp_softc *); int icp_print(void *, const char *); -int icp_submatch(struct device *, struct cfdata *, void *); +int icp_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); void icp_watchdog(void *); void icp_ucmd_intr(struct icp_ccb *); void icp_recompute_openings(struct icp_softc *); @@ -138,6 +141,8 @@ icp_init(struct icp_softc *icp, const char *intrstr) struct icp_ccb *ic; u_int16_t cdev_cnt; int i, j, state, feat, nsegs, rv; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ state = 0; @@ -379,9 +384,13 @@ icp_init(struct icp_softc *icp, const char *intrstr) icp->icp_bus_id[j] = ICP_MAXID_FC; icpa.icpa_unit = j + ICPA_UNIT_SCSI; + + ldesc->len = 1; + ldesc->locs[ICPCF_UNIT] = j + ICPA_UNIT_SCSI; + icp->icp_children[icpa.icpa_unit] = - config_found_sm(&icp->icp_dv, &icpa, icp_print, - icp_submatch); + config_found_sm_loc(&icp->icp_dv, "icp", ldesc, + &icpa, icp_print, icp_submatch); } } @@ -394,9 +403,13 @@ icp_init(struct icp_softc *icp, const char *intrstr) continue; icpa.icpa_unit = j; + + ldesc->len = 1; + ldesc->locs[ICPCF_UNIT] = j; + icp->icp_children[icpa.icpa_unit] = - config_found_sm(&icp->icp_dv, &icpa, icp_print, - icp_submatch); + config_found_sm_loc(&icp->icp_dv, "icp", ldesc, + &icpa, icp_print, icp_submatch); } } @@ -444,6 +457,8 @@ icp_rescan(struct icp_softc *icp, int unit) { struct icp_attach_args icpa; u_int newsize, newtype; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ /* * NOTE: It is very important that the queue be frozen and not @@ -515,8 +530,12 @@ icp_rescan(struct icp_softc *icp, int unit) DETACH_FORCE); icpa.icpa_unit = unit; - icp->icp_children[unit] = config_found_sm(&icp->icp_dv, &icpa, - icp_print, icp_submatch); + + ldesc->len = 1; + ldesc->locs[ICPCF_UNIT] = unit; + + icp->icp_children[unit] = config_found_sm_loc(&icp->icp_dv, + "icp", ldesc, &icpa, icp_print, icp_submatch); } icp_recompute_openings(icp); @@ -629,14 +648,12 @@ icp_print(void *aux, const char *pnp) } int -icp_submatch(struct device *parent, struct cfdata *cf, void *aux) +icp_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { - struct icp_attach_args *icpa; - icpa = (struct icp_attach_args *)aux; - - if (cf->icpacf_unit != ICPCF_UNIT_DEFAULT && - cf->icpacf_unit != icpa->icpa_unit) + if (cf->cf_loc[ICPCF_UNIT] != ICPCF_UNIT_DEFAULT && + cf->cf_loc[ICPCF_UNIT] != ldesc->locs[ICPCF_UNIT]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/ic/icpvar.h b/sys/dev/ic/icpvar.h index 0387cfb658bb..031f981d65a1 100644 --- a/sys/dev/ic/icpvar.h +++ b/sys/dev/ic/icpvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: icpvar.h,v 1.3 2003/06/13 05:57:31 thorpej Exp $ */ +/* $NetBSD: icpvar.h,v 1.4 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -39,8 +39,6 @@ #ifndef _IC_ICPVAR_H_ #define _IC_ICPVAR_H_ -#include "locators.h" - #include /* @@ -237,8 +235,6 @@ struct icp_attach_args { int icpa_unit; }; -#define icpacf_unit cf_loc[ICPCF_UNIT] - #define ICPA_UNIT_SCSI 100 struct icp_ccb *icp_ccb_alloc(struct icp_softc *); diff --git a/sys/dev/ic/mlx.c b/sys/dev/ic/mlx.c index 55bcf0b7a105..de925b26e977 100644 --- a/sys/dev/ic/mlx.c +++ b/sys/dev/ic/mlx.c @@ -1,4 +1,4 @@ -/* $NetBSD: mlx.c,v 1.29 2004/04/22 00:17:11 itojun Exp $ */ +/* $NetBSD: mlx.c,v 1.30 2004/09/13 12:55:47 drochner Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -74,7 +74,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.29 2004/04/22 00:17:11 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.30 2004/09/13 12:55:47 drochner Exp $"); #include "ld.h" @@ -102,6 +102,8 @@ __KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.29 2004/04/22 00:17:11 itojun Exp $"); #include #include +#include "locators.h" + #define MLX_TIMEOUT 60 #ifdef DIAGNOSTIC @@ -130,7 +132,8 @@ static void mlx_periodic_thread(void *); static int mlx_print(void *, const char *); static int mlx_rebuild(struct mlx_softc *, int, int); static void mlx_shutdown(void *); -static int mlx_submatch(struct device *, struct cfdata *, void *); +static int mlx_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); static int mlx_user_command(struct mlx_softc *, struct mlx_usercommand *); static __inline__ time_t mlx_curtime(void); @@ -573,6 +576,8 @@ mlx_configure(struct mlx_softc *mlx, int waitok) struct mlx_attach_args mlxa; int i, nunits; u_int size; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ mlx->mlx_flags |= MLXF_RESCANNING; @@ -636,7 +641,11 @@ mlx_configure(struct mlx_softc *mlx, int waitok) * Attach a new device. */ mlxa.mlxa_unit = i; - ms->ms_dv = config_found_sm(&mlx->mlx_dv, &mlxa, mlx_print, + + ldesc->len = 1; + ldesc->locs[MLXCF_UNIT] = i; + + ms->ms_dv = config_found_sm_loc(&mlx->mlx_dv, "mlx", NULL, &mlxa, mlx_print, mlx_submatch); nunits += (ms->ms_dv != NULL); } @@ -670,14 +679,12 @@ mlx_print(void *aux, const char *pnp) * Match a sub-device. */ static int -mlx_submatch(struct device *parent, struct cfdata *cf, void *aux) +mlx_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { - struct mlx_attach_args *mlxa; - mlxa = (struct mlx_attach_args *)aux; - - if (cf->mlxacf_unit != MLXCF_UNIT_DEFAULT && - cf->mlxacf_unit != mlxa->mlxa_unit) + if (cf->cf_loc[MLXCF_UNIT] != MLXCF_UNIT_DEFAULT && + cf->cf_loc[MLXCF_UNIT] != ldesc->locs[MLXCF_UNIT]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/ic/mlxvar.h b/sys/dev/ic/mlxvar.h index a137596390e9..26a380f1571b 100644 --- a/sys/dev/ic/mlxvar.h +++ b/sys/dev/ic/mlxvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: mlxvar.h,v 1.7 2002/09/22 18:59:00 ad Exp $ */ +/* $NetBSD: mlxvar.h,v 1.8 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -67,8 +67,6 @@ #ifndef _IC_MLXVAR_H_ #define _IC_MLXVAR_H_ -#include "locators.h" - /* Older boards allow up to 17 segments and 64kB transfers. */ #define MLX_MAX_SEGS 17 #define MLX_MAX_XFER 65536 @@ -183,8 +181,6 @@ struct mlx_attach_args { int mlxa_unit; }; -#define mlxacf_unit cf_loc[MLXCF_UNIT] - int mlx_flush(struct mlx_softc *, int); void mlx_init(struct mlx_softc *, const char *); int mlx_intr(void *); diff --git a/sys/dev/ic/upc.c b/sys/dev/ic/upc.c index 4f7b0edd012a..be5f11ceaa53 100644 --- a/sys/dev/ic/upc.c +++ b/sys/dev/ic/upc.c @@ -1,4 +1,4 @@ -/* $NetBSD: upc.c,v 1.7 2003/11/29 19:33:34 bjh21 Exp $ */ +/* $NetBSD: upc.c,v 1.8 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 2000, 2003 Ben Harris * All rights reserved. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: upc.c,v 1.7 2003/11/29 19:33:34 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: upc.c,v 1.8 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -70,7 +70,8 @@ static void upc_found(struct upc_softc *, char const *, int, int, static void upc_found2(struct upc_softc *, char const *, int, int, int, int, struct upc_irqhandle *); static int upc_print(void *, char const *); -static int upc_submatch(struct device *, struct cfdata *, void *); +static int upc_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); static int upc2_com3_addr(int); static int upc2_com4_addr(int); @@ -210,13 +211,20 @@ upc_found(struct upc_softc *sc, char const *devtype, int offset, int size, struct upc_irqhandle *uih) { struct upc_attach_args ua; + int help[2]; + locdesc_t *ldesc = (void *)help; ua.ua_devtype = devtype; ua.ua_offset = offset; ua.ua_iot = sc->sc_iot; bus_space_subregion(sc->sc_iot, sc->sc_ioh, offset, size, &ua.ua_ioh); ua.ua_irqhandle = uih; - config_found_sm(&sc->sc_dev, &ua, upc_print, upc_submatch); + + ldesc->len = 1; + ldesc->locs[UPCCF_OFFSET] = offset; + + config_found_sm_loc(&sc->sc_dev, "upc", ldesc, &ua, + upc_print, upc_submatch); } static void @@ -224,6 +232,8 @@ upc_found2(struct upc_softc *sc, char const *devtype, int offset, int size, int offset2, int size2, struct upc_irqhandle *uih) { struct upc_attach_args ua; + int help[2]; + locdesc_t *ldesc = (void *)help; ua.ua_devtype = devtype; ua.ua_offset = offset; @@ -232,7 +242,12 @@ upc_found2(struct upc_softc *sc, char const *devtype, int offset, int size, bus_space_subregion(sc->sc_iot, sc->sc_ioh, offset2, size2, &ua.ua_ioh2); ua.ua_irqhandle = uih; - config_found_sm(&sc->sc_dev, &ua, upc_print, upc_submatch); + + ldesc->len = 1; + ldesc->locs[UPCCF_OFFSET] = offset; + + config_found_sm_loc(&sc->sc_dev, "upc", ldesc, &ua, + upc_print, upc_submatch); } void @@ -291,13 +306,14 @@ upc_print(void *aux, char const *pnp) } static int -upc_submatch(struct device *parent, struct cfdata *cf, void *aux) +upc_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct upc_attach_args *ua = aux; if (strcmp(cf->cf_name, ua->ua_devtype) == 0 && (cf->cf_loc[UPCCF_OFFSET] == UPCCF_OFFSET_DEFAULT || - cf->cf_loc[UPCCF_OFFSET] == ua->ua_offset)) + cf->cf_loc[UPCCF_OFFSET] == ldesc->locs[UPCCF_OFFSET])) return config_match(parent, cf, aux); return 0; } diff --git a/sys/dev/ieee1394/fwohci.c b/sys/dev/ieee1394/fwohci.c index e7586a34b796..9d98b0ad245e 100644 --- a/sys/dev/ieee1394/fwohci.c +++ b/sys/dev/ieee1394/fwohci.c @@ -1,4 +1,4 @@ -/* $NetBSD: fwohci.c,v 1.82 2003/12/04 13:57:30 keihan Exp $ */ +/* $NetBSD: fwohci.c,v 1.83 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.82 2003/12/04 13:57:30 keihan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.83 2004/09/13 12:55:48 drochner Exp $"); #define FWOHCI_WAIT_DEBUG 1 @@ -233,7 +233,8 @@ static int fwohci_inreg(struct ieee1394_abuf *, int); static int fwohci_unreg(struct ieee1394_abuf *, int); static int fwohci_parse_input(struct fwohci_softc *, void *, struct fwohci_pkt *); -static int fwohci_submatch(struct device *, struct cfdata *, void *); +static int fwohci_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); /* XXX */ u_int16_t fwohci_cycletimer(struct fwohci_softc *); @@ -3237,8 +3238,9 @@ fwohci_uid_input(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *res) memcpy(fwa.uid, fu->fu_uid, 8); fwa.nodeid = n; iea = (struct ieee1394_softc *) - config_found_sm(&sc->sc_sc1394.sc1394_dev, &fwa, - fwohci_print, fwohci_submatch); + config_found_sm_loc(&sc->sc_sc1394.sc1394_dev, + "fwbus", NULL, &fwa, + fwohci_print, fwohci_submatch); if (iea != NULL) LIST_INSERT_HEAD(&sc->sc_nodelist, iea, sc1394_node); @@ -4257,7 +4259,8 @@ fwohci_parse_input(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) } static int -fwohci_submatch(struct device *parent, struct cfdata *cf, void *aux) +fwohci_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct ieee1394_attach_args *fwa = aux; diff --git a/sys/dev/isapnp/isapnp.c b/sys/dev/isapnp/isapnp.c index fae3998f8931..04b484ef397d 100644 --- a/sys/dev/isapnp/isapnp.c +++ b/sys/dev/isapnp/isapnp.c @@ -1,4 +1,4 @@ -/* $NetBSD: isapnp.c,v 1.42 2003/12/04 13:57:30 keihan Exp $ */ +/* $NetBSD: isapnp.c,v 1.43 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isapnp.c,v 1.42 2003/12/04 13:57:30 keihan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isapnp.c,v 1.43 2004/09/13 12:55:48 drochner Exp $"); #include "isadma.h" @@ -82,7 +82,8 @@ static void isapnp_configure __P((struct isapnp_softc *, static void isapnp_print_pin __P((const char *, struct isapnp_pin *, size_t)); static int isapnp_print __P((void *, const char *)); #ifdef _KERNEL -static int isapnp_submatch __P((struct device *, struct cfdata *, void *)); +static int isapnp_submatch __P((struct device *, struct cfdata *, + const locdesc_t *, void *)); #endif static int isapnp_find __P((struct isapnp_softc *, int)); static int isapnp_match __P((struct device *, struct cfdata *, void *)); @@ -602,11 +603,13 @@ isapnp_print(aux, str) * Probe the logical device... */ static int -isapnp_submatch(parent, match, aux) +isapnp_submatch(parent, match, ldesc, aux) struct device *parent; struct cfdata *match; + const locdesc_t *ldesc; void *aux; { + return (config_match(parent, match, aux)); } @@ -1036,8 +1039,8 @@ isapnp_callback(self) isapnp_write_reg(sc, ISAPNP_ACTIVATE, 1); #ifdef _KERNEL - if (config_found_sm(self, lpa, isapnp_print, - isapnp_submatch) == NULL) + if (config_found_sm_loc(self, "isapnp", NULL, lpa, + isapnp_print, isapnp_submatch) == NULL) isapnp_write_reg(sc, ISAPNP_ACTIVATE, 0); #else isapnp_print(lpa, NULL); diff --git a/sys/dev/marvell/gt.c b/sys/dev/marvell/gt.c index 838cfe8a095c..63897a9509d2 100644 --- a/sys/dev/marvell/gt.c +++ b/sys/dev/marvell/gt.c @@ -1,4 +1,4 @@ -/* $NetBSD: gt.c,v 1.6 2004/03/20 01:55:00 matt Exp $ */ +/* $NetBSD: gt.c,v 1.7 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.6 2004/03/20 01:55:00 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.7 2004/09/13 12:55:48 drochner Exp $"); #include "opt_marvell.h" @@ -115,7 +115,8 @@ gt_cfprint (void *aux, const char *pnp) static int -gt_cfsearch(struct device *parent, struct cfdata *cf, void *aux) +gt_cfsearch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct gt_softc *gt = (struct gt_softc *) parent; struct gt_attach_args ga; @@ -332,7 +333,7 @@ gt_attach_common(struct gt_softc *gt) gt_devbus_intr_enb(gt); gt_watchdog_disable(); - config_search(gt_cfsearch, >->gt_dev, NULL); + config_search_ia(gt_cfsearch, >->gt_dev, "gt", NULL); gt_watchdog_service(); gt_watchdog_enable(); } diff --git a/sys/dev/marvell/gtvar.h b/sys/dev/marvell/gtvar.h index ee02e09d6abb..365ee5f4c139 100644 --- a/sys/dev/marvell/gtvar.h +++ b/sys/dev/marvell/gtvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: gtvar.h,v 1.5 2004/03/20 01:55:00 matt Exp $ */ +/* $NetBSD: gtvar.h,v 1.6 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -95,27 +95,11 @@ struct obio_attach_args { }; #ifdef _KERNEL -#include "locators.h" #ifdef DEBUG extern int gtpci_debug; #endif -/* - * Locators for GT private devices, as specified to config. - */ -#define gtcf_unit cf_loc[GTCF_UNIT] -#define GT_UNK_UNIT GTCF_UNIT_DEFAULT /* wcarded 'function' */ - -#define obiocf_offset cf_loc[OBIOCF_OFFSET] -#define OBIO_UNK_OFFSET OBIOCF_OFFSET_DEFAULT /* wcarded 'offset' */ - -#define obiocf_size cf_loc[OBIOCF_SIZE] -#define OBIO_UNK_SIZE OBIOCF_SIZE_DEFAULT /* wcarded 'size' */ - -#define obiocf_irq cf_loc[OBIOCF_IRQ] -#define OBIO_UNK_IRQ OBIOCF_IRQ_DEFAULT /* wcarded 'irq' */ - void gt_attach_common(struct gt_softc *); uint32_t gt_read_mpp(void); int gt_cfprint(void *, const char *); diff --git a/sys/dev/marvell/obio.c b/sys/dev/marvell/obio.c index 9a5a62488715..dfa7bde888ec 100644 --- a/sys/dev/marvell/obio.c +++ b/sys/dev/marvell/obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: obio.c,v 1.4 2004/09/08 20:08:46 drochner Exp $ */ +/* $NetBSD: obio.c,v 1.5 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.4 2004/09/08 20:08:46 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.5 2004/09/13 12:55:48 drochner Exp $"); #include "opt_marvell.h" @@ -69,6 +69,8 @@ __KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.4 2004/09/08 20:08:46 drochner Exp $"); #include /* for Debugger() */ #endif +#include "locators.h" + static int obio_cfprint(void *, const char *); static int obio_cfmatch(struct device *, struct cfdata *, void *); static int obio_cfsearch(struct device *, struct cfdata *, @@ -109,7 +111,7 @@ obio_cfprint(void *aux, const char *pnp) aprint_normal("%s at %s", oa->oa_name, pnp); } aprint_normal(" offset %#x size %#x", oa->oa_offset, oa->oa_size); - if (oa->oa_irq != OBIO_UNK_IRQ) + if (oa->oa_irq != OBIOCF_IRQ_DEFAULT) aprint_normal(" irq %d", oa->oa_irq); return (UNCONF); @@ -125,9 +127,9 @@ obio_cfsearch(struct device *parent, struct cfdata *cf, oa.oa_name = cf->cf_name; oa.oa_memt = sc->sc_memt; - oa.oa_offset = cf->obiocf_offset; - oa.oa_size = cf->obiocf_size; - oa.oa_irq = cf->obiocf_irq; + oa.oa_offset = cf->cf_loc[OBIOCF_OFFSET]; + oa.oa_size = cf->cf_loc[OBIOCF_SIZE]; + oa.oa_irq = cf->cf_loc[OBIOCF_IRQ]; if (config_match(parent, cf, &oa) > 0) config_attach(parent, cf, &oa, obio_cfprint); diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c index 621ee7e7874f..fb2e5f830ed7 100644 --- a/sys/dev/mii/mii.c +++ b/sys/dev/mii/mii.c @@ -1,4 +1,4 @@ -/* $NetBSD: mii.c,v 1.36 2004/09/01 20:59:30 drochner Exp $ */ +/* $NetBSD: mii.c,v 1.37 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.36 2004/09/01 20:59:30 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.37 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -59,7 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.36 2004/09/01 20:59:30 drochner Exp $"); #include "locators.h" static int mii_print(void *, const char *); -static int mii_submatch(struct device *, struct cfdata *, void *); +static int mii_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); /* * Helper function used by network interface drivers, attaches PHYs @@ -73,6 +74,8 @@ mii_attach(struct device *parent, struct mii_data *mii, int capmask, struct mii_softc *child; int bmsr, offset = 0; int phymin, phymax; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) panic("mii_attach: phyloc and offloc specified"); @@ -141,8 +144,12 @@ mii_attach(struct device *parent, struct mii_data *mii, int capmask, ma.mii_capmask = capmask; ma.mii_flags = flags | (mii->mii_flags & MIIF_INHERIT_MASK); - if ((child = (struct mii_softc *)config_found_sm(parent, &ma, - mii_print, mii_submatch)) != NULL) { + ldesc->len = 1; + ldesc->locs[MIICF_PHY] = ma.mii_phyno; + + child = (struct mii_softc *)config_found_sm_loc(parent, "mii", + ldesc, &ma, mii_print, mii_submatch); + if (child) { /* * Link it up in the parent's MII data. */ @@ -231,12 +238,12 @@ mii_print(void *aux, const char *pnp) } static int -mii_submatch(struct device *parent, struct cfdata *cf, void *aux) +mii_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { - struct mii_attach_args *ma = aux; - if (ma->mii_phyno != cf->cf_loc[MIICF_PHY] && - cf->cf_loc[MIICF_PHY] != MIICF_PHY_DEFAULT) + if (cf->cf_loc[MIICF_PHY] != MIICF_PHY_DEFAULT && + cf->cf_loc[MIICF_PHY] != ldesc->locs[MIICF_PHY]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/pci/amr.c b/sys/dev/pci/amr.c index 4e9d1315becd..88f3a24400a4 100644 --- a/sys/dev/pci/amr.c +++ b/sys/dev/pci/amr.c @@ -1,4 +1,4 @@ -/* $NetBSD: amr.c,v 1.21 2004/09/02 21:12:42 he Exp $ */ +/* $NetBSD: amr.c,v 1.22 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.21 2004/09/02 21:12:42 he Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.22 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -93,6 +93,8 @@ __KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.21 2004/09/02 21:12:42 he Exp $"); #include #include +#include "locators.h" + void amr_attach(struct device *, struct device *, void *); void amr_ccb_dump(struct amr_softc *, struct amr_ccb *); void *amr_enquire(struct amr_softc *, u_int8_t, u_int8_t, u_int8_t, void *); @@ -102,7 +104,8 @@ int amr_intr(void *); int amr_match(struct device *, struct cfdata *, void *); int amr_print(void *, const char *); void amr_shutdown(void *); -int amr_submatch(struct device *, struct cfdata *, void *); +int amr_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); void amr_teardown(struct amr_softc *); void amr_thread(void *); void amr_thread_create(void *); @@ -255,6 +258,8 @@ amr_attach(struct device *parent, struct device *self, void *aux) pcireg_t reg; int rseg, i, j, size, rv, memreg, ioreg; struct amr_ccb *ac; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ aprint_naive(": RAID controller\n"); @@ -459,8 +464,12 @@ amr_attach(struct device *parent, struct device *self, void *aux) if (amr->amr_drive[j].al_size == 0) continue; amra.amra_unit = j; - amr->amr_drive[j].al_dv = config_found_sm(&amr->amr_dv, &amra, - amr_print, amr_submatch); + + ldesc->len = 1; + ldesc->locs[AMRCF_UNIT] = j; + + amr->amr_drive[j].al_dv = config_found_sm_loc(&amr->amr_dv, + "amr", ldesc, &amra, amr_print, amr_submatch); } SIMPLEQ_INIT(&amr->amr_ccb_queue); @@ -530,14 +539,15 @@ amr_print(void *aux, const char *pnp) * Match a sub-device. */ int -amr_submatch(struct device *parent, struct cfdata *cf, void *aux) +amr_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct amr_attach_args *amra; amra = (struct amr_attach_args *)aux; - if (cf->amracf_unit != AMRCF_UNIT_DEFAULT && - cf->amracf_unit != amra->amra_unit) + if (cf->cf_loc[AMRCF_UNIT] != AMRCF_UNIT_DEFAULT && + cf->cf_loc[AMRCF_UNIT] != ldesc->locs[AMRCF_UNIT]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/pci/amrvar.h b/sys/dev/pci/amrvar.h index 560034886e33..aedc1bd849a8 100644 --- a/sys/dev/pci/amrvar.h +++ b/sys/dev/pci/amrvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: amrvar.h,v 1.3 2003/05/14 11:22:55 ad Exp $ */ +/* $NetBSD: amrvar.h,v 1.4 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -39,8 +39,6 @@ #ifndef _PCI_AMRVAR_H_ #define _PCI_AMRVAR_H_ -#include "locators.h" - #define AMR_MAX_UNITS 16 #define AMR_WDOG_TICKS (hz * 5) #define AMR_NCCB_RESV 2 @@ -142,8 +140,6 @@ struct amr_attach_args { int amra_unit; }; -#define amracf_unit cf_loc[AMRCF_UNIT] - int amr_ccb_alloc(struct amr_softc *, struct amr_ccb **); void amr_ccb_enqueue(struct amr_softc *, struct amr_ccb *); void amr_ccb_free(struct amr_softc *, struct amr_ccb *); diff --git a/sys/dev/pci/puc.c b/sys/dev/pci/puc.c index 94ab7c1adfe0..c9d5231ffc3f 100644 --- a/sys/dev/pci/puc.c +++ b/sys/dev/pci/puc.c @@ -1,4 +1,4 @@ -/* $NetBSD: puc.c,v 1.20 2004/02/03 19:51:39 fredb Exp $ */ +/* $NetBSD: puc.c,v 1.21 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 1996, 1998, 1999 @@ -53,7 +53,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: puc.c,v 1.20 2004/02/03 19:51:39 fredb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: puc.c,v 1.21 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -98,7 +98,8 @@ struct puc_softc { int puc_match __P((struct device *, struct cfdata *, void *)); void puc_attach __P((struct device *, struct device *, void *)); int puc_print __P((void *, const char *)); -int puc_submatch __P((struct device *, struct cfdata *, void *)); +int puc_submatch __P((struct device *, struct cfdata *, + const locdesc_t *, void *)); CFATTACH_DECL(puc, sizeof(struct puc_softc), puc_match, puc_attach, NULL, NULL); @@ -167,6 +168,8 @@ puc_attach(parent, self, aux) #ifdef PUCCN bus_space_handle_t ioh; #endif + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ subsys = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG); sc->sc_desc = puc_find_description(PCI_VENDOR(pa->pa_id), @@ -311,9 +314,12 @@ puc_attach(parent, self, aux) (long)paa.t, (long)paa.h); #endif + ldesc->len = 1; + ldesc->locs[PUCCF_PORT] = i; + /* and configure it */ - sc->sc_ports[i].dev = config_found_sm(self, &paa, puc_print, - puc_submatch); + sc->sc_ports[i].dev = config_found_sm_loc(self, "puc", ldesc, + &paa, puc_print, puc_submatch); } } @@ -331,16 +337,17 @@ puc_print(aux, pnp) } int -puc_submatch(parent, cf, aux) +puc_submatch(parent, cf, ldesc, aux) struct device *parent; struct cfdata *cf; + const locdesc_t *ldesc; void *aux; { - struct puc_attach_args *aa = aux; if (cf->cf_loc[PUCCF_PORT] != PUCCF_PORT_DEFAULT && - cf->cf_loc[PUCCF_PORT] != aa->port) + cf->cf_loc[PUCCF_PORT] != ldesc->locs[PUCCF_PORT]) return 0; + return (config_match(parent, cf, aux)); } diff --git a/sys/dev/pci/twe.c b/sys/dev/pci/twe.c index 45bf83cff514..8575065e1a11 100644 --- a/sys/dev/pci/twe.c +++ b/sys/dev/pci/twe.c @@ -1,4 +1,4 @@ -/* $NetBSD: twe.c,v 1.58 2004/06/04 20:11:17 thorpej Exp $ */ +/* $NetBSD: twe.c,v 1.59 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.58 2004/06/04 20:11:17 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.59 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -97,6 +97,8 @@ __KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.58 2004/06/04 20:11:17 thorpej Exp $"); #include #include +#include "locators.h" + #define PCI_CBIO 0x10 static int twe_aen_get(struct twe_softc *, uint16_t *); @@ -112,7 +114,8 @@ static int twe_param_set(struct twe_softc *, int, int, size_t, void *); static void twe_poll(struct twe_softc *); static int twe_print(void *, const char *); static int twe_reset(struct twe_softc *); -static int twe_submatch(struct device *, struct cfdata *, void *); +static int twe_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); static int twe_status_check(struct twe_softc *, u_int); static int twe_status_wait(struct twe_softc *, u_int, int); static void twe_describe_controller(struct twe_softc *); @@ -513,6 +516,8 @@ twe_add_unit(struct twe_softc *sc, int unit) int rv; uint16_t dsize; uint8_t newtype, newstripe; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ if (unit < 0 || unit >= TWE_MAX_UNITS) return (EINVAL); @@ -599,8 +604,12 @@ twe_add_unit(struct twe_softc *sc, int unit) twe_recompute_openings(sc); twea.twea_unit = unit; - td->td_dev = config_found_sm(&sc->sc_dv, &twea, twe_print, - twe_submatch); + + ldesc->len = 1; + ldesc->locs[TWECF_UNIT] = unit; + + td->td_dev = config_found_sm_loc(&sc->sc_dv, "twe", NULL, &twea, + twe_print, twe_submatch); rv = 0; out: @@ -735,14 +744,12 @@ twe_print(void *aux, const char *pnp) * Match a sub-device. */ static int -twe_submatch(struct device *parent, struct cfdata *cf, void *aux) +twe_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { - struct twe_attach_args *twea; - twea = aux; - - if (cf->tweacf_unit != TWECF_UNIT_DEFAULT && - cf->tweacf_unit != twea->twea_unit) + if (cf->cf_loc[TWECF_UNIT] != TWECF_UNIT_DEFAULT && + cf->cf_loc[TWECF_UNIT] != ldesc->locs[TWECF_UNIT]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/pci/twevar.h b/sys/dev/pci/twevar.h index 0ca050a212f7..41fdde7ea3b4 100644 --- a/sys/dev/pci/twevar.h +++ b/sys/dev/pci/twevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: twevar.h,v 1.21 2004/05/27 23:47:23 thorpej Exp $ */ +/* $NetBSD: twevar.h,v 1.22 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. @@ -39,8 +39,6 @@ #ifndef _PCI_TWEVAR_H_ #define _PCI_TWEVAR_H_ -#include "locators.h" - #define TWE_MAX_QUEUECNT 129 /* Callbacks from controller to array. */ @@ -121,8 +119,6 @@ struct twe_attach_args { int twea_unit; }; -#define tweacf_unit cf_loc[TWECF_UNIT] - struct twe_ccb *twe_ccb_alloc(struct twe_softc *, int); struct twe_ccb *twe_ccb_alloc_wait(struct twe_softc *, int); void twe_ccb_enqueue(struct twe_softc *sc, struct twe_ccb *ccb); diff --git a/sys/dev/pci/viapm.c b/sys/dev/pci/viapm.c index 3ef5b905624d..5a319fb0132d 100644 --- a/sys/dev/pci/viapm.c +++ b/sys/dev/pci/viapm.c @@ -1,4 +1,4 @@ -/* $NetBSD: viapm.c,v 1.11 2004/07/25 18:04:52 christos Exp $ */ +/* $NetBSD: viapm.c,v 1.12 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 2000 Johan Danielsson @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: viapm.c,v 1.11 2004/07/25 18:04:52 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viapm.c,v 1.12 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -106,13 +106,6 @@ viapm_print(void *aux, const char *pnp) return UNCONF; } -static int -viapm_submatch(struct device * parent, struct cfdata * cf, void *aux) -{ - - return config_match(parent, cf, aux); -} - static void viapm_attach(struct device * parent, struct device * self, void *aux) { @@ -137,17 +130,17 @@ viapm_attach(struct device * parent, struct device * self, void *aux) */ vaa.va_type = VIAPM_POWER; vaa.va_offset = 0x40; - config_found_sm(self, &vaa, viapm_print, viapm_submatch); + config_found_ia(self, "viapm", &vaa, viapm_print); #endif vaa.va_type = VIAPM_HWMON; vaa.va_offset = 0x70; - config_found_sm(self, &vaa, viapm_print, viapm_submatch); + config_found(self, "viapm", &vaa, viapm_print); #if 0 vaa.va_type = VIAPM_SMBUS; vaa.va_offset = 0x93; - config_found_sm(self, &vaa, viapm_print, viapm_submatch); + config_found(self, "viapm", &vaa, viapm_print); #endif } diff --git a/sys/dev/pckbport/pckbport.c b/sys/dev/pckbport/pckbport.c index d9316ef7707b..666a929e705f 100644 --- a/sys/dev/pckbport/pckbport.c +++ b/sys/dev/pckbport/pckbport.c @@ -1,4 +1,4 @@ -/* $NetBSD: pckbport.c,v 1.3 2004/03/24 17:26:53 drochner Exp $ */ +/* $NetBSD: pckbport.c,v 1.4 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 2004 Ben Harris @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pckbport.c,v 1.3 2004/03/24 17:26:53 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pckbport.c,v 1.4 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -77,7 +77,8 @@ struct pckbport_slotdata { #define CMD_IN_QUEUE(q) (TAILQ_FIRST(&(q)->cmdqueue) != NULL) static void pckbport_init_slotdata(struct pckbport_slotdata *); -static int pckbport_submatch(struct device *, struct cfdata *, void *); +static int pckbport_submatch(struct device *, struct cfdata *, + const locdesc_t *, void *); static int pckbportprint(void *, const char *); static struct pckbport_slotdata pckbport_cons_slotdata; @@ -118,12 +119,12 @@ pckbport_send_devcmd(struct pckbport_tag *t, pckbport_slot_t slot, u_char val) } static int -pckbport_submatch(struct device *parent, struct cfdata *cf, void *aux) +pckbport_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { - struct pckbport_attach_args *pa = aux; if (cf->cf_loc[PCKBPORTCF_SLOT] != PCKBPORTCF_SLOT_DEFAULT && - cf->cf_loc[PCKBPORTCF_SLOT] != pa->pa_slot) + cf->cf_loc[PCKBPORTCF_SLOT] != ldesc->locs[PCKBPORTCF_SLOT]) return 0; return config_match(parent, cf, aux); } @@ -151,6 +152,8 @@ pckbport_attach_slot(struct device *dev, pckbport_tag_t t, void *sdata; struct device *found; int alloced = 0; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ pa.pa_tag = t; pa.pa_slot = slot; @@ -167,7 +170,11 @@ pckbport_attach_slot(struct device *dev, pckbport_tag_t t, alloced++; } - found = config_found_sm(dev, &pa, pckbportprint, pckbport_submatch); + ldesc->len = 1; + ldesc->locs[PCKBPORTCF_SLOT] = slot; + + found = config_found_sm_loc(dev, "pckbport", ldesc, &pa, + pckbportprint, pckbport_submatch); if (found == NULL && alloced) { free(t->t_slotdata[slot], M_DEVBUF); diff --git a/sys/dev/pcmcia/pcmciachip.h b/sys/dev/pcmcia/pcmciachip.h index e7b3e067000a..26ad7ccd10fc 100644 --- a/sys/dev/pcmcia/pcmciachip.h +++ b/sys/dev/pcmcia/pcmciachip.h @@ -1,4 +1,4 @@ -/* $NetBSD: pcmciachip.h,v 1.8 2004/08/11 00:18:20 mycroft Exp $ */ +/* $NetBSD: pcmciachip.h,v 1.9 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 1997 Marc Horowitz. All rights reserved. @@ -33,9 +33,6 @@ #define _PCMCIA_PCMCIACHIP_H_ #include -#ifdef _KERNEL_OPT -#include "locators.h" -#endif struct pcmcia_function; struct pcmcia_mem_handle; @@ -150,9 +147,6 @@ struct pcmciabus_attach_args { bus_size_t iosize; /* size of the i/o space range */ }; -#define pcmciabuscf_controller cf_loc[PCMCIABUSCF_CONTROLLER] -#define pcmciabuscf_socket cf_loc[PCMCIABUSCF_SOCKET] - /* interfaces for the chipset to call pcmcia */ int pcmcia_card_attach __P((struct device *)); diff --git a/sys/dev/pcmcia/pcmcom.c b/sys/dev/pcmcia/pcmcom.c index 42bf4e344c96..c0a9ac12ffd4 100644 --- a/sys/dev/pcmcia/pcmcom.c +++ b/sys/dev/pcmcia/pcmcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcmcom.c,v 1.19 2004/08/10 21:14:50 mycroft Exp $ */ +/* $NetBSD: pcmcom.c,v 1.20 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc. @@ -51,7 +51,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.19 2004/08/10 21:14:50 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcmcom.c,v 1.20 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -112,7 +112,8 @@ const size_t pcmcom_nproducts = sizeof(pcmcom_products) / sizeof(pcmcom_products[0]); int pcmcom_print __P((void *, const char *)); -int pcmcom_submatch __P((struct device *, struct cfdata *, void *)); +int pcmcom_submatch __P((struct device *, struct cfdata *, + const locdesc_t *, void *)); int pcmcom_enable __P((struct pcmcom_softc *)); void pcmcom_disable __P((struct pcmcom_softc *)); @@ -153,6 +154,8 @@ pcmcom_attach(parent, self, aux) struct pcmcia_config_entry *cfe; int slave; int error; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ sc->sc_pf = pa->pf; @@ -180,8 +183,12 @@ pcmcom_attach(parent, self, aux) pca.pca_ioh = cfe->iospace[slave].handle.ioh; pca.pca_slave = slave; - sc->sc_slaves[slave] = config_found_sm(&sc->sc_dev, &pca, - pcmcom_print, pcmcom_submatch); + ldesc->len = 1; + ldesc->locs[PCMCOMCF_SLAVE] = slave; + + sc->sc_slaves[slave] = config_found_sm_loc(&sc->sc_dev, + "pcmcom", ldesc, + &pca, pcmcom_print, pcmcom_submatch); } pcmcom_disable(sc); @@ -268,15 +275,15 @@ pcmcom_print(aux, pnp) } int -pcmcom_submatch(parent, cf, aux) +pcmcom_submatch(parent, cf, ldesc, aux) struct device *parent; struct cfdata *cf; + const locdesc_t *ldesc; void *aux; { - struct pcmcom_attach_args *pca = aux; - if (cf->cf_loc[PCMCOMCF_SLAVE] != pca->pca_slave && - cf->cf_loc[PCMCOMCF_SLAVE] != PCMCOMCF_SLAVE_DEFAULT) + if (cf->cf_loc[PCMCOMCF_SLAVE] != PCMCOMCF_SLAVE_DEFAULT && + cf->cf_loc[PCMCOMCF_SLAVE] != ldesc->locs[PCMCOMCF_SLAVE]); return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/podulebus/acemidi.c b/sys/dev/podulebus/acemidi.c index 8b7adeb78eb7..ae2e17d87d92 100644 --- a/sys/dev/podulebus/acemidi.c +++ b/sys/dev/podulebus/acemidi.c @@ -1,4 +1,4 @@ -/* $NetBSD: acemidi.c,v 1.7 2002/10/02 16:52:23 thorpej Exp $ */ +/* $NetBSD: acemidi.c,v 1.8 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 2001 Ben Harris @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acemidi.c,v 1.7 2002/10/02 16:52:23 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acemidi.c,v 1.8 2004/09/13 12:55:48 drochner Exp $"); #include @@ -82,7 +82,7 @@ acemidi_attach(struct device *parent, struct device *self, void *aux) /* struct podulebus_attach_args *pa = aux; */ printf("\n"); - config_found_sm(self, aux, NULL, NULL); + config_found_ia(self, "acemidi", aux, NULL); } static int diff --git a/sys/dev/scsipi/atapiconf.c b/sys/dev/scsipi/atapiconf.c index 3512bef3f243..36588071a44a 100644 --- a/sys/dev/scsipi/atapiconf.c +++ b/sys/dev/scsipi/atapiconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: atapiconf.c,v 1.65 2004/08/21 21:30:29 thorpej Exp $ */ +/* $NetBSD: atapiconf.c,v 1.66 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 1996, 2001 Manuel Bouyer. All rights reserved. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.65 2004/08/21 21:30:29 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.66 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -61,7 +61,8 @@ static void atapibusattach(struct device *, struct device *, void *); static int atapibusactivate(struct device *, enum devact); static int atapibusdetach(struct device *, int flags); -static int atapibussubmatch(struct device *, struct cfdata *, void *); +static int atapibussubmatch(struct device *, struct cfdata *, + const locdesc_t *, void *); static int atapi_probe_bus(struct atapibus_softc *, int); @@ -128,7 +129,8 @@ atapibusmatch(struct device *parent, struct cfdata *cf, void *aux) } static int -atapibussubmatch(struct device *parent, struct cfdata *cf, void *aux) +atapibussubmatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct scsipibus_attach_args *sa = aux; struct scsipi_periph *periph = sa->sa_periph; @@ -273,8 +275,8 @@ atapi_probe_device(struct atapibus_softc *sc, int target, */ periph->periph_quirks |= quirks; - if ((cf = config_search(atapibussubmatch, &sc->sc_dev, - sa)) != 0) { + if ((cf = config_search_ia(atapibussubmatch, &sc->sc_dev, + "atapibus", sa)) != 0) { scsipi_insert_periph(chan, periph); /* * XXX Can't assign periph_dev here, because we'll diff --git a/sys/dev/std/ieee1212.c b/sys/dev/std/ieee1212.c index e2f73c4d8d12..6b6f8f09f25c 100644 --- a/sys/dev/std/ieee1212.c +++ b/sys/dev/std/ieee1212.c @@ -1,4 +1,4 @@ -/* $NetBSD: ieee1212.c,v 1.7 2003/10/26 20:53:09 fvdl Exp $ */ +/* $NetBSD: ieee1212.c,v 1.8 2004/09/13 12:55:48 drochner Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ieee1212.c,v 1.7 2003/10/26 20:53:09 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ieee1212.c,v 1.8 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -1237,7 +1237,7 @@ p1212_match_units(struct device *sc, struct p1212_dir *dir, if (udirs) { do { - dev = config_found_sm(sc, udirs, print, NULL); + dev = config_found_ia(sc, "fwnode", udirs, print); if (dev && numdev) { devret = realloc(devret, sizeof(struct device *) * diff --git a/sys/dev/tc/tcds.c b/sys/dev/tc/tcds.c index a4aee02667c5..fa20b4fb26f8 100644 --- a/sys/dev/tc/tcds.c +++ b/sys/dev/tc/tcds.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcds.c,v 1.10 2003/01/01 00:10:25 thorpej Exp $ */ +/* $NetBSD: tcds.c,v 1.11 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcds.c,v 1.10 2003/01/01 00:10:25 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcds.c,v 1.11 2004/09/13 12:55:48 drochner Exp $"); #include #include @@ -109,7 +109,8 @@ struct tcds_softc { int tcdsmatch __P((struct device *, struct cfdata *, void *)); void tcdsattach __P((struct device *, struct device *, void *)); int tcdsprint __P((void *, const char *)); -int tcdssubmatch __P((struct device *, struct cfdata *, void *)); +int tcdssubmatch __P((struct device *, struct cfdata *, + const locdesc_t *, void *)); CFATTACH_DECL(tcds, sizeof(struct tcds_softc), tcdsmatch, tcdsattach, NULL, NULL); @@ -170,6 +171,8 @@ tcdsattach(parent, self, aux) bus_space_handle_t sbsh[2]; int i, gpi2; const struct evcnt *pevcnt; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ td = tcds_lookup(ta->ta_modname); if (td == NULL) @@ -305,7 +308,11 @@ tcdsattach(parent, self, aux) tcds_scsi_reset(tcdsdev.tcdsda_sc); - config_found_sm(self, &tcdsdev, tcdsprint, tcdssubmatch); + ldesc->len = 1; + ldesc->locs[TCDSCF_CHIP] = i; + + config_found_sm_loc(self, "tcds", ldesc, &tcdsdev, + tcdsprint, tcdssubmatch); #ifdef __alpha__ /* * The second SCSI chip isn't present on the baseboard TCDS @@ -319,15 +326,16 @@ tcdsattach(parent, self, aux) } int -tcdssubmatch(parent, cf, aux) +tcdssubmatch(parent, cf, ldesc, aux) struct device *parent; struct cfdata *cf; + const locdesc_t *ldesc; void *aux; { struct tcdsdev_attach_args *tcdsdev = aux; if (cf->cf_loc[TCDSCF_CHIP] != TCDSCF_CHIP_DEFAULT && - cf->cf_loc[TCDSCF_CHIP] != tcdsdev->tcdsda_chip) + cf->cf_loc[TCDSCF_CHIP] != ldesc->locs[TCDSCF_CHIP]) return (0); return (config_match(parent, cf, aux)); diff --git a/sys/dev/tc/zs_ioasic.c b/sys/dev/tc/zs_ioasic.c index 9b8d2252d5cb..9db1269949bf 100644 --- a/sys/dev/tc/zs_ioasic.c +++ b/sys/dev/tc/zs_ioasic.c @@ -1,4 +1,4 @@ -/* $NetBSD: zs_ioasic.c,v 1.22 2004/08/26 18:07:12 drochner Exp $ */ +/* $NetBSD: zs_ioasic.c,v 1.23 2004/09/13 12:55:48 drochner Exp $ */ /*- * Copyright (c) 1996, 1998 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.22 2004/08/26 18:07:12 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zs_ioasic.c,v 1.23 2004/09/13 12:55:48 drochner Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -194,7 +194,8 @@ zs_ioasic_get_chan_addr(zsaddr, channel) int zs_ioasic_match __P((struct device *, struct cfdata *, void *)); void zs_ioasic_attach __P((struct device *, struct device *, void *)); int zs_ioasic_print __P((void *, const char *name)); -int zs_ioasic_submatch __P((struct device *, struct cfdata *, void *)); +int zs_ioasic_submatch __P((struct device *, struct cfdata *, + const locdesc_t *, void *)); CFATTACH_DECL(zsc_ioasic, sizeof(struct zsc_softc), zs_ioasic_match, zs_ioasic_attach, NULL, NULL); @@ -248,6 +249,8 @@ zs_ioasic_attach(parent, self, aux) struct zshan *zc; int s, channel; u_long zflg; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ printf("\n"); @@ -316,11 +319,14 @@ zs_ioasic_attach(parent, self, aux) else cs->cs_ctl_chan = NULL; + ldesc->len = 1; + ldesc->locs[ZSCCF_CHANNEL] = channel; + /* * Look for a child driver for this channel. * The child attach will setup the hardware. */ - if (config_found_sm(self, (void *)&zs_args, + if (config_found_sm_loc(self, "zsc", ldesc, (void *)&zs_args, zs_ioasic_print, zs_ioasic_submatch) == NULL) { /* No sub-driver. Just reset it. */ u_char reset = (channel == 0) ? @@ -380,9 +386,10 @@ zs_ioasic_print(aux, name) } int -zs_ioasic_submatch(parent, cf, aux) +zs_ioasic_submatch(parent, cf, ldesc, aux) struct device *parent; struct cfdata *cf; + const locdesc_t *ldesc; void *aux; { struct zsc_softc *zs = (void *)parent; @@ -390,8 +397,9 @@ zs_ioasic_submatch(parent, cf, aux) char *defname = ""; if (cf->cf_loc[ZSCCF_CHANNEL] != ZSCCF_CHANNEL_DEFAULT && - cf->cf_loc[ZSCCF_CHANNEL] != pa->channel) + cf->cf_loc[ZSCCF_CHANNEL] != ldesc->locs[ZSCCF_CHANNEL]) return (0); + if (cf->cf_loc[ZSCCF_CHANNEL] == ZSCCF_CHANNEL_DEFAULT) { if (pa->channel == 0) { #if defined(pmax) diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index 4475da6e0a89..6e8b21ddb933 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -1,4 +1,4 @@ -/* $NetBSD: ubsa.c,v 1.9 2004/04/23 17:25:25 itojun Exp $ */ +/* $NetBSD: ubsa.c,v 1.10 2004/09/13 12:55:49 drochner Exp $ */ /*- * Copyright (c) 2002, Alexander Kabaev . * All rights reserved. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.9 2004/04/23 17:25:25 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.10 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -374,7 +374,8 @@ USB_ATTACH(ubsa) DPRINTF(("ubsa: in = 0x%x, out = 0x%x, intr = 0x%x\n", uca.bulkin_no, uca.bulkout_no, sc->sc_intr_number)); - sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); + sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, + ucomprint, ucomsubmatch); USB_ATTACH_SUCCESS_RETURN; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 87655b61fb54..c2db5734c358 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $NetBSD: ucom.c,v 1.52 2003/11/24 19:47:07 nathanw Exp $ */ +/* $NetBSD: ucom.c,v 1.53 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.52 2003/11/24 19:47:07 nathanw Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.53 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -73,6 +73,8 @@ __KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.52 2003/11/24 19:47:07 nathanw Exp $"); #include "ucom.h" +#include "locators.h" + #if NUCOM > 0 #ifdef UCOM_DEBUG @@ -1137,13 +1139,14 @@ ucomprint(void *aux, const char *pnp) } int -ucomsubmatch(struct device *parent, struct cfdata *cf, void *aux) +ucomsubmatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct ucom_attach_args *uca = aux; if (uca->portno != UCOM_UNK_PORTNO && - cf->ucomcf_portno != UCOM_UNK_PORTNO && - cf->ucomcf_portno != uca->portno) + cf->cf_loc[UCOMBUSCF_PORTNO] != UCOMBUSCF_PORTNO_DEFAULT && + cf->cf_loc[UCOMBUSCF_PORTNO] != uca->portno) return (0); return (config_match(parent, cf, aux)); } diff --git a/sys/dev/usb/ucomvar.h b/sys/dev/usb/ucomvar.h index 03e64c437526..92fa7feec1f2 100644 --- a/sys/dev/usb/ucomvar.h +++ b/sys/dev/usb/ucomvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ucomvar.h,v 1.10 2001/12/31 12:15:21 augustss Exp $ */ +/* $NetBSD: ucomvar.h,v 1.11 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -43,9 +43,8 @@ #define CLR(t, f) (t) &= ~(f) #define ISSET(t, f) ((t) & (f)) -#include "locators.h" -#define ucomcf_portno cf_loc[UCOMBUSCF_PORTNO] -#define UCOM_UNK_PORTNO UCOMBUSCF_PORTNO_DEFAULT +/* just for ucom_attach_args, not in the config namespace */ +#define UCOM_UNK_PORTNO (-1) struct ucom_softc; @@ -107,5 +106,6 @@ struct ucom_attach_args { }; int ucomprint(void *aux, const char *pnp); -int ucomsubmatch(struct device *parent, struct cfdata *cf, void *aux); +int ucomsubmatch(struct device *parent, struct cfdata *cf, + const locdesc_t *, void *aux); void ucom_status_change(struct ucom_softc *); diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index f3d72eb51bcd..9d63af97d6dc 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -1,4 +1,4 @@ -/* $NetBSD: uftdi.c,v 1.21 2004/04/23 17:25:25 itojun Exp $ */ +/* $NetBSD: uftdi.c,v 1.22 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.21 2004/04/23 17:25:25 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.22 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -255,7 +255,8 @@ USB_ATTACH(uftdi) USBDEV(sc->sc_dev)); DPRINTF(("uftdi: in=0x%x out=0x%x\n", uca.bulkin, uca.bulkout)); - sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); + sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, + ucomprint, ucomsubmatch); USB_ATTACH_SUCCESS_RETURN; diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 37e5e0e3bfc2..cd35c9459b2a 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhidev.c,v 1.21 2004/04/23 17:25:25 itojun Exp $ */ +/* $NetBSD: uhidev.c,v 1.22 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.21 2004/04/23 17:25:25 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.22 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -67,6 +67,8 @@ __KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.21 2004/04/23 17:25:25 itojun Exp $"); /* Report descriptor for broken Wacom Graphire */ #include +#include "locators.h" + #ifdef UHIDEV_DEBUG #define DPRINTF(x) if (uhidevdebug) logprintf x #define DPRINTFN(n,x) if (uhidevdebug>(n)) logprintf x @@ -80,7 +82,8 @@ Static void uhidev_intr(usbd_xfer_handle, usbd_private_handle, usbd_status); Static int uhidev_maxrepid(void *buf, int len); Static int uhidevprint(void *aux, const char *pnp); -Static int uhidevsubmatch(struct device *parent, struct cfdata *cf, void *aux); +Static int uhidevsubmatch(struct device *parent, struct cfdata *cf, + const locdesc_t *, void *aux); USB_DECLARE_DRIVER(uhidev); @@ -113,6 +116,8 @@ USB_ATTACH(uhidev) const void *descptr; usbd_status err; char devinfo[1024]; + int help[2]; + locdesc_t *ldesc = (void *)help; /* XXX */ sc->sc_udev = uaa->device; sc->sc_iface = iface; @@ -249,8 +254,12 @@ USB_ATTACH(uhidev) ; /* already NULL in sc->sc_subdevs[repid] */ } else { uha.reportid = repid; - dev = (struct uhidev *)config_found_sm(self, &uha, - uhidevprint, uhidevsubmatch); + ldesc->len = 1; + ldesc->locs[UHIDBUSCF_REPORTID] = repid; + + dev = (struct uhidev *)config_found_sm_loc(self, + "uhidbus", ldesc, &uha, + uhidevprint, uhidevsubmatch); sc->sc_subdevs[repid] = dev; if (dev != NULL) { dev->sc_in_rep_size = repsizes[repid]; @@ -304,14 +313,16 @@ uhidevprint(void *aux, const char *pnp) } int -uhidevsubmatch(struct device *parent, struct cfdata *cf, void *aux) +uhidevsubmatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { struct uhidev_attach_arg *uha = aux; - if (cf->uhidevcf_reportid != UHIDEV_UNK_REPORTID && - cf->uhidevcf_reportid != uha->reportid) + if (cf->cf_loc[UHIDBUSCF_REPORTID] != UHIDBUSCF_REPORTID_DEFAULT && + cf->cf_loc[UHIDBUSCF_REPORTID] != ldesc->locs[UHIDBUSCF_REPORTID]) return (0); - if (cf->uhidevcf_reportid == uha->reportid) + + if (cf->cf_loc[UHIDBUSCF_REPORTID] == ldesc->locs[UHIDBUSCF_REPORTID]) uha->matchlvl = UMATCH_VENDOR_PRODUCT; else uha->matchlvl = 0; diff --git a/sys/dev/usb/uhidev.h b/sys/dev/usb/uhidev.h index 96ae7af1914f..5894993dc475 100644 --- a/sys/dev/usb/uhidev.h +++ b/sys/dev/usb/uhidev.h @@ -1,4 +1,4 @@ -/* $NetBSD: uhidev.h,v 1.3 2002/10/08 09:56:17 dan Exp $ */ +/* $NetBSD: uhidev.h,v 1.4 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -42,11 +42,6 @@ #include #endif - -#include "locators.h" -#define uhidevcf_reportid cf_loc[UHIDBUSCF_REPORTID] -#define UHIDEV_UNK_REPORTID UHIDBUSCF_REPORTID_DEFAULT - struct uhidev_softc { USBBASEDEVICE sc_dev; /* base device */ usbd_device_handle sc_udev; diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c index c0e1c16547cf..0498a5c1e435 100644 --- a/sys/dev/usb/umct.c +++ b/sys/dev/usb/umct.c @@ -1,4 +1,4 @@ -/* $NetBSD: umct.c,v 1.14 2004/07/08 00:54:21 rumble Exp $ */ +/* $NetBSD: umct.c,v 1.15 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: umct.c,v 1.14 2004/07/08 00:54:21 rumble Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umct.c,v 1.15 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -303,7 +303,8 @@ USB_ATTACH(umct) DPRINTF(("umct: in=0x%x out=0x%x intr=0x%x\n", uca.bulkin, uca.bulkout, sc->sc_intr_number )); - sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); + sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, + ucomprint, ucomsubmatch); USB_ATTACH_SUCCESS_RETURN; } diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 15c03047ca50..deb7e2dbe710 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -1,4 +1,4 @@ -/* $NetBSD: umodem.c,v 1.47 2004/04/23 17:25:25 itojun Exp $ */ +/* $NetBSD: umodem.c,v 1.48 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -51,7 +51,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: umodem.c,v 1.47 2004/04/23 17:25:25 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umodem.c,v 1.48 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -330,7 +330,8 @@ USB_ATTACH(umodem) USBDEV(sc->sc_dev)); DPRINTF(("umodem_attach: sc=%p\n", sc)); - sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); + sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, + ucomprint, ucomsubmatch); USB_ATTACH_SUCCESS_RETURN; diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index 9fd3cb1db7da..efd589152780 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: uplcom.c,v 1.38 2004/06/05 08:41:43 jdolecek Exp $ */ +/* $NetBSD: uplcom.c,v 1.39 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.38 2004/06/05 08:41:43 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.39 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -374,7 +374,8 @@ USB_ATTACH(uplcom) DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", uca.bulkin, uca.bulkout, sc->sc_intr_number )); - sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); + sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, + ucomprint, ucomsubmatch); USB_ATTACH_SUCCESS_RETURN; } diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 6ab1f5b2750c..a74160f78f50 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -1,5 +1,5 @@ /* $OpenBSD: usb_port.h,v 1.18 2000/09/06 22:42:10 rahnds Exp $ */ -/* $NetBSD: usb_port.h,v 1.62 2003/02/15 18:33:30 augustss Exp $ */ +/* $NetBSD: usb_port.h,v 1.63 2004/09/13 12:55:49 drochner Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.21 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -190,7 +190,8 @@ int __CONCAT(dname,_detach)(struct device *self, int flags) sc = __CONCAT(dname,_cd).cd_devs[unit] #define USB_DO_ATTACH(dev, bdev, parent, args, print, sub) \ - (config_found_sm(parent, args, print, sub)) + (config_found_sm_loc(parent, (args)->port == 0 ? "usb" : "uhub", \ + NULL, args, print, sub)) #elif defined(__OpenBSD__) /* diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 09f4af72b6df..88492ff1a7c3 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.117 2004/09/08 19:59:15 drochner Exp $ */ +/* $NetBSD: usb_subr.c,v 1.118 2004/09/13 12:55:49 drochner Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.117 2004/09/08 19:59:15 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.118 2004/09/13 12:55:49 drochner Exp $"); #include "opt_usbverbose.h" @@ -86,8 +86,9 @@ Static void usbd_devinfo_vp(usbd_device_handle, char *, size_t, char *, Static char *usbd_get_string(usbd_device_handle, int, char *); Static int usbd_getnewaddr(usbd_bus_handle bus); #if defined(__NetBSD__) -Static int usbd_print(void *aux, const char *pnp); -Static int usbd_submatch(device_ptr_t, struct cfdata *cf, void *); +Static int usbd_print(void *, const char *); +Static int usbd_submatch(device_ptr_t, struct cfdata *, + const locdesc_t *, void *); #elif defined(__OpenBSD__) Static int usbd_print(void *aux, const char *pnp); Static int usbd_submatch(device_ptr_t, void *, void *); @@ -1217,7 +1218,8 @@ usbd_print(void *aux, const char *pnp) #if defined(__NetBSD__) int -usbd_submatch(struct device *parent, struct cfdata *cf, void *aux) +usbd_submatch(struct device *parent, struct cfdata *cf, + const locdesc_t *ldesc, void *aux) { #elif defined(__OpenBSD__) int diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index 05a5cbd51650..e4abbada40a1 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvisor.c,v 1.26 2004/07/07 21:11:03 mycroft Exp $ */ +/* $NetBSD: uvisor.c,v 1.27 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvisor.c,v 1.26 2004/07/07 21:11:03 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvisor.c,v 1.27 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -326,8 +326,9 @@ USB_ATTACH(uvisor) } } if (hasin == 1 && hasout == 1) - sc->sc_subdevs[i] = config_found_sm(self, &uca, - ucomprint, ucomsubmatch); + sc->sc_subdevs[i] = config_found_sm_loc(self, + "ucombus", NULL, &uca, + ucomprint, ucomsubmatch); else printf("%s: no proper endpoints for port %d (%d,%d)\n", USBDEVNAME(sc->sc_dev), port, hasin, hasout); @@ -356,8 +357,8 @@ USB_ATTACH(uvisor) uca.bulkin = port | UE_DIR_IN; uca.bulkout = port | UE_DIR_OUT; } - sc->sc_subdevs[i] = config_found_sm(self, &uca, - ucomprint, ucomsubmatch); + sc->sc_subdevs[i] = config_found_sm_loc(self, "ucombus", + NULL, &uca, ucomprint, ucomsubmatch); } diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index 145dce7cd290..acac6744149d 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvscom.c,v 1.12 2004/04/23 17:25:27 itojun Exp $ */ +/* $NetBSD: uvscom.c,v 1.13 2004/09/13 12:55:49 drochner Exp $ */ /*- * Copyright (c) 2001-2002, Shunsuke Akiyama . * All rights reserved. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.12 2004/04/23 17:25:27 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.13 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -399,7 +399,8 @@ USB_ATTACH(uvscom) DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", uca.bulkin, uca.bulkout, sc->sc_intr_number )); - sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); + sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, + ucomprint, ucomsubmatch); USB_ATTACH_SUCCESS_RETURN; } diff --git a/sys/dev/vme/vme.c b/sys/dev/vme/vme.c index 7794b9adcc88..b20da4909097 100644 --- a/sys/dev/vme/vme.c +++ b/sys/dev/vme/vme.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme.c,v 1.12 2004/08/02 13:04:58 drochner Exp $ */ +/* $NetBSD: vme.c,v 1.13 2004/09/13 12:55:49 drochner Exp $ */ /* * Copyright (c) 1999 @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.12 2004/08/02 13:04:58 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.13 2004/09/13 12:55:49 drochner Exp $"); #include #include @@ -43,8 +43,10 @@ __KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.12 2004/08/02 13:04:58 drochner Exp $"); static void vme_extractlocators __P((int*, struct vme_attach_args*)); static int vmeprint __P((struct vme_attach_args*, char*)); -static int vmesubmatch1 __P((struct device*, struct cfdata*, void*)); -static int vmesubmatch __P((struct device*, struct cfdata*, void*)); +static int vmesubmatch1 __P((struct device*, struct cfdata*, + const locdesc_t *, void*)); +static int vmesubmatch __P((struct device*, struct cfdata*, + const locdesc_t *, void*)); int vmematch __P((struct device *, struct cfdata *, void *)); void vmeattach __P((struct device*, struct device*,void*)); static struct extent *vme_select_map __P((struct vmebus_softc*, vme_am_t)); @@ -125,9 +127,10 @@ vmeprint(v, dummy) * devices are attached. */ static int -vmesubmatch1(bus, dev, aux) +vmesubmatch1(bus, dev, ldesc, aux) struct device *bus; struct cfdata *dev; + const locdesc_t *ldesc; void *aux; { struct vmebus_softc *sc = (struct vmebus_softc*)bus; @@ -148,6 +151,7 @@ static int vmesubmatch(bus, dev, aux) struct device *bus; struct cfdata *dev; + const locdesc_t *ldesc; void *aux; { struct vmebus_softc *sc = (struct vmebus_softc*)bus; @@ -224,9 +228,9 @@ vmeattach(parent, self, aux) if (sc->slaveconfig) { /* first get info about the bus master's slave side, if present */ - config_search(vmesubmatch1, self, 0); + config_search_ia(vmesubmatch1, self, "vme", 0); } - config_search(vmesubmatch, self, 0); + config_search_ia(vmesubmatch, self, "vme", 0); #ifdef VMEDEBUG if (sc->vme32ext)