Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch autoconf cleanup: turn xxxsubmatch() functions into...
details: https://anonhg.NetBSD.org/src/rev/99ac93942db8
branches: trunk
changeset: 569918:99ac93942db8
user: drochner <drochner%NetBSD.org@localhost>
date: Mon Sep 13 14:57:31 2004 +0000
description:
autoconf cleanup: turn xxxsubmatch() functions into the locator
passing variants
diffstat:
sys/arch/alpha/mcbus/mcbus.c | 39 +++++++++++++++++++-----------
sys/arch/alpha/mcbus/mcbusvar.h | 3 +-
sys/arch/alpha/sableio/sableio.c | 28 ++++++++++++++-------
sys/arch/alpha/tlsb/gbus.c | 23 +++++++++++------
sys/arch/cesfic/cesfic/autoconf.c | 12 +++++---
sys/arch/i386/pnpbios/pnpbios.c | 48 +++++++++++++++++++++++--------------
sys/arch/mips/alchemy/aubus.c | 21 +++++++++++-----
sys/arch/mips/sibyte/dev/sbgbus.c | 12 +++++---
sys/arch/mips/sibyte/dev/sbobio.c | 27 +++++++++++++++------
sys/arch/mips/sibyte/dev/sbscd.c | 29 ++++++++++++++++------
sys/arch/mips/sibyte/dev/sbsmbus.c | 26 +++++++++++++++-----
sys/arch/pmax/ibus/ibus.c | 25 +++++++++++-------
12 files changed, 190 insertions(+), 103 deletions(-)
diffs (truncated from 843 to 300 lines):
diff -r cade57ad4dd6 -r 99ac93942db8 sys/arch/alpha/mcbus/mcbus.c
--- a/sys/arch/alpha/mcbus/mcbus.c Mon Sep 13 14:48:46 2004 +0000
+++ b/sys/arch/alpha/mcbus/mcbus.c Mon Sep 13 14:57:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mcbus.c,v 1.13 2003/01/01 00:39:20 thorpej Exp $ */
+/* $NetBSD: mcbus.c,v 1.14 2004/09/13 14:57:31 drochner Exp $ */
/*
* Copyright (c) 1998 by Matthew Jacob
@@ -37,7 +37,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mcbus.c,v 1.13 2003/01/01 00:39:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcbus.c,v 1.14 2004/09/13 14:57:31 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -66,7 +66,8 @@
static int mcbusmatch __P((struct device *, struct cfdata *, void *));
static void mcbusattach __P((struct device *, struct device *, void *));
static int mcbusprint __P((void *, const char *));
-static int mcbussbm __P((struct device *, struct cfdata *, void *));
+static int mcbussbm __P((struct device *, struct cfdata *,
+ const locdesc_t *, void *));
static char *mcbus_node_type_str __P((u_int8_t));
typedef struct {
@@ -102,17 +103,17 @@
}
static int
-mcbussbm(parent, cf, aux)
+mcbussbm(parent, cf, ldesc, aux)
struct device *parent;
struct cfdata *cf;
+ const locdesc_t *ldesc;
void *aux;
{
- struct mcbus_dev_attach_args *tap = aux;
- if (tap->ma_name != mcbus_cd.cd_name)
+
+ if (cf->cf_loc[MCBUSCF_MID] != MCBUSCF_MID_DEFAULT &&
+ cf->cf_loc[MCBUSCF_MID] != ldesc->locs[MCBUSCF_MID])
return (0);
- if (cf->cf_loc[MCBUSCF_MID] != MCBUSCF_MID_DEFAULT &&
- cf->cf_loc[MCBUSCF_MID] != tap->ma_mid)
- return (0);
+
return (config_match(parent, cf, aux));
}
@@ -148,6 +149,8 @@
struct mcbus_dev_attach_args ta;
mcbus_softc_t *mbp = (mcbus_softc_t *)self;
int i, mid;
+ int help[2];
+ locdesc_t *ldesc = (void *)help; /* XXX */
printf(": %s BCache\n", mcbus_primary.mcbus_valid ?
bcs[mcbus_primary.mcbus_bcache] : "Unknown");
@@ -159,7 +162,6 @@
/*
* Find and "configure" memory.
*/
- ta.ma_name = mcbus_cd.cd_name;
/*
* XXX If we ever support more than one MCBUS, we'll
@@ -170,14 +172,16 @@
ta.ma_mid = 1;
ta.ma_type = MCBUS_TYPE_MEM;
mbp->mcbus_types[1] = MCBUS_TYPE_MEM;
- (void) config_found_sm(self, &ta, mcbusprint, mcbussbm);
+ ldesc->len = 1;
+ ldesc->locs[MCBUSCF_MID] = 1;
+ (void) config_found_sm_loc(self, "mcbus", ldesc, &ta,
+ mcbusprint, mcbussbm);
/*
* Now find PCI busses.
*/
for (i = 0; i < MCPCIA_PER_MCBUS; i++) {
mid = mcbus_mcpcia_probe_order[i];
- ta.ma_name = mcbus_cd.cd_name;
/*
* XXX If we ever support more than one MCBUS, we'll
* XXX have to probe for them, and map them to unit
@@ -186,8 +190,11 @@
ta.ma_gid = MCBUS_GID_FROM_INSTANCE(0);
ta.ma_mid = mid;
ta.ma_type = MCBUS_TYPE_PCI;
+ ldesc->len = 1;
+ ldesc->locs[MCBUSCF_MID] = mid;
if (MCPCIA_EXISTS(ta.ma_mid, ta.ma_gid))
- (void) config_found_sm(self, &ta, mcbusprint, mcbussbm);
+ (void) config_found_sm_loc(self, "mcbus", ldesc, &ta,
+ mcbusprint, mcbussbm);
}
#if 0
@@ -204,7 +211,6 @@
printf("%s mid %d: %s %s\n", self->dv_xname,
mid, mcbus_node_type_str(MCBUS_TYPE_CPU),
bcs[mcbus_primary.mcbus_bcache & 0x7]);
- ta.ma_name = mcbus_cd.cd_name;
/*
* XXX If we ever support more than one MCBUS, we'll
* XXX have to probe for them, and map them to unit
@@ -214,7 +220,10 @@
ta.ma_mid = mid;
ta.ma_type = MCBUS_TYPE_CPU;
mbp->mcbus_types[mid] = MCBUS_TYPE_CPU;
- (void) config_found_sm(self, &ta, mcbusprint, mcbussbm);
+ ldesc->len = 1;
+ ldesc->locs[MCBUSCF_MID] = mid;
+ (void) config_found_sm_loc(self, "mcbus", ldesc, &ta,
+ mcbusprint, mcbussbm);
}
#endif
diff -r cade57ad4dd6 -r 99ac93942db8 sys/arch/alpha/mcbus/mcbusvar.h
--- a/sys/arch/alpha/mcbus/mcbusvar.h Mon Sep 13 14:48:46 2004 +0000
+++ b/sys/arch/alpha/mcbus/mcbusvar.h Mon Sep 13 14:57:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mcbusvar.h,v 1.4 2002/09/26 20:02:47 thorpej Exp $ */
+/* $NetBSD: mcbusvar.h,v 1.5 2004/09/13 14:57:31 drochner Exp $ */
/*
* Copyright (c) 1998 by Matthew Jacob
@@ -39,7 +39,6 @@
* The structure used to attach devices to the MCbus.
*/
struct mcbus_dev_attach_args {
- const char * ma_name; /* so things aren't confused */
u_int8_t ma_gid; /* GID of MCBUS (MCBUS #) */
u_int8_t ma_mid; /* Module ID on MCBUS */
u_int8_t ma_type; /* Module "type" */
diff -r cade57ad4dd6 -r 99ac93942db8 sys/arch/alpha/sableio/sableio.c
--- a/sys/arch/alpha/sableio/sableio.c Mon Sep 13 14:48:46 2004 +0000
+++ b/sys/arch/alpha/sableio/sableio.c Mon Sep 13 14:57:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sableio.c,v 1.7 2004/08/30 15:05:16 drochner Exp $ */
+/* $NetBSD: sableio.c,v 1.8 2004/09/13 14:57:31 drochner Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: sableio.c,v 1.7 2004/08/30 15:05:16 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sableio.c,v 1.8 2004/09/13 14:57:31 drochner Exp $");
#include "isadma.h"
@@ -71,6 +71,8 @@
#include <alpha/sableio/sableiovar.h>
+#include "locators.h"
+
/*
* The devices built-in to the Sable STDIO module.
*/
@@ -109,7 +111,8 @@
sableio_match, sableio_attach, NULL, NULL);
int sableio_print(void *, const char *);
-int sableio_submatch(struct device *, struct cfdata *, void *);
+int sableio_submatch(struct device *, struct cfdata *,
+ const locdesc_t *, void *);
struct sableio_softc *sableio_attached;
@@ -122,8 +125,8 @@
* These are really ISA devices, and thus must be on
* PCI bus 0.
*/
- if (cf->pcibuscf_bus != PCIBUS_UNK_BUS &&
- cf->pcibuscf_bus != pba->pba_bus)
+ if (cf->cf_loc[SABLEIOBUSCF_BUS] != SABLEIOBUSCF_BUS_DEFAULT &&
+ cf->cf_loc[SABLEIOBUSCF_BUS] != pba->pba_bus)
return (0);
/* sanity */
@@ -145,6 +148,8 @@
struct sableio_attach_args sa;
bus_dma_tag_t dmat;
int i;
+ int help[2];
+ locdesc_t *ldesc = (void *)help; /* XXX */
printf(": Sable STDIO module\n");
@@ -171,18 +176,21 @@
sa.sa_ic = &sc->sc_isa_chipset;
sa.sa_pc = pba->pba_pc;
- (void) config_found_sm(self, &sa, sableio_print,
- sableio_submatch);
+ ldesc->len = 1;
+ ldesc->locs[SABLEIOCF_PORT] = sableio_devs[i].sd_ioaddr;
+
+ (void) config_found_sm_loc(self, "sableio", ldesc, &sa,
+ sableio_print, sableio_submatch);
}
}
int
-sableio_submatch(struct device *parent, struct cfdata *cf, void *aux)
+sableio_submatch(struct device *parent, struct cfdata *cf,
+ const locdesc_t *ldesc, void *aux)
{
- struct sableio_attach_args *sa = aux;
if (cf->cf_loc[SABLEIOCF_PORT] != SABLEIOCF_PORT_DEFAULT &&
- cf->cf_loc[SABLEIOCF_PORT] != sa->sa_ioaddr)
+ cf->cf_loc[SABLEIOCF_PORT] != ldesc->locs[SABLEIOCF_PORT])
return (0);
return (config_match(parent, cf, aux));
diff -r cade57ad4dd6 -r 99ac93942db8 sys/arch/alpha/tlsb/gbus.c
--- a/sys/arch/alpha/tlsb/gbus.c Mon Sep 13 14:48:46 2004 +0000
+++ b/sys/arch/alpha/tlsb/gbus.c Mon Sep 13 14:57:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gbus.c,v 1.14 2003/01/01 00:39:21 thorpej Exp $ */
+/* $NetBSD: gbus.c,v 1.15 2004/09/13 14:57:31 drochner Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@@ -37,7 +37,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: gbus.c,v 1.14 2003/01/01 00:39:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gbus.c,v 1.15 2004/09/13 14:57:31 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,7 +68,8 @@
gbusmatch, gbusattach, NULL, NULL);
static int gbusprint __P((void *, const char *));
-static int gbussubmatch __P((struct device *, struct cfdata *, void *));
+static int gbussubmatch __P((struct device *, struct cfdata *,
+ const locdesc_t *, void *));
struct gbus_attach_args gbus_children[] = {
{ "zsc", GBUS_DUART0_OFFSET },
@@ -122,26 +123,32 @@
struct gbus_softc *sc = (struct gbus_softc *)self;
struct tlsb_dev_attach_args *ta = aux;
struct gbus_attach_args *ga;
+ int help[2];
+ locdesc_t *ldesc = (void *)help; /* XXX */
printf("\n");
sc->sc_tlsbnode = ta->ta_node;
/* Attach the children. */
- for (ga = gbus_children; ga->ga_name != NULL; ga++)
- (void) config_found_sm(self, ga, gbusprint, gbussubmatch);
+ for (ga = gbus_children; ga->ga_name != NULL; ga++) {
+ ldesc->len = 1;
+ ldesc->locs[GBUSCF_OFFSET] = ga->ga_offset;
+ (void) config_found_sm_loc(self, "gbus", ldesc, ga,
+ gbusprint, gbussubmatch);
+ }
}
static int
-gbussubmatch(parent, cf, aux)
+gbussubmatch(parent, cf, ldesc, aux)
struct device *parent;
struct cfdata *cf;
+ const locdesc_t *ldesc;
void *aux;
{
- struct gbus_attach_args *ga = aux;
if (cf->cf_loc[GBUSCF_OFFSET] != GBUSCF_OFFSET_DEFAULT &&
- cf->cf_loc[GBUSCF_OFFSET] != ga->ga_offset)
+ cf->cf_loc[GBUSCF_OFFSET] != ldesc->locs[GBUSCF_OFFSET])
return (0);
return (config_match(parent, cf, aux));
diff -r cade57ad4dd6 -r 99ac93942db8 sys/arch/cesfic/cesfic/autoconf.c
--- a/sys/arch/cesfic/cesfic/autoconf.c Mon Sep 13 14:48:46 2004 +0000
+++ b/sys/arch/cesfic/cesfic/autoconf.c Mon Sep 13 14:57:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.9 2003/07/15 01:29:19 lukem Exp $ */
+/* $NetBSD: autoconf.c,v 1.10 2004/09/13 14:57:31 drochner Exp $ */
/*
* Copyright (c) 1997, 1999
@@ -27,7 +27,7 @@
*/
Home |
Main Index |
Thread Index |
Old Index