Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/mca use a submatch function for drive attachment, an...
details: https://anonhg.NetBSD.org/src/rev/78ef7627f377
branches: trunk
changeset: 569723:78ef7627f377
user: drochner <drochner%NetBSD.org@localhost>
date: Wed Sep 01 20:57:58 2004 +0000
description:
use a submatch function for drive attachment, and pass locators
just for sanity
diffstat:
sys/dev/mca/ed_mca.c | 12 ++----------
sys/dev/mca/edc_mca.c | 33 ++++++++++++++++++++++++++-------
sys/dev/mca/edcvar.h | 4 +---
3 files changed, 29 insertions(+), 20 deletions(-)
diffs (149 lines):
diff -r 3a2779c1dd8d -r 78ef7627f377 sys/dev/mca/ed_mca.c
--- a/sys/dev/mca/ed_mca.c Wed Sep 01 20:31:20 2004 +0000
+++ b/sys/dev/mca/ed_mca.c Wed Sep 01 20:57:58 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ed_mca.c,v 1.23 2004/08/13 04:10:49 thorpej Exp $ */
+/* $NetBSD: ed_mca.c,v 1.24 2004/09/01 20:57:58 drochner Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,10 +38,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.23 2004/08/13 04:10:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.24 2004/09/01 20:57:58 drochner Exp $");
#include "rnd.h"
-#include "locators.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -132,13 +131,6 @@
int found = 1;
/*
- * Check we match hardwired config.
- */
- if (cf->edccf_unit != EDCCF_DRIVE_DEFAULT &&
- cf->edccf_unit != eda->edc_drive)
- return (0);
-
- /*
* Get Device Configuration (09).
*/
cmd_args[0] = 14; /* Options: 00s110, s: 0=Physical 1=Pseudo */
diff -r 3a2779c1dd8d -r 78ef7627f377 sys/dev/mca/edc_mca.c
--- a/sys/dev/mca/edc_mca.c Wed Sep 01 20:31:20 2004 +0000
+++ b/sys/dev/mca/edc_mca.c Wed Sep 01 20:57:58 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edc_mca.c,v 1.24 2004/08/30 18:28:33 drochner Exp $ */
+/* $NetBSD: edc_mca.c,v 1.25 2004/09/01 20:57:58 drochner Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.24 2004/08/30 18:28:33 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.25 2004/09/01 20:57:58 drochner Exp $");
#include "rnd.h"
@@ -82,6 +82,8 @@
#include <dev/mca/edvar.h>
#include <dev/mca/edcvar.h>
+#include "locators.h"
+
#define EDC_ATTN_MAXTRIES 10000 /* How many times check for unbusy */
#define EDC_MAX_CMD_RES_LEN 8
@@ -147,6 +149,18 @@
}
}
+static int
+edcsubmatch(struct device *parent, struct cfdata *cf,
+ const locdesc_t *ldesc, void *aux)
+{
+
+ if (cf->cf_loc[EDCCF_DRIVE] != EDCCF_DRIVE_DEFAULT &&
+ cf->cf_loc[EDCCF_DRIVE] != ldesc->locs[EDCCF_DRIVE])
+ return (0);
+
+ return (config_match(parent, cf, aux));
+}
+
void
edc_mca_attach(parent, self, aux)
struct device *parent, *self;
@@ -159,6 +173,8 @@
int irq, drq, iobase;
const char *typestr;
int devno, error;
+ int help[2];
+ locdesc_t *ldesc = (void *)help; /* XXX */
pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2);
pos3 = mca_conf_read(ma->ma_mc, ma->ma_slot, 3);
@@ -287,13 +303,13 @@
/* "SOFT" reset */
edc_do_attn(sc, ATN_RESET_ATTACHMENT, DASD_DEVNO_CONTROLLER,0);
}
-
+
/*
* Since interrupts are disabled, it's necessary
* to detect the interrupt request and call edc_intr()
* explicitly. See also edc_run_cmd().
*/
- while(bus_space_read_1(sc->sc_iot, sc->sc_ioh, BSR) & BSR_BUSY) {
+ while (bus_space_read_1(sc->sc_iot, sc->sc_ioh, BSR) & BSR_BUSY) {
if (bus_space_read_1(sc->sc_iot, sc->sc_ioh, BSR) & BSR_INTR)
edc_intr(sc);
@@ -304,10 +320,13 @@
sc->sc_flags |= DASD_QUIET;
/* check for attached disks */
- for(devno=0; devno < sc->sc_maxdevs; devno++) {
+ for (devno = 0; devno < sc->sc_maxdevs; devno++) {
eda.edc_drive = devno;
+ ldesc->len = 1;
+ ldesc->locs[EDCCF_DRIVE] = devno;
sc->sc_ed[devno] =
- (void *) config_found(self, &eda, NULL);
+ (void *) config_found_sm_loc(self, "edc", ldesc, &eda,
+ NULL, edcsubmatch);
/* If initialization did not succeed, NULL the pointer. */
if (sc->sc_ed[devno]
@@ -322,7 +341,7 @@
* Check if there are any disks attached. If not, disestablish
* the interrupt.
*/
- for(devno=0; devno < sc->sc_maxdevs; devno++) {
+ for (devno = 0; devno < sc->sc_maxdevs; devno++) {
if (sc->sc_ed[devno])
break;
}
diff -r 3a2779c1dd8d -r 78ef7627f377 sys/dev/mca/edcvar.h
--- a/sys/dev/mca/edcvar.h Wed Sep 01 20:31:20 2004 +0000
+++ b/sys/dev/mca/edcvar.h Wed Sep 01 20:57:58 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edcvar.h,v 1.4 2001/11/24 12:46:15 jdolecek Exp $ */
+/* $NetBSD: edcvar.h,v 1.5 2004/09/01 20:57:58 drochner Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,8 +37,6 @@
int edc_drive;
};
-#define edccf_unit cf_loc[EDCCF_DRIVE]
-
int edc_run_cmd __P((struct edc_mca_softc *, int,
int, u_int16_t [], int, int));
void edc_add_disk __P((struct edc_mca_softc *, struct ed_softc *));
Home |
Main Index |
Thread Index |
Old Index