summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authordrochner <drochner@NetBSD.org>2005-08-25 18:35:38 +0000
committerdrochner <drochner@NetBSD.org>2005-08-25 18:35:38 +0000
commitfa3cb84d6262bbf1db28e9d4d55ca3842a1d09e3 (patch)
tree11ffeefbbae1cf974abb0fbc0c79eaffe1f7a506 /sys/dev/ic
parentede55d75e5923dcb6b25383599fa8f9c8b8a36c0 (diff)
replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array the length in now known to all relevant parties, so this avoids duplication of information, and we can allocate that thing in drivers without hacks
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/aac.c24
-rw-r--r--sys/dev/ic/cac.c16
-rw-r--r--sys/dev/ic/i82365.c22
-rw-r--r--sys/dev/ic/icp.c29
-rw-r--r--sys/dev/ic/mlx.c18
-rw-r--r--sys/dev/ic/tcic2.c22
-rw-r--r--sys/dev/ic/upc.c24
7 files changed, 64 insertions, 91 deletions
diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c
index 8c38c2b3da2..b30608f98bd 100644
--- a/sys/dev/ic/aac.c
+++ b/sys/dev/ic/aac.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aac.c,v 1.21 2005/06/20 20:40:21 darcy Exp $ */
+/* $NetBSD: aac.c,v 1.22 2005/08/25 18:35:39 drochner Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.21 2005/06/20 20:40:21 darcy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.22 2005/08/25 18:35:39 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -154,13 +154,7 @@ 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 - Not clean
- The big plan is to let config(8) issue information
- about the length of the locator array in a useful way.
- Then the allocation can be centralized. See also
- http://mail-index.netbsd.org/tech-kern/2005/02/09/0025.html
- */
+ int locs[AACCF_NLOCS];
SIMPLEQ_INIT(&sc->sc_ccb_free);
SIMPLEQ_INIT(&sc->sc_ccb_queue);
@@ -259,10 +253,9 @@ aac_attach(struct aac_softc *sc)
continue;
aaca.aaca_unit = i;
- ldesc->len = 1;
- ldesc->locs[AACCF_UNIT] = i;
+ locs[AACCF_UNIT] = i;
- config_found_sm_loc(&sc->sc_dv, "aac", ldesc, &aaca,
+ config_found_sm_loc(&sc->sc_dv, "aac", locs, &aaca,
aac_print, aac_submatch);
}
@@ -316,14 +309,11 @@ aac_print(void *aux, const char *pnp)
*/
static int
aac_submatch(struct device *parent, struct cfdata *cf,
- const locdesc_t *ldesc, void *aux)
+ const locdesc_t *locs, void *aux)
{
- struct aac_attach_args *aaca;
-
- aaca = aux;
if (cf->cf_loc[AACCF_UNIT] != AACCF_UNIT_DEFAULT &&
- cf->cf_loc[AACCF_UNIT] != ldesc->locs[AACCF_UNIT])
+ cf->cf_loc[AACCF_UNIT] != locs[AACCF_UNIT])
return (0);
return (config_match(parent, cf, aux));
diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c
index 50efd0e7673..cb00282f2cc 100644
--- a/sys/dev/ic/cac.c
+++ b/sys/dev/ic/cac.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cac.c,v 1.30 2005/05/30 04:43:46 christos Exp $ */
+/* $NetBSD: cac.c,v 1.31 2005/08/25 18:35:39 drochner Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.30 2005/05/30 04:43:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.31 2005/08/25 18:35:39 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -101,8 +101,7 @@ 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 */
+ int locs[CACCF_NLOCS];
if (intrstr != NULL)
aprint_normal("%s: interrupting at %s\n", sc->sc_dv.dv_xname,
@@ -185,10 +184,9 @@ cac_init(struct cac_softc *sc, const char *intrstr, int startfw)
for (i = 0; i < cinfo.num_drvs; i++) {
caca.caca_unit = i;
- ldesc->len = 1;
- ldesc->locs[CACCF_UNIT] = i;
+ locs[CACCF_UNIT] = i;
- config_found_sm_loc(&sc->sc_dv, "cac", ldesc, &caca,
+ config_found_sm_loc(&sc->sc_dv, "cac", locs, &caca,
cac_print, cac_submatch);
}
@@ -242,11 +240,11 @@ cac_print(void *aux, const char *pnp)
*/
static int
cac_submatch(struct device *parent, struct cfdata *cf,
- const locdesc_t *ldesc, void *aux)
+ const locdesc_t *locs, void *aux)
{
if (cf->cf_loc[CACCF_UNIT] != CACCF_UNIT_DEFAULT &&
- cf->cf_loc[CACCF_UNIT] != ldesc->locs[CACCF_UNIT])
+ cf->cf_loc[CACCF_UNIT] != locs[CACCF_UNIT])
return (0);
return (config_match(parent, cf, aux));
diff --git a/sys/dev/ic/i82365.c b/sys/dev/ic/i82365.c
index 5b5d946c591..a51891f1ad9 100644
--- a/sys/dev/ic/i82365.c
+++ b/sys/dev/ic/i82365.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82365.c,v 1.90 2005/05/30 04:43:46 christos Exp $ */
+/* $NetBSD: i82365.c,v 1.91 2005/08/25 18:35:39 drochner Exp $ */
/*
* Copyright (c) 2004 Charles M. Hannum. All rights reserved.
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82365.c,v 1.90 2005/05/30 04:43:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82365.c,v 1.91 2005/08/25 18:35:39 drochner Exp $");
#define PCICDEBUG
@@ -396,8 +396,7 @@ pcic_attach_socket(h)
{
struct pcmciabus_attach_args paa;
struct pcic_softc *sc = (struct pcic_softc *)h->ph_parent;
- int help[3];
- locdesc_t *ldesc = (void *)help; /* XXX */
+ int locs[PCMCIABUSCF_NLOCS];
/* initialize the rest of the handle */
@@ -414,11 +413,10 @@ pcic_attach_socket(h)
paa.iobase = sc->iobase;
paa.iosize = sc->iosize;
- ldesc->len = 2;
- ldesc->locs[PCMCIABUSCF_CONTROLLER] = h->chip;
- ldesc->locs[PCMCIABUSCF_SOCKET] = h->socket;
+ locs[PCMCIABUSCF_CONTROLLER] = h->chip;
+ locs[PCMCIABUSCF_SOCKET] = h->socket;
- h->pcmcia = config_found_sm_loc(&sc->dev, "pcmciabus", ldesc, &paa,
+ h->pcmcia = config_found_sm_loc(&sc->dev, "pcmciabus", locs, &paa,
pcic_print, pcic_submatch);
if (h->pcmcia == NULL) {
h->flags &= ~PCIC_FLAG_SOCKETP;
@@ -642,18 +640,18 @@ pcic_event_thread(arg)
}
int
-pcic_submatch(parent, cf, ldesc, aux)
+pcic_submatch(parent, cf, locs, aux)
struct device *parent;
struct cfdata *cf;
- const locdesc_t *ldesc;
+ const locdesc_t *locs;
void *aux;
{
if (cf->cf_loc[PCMCIABUSCF_CONTROLLER] != PCMCIABUSCF_CONTROLLER_DEFAULT &&
- cf->cf_loc[PCMCIABUSCF_CONTROLLER] != ldesc->locs[PCMCIABUSCF_CONTROLLER])
+ cf->cf_loc[PCMCIABUSCF_CONTROLLER] != locs[PCMCIABUSCF_CONTROLLER])
return 0;
if (cf->cf_loc[PCMCIABUSCF_SOCKET] != PCMCIABUSCF_SOCKET_DEFAULT &&
- cf->cf_loc[PCMCIABUSCF_SOCKET] != ldesc->locs[PCMCIABUSCF_SOCKET])
+ cf->cf_loc[PCMCIABUSCF_SOCKET] != locs[PCMCIABUSCF_SOCKET])
return 0;
return (config_match(parent, cf, aux));
diff --git a/sys/dev/ic/icp.c b/sys/dev/ic/icp.c
index 3ceb352da33..940e5c75d8e 100644
--- a/sys/dev/ic/icp.c
+++ b/sys/dev/ic/icp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: icp.c,v 1.14 2005/02/27 00:27:01 perry Exp $ */
+/* $NetBSD: icp.c,v 1.15 2005/08/25 18:35:39 drochner Exp $ */
/*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.14 2005/02/27 00:27:01 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.15 2005/08/25 18:35:39 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -141,8 +141,7 @@ 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 */
+ int locs[ICPCF_NLOCS];
state = 0;
@@ -385,11 +384,10 @@ icp_init(struct icp_softc *icp, const char *intrstr)
icpa.icpa_unit = j + ICPA_UNIT_SCSI;
- ldesc->len = 1;
- ldesc->locs[ICPCF_UNIT] = j + ICPA_UNIT_SCSI;
+ locs[ICPCF_UNIT] = j + ICPA_UNIT_SCSI;
icp->icp_children[icpa.icpa_unit] =
- config_found_sm_loc(&icp->icp_dv, "icp", ldesc,
+ config_found_sm_loc(&icp->icp_dv, "icp", locs,
&icpa, icp_print, icp_submatch);
}
}
@@ -404,11 +402,10 @@ icp_init(struct icp_softc *icp, const char *intrstr)
icpa.icpa_unit = j;
- ldesc->len = 1;
- ldesc->locs[ICPCF_UNIT] = j;
+ locs[ICPCF_UNIT] = j;
icp->icp_children[icpa.icpa_unit] =
- config_found_sm_loc(&icp->icp_dv, "icp", ldesc,
+ config_found_sm_loc(&icp->icp_dv, "icp", locs,
&icpa, icp_print, icp_submatch);
}
}
@@ -457,8 +454,7 @@ 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 */
+ int locs[ICPCF_NLOCS];
/*
* NOTE: It is very important that the queue be frozen and not
@@ -531,11 +527,10 @@ icp_rescan(struct icp_softc *icp, int unit)
icpa.icpa_unit = unit;
- ldesc->len = 1;
- ldesc->locs[ICPCF_UNIT] = unit;
+ locs[ICPCF_UNIT] = unit;
icp->icp_children[unit] = config_found_sm_loc(&icp->icp_dv,
- "icp", ldesc, &icpa, icp_print, icp_submatch);
+ "icp", locs, &icpa, icp_print, icp_submatch);
}
icp_recompute_openings(icp);
@@ -649,11 +644,11 @@ icp_print(void *aux, const char *pnp)
int
icp_submatch(struct device *parent, struct cfdata *cf,
- const locdesc_t *ldesc, void *aux)
+ const locdesc_t *locs, void *aux)
{
if (cf->cf_loc[ICPCF_UNIT] != ICPCF_UNIT_DEFAULT &&
- cf->cf_loc[ICPCF_UNIT] != ldesc->locs[ICPCF_UNIT])
+ cf->cf_loc[ICPCF_UNIT] != locs[ICPCF_UNIT])
return (0);
return (config_match(parent, cf, aux));
diff --git a/sys/dev/ic/mlx.c b/sys/dev/ic/mlx.c
index b6770bd82de..d5fda26844f 100644
--- a/sys/dev/ic/mlx.c
+++ b/sys/dev/ic/mlx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mlx.c,v 1.34 2005/07/30 17:37:11 mhitch Exp $ */
+/* $NetBSD: mlx.c,v 1.35 2005/08/25 18:35:39 drochner Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.34 2005/07/30 17:37:11 mhitch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.35 2005/08/25 18:35:39 drochner Exp $");
#include "ld.h"
@@ -577,8 +577,7 @@ 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 */
+ int locs[MLXCF_NLOCS];
mlx->mlx_flags |= MLXF_RESCANNING;
@@ -643,11 +642,10 @@ mlx_configure(struct mlx_softc *mlx, int waitok)
*/
mlxa.mlxa_unit = i;
- ldesc->len = 1;
- ldesc->locs[MLXCF_UNIT] = i;
+ locs[MLXCF_UNIT] = i;
- ms->ms_dv = config_found_sm_loc(&mlx->mlx_dv, "mlx", NULL, &mlxa, mlx_print,
- mlx_submatch);
+ ms->ms_dv = config_found_sm_loc(&mlx->mlx_dv, "mlx", locs,
+ &mlxa, mlx_print, mlx_submatch);
nunits += (ms->ms_dv != NULL);
}
@@ -681,11 +679,11 @@ mlx_print(void *aux, const char *pnp)
*/
static int
mlx_submatch(struct device *parent, struct cfdata *cf,
- const locdesc_t *ldesc, void *aux)
+ const locdesc_t *locs, void *aux)
{
if (cf->cf_loc[MLXCF_UNIT] != MLXCF_UNIT_DEFAULT &&
- cf->cf_loc[MLXCF_UNIT] != ldesc->locs[MLXCF_UNIT])
+ cf->cf_loc[MLXCF_UNIT] != locs[MLXCF_UNIT])
return (0);
return (config_match(parent, cf, aux));
diff --git a/sys/dev/ic/tcic2.c b/sys/dev/ic/tcic2.c
index 4bcf668ea04..82f03761446 100644
--- a/sys/dev/ic/tcic2.c
+++ b/sys/dev/ic/tcic2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcic2.c,v 1.20 2005/05/30 04:43:47 christos Exp $ */
+/* $NetBSD: tcic2.c,v 1.21 2005/08/25 18:35:39 drochner Exp $ */
/*
* Copyright (c) 1998, 1999 Christoph Badura. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcic2.c,v 1.20 2005/05/30 04:43:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcic2.c,v 1.21 2005/08/25 18:35:39 drochner Exp $");
#undef TCICDEBUG
@@ -412,8 +412,7 @@ tcic_attach_socket(h)
struct tcic_handle *h;
{
struct pcmciabus_attach_args paa;
- int help[3];
- locdesc_t *ldesc = (void *)help; /* XXX */
+ int locs[PCMCIABUSCF_NLOCS];
/* initialize the rest of the handle */
@@ -430,11 +429,10 @@ tcic_attach_socket(h)
paa.iobase = h->sc->iobase;
paa.iosize = h->sc->iosize;
- ldesc->len = 2;
- ldesc->locs[PCMCIABUSCF_CONTROLLER] = 0;
- ldesc->locs[PCMCIABUSCF_SOCKET] = h->sock;
+ locs[PCMCIABUSCF_CONTROLLER] = 0;
+ locs[PCMCIABUSCF_SOCKET] = h->sock;
- h->pcmcia = config_found_sm_loc(&h->sc->dev, "pcmciabus", ldesc, &paa,
+ h->pcmcia = config_found_sm_loc(&h->sc->dev, "pcmciabus", locs, &paa,
tcic_print, tcic_submatch);
/* if there's actually a pcmcia device attached, initialize the slot */
@@ -538,18 +536,18 @@ tcic_init_socket(h)
}
int
-tcic_submatch(parent, cf, ldesc, aux)
+tcic_submatch(parent, cf, locs, aux)
struct device *parent;
struct cfdata *cf;
- const locdesc_t *ldesc;
+ const locdesc_t *locs;
void *aux;
{
if (cf->cf_loc[PCMCIABUSCF_CONTROLLER] != PCMCIABUSCF_CONTROLLER_DEFAULT &&
- cf->cf_loc[PCMCIABUSCF_CONTROLLER] != ldesc->locs[PCMCIABUSCF_CONTROLLER])
+ cf->cf_loc[PCMCIABUSCF_CONTROLLER] != locs[PCMCIABUSCF_CONTROLLER])
return 0;
if (cf->cf_loc[PCMCIABUSCF_SOCKET] != PCMCIABUSCF_SOCKET_DEFAULT &&
- cf->cf_loc[PCMCIABUSCF_SOCKET] != ldesc->locs[PCMCIABUSCF_SOCKET])
+ cf->cf_loc[PCMCIABUSCF_SOCKET] != locs[PCMCIABUSCF_SOCKET])
return 0;
return (config_match(parent, cf, aux));
diff --git a/sys/dev/ic/upc.c b/sys/dev/ic/upc.c
index 92add4fa2e3..428a225ddc2 100644
--- a/sys/dev/ic/upc.c
+++ b/sys/dev/ic/upc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: upc.c,v 1.9 2005/02/27 00:27:03 perry Exp $ */
+/* $NetBSD: upc.c,v 1.10 2005/08/25 18:35:39 drochner Exp $ */
/*-
* Copyright (c) 2000, 2003 Ben Harris
* All rights reserved.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: upc.c,v 1.9 2005/02/27 00:27:03 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: upc.c,v 1.10 2005/08/25 18:35:39 drochner Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -211,8 +211,7 @@ 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;
+ int locs[UPCCF_NLOCS];
ua.ua_devtype = devtype;
ua.ua_offset = offset;
@@ -220,10 +219,9 @@ upc_found(struct upc_softc *sc, char const *devtype, int offset, int size,
bus_space_subregion(sc->sc_iot, sc->sc_ioh, offset, size, &ua.ua_ioh);
ua.ua_irqhandle = uih;
- ldesc->len = 1;
- ldesc->locs[UPCCF_OFFSET] = offset;
+ locs[UPCCF_OFFSET] = offset;
- config_found_sm_loc(&sc->sc_dev, "upc", ldesc, &ua,
+ config_found_sm_loc(&sc->sc_dev, "upc", locs, &ua,
upc_print, upc_submatch);
}
@@ -232,8 +230,7 @@ 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;
+ int locs[UPCCF_NLOCS];
ua.ua_devtype = devtype;
ua.ua_offset = offset;
@@ -243,10 +240,9 @@ upc_found2(struct upc_softc *sc, char const *devtype, int offset, int size,
&ua.ua_ioh2);
ua.ua_irqhandle = uih;
- ldesc->len = 1;
- ldesc->locs[UPCCF_OFFSET] = offset;
+ locs[UPCCF_OFFSET] = offset;
- config_found_sm_loc(&sc->sc_dev, "upc", ldesc, &ua,
+ config_found_sm_loc(&sc->sc_dev, "upc", locs, &ua,
upc_print, upc_submatch);
}
@@ -307,13 +303,13 @@ upc_print(void *aux, char const *pnp)
static int
upc_submatch(struct device *parent, struct cfdata *cf,
- const locdesc_t *ldesc, void *aux)
+ const locdesc_t *locs, 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] == ldesc->locs[UPCCF_OFFSET]))
+ cf->cf_loc[UPCCF_OFFSET] == locs[UPCCF_OFFSET]))
return config_match(parent, cf, aux);
return 0;
}